一直像写一个像Metasploit一样的框架,又帅气又好用,这次 终于鼓起冲动写了,初次写这样的框架,如果有什么错误请多多包涵!
目录如下:
I:\JB\框架
├─lib
│ └─__pycache__
└─plugin
├─auxiliary
└─exploit
kj.py 为主文件 lib目录下data.py和use_data.py 为参数设置文件(需要可自改) plugin 用于放插件
帮助:
.__
____ ___ ________ _____ ______ | | ____
_/ __ \ \/ /\__ \ / \____ \| | _/ __ \
\ ___/ > < / __ \| Y Y \ |_> > |_\ ___/
\___ >__/\_ \(____ /__|_| / __/|____/\___ >
\/ \/ \/ \/|__| \/
exploit:1 个
auxiliary:1 个
version:0.0.1
author:九世
github:https://github.com/422926799
kj > help
help 查看帮助
exec 执行系统命令
use 选择指定的模块
version 查看工具版本
search 搜索模块
exit 退出
选择了模块之后也有个帮助
.__
____ ___ ________ _____ ______ | | ____
_/ __ \ \/ /\__ \ / \____ \| | _/ __ \
\ ___/ > < / __ \| Y Y \ |_> > |_\ ___/
\___ >__/\_ \(____ /__|_| / __/|____/\___ >
\/ \/ \/ \/|__| \/
exploit:1 个
auxiliary:1 个
version:0.0.1
author:九世
github:https://github.com/422926799
kj > help
help 查看帮助
exec 执行系统命令
use 选择指定的模块
version 查看工具版本
search 搜索模块
exit 退出
kj > use auxiliary/port_scan
auxiliary/port_scan > helps
set 设置指定参数
unset 取消 指定参数
run 运行
info 获取模块详细介绍
show_options 模块要配置的参数
插件编写例子如下:
# @author:九世
# @time:2019/5/11
# @file:demo_exp.py
import sys
sys.dont_write_bytecode=True #加载脚本的时候不生成缓存文件
usage={} #用于存放参数说明
options={} #用于存放参数配置
options['RHOST']=''
options['RPORT']=''
usage['RHOST']='目标IP'
usage['RPORT']='目标端口'
def init(): #模块搜索时显示出的
jg={}
jg['name']='demo_exp'
jg['time']='2019/5/11'
jg['author']='jiushi'
jg['fun']='用来测试的啦'
return jg
def info(): #漏洞详细说明
print('漏洞详细说明:xxxxx,漏洞编号:CVE-xxxxx-xxxx')
def run(): #主函数
print('[+] 目标IP:{}\n [+] 目标端口:{}'.format(options['RHOST'],options['RPORT']))
一个端口扫描插件的例子:
# @author:九世
# @time:2019/5/11
# @file:port_scan.py
import gevent
from gevent import monkey;monkey.patch_all()
import sys
import socket
import re
from multiprocessing import Process
sys.dont_write_bytecode=True
usage={}
options={}
options['RHOST']=''
options['RPORT']=''
usage['RHOST']='目标IP'
usage['RPORT']='扫描端口范围,例如:1-65535'
def init():
jg={}
jg['name']='port_scan'
jg['time']='2019/5/11'
jg['author']='jiushi'
jg['fun']='端口扫描'
return jg
def info():
print('用于端口扫描')
def scan(host,port):
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.settimeout(3)
try:
s.connect((host,int(port)))
print('[+] 开放的端口:{}'.format(port))
except:
pass
def xc(rw):
rpg=[]
for u in rw:
rpg.append(gevent.spawn(scan,options['RHOST'],u))
gevent.joinall(rpg)
def run():
tg=[]
calc=0
port_fan=re.findall('[1-9]\d*',options['RPORT'])
print('[&] 目标IP:{}'.format(options['RHOST']))
for p in range(int(port_fan[0]),int(port_fan[1])):
if calc==5000:
p=Process(target=xc,args=(tg,))
p.start()
calc=0
tg.clear()
calc += 1
tg.append(p)
if len(tg)>0:
p = Process(target=xc, args=(tg,))
p.start()
p.join()
注意:在程序没有结束之前,请阻塞程序,否则将返回到kj.py
.__
____ ___ ________ _____ ______ | | ____
_/ __ \ \/ /\__ \ / \____ \| | _/ __ \
\ ___/ > < / __ \| Y Y \ |_> > |_\ ___/
\___ >__/\_ \(____ /__|_| / __/|____/\___ >
\/ \/ \/ \/|__| \/
exploit:1 个
auxiliary:1 个
version:0.0.1
author:九世
github:https://github.com/422926799
kj > help
help 查看帮助
exec 执行系统命令
use 选择指定的模块
version 查看工具版本
search 搜索模块
exit 退出
kj > version
版本:v 0.0.1
kj > search portscan
kj > search port
auxiliary/port_scan author:jiushi function:端口扫描 time:2019/5/11
kj > use auxiliary/port_scan
auxiliary/port_scan > show_options
RHOST 目标IP
RPORT 扫描端口范围,例如:1-65535
auxiliary/port_scan > set RHOST 127.0.0.1
RHOST=>127.0.0.1
auxiliary/port_scan > set RPORT 1-1000
RPORT=>1-1000
auxiliary/port_scan > show_options
RHOST 127.0.0.1 目标IP
RPORT 1-1000 扫描端口范围,例如:1-65535
auxiliary/port_scan > run
[&] 目标IP:127.0.0.1
[+] 开放的端口:443
[+] 开放的端口:902
[+] 开放的端口:912
[+] 开放的端口:139
[+] 开放的端口:135
auxiliary/port_scan > unset RHOST
RHOST=>NULL
auxiliary/port_scan > show_options
RHOST 目标IP
RPORT 1-1000 扫描端口范围,例如:1-65535
auxiliary/port_scan > back
kj > exit
[*] 正在退出