SpoofW.c "spoofs" messages from any user on the system (can only be used as root, or as normal user on very old systems). Re-written by Root-Dude
4a5e56e60655e168369f38dd84cc5052a91abd3ee503bc5cc47330ac24ff1cba
/*
* spoofW.c (spoofWrite)
*
* written by R00T-dude
*
* "spoofs" messages from any user on the system
* (can only be used as root, or as normal user
* on OLD SYSTEMS !!!)
*
* this was originaly written by a guy claiming
* to be Sir Hackalot, but it suckt, so I totaly
* rewrote it !!
*
* greetz to : |ncubus, f0bic, F_F, nostalgic,
* vorlon, cicero, zym0t1c, segfau|t, demongirl,
* so many other i forgot !
*
*/
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <sys/utsname.h>
#include <unistd.h>
main(int argc, char **argument)
{
char olm[1024];
char user[25];
char tty[25];
char temp[100];
char tmp[128];
char time[128];
int handle, acnt = 2, i, b, c;
FILE *strm;
FILE *stream;
struct utsname name;
if (argc == 1) {
printf("send one line of txt to a user ... \n");
printf("\nSyntax: %s <tty of the user> [message] (message is an option, you can give it in later if you want!)\n", argument[0]);
printf("Example: %s tty01 You suck\n", argument[0]);
exit(1);
}
printf("OL (OneLiner) Version 2.0\n");
printf("originaly By Sir Hackalot, rewritten By R00T-dude \n");
bzero(temp, sizeof(temp));
strcat(temp, "/dev/");
strcat(temp, argument[1]);
if (argc == 2)
{
printf("\nYou forgot to Supply a ONE LINE MESSAGE\n");
printf("Enter one Here (keep the text less that 1024 chars please) :: ");
fgets(olm, sizeof(olm), stdin);
printf("enter the login name you want to use for the message (less that 25chars) :: ");
fgets(user, sizeof(user), stdin);
for(b=0; b <= sizeof(user); b++)
{
if(user[b] == '\n') /* taking off the nextline character !!! */
{
bzero(&user[b], 1) ;
}
}
printf("what tty do you want %s to appear on :: ", user);
fgets(tty, sizeof(tty), stdin);
for(c=0; c <= sizeof(tty); c++)
{
if(tty[c] == '\n') /* taking off the nextline character !!! */
{
bzero(&tty[c], 1) ;
}
}
printf("Sending to: [%s]\n",temp);
}
strm = fopen(temp,"a+");
if (strm == NULL) {
printf("Error writing to: %s\n",temp);
exit(2);
}
uname(&name);
if (argc == 2) {
fprintf(strm,"\nMessage from %s@%s on %s",user, name.nodename, tty);
fprintf(strm, " at ");
sprintf(tmp, "date +\%k:\%M");
stream = popen(tmp, "r"); /* ok, so this is slow, but I dunno the function to ask the time in c :( */
while(fgets(time, sizeof(time), stream) != NULL)
{
fprintf(strm, "%s", time);
}
pclose(stream);
fprintf(strm,"%s",olm);
fprintf(strm,"EOF");
fclose(strm);
printf("Message Sent.\n");
exit(0);
}
if (argc > 2) {
printf("enter the login name you want to use for the message (less that 25chars) :: ");
fgets(user, sizeof(user), stdin);
for(b=0; b <= sizeof(user); b++)
{
if(user[b] == '\n') /* taking off the nextline character !!! */
{
bzero(&user[b], 1) ;
}
}
printf("what tty do you want %s to appear on :: ", user);
fgets(tty, sizeof(tty), stdin);
for(c=0; c <= sizeof(tty); c++)
{
if(tty[c] == '\n') /* taking off the nextline character !!! */
{
bzero(&tty[c], 1) ;
}
}
printf("Sending to: [%s]\n",temp);
fprintf(strm,"\nMessage from %s@%s on %s",user, name.nodename, tty);
fprintf(strm, " at ");
sprintf(tmp, "date +\%k:\%M");
stream = popen(tmp, "r"); /* ok, so this is slow, but I dunno the function to ask the time in c :( */
while(fgets(time, sizeof(time), stream) != NULL)
{
fprintf(strm, "%s", time);
}
pclose(stream);
while (acnt <= argc - 1) {
fprintf(strm,"%s ",argument[acnt]);
acnt++;
}
fprintf(strm, "\nEOF");
fclose(strm);
printf("Message sent!\n");
exit(0);
}
}