-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfase18.pl
61 lines (47 loc) · 1.59 KB
/
fase18.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
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl -w
use lib 'libs';
use Msg;
use open qw(:std :utf8);
use Encode qw(decode_utf8);
cambia_idioma($idioma_solicitado);
no warnings;
# ----------------------------------------------------------------------------------------
# Fase 1.8 -- Ultimos comandos ejecutados por los usuarios / Recent commands executed by users
# ----------------------------------------------------------------------------------------
print $Msg::msg[$Msg::idioma][47];
print F $Msg::msg[$Msg::idioma][48];
print F "<div>\n";
print F "<div class=\"content\">\n";
print R $Msg::msg[$Msg::idioma][48];
print R "<div>\n";
print R "<div class=\"content\">\n";
print "-" x 100;
open(SINPASSWD,"/etc/shadow");
while (<SINPASSWD>) {
($linea)=split(/\n/,$_,1); (@userdata)=split(/:/,$linea);
$user=$userdata[0];
$passwd=$userdata[1];
if ($passwd =~ m/^\$/ ) {
$filename = `grep -e "^$user" /etc/passwd | awk -F: {'print \$6'}`;
chomp ($filename);
$filename= "$filename/.bash_history";
if( -e $filename){
open INFILE,$filename;
my $linea;
while ( $linea = <INFILE>) {
chomp($linea);
print "\n$user:\n$linea\n";
print F"<p><b>$user:</b>\n$linea</p>\n";
}
}
}
}
close (SINPASSWD);
close (INFILE);
close (SINPASSWD);
close (SINPASSWD2);
print F "</div>\n";
print F "</div>\n";
print R $Msg::msg[$Msg::idioma][49];
print R "</div>\n";
print R "</div>\n";