Skip to content

Commit

Permalink
Added wDirectSyscall.asm to the tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-z committed Nov 21, 2023
1 parent 38ede49 commit 9b3c10d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 6 additions & 6 deletions bofs/src/wDirectSyscall.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ section '.text' code readable executable align 8
align 8
go:
.STACK_SIZE = 128+8
sub rsp, .STACK_SIZE ; allocate some stack space and align it to 16 bytes
sub rsp, .STACK_SIZE ; allocate stack space and align it to 16 bytes

mov rax, [gs:0x60] ; PEB address
mov rax, [rax+32] ; ProcessParameters address
Expand All @@ -28,13 +28,13 @@ go:
mov dword [rsp+80], 0 ; EaLength
call nt_create_file

mov ecx, 0
mov rdx, str_fmt
mov r8d, eax
call BeaconPrintf
mov ecx, 0 ; `type`
mov rdx, str_fmt ; `fmt`
mov r8d, eax ; `...`
call BeaconPrintf ; print result returned from syscall (NTSTATUS)

add rsp, .STACK_SIZE
xor eax, eax
xor eax, eax ; BOF exit code
ret

; syscall numbers for Windows 10+ x64:
Expand Down
14 changes: 8 additions & 6 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,14 @@ pub fn build(b: *std.build.Builder) void {
);
winver_x86.step.dependOn(b.getInstallStep());

// TODO: Check if we are running on Windows 10+
//const direct_syscall_x64 = b.addSystemCommand(
// &.{ "zig-out/bin/cli4bofs_win_x64.exe", "zig-out/bin/wDirectSyscall.coff.x64.o" },
//);
//direct_syscall_x64.step.dependOn(b.getInstallStep());
//test_step.dependOn(&direct_syscall_x64.step);
const detected_version = std.zig.system.windows.detectRuntimeVersion();
if (detected_version.isAtLeast(.win10)) {
const direct_syscall_x64 = b.addSystemCommand(
&.{ "zig-out/bin/cli4bofs_win_x64.exe", "zig-out/bin/wDirectSyscall.coff.x64.o" },
);
direct_syscall_x64.step.dependOn(b.getInstallStep());
test_step.dependOn(&direct_syscall_x64.step);
}

test_step.dependOn(&udp_scanner_x64.step);
test_step.dependOn(&udp_scanner_x86.step);
Expand Down

0 comments on commit 9b3c10d

Please sign in to comment.