File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
modules/exploits/multi/http Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -47,26 +47,28 @@ def http_verb
47
47
end
48
48
49
49
50
- def auto_target
50
+ def auto_target ( available_targets )
51
51
if http_verb == 'HEAD' then
52
52
print_status ( "Sorry, automatic target detection doesn't work with HEAD requests" )
53
53
else
54
54
print_status ( "Attempting to automatically select a target..." )
55
55
res = query_serverinfo
56
56
if not ( plat = detect_platform ( res ) )
57
- fail_with ( Failure ::NoTarget , 'Unable to detect platform!' )
57
+ print_warning ( 'Unable to detect platform!' )
58
+ return nil
58
59
end
59
60
60
61
if not ( arch = detect_architecture ( res ) )
61
- fail_with ( Failure ::NoTarget , 'Unable to detect architecture!' )
62
+ print_warning ( 'Unable to detect architecture!' )
63
+ return nil
62
64
end
63
65
64
66
# see if we have a match
65
- targets . each { |t | return t if ( t [ 'Platform' ] == plat ) and ( t [ 'Arch' ] == arch ) }
67
+ available_targets . each { |t | return t if ( t [ 'Platform' ] == plat ) and ( t [ 'Arch' ] == arch ) }
66
68
end
67
69
68
70
# no matching target found, use Java as fallback
69
- java_targets = targets . select { |t | t . name =~ /^Java/ }
71
+ java_targets = available_targets . select { |t | t . name =~ /^Java/ }
70
72
return java_targets [ 0 ]
71
73
end
72
74
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ def exploit
96
96
mytarget = target
97
97
98
98
if target . name =~ /Automatic/
99
- mytarget = auto_target
99
+ mytarget = auto_target ( targets )
100
100
unless mytarget
101
101
fail_with ( Failure ::NoTarget , "Unable to automatically select a target" )
102
102
end
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ def exploit
93
93
print_status ( "Unable to automatically select a target with HEAD requests" )
94
94
else
95
95
if ( target . name =~ /Automatic/ )
96
- mytarget = auto_target ( )
96
+ mytarget = auto_target ( targets )
97
97
if ( not mytarget )
98
98
fail_with ( Failure ::NoTarget , "Unable to automatically select a target" )
99
99
end
You can’t perform that action at this time.
0 commit comments