mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-05-13 22:23:24 +08:00
[+] routines for loading array ( loadBytes, loadWords ... ) added
[+] sample added git-svn-id: https://pykd.svn.codeplex.com/svn@53051 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
e396c27fa9
commit
a95075cb6f
@ -44,6 +44,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
boost::python::def( "getOffset", &findAddressForSymbol );
|
boost::python::def( "getOffset", &findAddressForSymbol );
|
||||||
boost::python::def( "findModule", &findModule );
|
boost::python::def( "findModule", &findModule );
|
||||||
boost::python::def( "addr64", &addr64 );
|
boost::python::def( "addr64", &addr64 );
|
||||||
|
boost::python::def( "loadBytes", &loadArray<unsigned char> );
|
||||||
|
boost::python::def( "loadWords", &loadArray<unsigned short> );
|
||||||
|
boost::python::def( "loadDWords", &loadArray<unsigned long> );
|
||||||
|
boost::python::def( "loadQWords", &loadArray<__int64> );
|
||||||
boost::python::def( "compareMemory", &compareMemory );
|
boost::python::def( "compareMemory", &compareMemory );
|
||||||
boost::python::class_<typedVarClass>( "typedVarClass" )
|
boost::python::class_<typedVarClass>( "typedVarClass" )
|
||||||
.def("getAddress", &typedVarClass::getAddress );
|
.def("getAddress", &typedVarClass::getAddress );
|
||||||
|
@ -87,5 +87,4 @@ compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -1,10 +1,37 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <boost/python.hpp>
|
||||||
|
#include <boost/python/object.hpp>
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool
|
bool
|
||||||
loadMemory( ULONG64 address, PVOID dest, ULONG length );
|
loadMemory( ULONG64 address, PVOID dest, ULONG length );
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
boost::python::object
|
||||||
|
loadArray( ULONG64 address, ULONG number )
|
||||||
|
{
|
||||||
|
T *buffer = new T[ number ];
|
||||||
|
|
||||||
|
if ( loadMemory( address, buffer, number*sizeof(T) ) )
|
||||||
|
{
|
||||||
|
boost::python::dict arr;
|
||||||
|
|
||||||
|
for ( ULONG i = 0; i < number; ++i )
|
||||||
|
arr[i] = buffer[i];
|
||||||
|
|
||||||
|
delete[] buffer;
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] buffer;
|
||||||
|
|
||||||
|
return boost::python::object();
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length );
|
compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length );
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="dbgeng.lib engextcpp.lib"
|
AdditionalDependencies="dbgeng.lib"
|
||||||
OutputFile="$(OutDir)\$(ProjectName).pyd"
|
OutputFile="$(OutDir)\$(ProjectName).pyd"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
AdditionalLibraryDirectories=""$(DBG_SDK_ROOT)\lib\amd64";"$(PYTHON_ROOT)\x64\libs";"$(BOOST_ROOT)\stage64\lib""
|
AdditionalLibraryDirectories=""$(DBG_SDK_ROOT)\lib\amd64";"$(PYTHON_ROOT)\x64\libs";"$(BOOST_ROOT)\stage64\lib""
|
||||||
|
32
samples/ssdt.py
Normal file
32
samples/ssdt.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
from pykd import *
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def checkSSDT():
|
||||||
|
|
||||||
|
nt = loadModule( "nt" )
|
||||||
|
nt.KeServiceDescriptorTable = getOffset( "nt", "KeServiceDescriptorTable" )
|
||||||
|
|
||||||
|
serviceTableHeader = loadDWords( nt.KeServiceDescriptorTable, 4 )
|
||||||
|
serviceTableStart = serviceTableHeader[0]
|
||||||
|
serviceCount = serviceTableHeader[2]
|
||||||
|
|
||||||
|
|
||||||
|
dprintln( "ServiceTable start: %(1)x count: %(2)x" % { "1" : serviceTableStart, "2" : serviceCount } )
|
||||||
|
|
||||||
|
|
||||||
|
serviceTable = loadDWords( serviceTableStart, serviceCount )
|
||||||
|
|
||||||
|
|
||||||
|
for i in range( 0, serviceCount ):
|
||||||
|
dprintln( findSymbol( serviceTable[i] ) )
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
if not isSessionStart():
|
||||||
|
createSession()
|
||||||
|
loadDump( sys.argv[1] )
|
||||||
|
|
||||||
|
checkSSDT()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user