@@ -13,11 +13,10 @@ def initialize(info = {})
13
13
super ( update_info ( info ,
14
14
'Name' => 'F5 BigIP HTTP Virtual Server Scanner' ,
15
15
'Description' => %q{
16
- This module scans for BigIP HTTP virtual servers based on simple banner grabbing technique.
17
- BigIP system uses different HTTP profiles for managing HTTP traffic. In particular, BIG-IP
18
- system uses an HTTP profile that specifies the string used as the server agent name in
19
- traffic generated by LTM. The default value is equal to "BigIP" or "BIG-IP" and depends on
20
- BigIP system version.
16
+ This module scans for BigIP HTTP virtual servers using banner grabbing. BigIP system uses
17
+ different HTTP profiles for managing HTTP traffic and these profiles allow to customize
18
+ the string used as Server HTTP header. The default values are "BigIP" or "BIG-IP" depending
19
+ on the BigIP system version.
21
20
} ,
22
21
'Author' =>
23
22
[
@@ -34,55 +33,53 @@ def initialize(info = {})
34
33
35
34
register_options (
36
35
[
37
- OptString . new ( 'PORTS' , [ true , " Ports to scan (e.g. 80-81,443,8080-8090)" , " 80,443" ] ) ,
38
- OptInt . new ( 'TIMEOUT' , [ true , " The socket connect timeout in milliseconds" , 1000 ] ) ,
36
+ OptString . new ( 'PORTS' , [ true , ' Ports to scan (e.g. 80-81,443,8080-8090)' , ' 80,443' ] ) ,
37
+ OptInt . new ( 'TIMEOUT' , [ true , ' The socket connect/read timeout in seconds' , 1 ] ) ,
39
38
] , self . class )
40
39
41
- deregister_options ( 'RPORT' , 'RHOST' )
40
+ deregister_options ( 'RPORT' )
42
41
end
43
42
44
- def bigip_http? ( ip , port , ssl , verbose = false )
43
+ def bigip_http? ( ip , port , ssl )
45
44
begin
46
- timeout = ( datastore [ 'TIMEOUT' ] || 1000 ) . to_f / 1000.0
47
- ::Timeout . timeout ( timeout ) do
48
- begin
49
- res = send_request_raw ( 'method' => 'GET' , 'uri' => '/' , 'rport' => port , 'SSL' => ssl )
50
- if res
51
- server = res . headers [ 'Server' ]
52
- return true if server =~ /BIG\- IP/ || server =~ /BigIP/
53
- end
54
- rescue ::Rex ::ConnectionRefused
55
- vprint_error ( "#{ ip } :#{ port } - Connection refused" )
56
- rescue ::Rex ::ConnectionError
57
- vprint_error ( "#{ ip } :#{ port } - Connection error" )
58
- rescue ::OpenSSL ::SSL ::SSLError
59
- vprint_error ( "#{ ip } :#{ port } - SSL/TLS connection error" )
60
- end
61
- end
62
- rescue Timeout ::Error
63
- vprint_error ( "#{ ip } :#{ port } - HTTP connection timed out" ) if verbose
45
+ res = send_request_raw (
46
+ 'method' => 'GET' ,
47
+ 'uri' => '/' ,
48
+ 'rport' => port ,
49
+ 'SSL' => ssl ,
50
+ 'timeout' => 1
51
+ )
52
+ return false unless res
53
+ server = res . headers [ 'Server' ]
54
+ return true if server =~ /BIG\- IP/ || server =~ /BigIP/
55
+ rescue ::Rex ::ConnectionRefused
56
+ vprint_error ( "#{ ip } :#{ port } - Connection refused" )
57
+ rescue ::Rex ::ConnectionError
58
+ vprint_error ( "#{ ip } :#{ port } - Connection error" )
59
+ rescue ::OpenSSL ::SSL ::SSLError
60
+ vprint_error ( "#{ ip } :#{ port } - SSL/TLS connection error" )
64
61
end
65
- return false
62
+
63
+ false
66
64
end
67
65
68
66
def run_host ( ip )
69
- verbose = datastore [ 'VERBOSE' ]
70
67
ports = Rex ::Socket . portspec_crack ( datastore [ 'PORTS' ] )
71
- fail Msf ::OptionValidateError . new ( [ 'PORTS' ] ) if ports . empty?
72
- ports . each do |port |
73
- next if port == 443
74
- if bigip_http? ( ip , port , ssl = false , verbose )
75
- print_good ( "#{ ip } :#{ port } - BigIP HTTP virtual server found" )
76
- ports . delete ( port )
77
- end
68
+
69
+ if ports . empty?
70
+ print_error ( 'PORTS options is invalid' )
71
+ return
78
72
end
79
73
80
74
ports . each do |port |
81
- next if port == 80
82
- if bigip_http? ( ip , port , ssl = true , verbose )
75
+ if bigip_http? ( ip , port , false )
83
76
print_good ( "#{ ip } :#{ port } - BigIP HTTP virtual server found" )
77
+ next
84
78
end
85
- end
86
79
80
+ if bigip_http? ( ip , port , true )
81
+ print_good ( "#{ ip } :#{ port } - BigIP HTTPS virtual server found" )
82
+ end
83
+ end
87
84
end
88
85
end
0 commit comments