Results 1 to 4 of 4

Thread: Metasploit & Oracle (ruby-oci8) not working together

  1. #1
    Join Date
    2015-May
    Posts
    2

    Metasploit & Oracle (ruby-oci8) not working together

    Hello Kali-Community,

    After searching the web for a couple of days and following half a dozend different instructions without success, I'm hoping that you can help me to get metasploit working with oracle instant client.

    Current Situation:
    Code:
    msf > use auxiliary/admin/oracle/oracle_login
    msf auxiliary(oracle_login) > set rhost 127.0.0.1
    rhost => 127.0.0.1
    msf auxiliary(oracle_login) > run
    
    [-] Failed to load the OCI library: cannot load such file -- oci8
    [-] Try 'gem install ruby-oci8'[*] Auxiliary module execution completed
    When I run the 'gem install ruby-oci8' I get the following:
    Code:
    msf auxiliary(oracle_login) > gem install ruby-oci8[*] exec: gem install ruby-oci8
    
    Building native extensions.  This could take a while...
    ERROR:  Error installing ruby-oci8:
            ERROR: Failed to build gem native extension.
    
        /opt/metasploit/ruby/bin/ruby extconf.rb
    checking for load library path...
      LD_LIBRARY_PATH...
        checking /opt/metasploit/ruby/lib... no
        checking /opt/oracle/instantclient_12_1... yes
      /opt/oracle/instantclient_12_1/libclntsh.so.12.1 looks like an instant client.
    checking for cc... *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary
    libraries and/or headers.  Check the mkmf.log file for more details.  You may
    need configuration options.
    
    Provided configuration options:
            --with-opt-dir
            --without-opt-dir
            --with-opt-include
            --without-opt-include=${opt-dir}/include
            --with-opt-lib
            --without-opt-lib=${opt-dir}/lib
            --with-make-prog
            --without-make-prog
            --srcdir=.
            --curdir
            --ruby=/opt/metasploit/ruby/bin/ruby
            --with-instant-client
            --without-instant-client
    /opt/metasploit/ruby/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': RuntimeError (RuntimeError)
            from /opt/metasploit/ruby/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
            from /opt/metasploit/ruby/lib/ruby/2.1.0/mkmf.rb:834:in `try_run'
            from /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:566:in `check_cc'
            from /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:556:in `init'
            from /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:933:in `initialize'
            from /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:318:in `new'
            from /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:318:in `get'
            from extconf.rb:18:in `<main>'
    ---------------------------------------------------
    Error Message:
      The compiler failed to generate an executable file.
      You have to install development tools first.
    
    Backtrace:
      /opt/metasploit/ruby/lib/ruby/2.1.0/mkmf.rb:456:in `try_do'
      /opt/metasploit/ruby/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
      /opt/metasploit/ruby/lib/ruby/2.1.0/mkmf.rb:834:in `try_run'
      /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:566:in `check_cc'
      /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:556:in `init'
      /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:933:in `initialize'
      /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:318:in `new'
      /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8/ext/oci8/oraconf.rb:318:in `get'
      extconf.rb:18:in `<main>'
    ---------------------------------------------------
    See:
     * http://rubydoc.info/gems/ruby-oci8/file/docs/install-full-client.md for Oracle full client
     * http://rubydoc.info/gems/ruby-oci8/file/docs/install-instant-client.md for Oracle instant client
     * http://ruby-oci8.rubyforge.org/en/file.report-installation-issue.html to report an issue.
    
    
    extconf failed, exit code 1
    
    Gem files will remain installed in /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.8 for inspection.
    Results logged to /opt/metasploit/apps/pro/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/ruby-oci8-2.1.8/gem_make.out
    And that's basically where I'm stuck.

    As you can see, I extracted the latest instantclient files from Oracle (basic-linux / sdk / sqlplus in version 12.1.0.2) togehter with ruby-oci8-2.1.8.tar.gz to /opt/oracle/instantclient_12_1.

    LD_LIBRARY_PATH, TNS_ADMIN, SQLPATH, ORACLE_HOME are set and PAHT has been extended to /opt/oracle/instantclient_12_1.

    Many thanks in advance!

    Any ideas would be highly welcome!

  2. #2
    In short - its not easy.

    Kali 1.x is based on Debian 7, which uses Ruby 1.9.x
    Kali 2.x will be based on Debian 8, which uses Ruby 2.x

    Metasploit v4.10+ (I think) made the switch to ruby 2.x.
    To make sure metasploit will work with Kali - they have added in a 'custom environment/wrapper' of sorts to use their own version of ruby (v2), rather than the OSs (v1.9).

    Edit:
    Solution: https://github.com/rapid7/metasploit...ith-Kali-Linux
    Last edited by g0tmi1k; 2015-06-02 at 07:55.
    This is a Kali-Linux support forum - not general IT/infosec help.

    Useful Commands: OS, Networking, Hardware, Wi-Fi
    Troubleshooting: Kali-Linux Installation, Repository, Wi-Fi Cards (Official Docs)
    Hardware: Recommended 802.11 Wireless Cards

    Documentation: http://docs.kali.org/ (Offline PDF version)
    Bugs Reporting & Tool Requests: https://bugs.kali.org/
    Kali Tool List, Versions & Man Pages: https://tools.kali.org/

  3. #3
    Join Date
    2015-May
    Posts
    2
    Many thanks g0tmi1k!

    Your solution works great!

  4. #4
    Join Date
    2016-May
    Posts
    1

    Hangs?

    Quote Originally Posted by g0tmi1k View Post
    In short - its not easy.

    Kali 1.x is based on Debian 7, which uses Ruby 1.9.x
    Kali 2.x will be based on Debian 8, which uses Ruby 2.x

    Metasploit v4.10+ (I think) made the switch to ruby 2.x.
    To make sure metasploit will work with Kali - they have added in a 'custom environment/wrapper' of sorts to use their own version of ruby (v2), rather than the OSs (v1.9).

    Edit:
    Solution: https://github.com/rapid7/metasploit...ith-Kali-Linux
    I trekked through this solution and unfortunately, I no longer receive an error, but modules just hang indefinitely. I tried running auxiliary/admin/oracle/oracle_login and while it no longer throws an error, it just hangs after saying, "Starting brute force on <IP>...

    Has anyone else run into this and solved it?

Similar Threads

  1. cant load ruby modules in metasploit
    By cryptoacid in forum TroubleShooting Archive
    Replies: 0
    Last Post: 2020-02-29, 22:20
  2. Kali 1.10 - Ruby 2.1.5, Metasploit needed for SET to work.
    By LinuxDad in forum General Archive
    Replies: 2
    Last Post: 2015-03-24, 12:43
  3. Missing Ruby Gem breaks Metasploit Framework?
    By factgasm in forum TroubleShooting Archive
    Replies: 1
    Last Post: 2014-08-01, 11:09
  4. Metasploit Ruby Error?
    By Radesh in forum General Archive
    Replies: 1
    Last Post: 2014-07-15, 07:51

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •