• Deepin Linux下的Metasploit安装及优化


    前言

    本文不限于Deepin Linux系统,类似的在ubuntu debian xubuntu等血统类似的Linux发行版中都可以使用这里方法来安装原生的metasploit

    配置Kali Linux官方源

    Kali 官方源
    这个源是我在Kali 2016.2中提取的原生源,速度很快,会根据具体的网络情况自动去选择最近的更新源服务器进行更新的。

    deb http://http.kali.org/kali kali-rolling main contrib non-free
    deb-src http://http.kali.org/kali kali-rolling main contrib non-free
    

    把kali的源添加到 Deepin 自带的源后面

    # vim /etc/apt/sources.list
    ## GGenerated by deepin-installer-reborn
    deb [by-hash=force] http://ackages.deepin.com/deepin unstable main contrib non-free
    #deb-src http://packages.deepin.com/deepin unstable main contrib non-free
    #Kali Linux2016.2
    deb http://http.kali.org/kali kali-rolling main contrib non-free
    deb-src http://http.kali.org/kali kali-rolling main contrib non-free
    

    如下图
    sourlist

    更新源

    apt-get update
    

    大概3分钟左右可以更新完,然后就可以像Kali Linux一样,任意安装所需要的工具了。 举个例子
    安装sqlmap

    apt-get install sqlmap
    

    就是这种格式apt-get install 软件名
    强迫症患者可以把Kali Linux下的工具全部搬到 Deepin上面,使用如下命令,安装Kali的全部工具

    apt-get install kali-linux-all
    

    linux
    然而我看到了要下载这么大的文件~! 当时就放弃这个想法了,真不清楚Demon他下载了多长时间~~ 细思恐极

    安装 Metasploit

    metasploit神器级别的工具,怎么错过。
    Deepin Linux安装metasploit很简单,一条命令即可

    apt-get install metasploit-framework
    

    配置postgresql 数据库

    先切换到root用户,然后再切换到postgresql,然后就进入了数据库管理了

    gg@gg-PC:~$ su  
    密码:
    root@gg-PC:/home/gg# su postgres
    postgres@gg-PC:/home/gg$
    

    然后创建metasploit的数据库和用户

    createuser msf -P -S -R -D  #创建用户 会提示输入密码 
    
    createdb -O msf msf        #创建数据库  
    

    配置metasploit数据库的连接

    在metasploit的安装目录下新建database.yml文件,内容如下

    production:  
       adapter: postgresql  
       database: msf  
       username: msf  
       password: gg   #我在上一步创建用户的时候  设置的密码
       host: 127.0.0.1  
       port: 5432  
       pool: 75  
       timeout: 5
    

    然后在msfconsole下手动连接数据库

    msf > db_connect -y /usr/share/metasploit-framework/databa查看数据库连接状态
    ```r
    msf > db_status
    [*] postgresql connected to msf
    

    解决metasploi搜索缓慢, 调用数据库缓存 实现秒搜索

    Deepin Linux安装完metasploit后,例行公事 搜索下经典的08-067漏洞攻击模块

    msf > search 08-067
    [!] Module database cache not built yet, using slow search
    
    Matching Modules
    ================
    
       Name                                 Disclosure Date  Rank   Description
       ----                                 ---------------  ----   -----------
       exploit/windows/smb/ms08_067_netapi  2008-10-28       great  MS08-067 Microsoft Server Service Relative Path Stack Corruption
    
    
    msf > exit
    

    可以发现第1行就出现了警告:[!] Module database cache not built yet, using slow search
    大意是没有调用缓存模块,只能使用慢速搜索了~~ ,这怎么能忍?Google查了下资料,解决方法是重启postgresql和重建metasploit缓存

    重启postgresql

    # etc/init.d/postgresql restart
    

    重新进msf 并重建缓存

    gg@gg-PC:/usr/share/metasploit-framework$ msfconsole
    
     _                                                    _
    /     /         __                         _   __  /_/ __
    | |  / | _____               ___   _____ | | /   _    
    | | /| | | ___ |- -|   /    / __ | -__/ | || | || | |- -|
    |_|   | | | _|__  | |_  / - __    | |    | | \__/| |  | |_
          |/  |____/  \___/ / \___/   /     \__|    |_  \___
    
    
    Validate lots of vulnerabilities to demonstrate exposure
    with Metasploit Pro -- Learn more on http://rapid7.com/metasploit
    
           =[ metasploit v4.14.2-dev                          ]
    + -- --=[ 1631 exploits - 932 auxiliary - 282 post        ]
    + -- --=[ 472 payloads - 40 encoders - 9 nops             ]
    + -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
    

    重建缓存

    msf > db_rebuild_cache
    [*] Purging and rebuilding the module cache in the background...
    

    查看metasploit数据库状态

    msf > db_status
    [*] postgresql selected, no connection
    

    手动连接数据库

    msf > db_connect -y /usr/share/metasploit-framework/database.yml
    [*] Rebuilding the module cache in the background...
    

    再次检验数据库

    msf > db_status
    [*] postgresql connected to msf
    

    然后再次搜索就会发现 搜索速度瞬间上来了
    没有再报错 数据库缓存没有建立 的错误了

    metasploit秒搜效果

  • 相关阅读:
    在esx上 docker的网络桥接
    docker 配置桥接网络
    docker 配置桥接网络
    perl 创建包
    perl 创建包
    perl 一个简单的面向对象的例子
    perl 一个简单的面向对象的例子
    perl 对象 bless 引用
    【技术角度看问题之一】ARM到底是个啥?
    【nodejs原理&源码赏析(3)】欣赏手术级的原型链加工艺术
  • 原文地址:https://www.cnblogs.com/sqlsec/p/linuxmsf.html
Copyright © 2020-2023  润新知