From eff0ba40ff000cc3a1f2dc1ff3819c3a88b408d1 Mon Sep 17 00:00:00 2001 From: Noam Rathaus Date: Thu, 11 Apr 2024 08:30:25 +0300 Subject: [PATCH] Make it possible to provide a non-default RPORT --- modules/auxiliary/scanner/smb/smb_version.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/auxiliary/scanner/smb/smb_version.rb b/modules/auxiliary/scanner/smb/smb_version.rb index f8a48bf721dc..c781364f1381 100644 --- a/modules/auxiliary/scanner/smb/smb_version.rb +++ b/modules/auxiliary/scanner/smb/smb_version.rb @@ -47,7 +47,7 @@ def initialize ] ) - deregister_options('RPORT', 'SMBDIRECT', 'SMB::ProtocolVersion') + deregister_options('SMBDIRECT', 'SMB::ProtocolVersion') end def rport @@ -189,7 +189,11 @@ def smb_os_description(res, nd_smb_fingerprint) # Fingerprint a single host # def run_host(ip) - smb_ports = [445, 139] + # Use a set, rather than an array, so that we can add the user provided + # RPORTS + smb_ports = Set[445, 139] + smb_ports.add(datastore['RPORT']) + lines = [] # defer status output to the very end to group lines together by host smb_ports.each do |pnum| @smb_port = pnum