Home page logo

nmap-dev logo Nmap Development mailing list archives

Nmap on Vista - maybe UAC?
From: majek04 <majek04+nmap-dev () gmail com>
Date: Fri, 11 Apr 2008 01:34:24 +0200

c:\nmap -sS nmap.org
dnet: Failed to open device eth4

As everybody knows, first run of nmap on Vista must be with
Administrator rights,
so that WinPcap driver gets loaded.

I thought it would be nice to get standard UAC window instead of that.

The code works like this:
  - if nmap can't open dnet interface (in tcpip.cc:eth_open_cached)
  - new instance of nmap is invoked using ShellExecute function
  - with parameter "runas" which should show the UAC dialog
  - new instance of nmap does nothing, except that it loads the WinPcap driver
  - we try to open the dnet interface once more (and it should succeed now)

This command is executed with Administrator priviledges when nmap
fails to open dnet interface:
nmap -sS -p80 -P0 -n -e <interface name, like eth4>
(nmap string is actually argv[0])

This command sucesfully loads WinPcap driver. I thought that it's
going to quickly fail, because
nmap can't scan localhost on windows. But it actually sends something,
which is not what
I intended.

Anyone has better idea for simplest nmap command that is going to load
winpcap drivers?

Can anyone tell me if this works for windows xp? (i mean when you run
nmap as normal user)

The code is here (uac code + fix for vs2008):

Oh, the project must be linked with shell32.lib.
I haven't updated the *sln or *vcproj files, so you must add this lib by hand.
(Alt+F7 -> configuration -> linker -> input -> additional
dependencies, add "shell32.lib" there)

Separate patches:
  vs2008 - http://ai.pjwstk.edu.pl/~majek/private/nmap/nmap-vs2008-2.diff
  uac    - http://ai.pjwstk.edu.pl/~majek/private/nmap/nmap-vista-uac.diff
  minor warnigs -

 Marek Majkowski

Sent through the nmap-dev mailing list
Archived at http://SecLists.Org

  By Date           By Thread  

Current thread:
  • Nmap on Vista - maybe UAC? majek04 (Apr 10)
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]