Getting list of hosts

S

Sard

I'm using the following to execute "nbtscan 192.168.0.1-255"
(http://www.inetcat.org/software/nbtscan.html)

String line;
Process aProcess = Runtime.getRuntime().exec(cmdline);
BufferedReader input = new BufferedReader(new
InputStreamReader(
aProcess.getInputStream()));
while ((line = input.readLine()) != null)
{
output.add(line);
}
input.close();

So I can pass the output. Unfortunately I get

java.io.IOException: CreateProcess: nbtscan.exe 192.168.0.1-255
error=53
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:429)
at java.lang.Runtime.exec(Runtime.java:326)

I am able to execute many other processes and capture their output but
not this one.

I'm using nbtscan as the InetAddress class is very unreliable as
reporting which ip addresses are reachable and it fails to
getHostName() a lot of the time too. Any help or a better was to get a
list of hosts would be great.
 
C

Chris Uppal

Sard said:
I'm using the following to execute "nbtscan 192.168.0.1-255"
(http://www.inetcat.org/software/nbtscan.html) [...]
I am able to execute many other processes and capture their output but
not this one.

Works OK for me, either using my own test code or yours. Perhaps there's
something wrong with the executable, or the cygwin.dll which it needs. You
could try re-"installing" it.

Alternatively, maybe something it is trying to do is interacting badly with a
virus checker (or similar) on your system.

Incidentally, I would be a bit reluctant to depend on external executables that
use Cygwin. It seems to work OK in this case, but you /might/ find it
worthwhile porting nbtscan to MSVC, or MinGW, to avoid potential problems.

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top