dcsimg
execute NMAP command in java
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Angela_Stempfel
Posted On:   Friday, May 2, 2003 07:29 AM

Hi all i would like to execute a NMAP command from java. So i wrote the following method: public void execute(){ try { Runtime r = Runtime.getRuntime(); String command = new String("nmap -sU -p 161-162 "+this.network+" -oX /home/hippie/blaTEST.txt"); System.out.println("command: "+command); Process p = r.exec(command); System.out.println("executed nmap"); } catch (Exception ex) { System.out.println(ex); } } Now i have the problem that i have to be root user in linux to execute this command. So it doesn't work the way i implemented it Could someone expl   More>>

Hi all


i would like to execute a NMAP command from java. So i wrote the following method:


			
public void execute(){
try {
Runtime r = Runtime.getRuntime();

String command = new String("nmap -sU -p 161-162 "+this.network+" -oX /home/hippie/blaTEST.txt");
System.out.println("command: "+command);
Process p = r.exec(command);

System.out.println("executed nmap");
}
catch (Exception ex) {
System.out.println(ex);
}
}



Now i have the problem that i have to be root user in linux to execute this command. So it doesn't work the way i implemented it
Could someone explain me how i have to implement it?
I think the same problem could occur in Windows if i'm not Admin, is this right?



Thanks Angela    <<Less

Re: execute NMAP command in java

Posted By:   Christopher_Koenigsberg  
Posted On:   Friday, May 2, 2003 08:26 AM

Well, either you have to "su" to root on the command line, or else the program has to be chmod'ed so it is "setuid" and hence runs as root, itself.

About | Sitemap | Contact