Nmap Development mailing list archives
Re: Help required:to execute nmap.exe from java app
From: Darren VanBuren <admin () theoks net>
Date: Wed, 7 Sep 2011 18:35:04 -0700
Sorry, didn't CC the list. First of all, you would have to escape the backslashes. Second of all, if I remember correctly, all IO in Java, regardless of operating system, is with forward slashes. Darren VanBuren ================== http://theoks.net/ 2011/9/7 guoxing.guo <guoxing.guo () wdk-networks com>:
Hi,all I was trying to execute nmap.exe from my java app(JDK1.6+WinXP). But it seems never return. Code following: Process process = Runtime.getRuntime().exec("E:\workspace2\NM_Server\3rdparty\nmap\windows/nmap -O 172.16.164.64"); process.waitFor(); byte[] buffer = new byte[256]; int cnt = 0; InputStream is = process.getInputStream(); StringBuffer sb = new StringBuffer(); while((cnt=is.read(buffer))>-0){ sb.append(new String(buffer,0,cnt)); } is.close(); return sb.toString(); //Not work. It can show the expected infomation when I execute "E:\workspace2\NM_Server\3rdparty\nmap\windows/nmap -O 172.16.164.64" in a command line window. Someone in stackoverflow.com says it maybe lost the PATH env . Actually it works after I set PATH='' in the CMD window. I found a related thread on http://seclists.org/nmap-dev/2008/q2/498 . But it seems have not been solved. Any idea to out of this or workaround it will be appreciated. Regards Simon KWOK(郭国兴) _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Help required:to execute nmap.exe from java app guoxing . guo (Sep 07)
- Message not available
- Re: Help required:to execute nmap.exe from java app Darren VanBuren (Sep 07)
- Message not available
- Re: Re: Help required:to execute nmap.exe from java app guoxing . guo (Sep 07)
- <Possible follow-ups>
- Re: Help required:to execute nmap.exe from java app guoxing . guo (Sep 07)