I'm writing a script to automate metasploit now my script works fine till the commands i need to run on the terminal but when i try to run the commands which i have to execute inside the metasploit console the script stops until i manually exit the console, and then it will resume from the next line.when you run metasploit it opens a console (msfconsole) inside the terminal where you can run your commands.how can i add specific commands in my script to run inside the console??
Writing a script to run commands inside a console
linux;shell script;scripting;metasploit
Scripts, in general, will run a command and wait for it to execute.  Only once the process launched by the command finishes will your script move on to the next command.metasploit can be used in interactive mode, and that seems to be what you're trying to do.  That means the msfconsole is the process that's created and so the script won't continue until that process terminates.You could look at using something like expect to interact with a program that expects input while it's running.  Alternately, many things you want to do in metasploit can be done without an interactive session so you could try to find those sets of commands and use them instead.