Using Process to triger Metasplot MSFCLI command in java applications

raneez

New Member
I am trying to build application that will automate Some of my Metasploit command for example the follwing basic command ./msfcli windows/smb/ms08_067_netapt.Should be able to preform on Terminal when i pass this command as a string into java application.when ido that all what i get is either the Terminal hangs or it will produce a message Program Terminates. could some one help me to solve this problem as i am trying to build an agent that will preform penetration testing automatically.Note the command given is just a sample i should be able to run other commands as well. The code that i use is as follows:\[code\] import java.io.*; import java.util.*; public class CmdProcessBuilder { public static void main(String args[]) throws InterruptedException,IOException {List<String> command = new ArrayList<String>();command.add(args[0]);ProcessBuilder builder = new ProcessBuilder(command);Map<String, String> environ = builder.environment();final Process process = builder.start();InputStream is = process.getInputStream();InputStreamReader isr = new InputStreamReader(is);BufferedReader br = new BufferedReader(isr);String line;while ((line = br.readLine()) != null) { System.out.println(line);} System.out.println("Program terminated!");\[/code\]}}
 
Back
Top