Skip to content

Commit 2faa6e4

Browse files
committed
corrected event handles
1 parent 63f6418 commit 2faa6e4

13 files changed

Lines changed: 64 additions & 31 deletions

modules/action/scan_gethostname.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def process(self):
3333
self.display.verbose(self.shortName + " - Connecting to " + t)
3434
try:
3535
results = socket.gethostbyaddr(t)
36-
self.fire("newHostName")
36+
self.fire("newHostname")
3737
kb.add('host/' + t + '/hostname/' + results[0])
3838
except:
3939
pass

modules/action/scan_httpoptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, config, display, lock):
1313
self.description = "issue [OPTIONS / HTTP/1.0] to each web server"
1414

1515
self.requirements = []
16-
self.triggers = ["newServicehttp", "newServicehttps", "newPort80", "newPort443"]
16+
self.triggers = ["newService_http", "newService_https", "newPort_tcp_80", "newPort_tcp_443"]
1717
self.types = ["http"]
1818

1919
self.safeLevel = 5

modules/action/scan_httpscreenshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, config, display, lock):
1111
self.description = "load each web server and get a screenshot"
1212

1313
self.requirements = ["phantomjs"]
14-
self.triggers = ["newServicehttp", "newServicehttps", "newPort80", "newPort443"]
14+
self.triggers = ["newService_http", "newService_https", "newPort_tcp_80", "newPort_tcp_443"]
1515
self.types = ["http"]
1616

1717
self.safeLevel = 5

modules/action/scan_httpserverversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, config, display, lock):
1313
self.description = "issue [GET / HTTP/1.0] to each web server"
1414

1515
self.requirements = []
16-
self.triggers = ["newServicehttp", "newServicehttps", "newPort80", "newPort443"]
16+
self.triggers = ["newService_http", "newService_https", "newPort_tcp_80", "newPort_tcp_443"]
1717
self.types = ["http"]
1818

1919
self.safeLevel = 5

modules/action/scan_msf_jboss_vulnscan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class scan_msf_jboss_vulnscan(actionModule):
1010
def __init__(self, config, display, lock):
1111
super(scan_msf_jboss_vulnscan, self).__init__(config, display, lock)
12-
self.triggers = ["newServicehttp", "newPort80", "newPort8080"]
12+
self.triggers = ["newService_http", "newPort_tcp_80", "newPort_tcp_8080"]
1313
self.requirements = ["msfconsole"]
1414
self.types = ["http"]
1515
self.title = "Attempt to determine if a jboss instance has default creds"

modules/action/scan_msf_openx11.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class scan_msf_openx11(actionModule):
1010
def __init__(self, config, display, lock):
1111
super(scan_msf_openx11, self).__init__(config, display, lock)
12-
self.triggers = ["newPort6000"]
12+
self.triggers = ["newPort_tcp_6000"]
1313
self.requirements = ["msfconsole"]
1414
self.title = "Attempt Login To Open X11 Service"
1515
self.shortName = "MSFOpenX11"

modules/action/scan_msf_snmplogin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class scan_msf_snmplogin(actionModule):
1010
def __init__(self, config, display, lock):
1111
super(scan_msf_snmplogin, self).__init__(config, display, lock)
12-
self.triggers = ["newPort161"]
12+
self.triggers = ["newPort_tcp_161"]
1313
self.requirements = ["msfconsole"]
1414
self.title = "Attempt Login Using Common Community Strings"
1515
self.shortName = "MSFSNMPLogin"

modules/action/scan_msf_vncnoneauth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class scan_msf_vncnoneauth(actionModule):
1010
def __init__(self, config, display, lock):
1111
super(scan_msf_vncnoneauth, self).__init__(config, display, lock)
12-
self.triggers = ["newPort5900"]
12+
self.triggers = ["newPort_tcp_5900"]
1313
self.requirements = ["msfconsole"]
1414
self.title = "Detect VNC Services with the None authentication type"
1515
self.shortName = "MSFVNCNoneAuth"

modules/action/scan_rpcclient_nullsession.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, config, display, lock):
1313
self.description = "execute [rpcclient -U \"\" -N <IP> -c srvinfo] on each target"
1414

1515
self.requirements = ["rpcclient"]
16-
self.triggers = ["newPort445", "newPort139"]
16+
self.triggers = ["newPort_tcp_445", "newPort_tcp_139"]
1717

1818
self.safeLevel = 5
1919

modules/action/scan_searchsmbshare.py

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#import fnmatch
21
import re
32

43
try:
@@ -18,7 +17,7 @@ def __init__(self, config, display, lock):
1817
self.description = "connect to remote SMB Share service and search for interesting files"
1918

2019
self.requirements = []
21-
self.triggers = ["newServicen_smb", "newPort_tcp_445", "newPort_tcp_139"]
20+
self.triggers = ["newService_smb", "newPort_tcp_445", "newPort_tcp_139"]
2221
self.types = ["filesearch"]
2322

2423
self.safeLevel = 4
@@ -30,6 +29,39 @@ def getTargets(self):
3029
self.targets = kb.get('port/tcp/445', 'port/tcp/139')
3130
self.targets2 = kb.get('service/smb')
3231

32+
def searchDir(self, conn, share, path, depth=0):
33+
if depth > 5:
34+
return
35+
36+
try:
37+
# list the files on each share (recursivity?)
38+
print "----------" + share + "---" + path
39+
names = conn.listPath(share, path, timeout=30)
40+
41+
for name in names:
42+
if name.isDirectory:
43+
if name.filename not in [u'.', u'..']:
44+
self.searchDir(conn, share, path + name.filename + '/', depth + 1)
45+
else:
46+
for pattern in self.filepatterns:
47+
try:
48+
re.compile(pattern)
49+
result = re.match(pattern, name.filename)
50+
if (result):
51+
outfile = self.config["proofsDir"] + self.shortName + "_" + host + "_" + share + "_" + name.file.name.replace("/", "-") + "_" + Utils.getRandStr(10)
52+
53+
# TODO
54+
#conn.retrieveFile(share, path + name.filename, loacl_file)
55+
#Utils.writeFile(result, outfile)
56+
self.display.debug("_____ Share[" + share + "] =" + path + name.filename)
57+
except re.error:
58+
pass
59+
#self.display.debug("Invalid File Pattern --> %s <--" % pattern)
60+
except:
61+
self.display.error('### can not access the resource')
62+
63+
return
64+
3365
def searchTarget(self, host, username, password, domainname):
3466
success = False
3567

@@ -55,23 +87,24 @@ def searchTarget(self, host, username, password, domainname):
5587
self.display.debug('Shares on: ' + host)
5688
for i in range(len(Response)): # iterate through the list of shares
5789
self.display.debug(" Share[" + str(i) + "] =" + str(Response[i].name))
58-
try:
59-
# list the files on each share (recursivity?)
60-
Response2 = conn.listPath(Response[i].name, '/', timeout=30)
61-
self.display.debug(' Files on: ' + host + '/' + " Share[" + str(i) + "] =" + str(Response[i].name))
62-
for i in range(len(Response2)):
63-
for pattern in self.filepatterns:
64-
try:
65-
re.compile(pattern)
66-
result = re.match(pattern, Response2[i].filename)
67-
if (result):
68-
# TODO
69-
# host.download(fpath, self.config["proofsDir"] + ip + fpath.replace("/", "_"))
70-
self.display.debug(" File[" + str(i) + "] =" + str(Response2[i].filename))
71-
except re.error:
72-
self.display.debug("Invalid File Pattern --> %s <--" % pattern)
73-
except:
74-
self.display.error('### can not access the resource')
90+
self.searchDir(conn, Response[i].name, '/')
91+
# try:
92+
# # list the files on each share (recursivity?)
93+
# Response2 = conn.listPath(Response[i].name, '/', timeout=30)
94+
# self.display.debug(' Files on: ' + host + '/' + " Share[" + str(i) + "] =" + str(Response[i].name))
95+
# for i in range(len(Response2)):
96+
# for pattern in self.filepatterns:
97+
# try:
98+
# re.compile(pattern)
99+
# result = re.match(pattern, Response2[i].filename)
100+
# if (result):
101+
# # TODO
102+
# # host.download(fpath, self.config["proofsDir"] + ip + fpath.replace("/", "_"))
103+
# self.display.debug(" File[" + str(i) + "] =" + str(Response2[i].filename))
104+
# except re.error:
105+
# self.display.debug("Invalid File Pattern --> %s <--" % pattern)
106+
# except:
107+
# self.display.error('### can not access the resource')
75108
except:
76109
self.display.error('### can not list shares')
77110
except:

0 commit comments

Comments
 (0)