break a time, with break the c0de…

Posts tagged “source

PyProxy | Proxy Hunter and Tester, A high-level cross-protocol proxy-hunter python library


This idea is taken after doing any research with some socket. and finally, i need some proxy for it’s research .
so i’m going to make something to parse proxy in every site and has a proxy checker ability
and i need to use / import that dinamically for the research, so i must play with the object too .

This article will introduce a python library has done by me
the name is PyProxy .
PyProxy is a Proxy Hunter and Tester, A high-level cross-protocol proxy-hunter python library
This is can be use by direct or you can import this to your program

for direct use , you just need to execute this library . you will see the help module along with the library
by adding -h or –help in first argument

PyProxy v.09 by Gunslinger_ <yudha.gunslinger@gmail.com> - Proxy Hunter and Tester Opensource engine
A high-level cross-protocol proxy-hunter

Usage: pyproxy.py [options]

Options:
  -h, --help            show this help message and exit
  -s, --samair          just use samair.ru to hunt proxies
  -l, --sitelist        use all site in the list
  -t, --test            test all proxy !
  -a, --all             do all !
  -v, --version         print current proxy hunter version
  -d, --debug           debug program for more talkable & every proxy will be
                        print to screen
  -o FILE, --outputfile=FILE
                        output proxy will be print
                        [default : proxylist.txt]
  -i FILE, --inputfile=FILE
                        input proxy will be checked
                        [default : proxylist.txt]
  -g FILE, --outputgood=FILE
                        output all good proxy will be saved
                        [default : goodproxy.txt]
  -c NUMBER, --timeout=NUMBER
                        timeout connections being program run
                        [default : 30]

  Example :
    pyproxy.py -s                   | Gather proxy with samair.ru
    pyproxy.py -l                   | Gather proxy in the url list
    pyproxy.py -t proxylist.txt     | Test proxy inside proxylist.txt
    pyproxy.py -a                   | Do all
    pyproxy.py -v                   | Print current version

for advance user / python programmer .
we can use it in PyShell too by import them inside

gunslinger@c0debreaker:~/python/lib$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyproxy
>>> help(pyproxy)
Help on module pyproxy:

NAME
    pyproxy

FILE
    /home/gunslinger/python/module/pyproxy/pyproxy.py

DESCRIPTION
    # -*- coding: utf-8 -*-
    #   This library is free software; you can redistribute it and/or
    #   modify it under the terms of the GNU Lesser General Public
    #   License as published by the Free Software Foundation; either
    #   version 2.1 of the License, or (at your option) any later version.
    #
    #   This library is distributed in the hope that it will be useful,
    #   but WITHOUT ANY WARRANTY; without even the implied warranty of
    #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    #   Lesser General Public License for more details.
    #
    #   You should have received a copy of the GNU Lesser General Public
    #   License along with this library; if not, write to the 
    #      Free Software Foundation, Inc., 
    #      59 Temple Place, Suite 330, 
    #      Boston, MA  02111-1307  USA
    #
    #   Copyright 2010 Gunslinger_ <yudha.gunslinger@gmail.com>
    #   http://bit.ly/c0debreaker

CLASSES
    __builtin__.object
        proxyhunter
        runengine
    
    class proxyhunter(__builtin__.object)
     |  Instance variables:
     |   
     |  Outputproxy
     |          Output file every proxy will be printed in
     |          Default : proxylist.txt
     |  
     |  Goodproxy
     |          Output file all good proxy will be print
     |          Default : goodproxylist.txt
     |  
     |  Verbose
     |          More noise, every proxy will be print into screen
     |          Default : True
     |  Timeout
     |          Timeout every test proxy connections in socket
     |          Default : 30
     |  
     |  Sitelist
     |          Proxy site for parsing proxy
     |          Default : []
     |  
     |  Methods defined here:
     |  
     |  Cleanitup(self, sorted_output='uniqueproxylist.txt')
     |      proxy will be printed in uniqueproxylist.txt by default
     |  
     |  CoreFreshTester(self, proxy)
     |  
     |  LoadProxy(self)
     |  
     |  MainFreshTester(self, proxy)
     |  
     |  ParseProxy(self, site)
     |  
     |  Samairdotru(self)
     |  
     |  Single(self)
     |  
     |  TestProxy(self)
     |  
     |  __init__(self, OutputProxy='proxylist.txt', GoodProxy='goodproxylist.txt', Verbose=True, TimeOut=30, Sitelist=[])
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
    
    class runengine(__builtin__.object)
     |  Methods defined here:
     |  
     |  __init__(self)
     |  
     |  parseoption(self)
     |  
     |  printversion(self)
     |  
     |  run(self)
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)

FUNCTIONS
    main()

DATA
    __author__ = 'Gunslinger_ <yudha.gunslinger@gmail.com>'
    __copyright__ = 'Copyright (c) 2010 Gunslinger_'
    __date__ = 'Thu Oct  7 00:00:41 2010'
    __version__ = '09'
    __warningregistry__ = {('the sets module is deprecated', <type 'except...

VERSION
    09

DATE
    Thu Oct  7 00:00:41 2010

AUTHOR
    Gunslinger_ <yudha.gunslinger@gmail.com>

(END) q

Need parse proxy in any site ? simply like this

>>> ph = pyproxy.proxyhunter()
>>> ph.ParseProxy("http://aliveproxy.com/high-anonymity-proxy-list/")
[*] Parse proxy from aliveproxy.com/high-anonymity-proxy-list/
218.182.134.23:8080
210.158.6.201:8080
174.142.24.201:3128
217.23.137.56:80
174.142.104.57:3128
205.213.195.70:8080
174.142.24.203:3128
174.142.24.205:3128
24.155.96.93:0080
174.142.24.204:3128
[*] 10 Proxies receieved from : aliveproxy.com/high-anonymity-proxy-list/ 

This module can be use for proxy testing too

>>> import pyproxy
>>> ph = pyproxy.proxyhunter(GoodProxy="goodproxylist.txt")
>>> ph.LoadProxy()
[*] File successfully loaded...
>>> ph.TestProxy()
Error : <urlopen error [Errno 111] Connection refused>
[*] 218.182.134.23:8080 
 '--------------> Bad
Error : <urlopen error [Errno 111] Connection refused>
[*] 210.158.6.201:8080 
 '--------------> Bad
Date: Fri, 08 Oct 2010 12:56:21 GMT
Server: gws
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=UTF-8
X-XSS-Protection: 1; mode=block
Set-Cookie: PREF=ID=3b034e546cd351bf:TM=1286542581:LM=1286542581:S=EmivqSAOZBhj22iF; expires=Sun, 07-Oct-2012 12:56:21 GMT; path=/; domain=.google.ca
Set-Cookie: NID=39=AQ2UnSEV0xbVMzzwrlcIhBN6dBszmQNIrHgh_iggOQh2JB8pBqz8bIrsxWQv-YX_6jaB3HlMJ7U1ghKURQyUM5evLmenr8vy9ByPZcVM-rkOGsf6nMNxxLQST1SkyJZK; expires=Sat, 09-Apr-2011 12:56:21 GMT; path=/; domain=.google.ca; HttpOnly
Connection: close
Transfer-Encoding: chunked

...
[*] 174.142.24.201:3128 
 '--------------> Good
[*] All Fresh proxy has been saved in goodproxylist.txt
>>> 

doesn’t need more noise ? take down the Verbose variable to False

>>> ph = pyproxy.proxyhunter(GoodProxy="goodproxylist.txt", Verbose=False)
>>> ph.LoadProxy()
[*] File successfully loaded...
>>> ph.TestProxy()
[*] 218.182.134.23:8080 
 '--------------> Good
[*] 210.158.6.201:8080 
 '--------------> Good
[*] 174.142.24.201:3128 
 '--------------> Good
[*] 217.23.137.56:80 
 '--------------> Good
[*] 174.142.104.57:3128 
 '--------------> Good
[*] 205.213.195.70:8080 
 '--------------> Bad
[*] 174.142.24.203:3128 
 '--------------> Good
[*] 174.142.24.205:3128 
 '--------------> Good
[*] 24.155.96.93:0080 
 '--------------> Bad
[*] 174.142.24.204:3128 
 '--------------> Good
[*] All Fresh proxy has been saved in goodproxylist.txt
>>> 

For more infomations, you can take a look at the source
you can find the project here https://sourceforge.net/projects/pyproxy/
hope can be useful for you ;)

Advertisements