zoukankan      html  css  js  c++  java
  • 基于msfrpcd服务编写python的自动测试框架

    msprpc 服务:  metasploit 提供的rpc调用接口 

    参考 https://docs.rapid7.com/metasploit/rpc-api/

    启动服务 

    在msfrpcd目录下运行

    ./msfrpcd -U username -P passwd      
    或者 运行msfconsole 在内部控制台 运行
    msf5 > load msgrpc ServerHost=0.0.0.0 ServerPort=55553  -U username  -P passwd 
    各个参数含义
    -P <opt> - The password to access msfrpcd.
    -S - Enables or disables SSL on the RPC socket. Set this value to true or false. SSL is on by default. 默认是有ssl的
    -U <opt> - The username to access msfrpcd.
    -a <opt> - The address msfrpcd runs on.
    -p <opt> - The port the msfrpc listens on. The default port is 55553.

    python 链接msf使用第三方库pymetasploit3

    msfclient=MsfRpcClient(host, username,port,ssl)

    使用这个库碰到的问题

    1. 使用pip 安装库后一直连接不成功 ,原因 内部依赖包 msgpack,该包没有被依赖安装 导致一直编码不成功,手动安装后成功

    2. 运行任务设置参数不能成功,比如需要设置payload的参数,会返回没有这个参数的错误 ,解决方案:

    直接调用call函数 如

    msfclient.call('module.execute', [jobtype, jobname, joboption])
     msfclient.call('module.execute', ['exploit', 'multi/handler', {
                'LHOST': '0.0.0.0',
                'LPORT': 4444,
                'PAYLOAD': 'linux/x86/meterpreter/reverse_tcp'
            }])

  • 相关阅读:
    取消chrome(谷歌浏览器)浏览器下最小字体限制
    函数声明方式及作为值的函数
    常用的正则表达式
    8腾讯云服务器账号密码
    errno -4058 and npm WARN enoent ENOENT 解决方案
    node gyp的问题
    npm 版本问题
    无缘无故出现npm 解析异常的的问题 解决方案
    idea注册码
    以太坊测试网络 账号密码
  • 原文地址:https://www.cnblogs.com/skycandy/p/14367670.html
Copyright © 2011-2022 走看看