mirror of
https://github.com/adulau/HHHash.git
synced 2024-12-22 00:36:01 +00:00
Merge remote-tracking branch 'upstream/master' into feature/from_banner
This commit is contained in:
commit
e4403fea99
2 changed files with 16 additions and 3 deletions
|
@ -2,10 +2,23 @@ import requests
|
|||
import hashlib
|
||||
|
||||
|
||||
def buildhash(url=None, debug=False):
|
||||
def buildhash(url=None, debug=False, method='GET', timeout=5):
|
||||
"""Build a HHHash from an HTTP request to specific url.
|
||||
|
||||
Keyword arguments:
|
||||
url -- the url to build the HHHash from the response headers (default None)
|
||||
debug -- output the headers returned before hashing (default False)
|
||||
method -- HTTP method to use (GET or HEAD) (default GET)
|
||||
timeout -- default timeout for the connect/read timeout of request (default 2)
|
||||
"""
|
||||
if url is None:
|
||||
return False
|
||||
r = requests.get(url)
|
||||
if method == 'GET':
|
||||
r = requests.get(url, timeout=timeout)
|
||||
elif method == 'HEAD':
|
||||
r = requests.head(url, timeout=timeout)
|
||||
else:
|
||||
return False
|
||||
hhhash = ""
|
||||
for header in r.headers.keys():
|
||||
hhhash = f"{hhhash}:{header}"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
[tool.poetry]
|
||||
name = "HHHash"
|
||||
version = "0.1"
|
||||
version = "0.2"
|
||||
authors = [
|
||||
"Alexandre Dulaunoy <a@foo.be>"
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue