diff --git a/SA/src/uname.c b/SA/src/uname.c index 4293aba..e5d1f72 100644 --- a/SA/src/uname.c +++ b/SA/src/uname.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "beacon_api.h" @@ -8,8 +9,14 @@ int run_uname(void){ struct utsname values; int retcode = 0; - retcode = uname(&values); - BeaconPrintf(CALLBACK_OUTPUT, "%s %s %s %s %s\n", values.sysname, values.nodename, values.release, values.version, values.machine); + char* osversion = getOSName(); + if (strcmp("lin", osversion)==0){ + retcode = uname(&values); + BeaconPrintf(CALLBACK_OUTPUT, "%s %s %s %s %s\n", values.sysname, values.nodename, values.release, values.version, values.machine); + } + else{ + BeaconPrintf(CALLBACK_OUTPUT, "Not supported\n"); + } return 0; } diff --git a/includes/beacon_api.h b/includes/beacon_api.h index f888032..1118fc9 100644 --- a/includes/beacon_api.h +++ b/includes/beacon_api.h @@ -55,4 +55,5 @@ uint32_t swap_endianess(uint32_t indata); char* BeaconGetOutputData(int *outsize); char** getEnviron(void); +char* getOSName(void); #endif diff --git a/includes/beacon_compatibility.h b/includes/beacon_compatibility.h index c147c8d..26b32d0 100644 --- a/includes/beacon_compatibility.h +++ b/includes/beacon_compatibility.h @@ -13,8 +13,8 @@ typedef struct beacon_function{ void* function; } beacon_function_t; -extern beacon_function_t BeaconInternalMapping[17]; -#define BEACONINTERNALMAPPINGCOUNT 16 +extern beacon_function_t BeaconInternalMapping[18]; +#define BEACONINTERNALMAPPINGCOUNT 17 void* internalFunctionLookup(char* symbolName); /* Structures as is in beacon.h */ @@ -63,4 +63,5 @@ uint32_t swap_endianess(uint32_t indata); char* BeaconGetOutputData(int *outsize); char** getEnviron(void); +char* getOSName(void); #endif diff --git a/src/beacon_compatibility.c b/src/beacon_compatibility.c index e576f61..93fc1b0 100644 --- a/src/beacon_compatibility.c +++ b/src/beacon_compatibility.c @@ -33,7 +33,7 @@ extern char** environ; /* Data Parsing */ -beacon_function_t BeaconInternalMapping[17] = { +beacon_function_t BeaconInternalMapping[18] = { {"BeaconDataParse", (void*)BeaconDataParse}, {"BeaconDataInt", (void*)BeaconDataInt}, {"BeaconDataShort", (void*)BeaconDataShort}, @@ -49,7 +49,8 @@ beacon_function_t BeaconInternalMapping[17] = { {"BeaconPrintf", (void*)BeaconPrintf}, {"BeaconOutput", (void*)BeaconOutput}, {"BeaconIsAdmin", (void*)BeaconIsAdmin}, - {"getEnviron", (void*)getEnviron} + {"getEnviron", (void*)getEnviron}, + {"getOSName", (void*)getOSName} }; @@ -57,6 +58,20 @@ char** getEnviron(void){ return environ; } +char* getOSName(void){ +#ifdef __APPLE__ + return "apple"; +#elif __FreeBSD__ + return "freebsd"; +#elif __OpenBSD__ + return "openbsd"; +#elif __linux__ + return "lin"; +#else + return "unk"; +#endif +} + #ifdef _WIN32 /* A hacky compatible dlsym function for use on windows systems. * TODO: Implement a internal function lookup function for all OS's that