Loading

Hackurllib

是的大部分的http请求库都不够hacking 不过有w8ay师傅的hack-requests 但是我想造一个属于自己的轮子它将会足够简单足够hacking 用这个名字是因为我选择了urllib做为最底裤

作为一个脚本小子的http库

他将能够

  • 发送 GET POST HEAD Requests请求
  • 重放burp requests.raw请求包
  • 支持raw请求头 而不是字典
  • 支持Proxy
  • 得到完整的报文像burp 那样
  • 未完待续

是的一个脚本小子 想写一个http库 对了他将只支持python3 因为我也只支持python3

requests中自动通过网页编码解码的实现:
原来是通过正则在content中取的,之前D盾拦截页面乱码但是网页内提供了编码格式应该可以通过添加一条正则来解决这个问题(我是不是可以给requests 提一个issus 或者贡献一个pull)
oh no刚看到注释中 将要在requests中移除它 分解到 requests-toolbelt中 在 requests-toolbelt先获得该功能在进行reuqests的移除更新

def get_encodings_from_content(content):
    """Returns encodings from given content string.

    :param content: bytestring to extract encodings from.
    """
    warnings.warn((
        'In requests 3.0, get_encodings_from_content will be removed. For '
        'more information, please see the discussion on issue #2266. (This'
        ' warning should only appear once.)'),
        DeprecationWarning)

    charset_re = re.compile(r'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)
    pragma_re = re.compile(r'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)
    xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]')

    return (charset_re.findall(content) +
            pragma_re.findall(content) +
            xml_re.findall(content))
posted @ 2021-10-20 08:54  _Waffle  阅读(53)  评论(0)    收藏  举报