@@ -44,15 +44,10 @@ def get_allow_header(ip)
44
44
'method' => 'OPTIONS' ,
45
45
'uri' => datastore [ 'TARGETURI' ]
46
46
} , 10 )
47
- if res
48
- if res . headers [ 'Allow' ]
49
- return res . headers [ 'Allow' ]
50
- else
51
- fail_with ( Failure ::UnexpectedReply , "#{ peer } - No Allow header identified" )
52
- end
53
- else
54
- fail_with ( Failure ::Unreachable , "#{ peer } - Failed to respond" )
55
- end
47
+
48
+ fail_with ( Failure ::Unreachable , "#{ peer } - Failed to respond" ) unless res
49
+ fail_with ( Failure ::UnexpectedReply , "#{ peer } - No Allow header identified" ) unless res . headers [ 'Allow' ]
50
+ res . headers [ 'Allow' ]
56
51
end
57
52
58
53
def run_host ( ip )
@@ -65,33 +60,29 @@ def run_host(ip)
65
60
66
61
for counter in 1 ..datastore [ 'REPEAT' ]
67
62
allows = get_allow_header ( ip )
68
- unless uniques . include? ( allows ) # no need to re-process non-new items
69
- uniques << allows
70
- if allows =~ bug_61207
71
- if allows . split ( ',' ) . length > allows . split ( ',' ) . uniq . length # check for repeat items
72
- if datastore [ 'BUGS' ]
73
- print_status ( 'Some methods were sent multiple times in the list. ' +
74
- 'This is a bug, but harmless. It may be Apache bug #61207.' )
75
- end
76
- else
77
- vprint_status ( "Request #{ counter } : [Standard Response] -> #{ allows } " )
78
- end
79
- elsif allows =~ bug_1717682 && datastore [ 'BUGS' ]
80
- print_status ( 'The list of methods was space-separated instead of comma-separated. ' +
81
- 'This is a bug, but harmless. It may be Launchpad bug #1717682.' )
63
+ next if uniques . include? ( allows ) # no need to re-process non-new items
64
+ uniques << allows
65
+ if allows =~ bug_61207
66
+ if allows . split ( ',' ) . length > allows . split ( ',' ) . uniq . length # check for repeat items
67
+ print_status ( 'Some methods were sent multiple times in the list. ' +
68
+ 'This is a bug, but harmless. It may be Apache bug #61207.' ) if datastore [ 'BUGS' ]
82
69
else
83
- print_good ( "Request #{ counter } : [OptionsBleed Response] -> #{ allows } " )
84
- unless already_reported
85
- report_vuln (
86
- :host => ip ,
87
- :port => rport ,
88
- :name => self . name ,
89
- :refs => self . references
90
- )
91
- already_reported = true
92
- end
70
+ vprint_status ( "Request #{ counter } : [Standard Response] -> #{ allows } " )
93
71
end
72
+ elsif allows =~ bug_1717682 && datastore [ 'BUGS' ]
73
+ print_status ( 'The list of methods was space-separated instead of comma-separated. ' +
74
+ 'This is a bug, but harmless. It may be Launchpad bug #1717682.' )
75
+ else
76
+ print_good ( "Request #{ counter } : [OptionsBleed Response] -> #{ allows } " )
94
77
end
78
+ next unless already_reported
79
+ report_vuln (
80
+ :host => ip ,
81
+ :port => rport ,
82
+ :name => self . name ,
83
+ :refs => self . references
84
+ )
85
+ already_reported = true
95
86
end
96
87
end
97
88
end
0 commit comments