forked from bl4de/security-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
41 lines (31 loc) · 1.15 KB
/
Copy pathutils.py
File metadata and controls
41 lines (31 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
Misc functions for headshot.py
"""
from modules.console_beautifier import ConsoleOutputBeautifier
def formatted_request(method, host, header, payload):
return """
---- REQUEST ----
{} / HTTP/1.1
Host: {}
{}: {}
---- RESPONSE ----
""".format(method, host, header, payload)
def line_start(fn):
"""
line start decorator
"""
def wrapper(*args, **kwargs):
print "[+]"
fn(*args, **kwargs)
return wrapper
def response_description(method, host, resp_size, resp):
message = "{}[+] Sending {} request to {}\t\t received {} {} with {} bytes of response {}"
if resp.status_code != 200:
return "{}[-] Sending {} request to {}\t\t response size is {}; HTTP respone status is: {} {}{}".format(ConsoleOutputBeautifier.getColor('red'), method, host, resp_size, resp.status_code, resp.reason, ConsoleOutputBeautifier.getColor('white'))
else:
return message.format(
ConsoleOutputBeautifier.getColor(
'green'), method, host, resp.status_code,
resp.reason, resp.headers.get(
'content-length'),
ConsoleOutputBeautifier.getColor('white'))