-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathuserassist.pl
142 lines (128 loc) · 3.84 KB
/
userassist.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#! c:\perl\bin\perl.exe
#-----------------------------------------------------------
# userassist.pl
# Plugin for Registry Ripper, NTUSER.DAT edition - gets the
# UserAssist values
#
# Change history
# 20120823 - updated to FS format
# 20100322 - Added CLSID list reference
# 20100308 - created, based on original userassist.pl plugin
#
# References
# Control Panel Applets - http://support.microsoft.com/kb/313808
# CLSIDs - http://www.autohotkey.com/docs/misc/CLSID-List.htm
#
# copyright 2010 Quantum Analytics Research, LLC
#-----------------------------------------------------------
package userassist;
use strict;
my %config = (hive => "NTUSER\.DAT",
hivemask => 0x10,
hasShortDescr => 1,
hasDescr => 0,
hasRefs => 0,
type => "Reg",
class => 1,
output => "report",
osmask => 31,
version => 20120823);
sub getConfig{return \%config}
sub getShortDescr {
return "Displays contents of UserAssist subkeys";
}
sub getDescr{}
sub getRefs {"Description of Control Panel Files in XP" => "http://support.microsoft.com/kb/313808"}
sub getHive {return $config{hive};}
sub getVersion {return $config{version};}
my $VERSION = getVersion();
sub pluginmain {
my $class = shift;
my $parent = ::getConfig();
::logMsg("userassist v.".$VERSION);
::rptMsg("-" x 60);
::rptMsg("userassist v.".$VERSION);
::rptMsg(getShortDescr());
::rptMsg("Category: ".$config{category});
::rptMsg("");
my $profile = $parent->{userprofile};
::rptMsg("Profile: ".$profile);
$profile .= "\\" unless ($profile =~ m/\\$/);
my $ntuser = $profile."NTUSER\.DAT";
my $reg = Parse::Win32Registry->new($ntuser);
my $root_key = $reg->get_root_key;
my $key_path = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UserAssist";
my $key;
if ($key = $root_key->get_subkey($key_path)) {
::rptMsg("UserAssist");
::rptMsg($key_path);
::rptMsg("LastWrite Time ".gmtime($key->get_timestamp())." (UTC)");
::rptMsg("");
my @subkeys = $key->get_list_of_subkeys();
if (scalar(@subkeys) > 0) {
foreach my $s (@subkeys) {
::rptMsg($s->get_name());
processKey($s);
::rptMsg("");
}
}
else {
::rptMsg($key_path." has no subkeys.");
}
}
else {
::rptMsg($key_path." not found.");
}
}
sub processKey {
my $ua = shift;
my $key = $ua->get_subkey("Count");
my %ua;
my $hrzr = "HRZR";
my @vals = $key->get_list_of_values();
if (scalar(@vals) > 0) {
foreach my $v (@vals) {
my $value_name = $v->get_name();
my $data = $v->get_data();
# Windows XP/2003/Vista/2008
if (length($data) == 16) {
my ($session,$count,$val1,$val2) = unpack("V*",$data);
if ($val2 != 0) {
my $time_value = ::getTime($val1,$val2);
if ($value_name =~ m/^$hrzr/) {
$value_name =~ tr/N-ZA-Mn-za-m/A-Za-z/;
}
$count -= 5 if ($count > 5);
push(@{$ua{$time_value}},$value_name." (".$count.")");
}
}
# Windows 7
elsif (length($data) == 72) {
$value_name =~ tr/N-ZA-Mn-za-m/A-Za-z/;
# if (unpack("V",substr($data,0,4)) == 0) {
# my $count = unpack("V",substr($data,4,4));
# my @t = unpack("VV",substr($data,60,8));
# next if ($t[0] == 0 && $t[1] == 0);
# my $time_val = ::getTime($t[0],$t[1]);
# print " .-> ".$time_val."\n";
# push(@{$ua{$time_val}},$value_name." (".$count.")");
# }
my $count = unpack("V",substr($data,4,4));
my @t = unpack("VV",substr($data,60,8));
next if ($t[0] == 0 && $t[1] == 0);
my $time_val = ::getTime($t[0],$t[1]);
push(@{$ua{$time_val}},$value_name." (".$count.")");
}
else {
# Nothing else to do
}
}
foreach my $t (reverse sort {$a <=> $b} keys %ua) {
::rptMsg(gmtime($t)." Z");
foreach my $i (@{$ua{$t}}) {
::rptMsg(" ".$i);
}
}
}
}
1;