Nmap Development mailing list archives

RV: nmap-4.22SOC2 bug


From: "flacman" <flacman () gmail com>
Date: Sun, 7 Oct 2007 18:54:08 -0500

 

 

De: flacman [mailto:flacman () gmail com] 
Enviado el: viernes, 05 de octubre de 2007 02:26 p.m.
Para: 'fyodor () insecure org'
Asunto: nmap-4.22SOC2 bug

 

Hi Fyodor, first of all sorry about this report, I really don't have a time
for verifying it very well and sorry for this BAD solution I'll give you. 

Well, I'm using a laptop over wifi with a intel 3945ABG adapter and using
windows vista, and one day I run wireshark (without using airpcap) and it
works very well (actually most of the wireless adapters works with the new
winpcap, but they capture the packages as ethernet packages, not 802.11)
then I try that with nmap but it gives me an error on the adapter, so I
search in the source code the error and was launched in 

pcap_t *my_pcap_open_live(const char *device, int snaplen, int promisc, 

                    int to_ms)

 

first of all i try the -e option and it doesn't work (the same error) (I
really don't understand it very well, I use as parameter eth0,.,ethN and the
long windows names) so, jeje i erease all the body of my_pcap_open_live and
replaceit for a code wich list me all the adapters and let me choose one and
then return the pcap_t handler(see below), and IT WORKS! :D. Sorry jeje,
I've tried lots of times to read nmap code but I doesn't understand it well
jeje, but it would be cool if u could make a function (pasing it by
parameter) to list al the devices. Sorry again if this was allready fixed, I
use nmap a lot but only for simple scans and I don't know all it's
functionallity, I really searched but I don't find anything.

 

Greatings and congrats for that amasing tool,

 

Flacman

2Secure fundation

 

 

The pice off code I changged it's really mediocre!

 

pcap_t *my_pcap_open_live(const char *device, int snaplen, int promisc, 

                    int to_ms) 

{

  pcap_if_t *alldevs;

pcap_if_t *d;

int inum;

int i=0;

pcap_t *adhandle;

char errbuf[PCAP_ERRBUF_SIZE];

    if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) ==
-1)

    {

        fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf);

        exit(1);

    }

    

    /* Print the list */

    for(d=alldevs; d; d=d->next)

    {

        printf("%d. %s", ++i, d->name);

        if (d->description)

            printf(" (%s)\n", d->description);

        else

            printf(" (No description available)\n");

    }

    

    if(i==0)

    {

        printf("\nNo interfaces found! Make sure WinPcap is installed.\n");

    }

    

    printf("Enter the interface number (1-%d):",i);

    scanf("%d", &inum);

    

    if(inum < 1 || inum > i)

    {

        printf("\nInterface number out of range.\n");

        /* Free the device list */

        pcap_freealldevs(alldevs);

      return;

    }

    

    /* Jump to the selected adapter */

    for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++);

    

    /* Open the device */

    if ( (adhandle= pcap_open(d->name, 65536, PCAP_OPENFLAG_PROMISCUOUS,
900, NULL, errbuf))==NULL)

    {

       printf(stderr,"\nUnable to open the adapter. %s is not supported by
WinPcap\n", d->name);

return;

    }

    

return adhandle;

}

 


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: