Ejemplo n.º 1
0
    def parse_66ip(self, response):
        proxies = response.xpath('/html/body').re(r'(\d+\.\d+\.\d+\.\d+:\d+)')
        for proxy_str in proxies:
            arr = proxy_str.split(':')
            if len(arr) > 1:
                proxy = Proxy('http://', arr[0], arr[1])
                proxy.add()

        return None
Ejemplo n.º 2
0
 def parse_youdaili_detail(self, response):
     for p in response.xpath('//div[@class="content"]/p'):
         str = p.xpath('text()').extract_first()
         ip = str.split(':')[0]
         port = str.split(':')[1].split('@')[0]
         if ip and port:
             proxy = Proxy('http://', ip, port)
             proxy.add()
     return None
Ejemplo n.º 3
0
    def parse_pachong(self, response):
        for tr in response.xpath('//table/tbody/tr[position()>1]'):
            ip = tr.xpath('td[2]/text()').extract_first()
            port = tr.xpath('td[3]').re(r'\d{2,4}')
            if ip and port:
                proxy = Proxy('http://', ip, port)
                proxy.add()

        return None
Ejemplo n.º 4
0
    def parse_cybersyndrome(self, response):
        for tr in response.xpath('//table/tbody/tr[position()>1]'):
            proxy_str = tr.xpath('td[2]//text()').extract_first()
            print(proxy_str)
            if proxy_str:
                arr = proxy_str.strip().split(':')
                if len(arr) > 1:
                    proxy = Proxy('http://', arr[0], arr[1])
                    proxy.add()

        return None
Ejemplo n.º 5
0
class Core(object):
    def __init__(self, parsed_opts):
        FileManager.create_tmp_env()
        self.opts = parsed_opts
        self.nb_vulnerabilities = 0

    def display_banner(self):
        banner = """
  _   _       ____
 | | | |_ __ |  _ \__      ___ __
 | | | | '_ \| |_) \ \ /\ / / '_ \\
 | |_| | |_) |  __/ \ V  V /| | | |
  \___/| .__/|_|     \_/\_/ |_| |_|
       |_|
        """
        print banner

    def run(self):
        self.display_banner()
        print "[+] UpPwn is running !"
        self.test_scenario()
        print "[+] Scenario successfully loaded"
        self.run_proxy()
        self.run_modules()
        print "[+] Work is done, {} vulnerabilities have been found !".format(
            self.nb_vulnerabilities)
        return True

    def test_scenario(self):
        Xvfb.start()
        self.up_s = Scenario(self.opts.scenario)
        self.up_s.build(self.opts.cookies)
        self.up_s.load()
        #if not self.up_s.has_succeeded(): return False

    def run_proxy(self):
        print "[+] Mitm proxy start"
        self.proxy = Proxy()
        self.proxy.start()

    def run_modules(self):
        print "[+] Upload vulnerabilities detection start"
        self.up_s.run()
        #time.sleep(120)

    def stop(self):
        print "[+] Close properly the proxy"
        time.sleep(
            15
        )  # All tcp connection have to be ended before stopping the MiTM / Has to be fixed
        self.proxy.stop()
        Xvfb.stop()
        print "[+] UpPwn stopped !"
Ejemplo n.º 6
0
    def parse_kuaidaili(self, response):
        for tr in response.xpath('//table/tbody/tr/[position()>1]'):
            ip = tr.xpath('td[1]//text()').extract()
            port = tr.xpath('td[2]/text()').extract()
            speed = tr.xpath('td[6]/text()').re(r'([\.\d]+)')
            protocal = tr.xpath('td[4]/text()').extract()
            if ip and port and speed and protocal:
                if float(speed[0]) < self.allowed_max_speed:
                    schema = 'http://'
                    if str(protocal[0]).strip().upper() == 'HTTP':
                        schema = 'http://'
                    if str(protocal[0]).strip().upper() == 'HTTPS':
                        schema = 'https://'

                    proxy = Proxy(schema, ip[0], port[0])
                    proxy.add()
                    return None
Ejemplo n.º 7
0
    def parse_goubanjia(self, response):
        for tr in response.xpath('//table[@class="table"]/tbody/tr'):
            ip = tr.xpath('td[1]//string(.)').extract()
            speed = tr.xpath('td[6]/text()').re(r'([\.\d]+)')
            protocal = tr.xpath('td[3]/a/text()').extract()
            if ip and speed and protocal:
                arr = str.split(':')
                if len(arr) > 1 and float(speed[0]) < self.allowed_max_speed:
                    schema = 'http://'
                    if str(schema[0]).strip().upper() == 'HTTP':
                        schema = 'http://'
                    if str(schema[0]).strip().upper() == 'HTTPS':
                        schema = 'https://'

                    proxy = Proxy(schema, arr[0], arr[1])
                    proxy.add()
                    return None
Ejemplo n.º 8
0
 def start_requests(self):
     proxies = Proxy.all()
     for i in range(1, (self.try_times+1)):
         for proxy in proxies:
             req = Request('http://httpbin.org/get?show_env=1', dont_filter=True)
             proxy = proxy.decode('utf-8')
             req.meta['proxy'] = proxy
             req.meta['dont_retry'] = True
             req.meta['download_timeout'] = 5
             yield req
Ejemplo n.º 9
0
 def closed(self, reason):
     Proxy.remove_invalid()
     print(Proxy.all_valid())
Ejemplo n.º 10
0
 def parse(self, response):
     proxy = response.meta['proxy']
     Proxy.update_score(proxy)
     return None
Ejemplo n.º 11
0
 def closed(self, reason):
     count = Proxy.count()
     self.log('现有代理' + str(count) + '条')
Ejemplo n.º 12
0
 def run_proxy(self):
     print "[+] Mitm proxy start"
     self.proxy = Proxy()
     self.proxy.start()
Ejemplo n.º 13
0
 def __init__(self, proxy_default='127.0.0.1'):
     self.proxy_ips = Proxy.all_valid()
     if not self.proxy_ips:
         proxy_ip = settings.get('HTTP_PROXY', proxy_default)
         self.proxy_ips = [proxy_ip]
Ejemplo n.º 14
0
 def _start_debug_session_wrapper(self, *args):
     func_call = args[0]
     target = Target(self.database.dsn)
     proxy = Proxy(self.database.dsn)
     self._start_debug_session(func_call, target, proxy)