home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Unix / Cloaking / inv.c < prev    next >
C/C++ Source or Header  |  1999-11-04  |  1KB  |  72 lines

  1. /*
  2.  
  3. I 'found' this little C program a few days ago, and runs on most UNIX
  4. machines I think (As I found it, I cant claim fame for writing it!).
  5.  
  6. What it does, is change your userid and x25 address to anything of your
  7. choice. This only affects programs such as 'write' and 'who'. It doesn't
  8. automatically give you different access rights, so it can only be used
  9. to disguise your real identity.
  10.  
  11. Usage
  12. -----
  13.  
  14.    inv god somewhere (Changes your uid to 'god' and X.25 to 'somewhere')
  15.    inv ''  ''        (Makes you INVISIBLE on 'who')
  16.  
  17. Program invis.c
  18. ---------------
  19. */
  20.  
  21. #include <stdio.h>
  22. #include <utmp.h>
  23. #include <sys/types.h>
  24.  
  25. #include <lastlog.h>
  26.  
  27. main(argc,argv)
  28. int argc;
  29. char *argv[];
  30. {
  31.  FILE *f;
  32.  struct utmp u;
  33.  
  34.  int v=ttyslot(1);
  35.  if(v==-1)
  36.  {
  37.   fprintf(stderr,"Can't find terminal.\n");
  38.   exit(1);
  39.  
  40.  if(argc!=3)
  41.  {
  42.   fprintf(stderr,"Args!\n");
  43.   exit(1);
  44.  }
  45.  f=fopen("/etc/utmp","r+");
  46.  if(f==NULL)
  47.  {
  48.   fprintf(stderr,"Utmp has escaped!\n");
  49.   exit(1);
  50.  }
  51.  if(fseek(f,v*sizeof(u),0)==-1)
  52.  {
  53.   fprintf(stderr,"Garbage utmp\n");
  54.   exit(1);
  55.  }
  56.  if(fread((char *)&u,sizeof(u),1,f)!=1)
  57.  {
  58.   fprintf(stderr,"Write failed\n");
  59.   exit(1);
  60.  }
  61.  
  62.  strncpy(u.ut_name,argv[1],8);
  63.  strncpy(u.ut_host,argv[2],16);
  64.  if(fseek(f,v*sizeof(u),0)==-1)
  65.  {
  66.   fprintf(stderr,"Seek failed\n");
  67.   exit(1);
  68.  }
  69.  fwrite((char *)&u,sizeof(u),1,f);
  70.  fclose(f);
  71. }
  72.