[历史归档]本文原发布于 cstriker1407.info 个人博客,内容为历史存档,仅供参考。
发布时间:2014-06-05| 标题:某《魔鬼训练营》读书笔记:metasploit自定义模块的编写|分类:操作系统 / 安全 |标签:metasploit·ruby·自定义模块
某《魔鬼训练营》读书笔记:metasploit自定义模块的编写
!!!笔记仅供学习交流使用,请勿进行其他用途!!!
首先看下已有模块的位置:
root@kali:/usr/share/metasploit-framework/modules# pwd/usr/share/metasploit-framework/modules root@kali:/usr/share/metasploit-framework/modules# lsauxiliary encoders exploits nops payloads post这里我们在auxiliary目录下新建一个文件夹,名称为cstriker1407,里面新建一个rb文件,名称为【 cstriker1407_hello.rb 】,如下:
root@kali:/usr/share/metasploit-framework/modules/auxiliary/cstriker1407# pwd/usr/share/metasploit-framework/modules/auxiliary/cstriker1407 root@kali:/usr/share/metasploit-framework/modules/auxiliary/cstriker1407# lscstriker1407_hello.rbcstriker1407_hello.rb的内容为:
### This module requires Metasploit: http//metasploit.com/download# Current source: https://github.com/rapid7/metasploit-framework##require'msf/core'classMetasploit3<Msf::AuxiliaryincludeMsf::Auxiliary::Reportdefinitializesuper('Name'=>'cstriker1407 hello module','Description'=>'A demo module to learn metasploit modules.','References'=>[['URL','http://116.62.110.235/blog'],],'Author'=>['cstriker1407'],'License'=>MSF_LICENSE)enddefrunprint_status("Hello Metasploit Modules")endend文件建立好之后,重新启动下Metasploit,然后就可以使用了,如下:
msf>search cstriker1407#搜索这个模块Matching Modules================Name Disclosure Date Rank Description ---- --------------- ---- ----------- auxiliary/cstriker1407/cstriker1407_hello normal cstriker1407 hello module msf>use auxiliary/cstriker1407/cstriker1407_hello msf auxiliary(cstriker1407_hello)>info Name: cstriker1407 hello module Module: auxiliary/cstriker1407/cstriker1407_hello License: Metasploit Framework License(BSD)Rank: Normal Provided by: cstriker1407 Description: A demo module to learn metasploit modules. References: http://116.62.110.235/blog msf auxiliary(cstriker1407_hello)>show options Module options(auxiliary/cstriker1407/cstriker1407_hello): Name Current Setting Required Description ---- --------------- -------- ----------- msf auxiliary(cstriker1407_hello)>exploit[*]Hello Metasploit Modules#执行了run方法[*]Auxiliary module execution completed msf auxiliary(cstriker1407_hello)>