root@kali:/# service postgresql start 开启postgresql数据库服务 root@kali:/# msfdb init 如果你的msf无法成功连接数据库可以尝试使用初始化命令 A database appears to be already configured, skipping initialization 由于我已经创建好了数据所以这里不会继续执行初始化进程 root@kali:/# msfconsole
db_status 查看msf的数据库连接状态 msf > db_status [*] postgresql connected to msf
db_connect 用于连接数据库,此时直接运行提示你已经连接了一个数据库 msf > db_connect [-] postgresql already connected to msf [-] Run db_disconnect first if you wish to connect to a different database
hosts查看数据库是否可以正常使用,可以看到之前所扫描过的IP地址相关信息 msf > hosts Hosts ===== address mac name os_name os_flavor os_sp purpose info comments ------- --- ---- ------- --------- ----- ------- ---- -------- 192.168.3.1 8c:ab:8e:fa:10:a1 Unknown device 192.168.3.20 68:db:ca:a9:ce:63 192.168.3.24 b8:44:d9:d0:04:08 192.168.3.85 40:4e:36:5f:9a:dd 192.168.3.86 192.168.3.88 80:e6:50:15:c2:60 192.168.3.96 14:2d:27:2b:1c:e9 192.168.3.111 74:c6:3b:9c:00:65 laptop-v63uitph Unknown device 192.168.3.133 5c:ad:cf:86:87:b1 192.168.3.140 00:cd:fe:33:16:02 192.168.3.142 20:ab:37:62:9f:18 192.168.3.144 70:ec:e4:d4:e9:d2 192.168.3.168 9c:b6:d0:12:75:27 192.168.3.172 38:bc:1a:24:ac:87 192.168.3.176 04:52:f3:13:38:71 192.168.3.186 e4:f8:9c:e7:58:b0 192.168.3.191 68:db:ca:74:57:b9 192.168.3.199 b8:27:eb:a9:1c:84 Linux 8.0 server 192.168.3.211 c8:f2:30:9e:93:83
msf > db_disconnect 断开与当前数据库的连接 msf > db_status [*] postgresql selected, no connection 可以再查看一下连接状态发现已经断开连接了。 msf > db_connect 再次使用db_connect命令会提示你正确的连接数据命令的书写格式例子。 [*] Usage: db_connect <user:pass>@<host:port>/<database> [*] OR: db_connect -y [path/to/database.yml] [*] Examples: [*] db_connect user@metasploit3 [*] db_connect user:pass@192.168.0.2/metasploit3 [*] db_connect user:pass@192.168.0.2:1500/metasploit3 msf > db_connect msf3:msf@localhost/msf3 我们按照例子连接到了本机的另外一个数据库上 [*] Rebuilding the module cache in the background... msf > hosts 可以发现我们的这个数据里面的内容和之前的数据还是有所不同的。 Hosts ===== address mac name os_name os_flavor os_sp purpose info comments ------- --- ---- ------- --------- ----- ------- ---- -------- 192.168.3.76 DESKTOP-09VA532 Windows 10 Pro client 192.168.3.88 DESKTOP-41OPH1D Windows 10 Pro client 192.168.3.168 W Windows 10 Enterprise client 192.168.3.172 Unknown device
MSF魔鬼训练营-3.5.3 MSF中常用的关于数据库的命令
标签:back bsp inux 获取 dev ping info connected 相关