Summary: C program to execute system calls

From: richard n. frank <rnfrank_at_wolfram.llnl.gov>
Date: Wed, 02 Dec 1998 14:57:25 -0800 (PST)

Greetings all,
   I have been trying to get a C program to do things like mount
and umount cd's. In desperation I gave up trying to make other
people's programs work and set out on my own. It was pretty
easy after all. You can make this little program do anything you want
by changing the command inside the quotes in this line:
char *command = ("enter any unix command");

This is the C program to shutdown the system in 1 minute



/*
 * shutdown.c 2. dec. 1998 rnf shutdown the system
 *
 */

#include <stdlib.h>
#include <unistd.h>
main()
{
char *command = ("shutdown -h +1");
 setuid(0);
 system(command);
}



compile by : cc shutdown.c
then : mv a.out shutdown
then as root : chown root shutdown
                chmod 755 shutdown
                chmod u+s shutdown
                cp shutdown /usr/bin
                
I believe this should be immune to the pervasive buffer
overflow problems because there is no input. I hope
somebody finds it useful.
                            rich frank
                            rnfrank_at_llnl.gov
                                           
                
 
Received on Wed Dec 02 1998 - 22:53:56 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:38 NZDT