tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* Summary: C program to execute system calls
@ 1998-12-02 22:57 richard n. frank
  0 siblings, 0 replies; only message in thread
From: richard n. frank @ 1998-12-02 22:57 UTC (permalink / raw)
  To: tru64-unix-managers

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@llnl.gov
                                           
                
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-12-02 22:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-12-02 22:57 Summary: C program to execute system calls richard n. frank

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox