Skip to content

Commit 852fc33

Browse files
committed
Added feedback, cleanup, and simplified modes
1 parent 3619623 commit 852fc33

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

modules/auxiliary/scanner/sap/sap_router_portscanner.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ def initialize
4040
[
4141
OptAddress.new('SAPROUTER_HOST', [true, 'SAPRouter address', '']),
4242
OptPort.new('SAPROUTER_PORT', [true, 'SAPRouter TCP port', '3299']),
43-
OptEnum.new('MODE', [true, 'Connection Mode: 0 for NI_MSG_IO (SAP), 1 for NI_RAW_IO (TCP), 2 for NI_ROUT_IO (ROUTER) ', 0, [0, 1, 2]]),
43+
OptEnum.new('MODE', [true, 'Connection Mode: SAP_PROTO or TCP ', 'SAP_PROTO', ['SAP_PROTO', 'TCP']]),
4444
OptString.new('PORTS', [true, 'Ports to scan (e.g. 22-25,80,110-900)', '3200-3299']),
45-
OptInt.new('TIMEOUT', [true, 'The socket connect timeout in milliseconds', 1000]),
4645
OptInt.new('CONCURRENCY', [true, 'The number of concurrent ports to check per host', 10]),
4746
], self.class)
4847

@@ -52,7 +51,8 @@ def initialize
5251

5352
def build_ni_packet(routes)
5453

55-
mode = datastore['MODE'].to_i
54+
mode = {'SAP_PROTO'=>0,'TCP'=>1}[datastore['MODE']]
55+
5656
route_data=''
5757
ni_packet = [
5858
'NI_ROUTE',
@@ -115,7 +115,6 @@ def parse_response_packet(response, ip, port)
115115

116116
def run_host(ip)
117117

118-
timeout = datastore['TIMEOUT'].to_i
119118
ports = Rex::Socket.portspec_crack(datastore['PORTS'])
120119

121120
sap_host = datastore['SAPROUTER_HOST']
@@ -147,8 +146,7 @@ def run_host(ip)
147146
s = connect(false,
148147
{
149148
'RPORT' => sap_port,
150-
'RHOST' => sap_host,
151-
'ConnectTimeout' => (timeout / 1000.0)
149+
'RHOST' => sap_host
152150
}
153151
)
154152

0 commit comments

Comments
 (0)