Skip to content

Commit d6e8a80

Browse files
author
unCodeSc
committed
unHooker
0 parents  commit d6e8a80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+528
-0
lines changed

Driver/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!include $(NTMAKEENV)\makefile.def

Driver/Source.c

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
// # unHooker Driver [ UNCODER ]
3+
4+
5+
#include <Ntddk.h>
6+
typedef struct HookData
7+
{
8+
int Index;
9+
ULONG Addr;
10+
}cHookData;
11+
12+
// Service Description Table (SDT)
13+
typedef struct ServiceDescriptorEntry {
14+
unsigned int *ServiceTableBase;
15+
unsigned int *ServiceCounterTableBase;
16+
unsigned int NumberOfServices;
17+
unsigned char *ParamTableBase;
18+
} ServiceDescriptorTableEntry, *PointerServiceDescriptorTableEntry;
19+
20+
// Import KeServiceDescriptorTable from ntoskrnl.exe
21+
__declspec(dllimport) ServiceDescriptorTableEntry KeServiceDescriptorTable;
22+
23+
24+
UNICODE_STRING DosName,Name;
25+
void DriverUnload(IN PDRIVER_OBJECT DriverObject)
26+
{
27+
IoDeleteSymbolicLink(&DosName);
28+
IoDeleteDevice(DriverObject->DeviceObject);
29+
DbgPrint("Unloaded - unCoder ");
30+
}
31+
32+
NTSTATUS __stdcall UnhookSsdtService(IN cHookData data)
33+
{
34+
// Disable the Memory Write Protection so we can access the protected System Service Dispatch Table (SSDT)
35+
_asm
36+
{
37+
CLI
38+
MOV EAX, CR0
39+
AND EAX, NOT 10000H
40+
MOV CR0, EAX
41+
}
42+
43+
KeServiceDescriptorTable.ServiceTableBase[data.Index] = (ULONG)data.Addr;
44+
45+
_asm
46+
{
47+
MOV EAX, CR0
48+
OR EAX, 10000H
49+
MOV CR0, EAX
50+
STI
51+
}
52+
53+
DbgPrint("unHooked - unCoder");
54+
55+
return STATUS_SUCCESS;
56+
}
57+
58+
NTSTATUS __stdcall IoCreate(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp)
59+
{
60+
IofCompleteRequest(Irp,IO_NO_INCREMENT);
61+
return STATUS_SUCCESS;
62+
63+
}
64+
NTSTATUS __stdcall IRP_DEVICE_CONTROL(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp)
65+
{
66+
cHookData data;
67+
memcpy(&data,Irp->AssociatedIrp.SystemBuffer,sizeof(data));
68+
69+
UnhookSsdtService(data);
70+
IofCompleteRequest(Irp,IO_NO_INCREMENT);
71+
return STATUS_SUCCESS;
72+
}
73+
74+
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING RegPath)
75+
{
76+
NTSTATUS NtStatus;
77+
PDEVICE_OBJECT DeviceObject;
78+
79+
RtlInitUnicodeString(&DosName,L"\\DosDevices\\uHo");
80+
RtlInitUnicodeString(&Name,L"\\Device\\uHo");
81+
82+
NtStatus = IoCreateDevice(DriverObject,0,&Name,FILE_DEVICE_UNKNOWN,0,FALSE,&DeviceObject);
83+
IoCreateSymbolicLink(&DosName,&Name);
84+
85+
DbgPrint("Driver Loaded - unCoder");
86+
87+
DriverObject->MajorFunction[IRP_MJ_CREATE] = IoCreate;
88+
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IRP_DEVICE_CONTROL;
89+
DriverObject->DriverUnload = DriverUnload;
90+
91+
92+
return NtStatus;
93+
}

Driver/Sources

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
TARGETNAME=unHooker
2+
TARGETPATH =.
3+
TARGETTYPE=DRIVER
4+
SOURCES=Source.c

Driver/buildfre_win7_x86.log

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
BUILD: Computing Include file dependencies:
2+
BUILD: Examining c:\users\hp\desktop\unhooker\driver directory for files to compile.
3+
oacr invalidate root:x86fre /autocleanqueue
4+
1>Compiling and Linking c:\users\hp\desktop\unhooker\driver *************
5+
1>'nmake.exe /nologo BUILDMSG=Stop. -i BUILD_PASS=PASS2 LINKONLY=1 NOPASS0=1 MAKEDIR_RELATIVE_TO_BASEDIR='
6+
1>c:\users\hp\desktop\unhooker\driver: TARGETPATH is .

Driver/i386/unHooker.pdb

115 KB
Binary file not shown.

Driver/i386/unHooker.sys

3.5 KB
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
3+
386_OBJECTS=\
4+
$(OBJ_PATH)\$O\source.obj \
5+
6+
7+
8+
9+
10+
# lowercased
11+
BASEDIR=c:\winddk\7600.16385.1
12+
OBJECT_ROOT=c:\winddk\7600.16385.1
13+
MAKEDIR_LOWERCASE=c:\users\hp\desktop\unhooker\driver
14+
OBJ_PATH=c:\users\hp\desktop\unhooker\driver
15+
CONCURRENT_MIDL=0
16+
CONCURRENT_MANIFEST_BUILD=0
69.7 KB
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<DEFECTS>
3+
<OACRDEFECTCOUNT>6</OACRDEFECTCOUNT>
4+
<OACRERRORCOUNT>0</OACRERRORCOUNT>
5+
<DEFECT _seq="1"><SFA><LINE>74</LINE><COLUMN>9</COLUMN><FILENAME>source.c</FILENAME><FILEPATH>c:\users\hp\desktop\unhooker\driver\</FILEPATH></SFA><DEFECTCODE>28101</DEFECTCODE><DESCRIPTION>The Drivers module has inferred that the current function is a DRIVER_INITIALIZE function: This is informational only. No problem has been detected.</DESCRIPTION><FUNCTION>DriverEntry</FUNCTION><FUNCLINE>74</FUNCLINE><PATH/></DEFECT>
6+
<DEFECT _seq="2"><SFA><LINE>87</LINE><COLUMN>44</COLUMN><FILENAME>source.c</FILENAME><FILEPATH>c:\users\hp\desktop\unhooker\driver\</FILEPATH></SFA><DEFECTCODE>28155</DEFECTCODE><DESCRIPTION>The function being assigned or passed should be a DRIVER_DISPATCH function: Add the declaration 'DRIVER_DISPATCH IoCreate;' before the current first declaration of IoCreate.</DESCRIPTION><FUNCTION>DriverEntry</FUNCTION><FUNCLINE>74</FUNCLINE><PATH/></DEFECT>
7+
<DEFECT _seq="3"><SFA><LINE>88</LINE><COLUMN>52</COLUMN><FILENAME>source.c</FILENAME><FILEPATH>c:\users\hp\desktop\unhooker\driver\</FILEPATH></SFA><DEFECTCODE>28155</DEFECTCODE><DESCRIPTION>The function being assigned or passed should be a DRIVER_DISPATCH function: Add the declaration 'DRIVER_DISPATCH IRP_DEVICE_CONTROL;' before the current first declaration of IRP_DEVICE_CONTROL.</DESCRIPTION><FUNCTION>DriverEntry</FUNCTION><FUNCLINE>74</FUNCLINE><PATH/></DEFECT>
8+
<DEFECT _seq="4"><SFA><LINE>89</LINE><COLUMN>28</COLUMN><FILENAME>source.c</FILENAME><FILEPATH>c:\users\hp\desktop\unhooker\driver\</FILEPATH></SFA><DEFECTCODE>28155</DEFECTCODE><DESCRIPTION>The function being assigned or passed should be a DRIVER_UNLOAD function: Add the declaration 'DRIVER_UNLOAD DriverUnload;' before the current first declaration of DriverUnload.</DESCRIPTION><FUNCTION>DriverEntry</FUNCTION><FUNCLINE>74</FUNCLINE><PATH/></DEFECT>
9+
<DEFECT _seq="5"><SFA><LINE>87</LINE><COLUMN>44</COLUMN><FILENAME>source.c</FILENAME><FILEPATH>c:\users\hp\desktop\unhooker\driver\</FILEPATH></SFA><DEFECTCODE>28169</DEFECTCODE><DESCRIPTION>The dispatch function 'IoCreate' does not have any __drv_dispatchType annotations: This can be corrected by adding appropriate __drv_dispatchType annotations to the function. Unnecessary casts can cause this warning.</DESCRIPTION><FUNCTION>DriverEntry</FUNCTION><FUNCLINE>74</FUNCLINE><PATH/></DEFECT>
10+
<DEFECT _seq="6"><SFA><LINE>88</LINE><COLUMN>52</COLUMN><FILENAME>source.c</FILENAME><FILEPATH>c:\users\hp\desktop\unhooker\driver\</FILEPATH></SFA><DEFECTCODE>28169</DEFECTCODE><DESCRIPTION>The dispatch function 'IRP_DEVICE_CONTROL' does not have any __drv_dispatchType annotations: This can be corrected by adding appropriate __drv_dispatchType annotations to the function. Unnecessary casts can cause this warning.</DESCRIPTION><FUNCTION>DriverEntry</FUNCTION><FUNCLINE>74</FUNCLINE><PATH/></DEFECT>
11+
</DEFECTS>

Loader/unHooker/Debug/CL.read.1.tlog

49.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)