Linux Console for Interactive Input Script

Hi there,

How do I enter command to the interactive console.

I was able to do it via the first line. What if I have more lines to input into the interactive console from line 3 onwards. Is there a more easier way?

(echo -e "load openvas" ; echo -e "openvas_help") | msfconsole

openvas_target_create "windows7" 192.168.0.13 "new_scan"
openvas_config_list
openvas_task_create windows7 new_scan 3 1
openvas_task_start 0
stty: standard input: Inappropriate ioctl for device

If I don't input command correctly from line 3 onwards, I will get error.

---------- Post updated 01-03-16 at 08:23 AM ---------- Previous update was 01-02-16 at 11:17 AM ----------

Hi Unix,

How can I suppress this error:

stty: standard input: Inappropriate ioctl for device

So far I have used

2> /dev/null

symbol to get things done.

You could try:

msfconsole<<EO_INPUT
load openvas
openvas_help
<your commands>
EO_INPUT

However, that would require you to know in advance what you are going to type in.

You might want to have a look at expect', i belive (but not sure) that is for such situations.

hth

EDIT:
Yes, to 'mute' errors, one would use: <cmd> 2>/dev/null

What does "correctly from line 3 onwards" mean? Please describe your problem in more detail.

Hi there,

I have created a file and name it test.sh

msfconsole<<EO_INPUT
load openvas
openvas_help
EO_INPUT

Do I proceed with this? sh test.sh 2> /dev/null

Depends what you're expecting it to do. If you want it to run those two commands and quit, sure.

If you want it to run those two commands, then start accepting input from terminal, that's a little more complicated.