Skip to content

Commit e62c586

Browse files
committed
Moved Find-Fruit.ps1 source to ./data/module_source/recon/*
Output tweak for find_fruit, added ShowAll flag
1 parent 8ac5107 commit e62c586

File tree

2 files changed

+116
-91
lines changed

2 files changed

+116
-91
lines changed
Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,3 @@
1-
import base64
2-
from lib.common import helpers
3-
4-
class Module:
5-
6-
def __init__(self, mainMenu, params=[]):
7-
8-
self.info = {
9-
'Name': 'Find-Fruit',
10-
11-
'Author': ['@424f424f'],
12-
13-
'Description': ("Searches a network range for potentially vulnerable web services."),
14-
15-
'Background' : True,
16-
17-
'OutputExtension' : None,
18-
19-
'NeedsAdmin' : False,
20-
21-
'OpsecSafe' : True,
22-
23-
'MinPSVersion' : '2',
24-
25-
'Comments': [
26-
'Inspired by mattifestation Get-HttpStatus in PowerSploit'
27-
]
28-
}
29-
30-
# any options needed by the module, settable during runtime
31-
self.options = {
32-
# format:
33-
# value_name : {description, required, default_value}
34-
'Agent' : {
35-
'Description' : 'Agent to run module on.',
36-
'Required' : True,
37-
'Value' : ''
38-
},
39-
'Rhosts' : {
40-
'Description' : 'Specify the CIDR range or host to scan.',
41-
'Required' : True,
42-
'Value' : ''
43-
},
44-
'Port' : {
45-
'Description' : 'Specify the port to scan.',
46-
'Required' : False,
47-
'Value' : ''
48-
},
49-
'Path' : {
50-
'Description' : 'Specify the path to a dictionary file.',
51-
'Required' : False,
52-
'Value' : ''
53-
},
54-
'Timeout' : {
55-
'Description' : 'Set timeout for each connection in milliseconds',
56-
'Required' : False,
57-
'Value' : '50'
58-
},
59-
'UseSSL' : {
60-
'Description' : 'Force SSL useage.',
61-
'Required' : False,
62-
'Value' : ''
63-
}
64-
}
65-
66-
# save off a copy of the mainMenu object to access external functionality
67-
# like listeners/agent handlers/etc.
68-
self.mainMenu = mainMenu
69-
70-
for param in params:
71-
# parameter format is [Name, Value]
72-
option, value = param
73-
if option in self.options:
74-
self.options[option]['Value'] = value
75-
76-
77-
def generate(self):
78-
79-
script = """
801
function Find-Fruit
812
{
823
<#
@@ -281,15 +202,3 @@ def generate(self):
281202
}
282203
}
283204
}
284-
Find-Fruit"""
285-
286-
for option,values in self.options.iteritems():
287-
if option.lower() != "agent" and option.lower() != "computername":
288-
if values['Value'] and values['Value'] != '':
289-
if values['Value'].lower() == "true":
290-
# if we're just adding a switch
291-
script += " -" + str(option)
292-
else:
293-
script += " -" + str(option) + " \"" + str(values['Value'].strip("\"")) + "\""
294-
295-
return script

lib/modules/recon/find_fruit.py

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import base64
2+
from lib.common import helpers
3+
4+
class Module:
5+
6+
def __init__(self, mainMenu, params=[]):
7+
8+
self.info = {
9+
'Name': 'Find-Fruit',
10+
11+
'Author': ['@424f424f'],
12+
13+
'Description': ("Searches a network range for potentially vulnerable web services."),
14+
15+
'Background' : True,
16+
17+
'OutputExtension' : None,
18+
19+
'NeedsAdmin' : False,
20+
21+
'OpsecSafe' : True,
22+
23+
'MinPSVersion' : '2',
24+
25+
'Comments': [
26+
'Inspired by mattifestation Get-HttpStatus in PowerSploit'
27+
]
28+
}
29+
30+
# any options needed by the module, settable during runtime
31+
self.options = {
32+
# format:
33+
# value_name : {description, required, default_value}
34+
'Agent' : {
35+
'Description' : 'Agent to run module on.',
36+
'Required' : True,
37+
'Value' : ''
38+
},
39+
'Rhosts' : {
40+
'Description' : 'Specify the CIDR range or host to scan.',
41+
'Required' : True,
42+
'Value' : ''
43+
},
44+
'Port' : {
45+
'Description' : 'Specify the port to scan.',
46+
'Required' : False,
47+
'Value' : ''
48+
},
49+
'Path' : {
50+
'Description' : 'Specify the path to a dictionary file.',
51+
'Required' : False,
52+
'Value' : ''
53+
},
54+
'Timeout' : {
55+
'Description' : 'Set timeout for each connection in milliseconds',
56+
'Required' : False,
57+
'Value' : '50'
58+
},
59+
'UseSSL' : {
60+
'Description' : 'Force SSL useage.',
61+
'Required' : False,
62+
'Value' : ''
63+
},
64+
'ShowAll' : {
65+
'Description' : 'Switch. Show all results (default is to only show 200s).',
66+
'Required' : False,
67+
'Value' : ''
68+
}
69+
}
70+
71+
# save off a copy of the mainMenu object to access external functionality
72+
# like listeners/agent handlers/etc.
73+
self.mainMenu = mainMenu
74+
75+
for param in params:
76+
# parameter format is [Name, Value]
77+
option, value = param
78+
if option in self.options:
79+
self.options[option]['Value'] = value
80+
81+
82+
def generate(self):
83+
84+
# read in the common module source code
85+
moduleSource = self.mainMenu.installPath + "/data/module_source/recon/Find-Fruit.ps1"
86+
87+
try:
88+
f = open(moduleSource, 'r')
89+
except:
90+
print helpers.color("[!] Could not read module source path at: " + str(moduleSource))
91+
return ""
92+
93+
moduleCode = f.read()
94+
f.close()
95+
96+
script = moduleCode
97+
98+
script += "\nFind-Fruit"
99+
100+
showAll = self.options['ShowAll']['Value'].lower()
101+
102+
for option,values in self.options.iteritems():
103+
if option.lower() != "agent" and option.lower() != "showall":
104+
if values['Value'] and values['Value'] != '':
105+
if values['Value'].lower() == "true":
106+
# if we're just adding a switch
107+
script += " -" + str(option)
108+
else:
109+
script += " -" + str(option) + " " + str(values['Value'])
110+
111+
if showAll != "true":
112+
script += " | ?{$_.Status -eq 'OK'}"
113+
114+
script += " | Format-Table -AutoSize | Out-String"
115+
116+
return script

0 commit comments

Comments
 (0)