PhishingKitHunter.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:PhishingKitHunter 作者: t4d 项目源码 文件源码
def get_page(ResRefererEx):
    global PK_status
    global htmlshash
    # Use a proxy if declared in config file
    try:
        # Use a HTTP proxy
        if proxy_type in 'http':
            http_proxy
            proxy_support = urllib.request.ProxyHandler({'http': http_proxy})
            opener = urllib.request.build_opener(proxy_support)
            urllib.request.install_opener(opener)
        # Use a SOCKS5 proxy
        elif proxy_type in 'socks':
            socks_proxy_server
            socks_proxy_port
            opener = urllib.request.build_opener(SocksiPyHandler(socks.SOCKS5, socks_proxy_server, int(socks_proxy_port), True))
            urllib.request.install_opener(opener)

    except NameError:
        pass

    try:
        request = urllib.request.Request(
        url=ResRefererEx,
        # Force user-agent
        headers={
                'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'
        }
        )
        response = urllib.request.urlopen(request, timeout=5)
        resp_code = response.getcode()
        htmldata = str(response.read().decode('utf-8'))

        if resp_code == 200:
            try:
                # If page contains tracking_file_request
                if RegRequest2.finditer(htmldata):
                    PK_status = 'UP'
                    # Create SHA256 hash of HTML page content
                    htmlshash = hashlib.sha256(htmldata.encode('utf-8')).hexdigest()
                else:
                    PK_status = 'Probably removed'
            except:
                err = sys.exc_info()
                print(err)
                pass
        else:
            PK_status = 'DOWN'

    except:
        #err = sys.exc_info()[1]
        err = sys.exc_info()[1]
        PK_status = ('can\'t connect ('+str(err)+')')
        pass

## Usage
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号