-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwinlogon.pl
109 lines (95 loc) · 2.73 KB
/
winlogon.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#-----------------------------------------------------------
# WinLogon
# Get values from WinLogon key
#
# History
# 20120925 - updated to RS format
# 20100219 - Updated output to better present some data
# 20080415 - created
#
# copyright 2010 Quantum Analytics Research, LLC
#-----------------------------------------------------------
package winlogon;
use strict;
my %config = (hive => "Software",
hivemask => 0x08,
type => "Reg",
class => 0,
output => "report",
category => "System Config",
osmask => 63, #XP - Win8
hasShortDescr => 1,
hasDescr => 0,
hasRefs => 0,
version => 20100925);
sub getConfig{return \%config}
sub getShortDescr {
return "Get values from the HKLM\\\.\.\\WinLogon key";
}
sub getDescr{}
sub getRefs {}
sub getHive {return $config{hive};}
sub getVersion {return $config{version};}
my $VERSION = getVersion();
sub pluginmain {
my $class = shift;
my $parent = ::getConfig();
::logMsg("winlogon v.".$VERSION);
::rptMsg("-" x 60);
::rptMsg("winlogon v.".$VERSION);
::rptMsg(getShortDescr());
::rptMsg("Category: ".$config{category});
::rptMsg("");
my $hive = $parent->{software};
my $reg = Parse::Win32Registry->new($hive);
my $root_key = $reg->get_root_key;
my $key_path = "Microsoft\\Windows NT\\CurrentVersion\\Winlogon";
my $key;
if ($key = $root_key->get_subkey($key_path)) {
::rptMsg($key_path);
::rptMsg("LastWrite Time ".gmtime($key->get_timestamp())." (UTC)");
my @vals = $key->get_list_of_values();
if (scalar(@vals) > 0) {
my %wl;
foreach my $v (@vals) {
my $name = $v->get_name();
my $data = $v->get_data();
my $len = length($data);
next if ($name eq "");
if ($v->get_type() == 3 && $name ne "DCacheUpdate") {
$data = _translateBinary($data);
}
$data = sprintf "0x%x",$data if ($name eq "SfcQuota");
if ($name eq "DCacheUpdate") {
my @v = unpack("VV",$data);
$data = gmtime(::getTime($v[0],$v[1]));
}
push(@{$wl{$len}},$name." = ".$data);
}
foreach my $t (sort {$a <=> $b} keys %wl) {
foreach my $item (@{$wl{$t}}) {
::rptMsg(" $item");
}
}
::rptMsg("");
::rptMsg("Analysis Tips: The UserInit and Shell values are executed when a user logs on.");
}
else {
::rptMsg($key_path." has no values.");
}
}
else {
::rptMsg($key_path." not found.");
}
}
sub _translateBinary {
my $str = unpack("H*",$_[0]);
my $len = length($str);
my @nstr = split(//,$str,$len);
my @list = ();
foreach (0..($len/2)) {
push(@list,$nstr[$_*2].$nstr[($_*2)+1]);
}
return join(' ',@list);
}
1;