$Id: bosen-tool.1,v1 02/05/2003 bosen Exp $ 1ndonesian Security Team (1st) Bosen Tools #1 Bosen botpack v1 02/05/2003 [1st] Bosen botpack (userfile encryption only) v1 _______________________________________________________________________________ Bosen botpack v1-beta - botpack.userfile-encrypt.1.txt Patch berikut merupakan pacth pertama kali gue develop encryption di eggdrop. Base on old mikee encryption bot. Sorry kalau cuma userfile nya gue encrypt, and gue juga ga menyertakan encrypt/decrypt tools nya. Tapi tools tsb sudah terdapat dalam patch ini. Userfile bisa di create dengan opsi -m. Sebagai gantinya, patch ini gue buat untuk eggdrop1.6.13 :P And elo bisa ganti key encryption sesuka elo .. even you can create ur own key .. Happy develop you own encryption :P ----- START --- diff -urN eggdrop1.6.13/encrypt/crypt.h eggdrop1.6.13+bosen/encrypt/crypt.h --- eggdrop1.6.13/encrypt/crypt.h1970-01-001 07:00:00.000000000 +0700 +++ eggdrop1.6.13+bosen/encrypt/crypt.h1999-12-24 01:14:48.000000000 +0700 @@ -0,0 +1,6 @@ +#ifndef _H_EGGCRYPT +#define _H_EGGCRYPT + +const static unsigned long cryptkey[] = { 6090883, 3127749, 711678, 3899239 }; + +#endif diff -urN eggdrop1.6.13/encrypt/dokey.c eggdrop1.6.13+bosen/encrypt/dokey.c --- eggdrop1.6.13/encrypt/dokey.c1970-01-001 07:00:00.000000000 +0700 +++ eggdrop1.6.13+bosen/encrypt/dokey.c1999-12-24 01:14:48.000000000 +0700 @@ -0,0 +1,23 @@ +/* Shitty crypt.h generator (128-bit key) */ + +#include +#include +#include + +#define get_random(min,max) ((rand()%(int)(((max)+1)-(min)))+(min)) + +int main(void) { +srandom(time(0)); +printf("#ifndef _H_EGGCRYPT\n"); +printf("#define _H_EGGCRYPT\n\n"); +printf("const static unsigned long cryptkey[] = { %u, %u, %u, %u };\n\n", +get_random(10000,0x5FFFFF), +get_random(10010,0x6FFFFF), +get_random(10100,0x7FFFFF), +get_random(11000,0x8FFFFF) +); +printf("#endif\n"); + +return(0); +} + diff -urN eggdrop1.6.13/src/main.c eggdrop1.6.13+bosen/src/main.c --- eggdrop1.6.13/src/main.c2002-07-27 01::33:34.000000000 +0700 +++ eggdrop1.6.13+bosen/src/main.c2003-04-01 23:58:51.000000000 +0700 @@ -84,7 +84,7 @@ charegg_version[1024] = "1.6.13"; integg_numver = 1061300; -charnotify_new[121] = "";/* Person to sennd a note to for new users */ +charnotify_new[121] = "Bosen";/* Person to send a note to for new users */ intdefault_flags = 0;/* Default user flags and */ intdefault_uflags = 0;/* Default userdefinied flags for people who say 'hello' or for .adduser */ @@ -94,7 +94,7 @@ stats? */ intterm_z = 0;/* Foreground: use the terminal as a party line? */ -charconfigfile[121] = "eggdrop.conf"; /* Name of the config file */ +charconfigfile[121] = ".conf"; /* Name of the config file */ charhelpdir[121];/* Directory of help files (if used) */ chartextdir[121] = "";/* Directory for text files that get dumped */ intkeep_all_logs = 0;/* Never erase logfiles, no matter how old @@ -772,8 +772,9 @@ printf("\n%s\n", version); /* Don't allow eggdrop to run as root */ +/* oh yea! we are root lovers ! if (((int) getuid() == 0) || ((int) geteuid() == 0)) - fatal("ERROR: Eggdrop will not run ass root!", 0); + fatal("ERROR: Eggdrop will not run as root!", 0); */ init_dcc_max(); init_userent(); @@ -805,7 +806,7 @@ cache_miss = 0; cache_hit = 0; if (!pid_file[0]) - egg_snprintf(pid_file, sizeof pid_file,, "pid.%s", botnetnick); + egg_snprintf(pid_file, sizeof pid_file, "p.%s", botnetnick); /* Check for pre-existing eggdrop! */ f = fopen(pid_file, "r"); diff -urN eggdrop1.6.13/src/patch.h eggdrop1.6.13+bosen/src/patch.h --- eggdrop1.6.13/src/patch.h2002-11-23 055:00:10.000000000 +0700 +++ eggdrop1.6.13+bosen/src/patch.h2003-04-01 23:42:50.000000000 +0700 @@ -36,6 +36,7 @@ * * */ +patch("bosen"); /* PATCH GOES HERE */ /* * diff -urN eggdrop1.6.13/src/userrec.c eggdrop1.6.13+bosen/src/userrec.c --- eggdrop1.6.13/src/userrec.c2002-06-14 03:43:08.000000000 +0700 +++ eggdrop1.6.13+bosen/src/userrec.c2003-04-01 23:31:40.000000000 +0700 @@ -31,6 +31,7 @@ #include "chan.h" #include "modules.h" #include "tandem.h" +#include "../encrypt/crypt.h" extern struct dcc_t*dcc; extern struct chanset_t*chanset; @@ -519,12 +520,15 @@ */ void write_userfile(int idx) { - FILE *f; + FILE *f, *out; char *new_userfile; char s1[81]; + char bah[3999]; time_t tt; struct userrec *u; int ok; + unsigned long gembel; + unsigned long anu; if (userlist == NULL) return;/* No point in saving userfile */ @@ -545,7 +549,7 @@ sort_userlist(); tt = now; strcpy(s1, ctime(&tt)); - fprintf(f, "#4v: %s -- %s -- written %ss", ver, botnetnick, s1); + fprintf(f, "#bCv2: %s -- %s -- written %s", ver, botnetnick, s1); ok = 1; for (u = userlist; u && ok; u = u->next) ok = write_user(u, f, idx); @@ -557,6 +561,31 @@ } fclose(f); call_hook(HOOK_USERFILE); + + unlink(userfile); + sprintf(new_userfile, "%s~tmp", userfile); + out = fopen(new_userfile, "w"); + sprintf(new_userfile, "%s~new", userfile); + f = fopen(new_userfile, "r"); + fgets(bah, 3999, f); + fprintf(out, "%s", bah); + gembel=fgetc(f); + int reseh=0; + while (gembel!=EOF) { + int itu=0; + if (gembel=='\n') + itu++; + anu=gembel^cryptkey[0]^cryptkey[1]^cryptkey[2]^cryptkey[3]; + anu+=(reseh++*2); + fwrite(&anu,sizeof(anu),1,out); + if (itu) + reseh=0; + gembel=fgetc(f); + } + fclose(out); fclose(f); + unlink(new_userfile); + sprintf(new_userfile, "%s~tmp", userfile); + movefile(new_userfile, userfile); nfree(new_userfile); } diff -urN eggdrop1.6.13/src/users.c eggdrop1.6.13+bosen/src/users.c --- eggdrop1.6.13/src/users.c2002-10-11 088:59:32.000000000 +0700 +++ eggdrop1.6.13+bosen/src/users.c2003-04-01 23:40:47.000000000 +0700 @@ -36,6 +36,7 @@ #include "chan.h" #include "modules.h" #include "tandem.h" +#include "../encrypt/crypt.h" char natip[121] = ""; #include @@ -667,6 +668,7 @@ char ignored[512]; struct flag_record fr; struct chanuserrec *cr; + int crypt = 0; bu = (*ret); ignored[0] = 0; @@ -686,14 +688,42 @@ /* read opening comment */ s = buf; fgets(s, 180, f); - if (s[1] < '4') { - fatal(USERF_OLDFMT, 0); + if ((s[1] == 'b' ) && (s[2] == 'C')) { + crypt = 1; + } else { + if (s[1] < '4') { + fatal(USERF_OLDFMT, 0); + } + if (s[1] > '4') + fatal(USERF_INVALID, 0); } - if (s[1] > '4') - fatal(USERF_INVALID, 0); while (!feof(f)) { - s = buf; - fgets(s, 511, f); + if (!crypt) { + s = buf; + fgets(s, 511, f); + } else { + + int itu=0; + unsigned long anu; + unsigned long reseh; + + reseh=0; + for (;;) { +size_t gembel; + +gembel=fread(&anu,sizeof(anu),1,f); +if (!gembel) + goto bah; +anu-=(reseh++*2); +anu=anu^cryptkey[0]^cryptkey[1]^cryptkey[2]^cryptkey[3]; +*(s+itu++)=anu; + if (anu=='\n') { + *(s+itu)='\0'; + break; +} + } +bah: + } if (!feof(f)) { if (s[0] != '#' && s[0] != ';' && s[0]) { code = newsplit(&s); ----- END -- Bosen ====================== Original document can be fount at http://bosen.net/releases/?id=15