sakiir

ApiWin32 Skype Ip Resolver GUI

Oct 14th, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.08 KB | None | 0 0
  1. #include <windows.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <unistd.h>
  6. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  7. int copyStringToClipboard(char* source) {
  8.     int ok = OpenClipboard(NULL);
  9.     if(!ok) return -1;
  10.     HGLOBAL clipbuffer;
  11.     char * buffer;
  12.     EmptyClipboard();
  13.     clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(source) + 1);
  14.     buffer = (char*)GlobalLock(clipbuffer);
  15.     strcpy(buffer, source);
  16.     GlobalUnlock(clipbuffer);
  17.     SetClipboardData(CF_TEXT, clipbuffer);
  18.     CloseClipboard();
  19. }
  20.  
  21.  
  22.  
  23.  
  24. void IpResolver(char *skypeuser)
  25. {
  26.  
  27.    WSADATA WSAData;
  28.    int erreur = WSAStartup(MAKEWORD(2,0), &WSAData);
  29.    SOCKET sock;
  30.    SOCKADDR_IN sin;
  31.    char buffer[1024] = "";
  32.  
  33.    char *url_server = "skype.coleak.com";
  34.    char path[1024] = "/index.php?key=4K9DZ&name=";
  35.  
  36.     strncat(path,skypeuser,1020);
  37.  
  38.  
  39.     /* Si les sockets Windows fonctionnent */
  40.     if(!erreur)
  41.     {
  42.         //On creer la Sockk'
  43.         sock = socket(AF_INET, SOCK_STREAM, 0);
  44.  
  45.         // Configuration'
  46.         sin.sin_addr.s_addr = inet_addr("184.22.145.70");
  47.         sin.sin_family = AF_INET;
  48.         sin.sin_port = htons(80);
  49.  
  50.         // Connection
  51.         if(connect(sock, (SOCKADDR *)&sin, sizeof(sin)) != SOCKET_ERROR)
  52.         {
  53.  
  54.  
  55.             char commande[1020];
  56.             sprintf(commande,"GET %s HTTP/1.1\r\nHost: %s\r\nAccept: */*\r\nContent-Type:application/x-www-form-urlencoded\r\nContent-Length:18\r\n\r\nIdentifiant=Pierre",path,url_server);
  57.             send(sock,commande,strlen(commande)+1,0);
  58.  
  59.             char response [1020] ="";
  60.             while (recv(sock,buffer, 1024, 0) > 0)
  61.             {
  62.                 strncat(response, buffer,1020);
  63.             }
  64. //On Affiche la reponse GET
  65.             printf("///////////////////////////////////////////////////\n%s\n///////////////////////////////////////////////////", response);
  66.  
  67.  
  68.  
  69. copyStringToClipboard(response);
  70. MessageBox(NULL,"Les Informtion Ont été Copié dans le presse papier","Copié",MB_OK | MB_ICONINFORMATION);
  71.         }
  72.  
  73.         else
  74.         {
  75.             printf("Impossible de se connecter\n");
  76.         }
  77.  
  78.         //on arrete tout ca :)
  79.         closesocket(sock);
  80.  
  81.         WSACleanup();
  82.     }
  83.  
  84. }
  85. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  86. enum { ID_LABEL = 1,ID_IMAGE,ID_EDIT,ID_LIST,ID_BUTTON1,ID_COMBO,ID_BUTTON2,ID_BUTTON0,
  87. ID_BUTTON3,ID_BUTTON4,ID_BUTTON5,ID_BUTTON6,ID_BUTTON7,ID_BUTTON8,ID_BUTTON9,
  88. ID_BUTTONPLUS, ID_BUTTONMINUS, ID_BUTTONTIME, ID_BUTTONDIVIDE, ID_BUTTONEQUAL};
  89. LRESULT CALLBACK WinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  90.  
  91. HINSTANCE g_hInst;
  92. TCHAR    szAppName[]    = TEXT("Skype Ip Resolver By Sakiir-Security");
  93. TCHAR    szWinClass[]    = TEXT("WIN_CLASS");
  94.  
  95. HWND static_label;
  96. HWND edit;
  97. HWND list;
  98. HWND exit11;
  99.  
  100. HWND button1;
  101.  
  102.  
  103.  
  104. int WINAPI WinMain (HINSTANCE hInstance,
  105.                     HINSTANCE hPrevInstance,
  106.                     LPSTR lpszArgument,
  107.                     int nFunsterStil){
  108.  
  109.     WNDCLASSA wc;
  110.     MSG            msg;
  111.     HWND        hwnd;
  112.     g_hInst = hInstance;
  113.  
  114.     wc.cbClsExtra        = 0;
  115.     wc.cbWndExtra        = 0;
  116.     wc.hbrBackground    = (HBRUSH)(COLOR_WINDOW+5);
  117.     wc.hCursor            = LoadCursor(NULL, IDC_ARROW);
  118.     wc.hIcon            = LoadIcon(NULL, IDI_APPLICATION);
  119.     wc.hInstance        = hInstance;
  120.     wc.lpfnWndProc        = WinProc;
  121.     wc.lpszClassName    = szWinClass;
  122.     wc.lpszMenuName        = NULL;
  123.     wc.style            = CS_HREDRAW | CS_VREDRAW;
  124.  
  125.      if( !RegisterClass(&wc))
  126.     {
  127.         MessageBox(NULL, TEXT("Error registering class"), TEXT("ERROR"), MB_OK);
  128.         return 0;
  129.     }
  130.  
  131.     hwnd = CreateWindow(szWinClass,
  132.                         szAppName,
  133.                         DS_CENTER,
  134.                         CW_USEDEFAULT,
  135.                         CW_USEDEFAULT,
  136.                         300,
  137.                         400,
  138.                         (HWND) NULL,
  139.                         (HMENU) NULL,
  140.                         (HINSTANCE) hInstance,
  141.                         (void *) NULL);
  142.  
  143.     ShowWindow (hwnd, nFunsterStil);
  144.  
  145.     while (GetMessage(&msg, (HWND) NULL, 0, 0))
  146.     {
  147.         TranslateMessage(&msg);
  148.         DispatchMessage(&msg);
  149.     }
  150.     return msg.wParam;
  151. }
  152. HINSTANCE hInst;
  153.  
  154. typedef BOOL (WINAPI *ATLWININIT)(void);
  155.  
  156. LRESULT CALLBACK WinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
  157.     PAINTSTRUCT    ps;
  158.     HDC            hdc;
  159.  
  160.     switch(msg){
  161.         case WM_CREATE:
  162.  
  163.  
  164.  
  165.             static_label = CreateWindow("Static","Please Enter A Skype User",WS_CHILD | WS_VISIBLE,50,15,200,25,hwnd,0,g_hInst,0);    ;
  166.             edit = CreateWindow("Edit", NULL,WS_BORDER | WS_CHILD | WS_VISIBLE ,50,45,200,20,hwnd,(HMENU)ID_EDIT,g_hInst,0);
  167.  
  168.  
  169.             button1 = CreateWindow("Button","GetSkypeIp",BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE ,50,170,80,80,hwnd,(HMENU)ID_BUTTON1,g_hInst,0);
  170.             exit11 = CreateWindow("Button","Exit",BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE ,200,170,80,80,hwnd,(HMENU)ID_BUTTON2,g_hInst,0);
  171.  
  172.         case WM_PAINT:
  173.             hdc = BeginPaint(hwnd, &ps);
  174.             EndPaint(hwnd, &ps);
  175.  
  176.             return 0;
  177.         case WM_COMMAND:
  178.             switch(wParam)
  179.             {
  180.  
  181.  
  182.                 case ID_BUTTON1:
  183.                     {
  184.  
  185.                     char buf[25];
  186.                     GetDlgItemText(hwnd,ID_EDIT,buf,20);
  187.                     IpResolver(buf);
  188.  
  189.                    
  190.  
  191.  
  192.                     }
  193.  
  194.                         break;
  195.  
  196.                     case ID_BUTTON2:
  197.                       {
  198.  
  199.  
  200.  
  201.                        exit(EXIT_SUCCESS);
  202.  
  203.                       }
  204.  
  205.  
  206.  
  207.  
  208.             }//switch.
  209.             break;
  210.         case WM_DESTROY:
  211.             PostQuitMessage(0);
  212.             break; // pass to DefWindowProc(...) as well
  213.         case WM_CLOSE:
  214.             DestroyWindow(hwnd);
  215.             break;
  216.     }
  217.     FreeConsole( );
  218.     return DefWindowProc(hwnd, msg, wParam, lParam);}
Add Comment
Please, Sign In to add comment