Skip to content

s0m30ne/pymsf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

==============================
|--\ \  / |\  /|  /----  |----
|--/  \/  | \/ |  |---\  |----
|     ||  |    |  ____|  |
==============================
               made by s0m30ne
------------------------------

Usage: python msf_python.py [options] 

Options:  
    -h, --help            show this help message and exit  
    -n, --normal          normal mode  
    -s SEARCH, --search=SEARCH  
                          chose a search engine, for example: censys, zoomeye or shodan  
    -f FILE_NAME, --file=FILE_NAME  
                          the poc file you want to run  
    -t THREAD_NUM, --threads=THREAD_NUM  
                          set the thread num

##准备工作: (1)安装Python的msgpack类库,MSF官方文档中的数据序列化标准就是参照msgpack。

root@kali:~# apt-get install python-setuptools
root@kali:~# easy_install msgpack-python

(2)创建createdb_sql.txt:

create database msf;
create user msf with password 'msf123';
grant all privileges on database msf to msf;

(3)在PostgreSQL 执行上述文件:

root@kali:~# /etc/init.d/postgresql start
root@kali:~# sudo -u postgres /usr/bin/psql < createdb_sql.txt

(4)创建setup.rc文件

db_connect msf:msf123@127.0.0.1/msf
load msgrpc User=msf Pass='abc123'

(5)启动MSF并执行载入文件

root@kali:~# msfconsole -r setup.rc
*SNIP*
[*] Processing setup.rc for ERB directives.
resource (setup.rc)> db_connect msf:msf123@127.0.0.1/msf
[*] Rebuilding the module cache in the background...
resource (setup.rc)> load msgrpc User=msf Pass='abc123'
[*] MSGRPC Service: 127.0.0.1:55552
[*] MSGRPC Username: msf
[*] MSGRPC Password: abc123
[*] Successfully loaded plugin: msgrpc

(6)安装msfrpc

root@kali:~# git clone git://github.com/SpiderLabs/msfrpc.git msfrpc
root@kali:~# cd msfrpc/python-msfrpc
root@kali:~# python setup.py install

(7)在config.txt中配置你的token信息

后面每次使用时都需要先使用msfconsole -r setup.rc启动msf

##使用方法 使用python msf_python.py -n或者直接使用python msf_python.py进入普通模式,使用python msf_python.py -s [censys,shodan,zoomeye]选择相应的搜索引擎,默认选择的是censys

启动脚本后的使用方式和msf基本相同,支持msf的所有命令,不同之处在于你没必要设置RHOST或者RHOSTS,后面的扫描过程中程序会自己进行设置。额外需要你设置的是QUERYPAGE选项,QUERY是你选择的搜索引擎下的搜索条件,PAGE则是你想要搜索的页数(默认为10)。

通过python msf_python.py -c COMMAND命令用户可以使用自定义的命令,比如执行python、ruby等poc文件或者ping等系统命令,但是注意命令中通过%s留出IP接口,比如你可以通过下面的形式执行特定的poc文件:python msf_python.py -c "python poc.py %s"

通过-c参数指定要执行的命令后,设置好QUERYPAGE参数就可以通过exploit命令执行了。

你可以通过-t参数指定线程数。

Releases

No releases published

Packages

No packages published

Languages