Coder Social home page Coder Social logo

kelvinben / autoredtools Goto Github PK

View Code? Open in Web Editor NEW
117.0 4.0 25.0 629 KB

AutoRedTools是一款轻量级一站式自动下载/自动更新常用开源软件的工具,主要帮助安全从业者/安全开发人员快速进行环境搭建以及常用软件的更新,节约软件的更新或者安 装的时间,从而提升生产效率或工作效率。

Python 100.00%
developer-tools devtools efficiency efficiency-tool pentest-tool pentesting redteam-tools security security-tools toolset

autoredtools's Issues

使用socks5作为代理时,会报错

报错信息如下:
检测到使用代理:socks5://*.*.*.*:port 配置错误,请检查无误后再重试!!!
报错位置应该是下面的函数:

    def __check_proxy__(self) -> bool:
        try:
            proxies = {"http": self.proxy,"https": self.proxy}
            requests.get("https://www.google.com",proxies=proxies)
        except Exception as e:
            error_msg = "检测到使用代理:%s 配置错误,请检查无误后再重试!!!" % (self.proxy)
            raise CustomException(error_msg)

问了GPT,回答是:
_上述代码中的requests.get()方法默认使用的是HTTP代理,而不是SOCKS5代理。因此,如果你传入一个SOCKS5代理地址,这段代码将无法正确执行。

要在requests库中使用SOCKS5代理,你可以使用第三方库requests-socks来实现。下面是修改后的代码示例_:

import requests
from requests.exceptions import RequestException
from requests_sock import SocksiPyHandler

def __check_proxy__(self) -> bool:
    try:
        proxies = {
            'http': self.proxy,
            'https': self.proxy,
        }
        session = requests.Session()
        session.mount('http://', SocksiPyHandler(socks.SOCKS5, self.proxy))
        session.mount('https://', SocksiPyHandler(socks.SOCKS5, self.proxy))
        session.get("https://www.google.com", proxies=proxies)
    except RequestException as e:
        error_msg = "检测到使用代理:%s 配置错误,请检查无误后再重试!!!" % (self.proxy)
        raise CustomException(error_msg)
    return True

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.