Skip to content

Commit

Permalink
bug fixes and code re-arrangement
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasser Alhazmi committed Jun 19, 2021
1 parent 65a9575 commit ed1fd61
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Backstab/Driverloading.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ BOOL UnloadDriver(LPWSTR szPath, LPWSTR szServiceName) {

ret = _NtUnLoadDriver(&usDriverServiceName);
if (ret != STATUS_SUCCESS) {
printf("Error : NtUnLoadDriver: %x\n", ret);
// printf("Error : NtUnLoadDriver: %x\n", ret);
DeleteRegistryKey(szServiceName);
return FALSE;
}
Expand Down
2 changes: 1 addition & 1 deletion Backstab/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BOOL Error(LPSTR szMethod) {
}

BOOL Success(LPSTR szMethod) {
printf("[+] %s:\n", szMethod);
printf("[+] %s\n", szMethod);
return TRUE;
}

Expand Down
10 changes: 6 additions & 4 deletions Backstab/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ int main(int argc, char* argv[]) {
return Error("Could not load driver");
}
else {
Success("Driver loaded as %ws\n", szServiceName);
printf("Driver loaded as %ws\n", szServiceName);
isRequestingDriverUnload = TRUE; // Set to unload the driver at the end of the operation

}
Expand Down Expand Up @@ -287,10 +287,10 @@ int main(int argc, char* argv[]) {
{
printf("\n");
if (isUsingProcessName) {
printf("Process Name : %ws", szProcessName);
printf("Process Name: %ws\n", szProcessName);
}

printf("[*] Process PID : %d\n", dwPid);
printf("[*] Process PID: %d\n", dwPid);
if (!ProcessGetProtectionLevel(dwPid, &dwProcessProtectionLevel))
printf("[!] Failed to get the protection level of process with PID %d\n", dwPid);
else
Expand All @@ -309,11 +309,13 @@ int main(int argc, char* argv[]) {
else if (isRequestingProcessKill) {
Info("Killing process\n");
KillProcessHandles(hProtectedProcess);
Success("Killing process succeeded");
}
else if (isUsingSpecificHandle)
{
Info("Killing Handle : 0x%x\n", strtol(szHandleToClose, 0, 16));
Info("Closing Handle : 0x%x\n", strtol(szHandleToClose, 0, 16));
ProcExpKillHandle(dwPid, strtol(szHandleToClose, 0, 16));
Success("Closing handle succeeded");
}
else {
printf("Please select an operation\n");
Expand Down

0 comments on commit ed1fd61

Please sign in to comment.