This commit is contained in:
Pippo 2017-10-19 16:39:01 +02:00
parent 5772fd26b8
commit 95007efff2
2 changed files with 4 additions and 26 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
compila compila
ifdmp ifdmp
ifdmp.o ifdmp.o
ifdmp_orig.c

28
ifdmp.c Normal file → Executable file
View File

@ -5,7 +5,7 @@ File : ifdmp.c
Progetto : Progetto :
Inizio : xx.11.2004 Inizio : xx.11.2004
Fine : Fine :
Autore/i : Giorgio D.Plescan Autore/i : GioDim
Commento : Commento :
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*/ */
@ -163,7 +163,7 @@ int main (int ac, char ** av)
* AppName = "ifdmp", * AppName = "ifdmp",
* Credits = "LEP FreeSoft by GioDim", * Credits = "LEP FreeSoft by GioDim",
* Version = "ver 1.1", * Version = "ver 1.1",
if_device [20] = "eth1", if_device [20] = "eth0",
if_address [40], if_address [40],
buffer [2000]; buffer [2000];
int int
@ -191,12 +191,6 @@ int main (int ac, char ** av)
ifr; ifr;
struct packet_mreq struct packet_mreq
mr; mr;
//struct sock_filter
// total_insn = BPF_STMT(BPF_RET | BPF_K, 0),
// gio_insn[] = {BPF_STMT(BPF_RET+BPF_K, BPF_LEN)};
//struct sock_fprog
// total_fcode = { 1, &total_insn },
// gio_fcode = { 1, gio_insn };
if (ac > 1) if (ac > 1)
strcpy (if_device, av[1]); strcpy (if_device, av[1]);
@ -258,22 +252,6 @@ int main (int ac, char ** av)
sa_family = ifr.ifr_hwaddr.sa_family; sa_family = ifr.ifr_hwaddr.sa_family;
/* get if index */
memset (&ifr, 0x00, sizeof (ifr));
strncpy (ifr.ifr_name, if_device, sizeof (ifr.ifr_name));
if (ioctl (fdsock, SIOCGIFINDEX, &ifr) == -1)
{
fprintf (stderr, "%s - ioctl(SIOCGIFINDEX) : Errno=%1d\n", AppName, errno);
exit (-1);
}
if_index = ifr.ifr_ifindex;
/* bind if */ /* bind if */
memset (&sll, 0x00, sizeof (sll)); memset (&sll, 0x00, sizeof (sll));
@ -348,7 +326,7 @@ int main (int ac, char ** av)
/* capture loop */ /* capture loop */
printf ("%s - %s - %s : Listening on %s (%s)\n", AppName, Version, Credits, if_device, if_address); printf ("%s - %s - %s : Listening on %s (%s) Family=%1d\n", AppName, Version, Credits, if_device, if_address, sa_family);
memset (&in_set, 0x00, sizeof (in_set)); memset (&in_set, 0x00, sizeof (in_set));