Add images sniffer
This commit is contained in:
parent
ace46c757a
commit
04be4f610d
38
python-ofensivo/15_hacking/05_images_sniffer.py
Normal file
38
python-ofensivo/15_hacking/05_images_sniffer.py
Normal file
@ -0,0 +1,38 @@
|
||||
#/usr/bin/env python3
|
||||
"""
|
||||
Images sniffer
|
||||
"""
|
||||
|
||||
from mitmproxy import http
|
||||
from mitmproxy import ctx
|
||||
|
||||
def response(flow):
|
||||
"""
|
||||
Sniff images
|
||||
"""
|
||||
|
||||
content_type = flow.response.headers.get("Content-Type", "No Content-Type")
|
||||
|
||||
try:
|
||||
|
||||
if "image" in content_type:
|
||||
|
||||
url = flow.request.url
|
||||
|
||||
ext = content_type.split("/")[-1]
|
||||
|
||||
if ext == "jpeg":
|
||||
ext = "jpg"
|
||||
|
||||
file_name = f"img/{url.replace('/', '_')}.{ext}"
|
||||
|
||||
image_data = flow.response.content
|
||||
|
||||
with open(file_name, "wb") as f:
|
||||
|
||||
f.write(image_data)
|
||||
|
||||
print(f"\n[+]Imagen guardada: {file_name}\n")
|
||||
|
||||
except:
|
||||
pass
|
Loading…
Reference in New Issue
Block a user