|
1 | 1 | require 'msf/core'
|
2 | 2 |
|
3 |
| -class Metasploit3 < Msf::Auxiliary |
| 3 | +class Metasploit4 < Msf::Auxiliary |
4 | 4 |
|
5 | 5 | include Msf::Exploit::Remote::Tcp
|
6 | 6 | include Msf::Auxiliary::Scanner
|
7 | 7 | include Msf::Auxiliary::Report
|
8 | 8 |
|
9 |
| - def initialize |
10 |
| - super( |
11 |
| - 'Name' => 'Kippo SSH Honeypot Detector', |
12 |
| - 'Description' => %q{This module will detect if an SSH server is running a Kippo |
13 |
| - honeypot. This is done by issuing unexpected data to the SSH service and checking |
14 |
| - the response returned for two particular non-standard error messages.}, |
15 |
| - 'References' => |
16 |
| - [ |
17 |
| - [ 'URL', 'https://cultofthedyingsun.wordpress.com/2014/09/12/death-by-magick-number-fingerprinting-kippo-2014/' ], |
18 |
| - [ 'URL', 'http://morris.guru/detecting-kippo-ssh-honeypots/' ], |
19 |
| - ], |
20 |
| - 'Author' => 'Andrew Morris <andrew[at]morris.guru>', |
21 |
| - 'License' => MSF_LICENSE |
22 |
| - ) |
23 |
| - register_options( |
24 |
| - [ |
25 |
| - Opt::RPORT(22) |
26 |
| - ], self.class) |
| 9 | + def initialize(info = {}) |
| 10 | + super(update_info(info, |
| 11 | + 'Name' => 'Kippo SSH Honeypot Detector', |
| 12 | + 'Description' => %q{ |
| 13 | + This module will detect if an SSH server is running a Kippo honeypot. |
| 14 | + This is done by issuing unexpected data to the SSH service and checking |
| 15 | + the response returned for two particular non-standard error messages. |
| 16 | + }, |
| 17 | + 'Author' => 'Andrew Morris <andrew[at]morris.guru>', |
| 18 | + 'References' => [ |
| 19 | + ['URL', 'https://cultofthedyingsun.wordpress.com/2014/09/12/death-by-magick-number-fingerprinting-kippo-2014/'], |
| 20 | + ['URL', 'http://morris.guru/detecting-kippo-ssh-honeypots/'] |
| 21 | + ], |
| 22 | + 'License' => MSF_LICENSE |
| 23 | + )) |
| 24 | + |
| 25 | + register_options([ |
| 26 | + Opt::RPORT(22) |
| 27 | + ]) |
27 | 28 | end
|
28 | 29 |
|
29 | 30 | def run_host(ip)
|
30 | 31 | connect
|
31 |
| - banner = sock.get_once(1024) |
32 |
| - sock.put(banner+"\n"*8) |
33 |
| - response = sock.get(1024) |
34 |
| - if response == "Protocol mismatch.\n" or response.include? "bad packet length 168430090" |
35 |
| - print_status("#{ip}:#{rport} - Kippo honeypot detected!") |
36 |
| - report_service(:host => rhost, :port => rport, :name => "ssh", :info => "Kippo SSH Honeypot") |
| 32 | + banner = sock.get_once |
| 33 | + sock.put(banner + "\n" * 8) |
| 34 | + response = sock.get_once |
| 35 | + |
| 36 | + if response =~ /(?:^Protocol mismatch\.\n$|bad packet length)/ |
| 37 | + print_good("#{ip}:#{rport} - Kippo detected!") |
| 38 | + report_service( |
| 39 | + :host => ip, |
| 40 | + :port => rport, |
| 41 | + :name => 'ssh', |
| 42 | + :info => 'Kippo SSH honeypot' |
| 43 | + ) |
| 44 | + else |
| 45 | + vprint_status("#{ip}:#{rport} - #{banner.strip} detected") |
37 | 46 | end
|
38 | 47 | end
|
39 |
| -end |
40 | 48 |
|
| 49 | +end |
0 commit comments