halt.c linux

Dont ask, its a result from a reverse engineering of has shutdown -h

halt.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(void)
{
int fh;
fh=open(“/dev/initctl”, O_WRONLY);
write(fh, “i\31\t\3\1\0\0\0000\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0”, 384);
close(fh);
}
—-endfile

cc halt.c -o myhalt
./myhalt

and everything gos puf…en poweroff. 😀

Dette indlæg blev udgivet i Knowledge Base, Linux, Old Base, Programmering. Bogmærk permalinket.

Skriv et svar