-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More work on volatility - Now ssdt module uses object2.py
darcs-hash:20090127030352-f1522-0ca9722fa03b83f388f1a0462274096eb790eb38.gz
- Loading branch information
scudette
committed
Jan 27, 2009
1 parent
1057c2c
commit bcf00b3
Showing
8 changed files
with
68 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,8 @@ | |
from bisect import bisect_right | ||
|
||
from forensics.object2 import * | ||
from forensics.win32.tasks import process_list | ||
from forensics.win32.modules import modules_list | ||
from forensics.win32.tasks import pslist | ||
from forensics.win32.modules import lsmod | ||
from forensics.win32.lists import list_entry | ||
from forensics.object import get_obj_offset | ||
from vutils import * | ||
|
@@ -1006,11 +1006,6 @@ | |
], | ||
] | ||
|
||
def get_threads(proc): | ||
return list_entry(proc.vm, types, proc.profile, | ||
proc.ThreadListHead.v(), "_ETHREAD", | ||
fieldname="ThreadListEntry") | ||
|
||
def find_module(modlist, mod_addrs, addr): | ||
"""Uses binary search to find what module a given address resides in. | ||
|
@@ -1029,18 +1024,16 @@ def find_module(modlist, mod_addrs, addr): | |
return None | ||
|
||
class ssdt(forensics.commands.command): | ||
|
||
# Declare meta information associated with this plugin | ||
meta_info = { | ||
'author': 'Brendan Dolan-Gavitt', | ||
'copyright': 'Copyright (c) 2007,2008 Brendan Dolan-Gavitt', | ||
'contact': '[email protected]', | ||
'license': 'GNU General Public License 2.0 or later', | ||
'url': 'http://moyix.blogspot.com/', | ||
'os': 'WIN_32_XP_SP2', | ||
'version': '1.0'} | ||
|
||
meta_info = forensics.commands.command.meta_info | ||
meta_info['author'] = 'Brendan Dolan-Gavitt' | ||
meta_info['copyright'] = 'Copyright (c) 2007,2008 Brendan Dolan-Gavitt' | ||
meta_info['contact'] = '[email protected]' | ||
meta_info['license'] = 'GNU General Public License 2.0 or later' | ||
meta_info['url'] = 'http://moyix.blogspot.com/' | ||
meta_info['os'] = 'WIN_32_XP_SP2' | ||
meta_info['version'] = '1.0' | ||
|
||
def help(self): | ||
return "Display SSDT entries" | ||
|
||
|
@@ -1055,21 +1048,15 @@ def execute(self): | |
|
||
(addr_space, symtab, types) = load_and_identify_image(self.op, | ||
self.opts) | ||
|
||
pslist = process_list(addr_space, types, symtab) | ||
procs = [ NewObject("_EPROCESS", p, addr_space, profile=profile) | ||
for p in pslist ] | ||
|
||
modlist = modules_list(addr_space, types, symtab) | ||
mods = [ NewObject("_LDR_MODULE", m, addr_space, profile=profile) | ||
for m in modlist ] | ||
mods = dict( (mod.BaseAddress.v(),mod) for mod in mods ) | ||
## Get a sorted list of module addresses | ||
mods = dict( (mod.BaseAddress.v(),mod) for mod in lsmod(addr_space, profile) ) | ||
mod_addrs = sorted(mods.keys()) | ||
|
||
# Gather up all SSDTs referenced by threads | ||
print "Gathering all referenced SSDTs from KTHREADs..." | ||
ssdts = set() | ||
for proc in procs: | ||
for proc in pslist(addr_space, profile): | ||
for thread in proc.ThreadListHead.list_of_type("_ETHREAD", "ThreadListEntry"): | ||
ssdt = thread.Tcb.ServiceTable.dereference() | ||
ssdts.add(ssdt) | ||
|
@@ -1086,15 +1073,19 @@ def execute(self): | |
tables_with_vm = [] | ||
for idx, table, n in tables: | ||
found = False | ||
for p in procs: | ||
if p.vm.is_valid_address(table): | ||
tables_with_vm.append( (idx, table, n, p.vm) ) | ||
for p in pslist(addr_space, profile): | ||
## This is the process address space | ||
ps_ad = p.get_process_address_space() | ||
## Is the table accessible from the process AS? | ||
if ps_ad.is_valid_address(table): | ||
tables_with_vm.append( (idx, table, n, ps_ad) ) | ||
found = True | ||
break | ||
## If not we use the kernel address space | ||
if not found: | ||
# Any VM is equally bad... | ||
tables_with_vm.append( (idx, table, n, addr_space) ) | ||
|
||
# Print out the entries for each table | ||
for idx,table,n,vm in sorted(tables_with_vm, key=itemgetter(0)): | ||
print "SSDT[%d] at %x with %d entries" % (idx,table, n) | ||
|
@@ -1117,4 +1108,4 @@ def execute(self): | |
syscall_name, | ||
syscall_modname) | ||
else: | ||
print " [SSDT not resident]" | ||
print " [SSDT not resident at 0x%08X ]" % table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters