Skip to content

Commit 017a44c

Browse files
author
Tod Beardsley
committed
Revert errored merge of deea30d
Revert "Merge branch 'master' of https://github.com/farias-r7/metasploit-framework into upstream-master" This reverts commit deea30d, reversing changes made to 14514d7.
1 parent deea30d commit 017a44c

File tree

4 files changed

+13
-159
lines changed

4 files changed

+13
-159
lines changed

.rubocop.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# inherit_from: .rubocop_todo.yml
1010

11-
Metrics/ClassLength:
11+
Style/ClassLength:
1212
Description: 'Most Metasploit modules are quite large. This is ok.'
1313
Enabled: true
1414
Exclude:
@@ -25,14 +25,14 @@ Style/Encoding:
2525
Description: 'We prefer binary to UTF-8.'
2626
EnforcedStyle: 'when_needed'
2727

28-
Metrics/LineLength:
28+
Style/LineLength:
2929
Description: >-
3030
Metasploit modules often pattern match against very
3131
long strings when identifying targets.
3232
Enabled: true
3333
Max: 180
3434

35-
Metrics/MethodLength:
35+
Style/MethodLength:
3636
Enabled: true
3737
Description: >-
3838
While the style guide suggests 10 lines, exploit definitions
@@ -44,11 +44,6 @@ Metrics/MethodLength:
4444
Style/Encoding:
4545
Enabled: false
4646

47-
# %q() is super useful for long strings split over multiple lines and
48-
# is very common in module constructors for things like descriptions
49-
Style/UnneededPercentQ:
50-
Enabled: false
51-
5247
Style/NumericLiterals:
5348
Enabled: false
5449
Description: 'This often hurts readability for exploit-ish code.'

lib/msf/core/auxiliary/scanner.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ def scanner_progress
241241

242242
def scanner_show_progress
243243
pct = scanner_progress
244-
if pct >= (@range_percent + @show_percent)
244+
if(pct >= (@range_percent + @show_percent))
245245
@range_percent = @range_percent + @show_percent
246246
tdlen = @range_count.to_s.length
247-
print_status(sprintf("Scanned %#{tdlen}d of %d hosts (%d%% complete)", @range_done, @range_count, pct))
247+
print_status("Scanned #{"%.#{tdlen}d" % @range_done} of #{@range_count} hosts (#{"%.3d" % pct.to_i}% complete)")
248248
end
249249
end
250250

lib/msf/core/auxiliary/udp_scanner.rb

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,33 @@ module Msf
88
#
99
###
1010
module Auxiliary::UDPScanner
11-
include Auxiliary::Scanner
1211

13-
# A hash of results of a given batch run, keyed by host
14-
attr_accessor :results
12+
include Auxiliary::Scanner
1513

1614
#
1715
# Initializes an instance of an auxiliary module that scans UDP
1816
#
17+
1918
def initialize(info = {})
2019
super
2120

2221
register_options(
2322
[
24-
Opt::RPORT,
23+
Opt::CHOST,
2524
OptInt.new('BATCHSIZE', [true, 'The number of hosts to probe in each set', 256]),
26-
OptInt.new('THREADS', [true, "The number of concurrent threads", 10])
2725
], self.class)
2826

2927
register_advanced_options(
3028
[
31-
Opt::CHOST,
32-
Opt::CPORT,
3329
OptInt.new('ScannerRecvInterval', [true, 'The maximum numbers of sends before entering the processing loop', 30]),
3430
OptInt.new('ScannerMaxResends', [true, 'The maximum times to resend a packet when out of buffers', 10]),
3531
OptInt.new('ScannerRecvQueueLimit', [true, 'The maximum queue size before breaking out of the processing loop', 100]),
36-
OptInt.new('ScannerRecvWindow', [true, 'The number of seconds to wait post-scan to catch leftover replies', 15])
32+
OptInt.new('ScannerRecvWindow', [true, 'The number of seconds to wait post-scan to catch leftover replies', 15]),
3733

3834
], self.class)
3935
end
4036

37+
4138
# Define our batch size
4239
def run_batch_size
4340
datastore['BATCHSIZE'].to_i
@@ -47,7 +44,6 @@ def run_batch_size
4744
def run_batch(batch)
4845
@udp_sock = Rex::Socket::Udp.create({
4946
'LocalHost' => datastore['CHOST'] || nil,
50-
'LocalPort' => datastore['CPORT'] || 0,
5147
'Context' => { 'Msf' => framework, 'MsfExploit' => self }
5248
})
5349
add_socket(@udp_sock)
@@ -159,25 +155,12 @@ def scanner_recv(timeout=0.1)
159155
queue.length
160156
end
161157

162-
def cport
163-
datastore['CPORT']
164-
end
165-
166-
def rport
167-
datastore['RPORT']
168-
end
169-
170158
#
171-
# The including module may override some of these methods
159+
# The including module override these methods
172160
#
173161

174-
# Builds and returns the probe to be sent
175-
def build_probe
176-
end
177-
178-
# Called for each IP in the batch. This will send all necessary probes.
162+
# Called for each IP in the batch
179163
def scan_host(ip)
180-
scanner_send(build_probe, ip, rport)
181164
end
182165

183166
# Called for each response packet
@@ -186,12 +169,11 @@ def scanner_process(data, shost, sport)
186169

187170
# Called before the scan block
188171
def scanner_prescan(batch)
189-
vprint_status("Sending probes to #{batch[0]}->#{batch[-1]} (#{batch.length} hosts)")
190-
@results = {}
191172
end
192173

193174
# Called after the scan block
194175
def scanner_postscan(batch)
195176
end
177+
196178
end
197179
end

modules/auxiliary/scanner/udp_scanner_template.rb

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)