forked from rapid7/metasploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 3
使用 Oracle
L edited this page May 23, 2022
·
1 revision
建议使用 InstantClient 10 以允许你与 8、9、10 和 11 服务器版本通话.
转至 https://www.oracle.com/database/technologies/instant-client/downloads.html 并选择与你的 UNIX PC 架构相对应的链接. Linux x64 示例, 使用 Instant Client for Linux x86-64 链接, 该链接应将你带到 https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
获取这些:
- Instant Client Package - Basic
- Instant Client Package - SDK (开发)
- Instant Client Package - SQL*Plus (Metasploit 不需要, 但很有用)
unzip into /opt/oracle
cd /opt/oracle
unzip /opt/oracle/oracle-instantclient-basic-10.2.0.4-1.i386.zip
unzip /opt/oracle/oracle-instantclient-sqlplus-10.2.0.4-1.i386.zip
unzip /opt/oracle/oracle-instantclient-devel-10.2.0.4-1.i386.zip
现在设置一个符号链接, 以便 gem 安装可以找到正确的库:
ln -s libclntsh.so.10.1 libclntsh.so
你可以创建 .sh 文件以在需要时进行适当的更改, 也可以将其添加到 .bashrc
export PATH=$PATH:/opt/oracle/instantclient_10_2
export SQLPATH=/opt/oracle/instantclient_10_2
export TNS_ADMIN=/opt/oracle/instantclient_10_2
export LD_LIBRARY_PATH=/opt/oracle/instantclient_10_2
export ORACLE_HOME=/opt/oracle/instantclient_10_2
如果你使用的是 Kali Linux, 则需要执行几个额外的步骤才能正确构建 Oracle 客户端 gem. 首先, 将路径设置为首选正确版本的 ruby, 以便 Metasploit 可以使用它:
root@kali:~/ruby-oci8-ruby-oci8-2.1.8# export PATH=/opt/metasploit/ruby/bin:$PATH
接下来, 安装 libgmp (构建 gem 所需)
root@kali:~/ruby-oci8-ruby-oci8-2.1.8# apt-get install libgmp-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
libgmp10-doc libmpfr-dev
The following NEW packages will be installed:
libgmp-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/610 kB of archives.
After this operation, 1,740 kB of additional disk space will be used.
Selecting previously unselected package libgmp-dev:amd64.
(Reading database ... 322643 files and directories currently installed.)
Unpacking libgmp-dev:amd64 (from .../libgmp-dev_2%3a5.0.5+dfsg-2_amd64.deb) ...
Setting up libgmp-dev:amd64 (2:5.0.5+dfsg-2) ...
回到你的 Metasploit 目录, 将 Gemfile.local.example
复制到 Gemfile.local
, 然后将以下行添加到 :local
组
gem 'ruby-oci8'
然后更新 gem:
bundle --gemfile Gemfile.local