ether promisc

BENET benet na kgb.cz
Neděle Září 16 23:12:57 CEST 2001


Hmm, co zkusit si napsat vlastni aplikaci,ktera by pouze prevedla dane
zarizeni (sitovku) do promisc modu?
Neco jako funkce:

int Set_Promisc(char *interface, int sock ) {
      struct ifreq ifr;
      strncpy(ifr.ifr_name, interface,strnlen(interface)+1);
      if((ioctl(sock, SIOCGIFFLAGS, &ifr) == -1)) {
            /*Could not retrieve flags for the interface*/
              perror("Could not retrive flags for the interface");
              exit(0);
      }
      printf("The interface is ::: %s\n", interface);
      perror("Retrieved flags from interface successfully");

    /*now that the flags have been retrieved*/
    /* set the flags to PROMISC */
      ifr.ifr_flags |= IFF_PROMISC;
      if (ioctl (sock, SIOCSIFFLAGS, &ifr) == -1 ) {
            /*Could not set the flags on the interface */
              perror("Could not set the PROMISC flag:");
              exit(0);
      }
      printf("Setting interface ::: %s ::: to promisc", interface);

      return(0);
}
- to je sice okopirovany z jednoho navodu pro zacatecniky ke staveni
snifferu, nicmene, myslim, ze by to Vas problem vyresilo...
S pozdravem
BENET

> _Hodne_ maly. Staticky ifconfig... fuj... prilis objemne :(




Další informace o konferenci Linux