• 158 | Chapter 5: Automated Exploits
  • Learning Kali Linux




    Download 22,59 Mb.
    Pdf ko'rish
    bet149/225
    Sana14.05.2024
    Hajmi22,59 Mb.
    #232856
    1   ...   145   146   147   148   149   150   151   152   ...   225
    Bog'liq
    learningkalilinux

    Starting with Metasploit
    While Kali comes with Metasploit installed, it isn’t fully configured. Metasploit uses a
    database behind the UI. This allows it to quickly locate the thousands of modules that
    come with the software. Additionally, the database will store results, including hosts
    that it knows about, vulnerabilities that may have been identified, as well as any loot
    that has been extracted from targeted and exploited hosts. While you can use Meta‐
    158 | Chapter 5: Automated Exploits


    sploit without the database configured and connected, it’s much better to use the
    database. Fortunately, configuring it is easy. All you need to do is run 
    msfdb init
    from
    the command line, and it will do the work of configuring the database with tables, as
    well as creating the database configuration file that 
    msfconsole
    will use. 
    shows the use of 
    msfdb init
    and the output showing what it does.
    Example 5-9. Initializing database for Metasploit
    root@yazpistachio:~# msfdb init
    Resetting password of database user 
    'msf'
    Creating databases 
    'msf'
    and 
    'msf_test'
    Creating configuration file in /usr/share/metasploit-framework/config/database.yml
    Creating initial database schema
    After the database is set up (and by default 
    msfdb
    will configure a PostgreSQL data‐
    base connection) you can use Metasploit. There used to be a couple of ways to use
    Metasploit. Currently, the way to get access to the Metasploit features is to run
    msfconsole
    . This Ruby script provides an interactive console. From this console, you
    issue commands to locate modules, load modules, query the database, and other fea‐
    msfconsole
    and checking the database connec‐
    tion using 
    db_status
    .
    Example 5-10. Starting msfconsole
    Code: 
    00
    00
    00
    00
    M3 T4 SP L0 1T FR 4M 3W OR K! V3 R5 I0 N4 
    00
    00
    00
    00
    Aiee, Killing Interrupt handler
    Kernel panic: Attempted to 
    kill 
    the idle task!
    In swapper task - not 
    syncing
    =[
    metasploit v4.16.31-dev
    ]
    + -- --
    =[
    1726
    exploits - 
    986
    auxiliary - 
    300
    post
    ]
    + -- --
    =[
    507
    payloads - 
    40
    encoders - 
    10
    nops
    ]
    + -- --
    =[
    Free Metasploit Pro trial: http://r-7.co/trymsp 
    ]
    msf > db_status
    [
    *
    ]
    postgresql connected to msf
    Once we have 
    msfconsole
    loaded, we can start using its functionality. Ultimately, we
    will be loading modules to use this functionality. The modules will do the work for
    us. All we need to do is to be able to find the right module, get it loaded and config‐
    ured, and then we can run it.

    Download 22,59 Mb.
    1   ...   145   146   147   148   149   150   151   152   ...   225




    Download 22,59 Mb.
    Pdf ko'rish