sqlmapproject / sqlmap

Automatic SQL injection and database takeover tool
http://sqlmap.org
Other
32.36k stars 5.7k forks source link

cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "libclntsh.so: cannot open shared object file: No such file or directory". See https://oracle.github.io/odpi/doc/installation.html#linux for help #3726

Closed anujanshu closed 5 years ago

anujanshu commented 5 years ago

I have written one python script to connect to oracle database using cx_Oracle.6.1. While running the script as stand alone with root logged in user, its is working fine. When I am using the same code in CGI script to connect to oracle database as apache:apache user its failing . and complainging that " 64-bit Oracle Client library cannot be loaded: "libclntsh.so: cannot open shared object file."

stamparm commented 5 years ago

This whole issue doesn't have anything to do with the sqlmap.

You should go to that same link (https://oracle.github.io/odpi/doc/installation.html#linux) and follow the instructions for Linux. You have to download that zip file (32-bit or 64-bit, depending on architecture) and extract those so files to appropriate places.

tgatev commented 4 years ago

I'm sorry but your instructions does not works, otherwise we will not ask this question.

[TERMINAL] $ node test-connect-oracle.js Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libnsl.so.1: cannot open shared object file: No such file or directory". See https://oracle.github.io/odpi/doc/installation.html#linux for help Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html You must have 64-bit Oracle client libraries in LD_LIBRARY_PATH, or configured with ldconfig. If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

[TERMINAL ]$ echo $LD_LIBRARY_PATH /usr/lib/oracle/19.6/client64/lib:

============================ To remember your instructions Oracle Instant Client RPM¶ To run ODPI-C applications with Oracle Instant Client RPMs:

Download an Oracle 19, 18, 12, or 11.2 “Basic” or “Basic Light” RPM: 64-bit or 32-bit, matching your application architecture.

Oracle’s yum server has Instant Client RPMs for Oracle Linux 7 and Instant Client RPMs for Oracle Linux 6 that can be downloaded without needing a click-through.

Install the downloaded RPM with sudo or as the root user. For example:

sudo yum install oracle-instantclient19.3-basic-19.3.0.0.0-1.x86_64.rpm Yum will automatically install required dependencies, such as libaio.

Oracle Linux users can alternatively automate download and installation. For example:

yum -y install oracle-release-el7 yum-config-manager --enable ol7_oracle_instantclient yum -y install oracle-instantclient19.3-basic For Instant Client 19 RPMs, the system library search path is automatically configured during installation.

For older versions, if there is no other Oracle software on the machine that will be impacted, permanently add Instant Client to the runtime link path. For example, with sudo or as the root user:

sudo sh -c "echo /usr/lib/oracle/18.5/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf" sudo ldconfig Alternatively, for version 18 and earlier, every shell will need to have the environment variable LD_LIBRARY_PATH set to the appropriate directory for the Instant Client version. For example:

export LD_LIBRARY_PATH=/usr/lib/oracle/18.5/client64/lib:$LD_LIBRARY_PATH If you intend to co-locate optional Oracle configuration files such as tnsnames.ora, sqlnet.ora or oraaccess.xml with Instant Client, then create a network/admin subdirectory under lib/, if it does not exist. For example:

sudo mkdir -p /usr/lib/oracle/12.2/client64/lib/network/admin This is the default Oracle configuration directory for applications linked with this Instant Client.

Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable TNS_ADMIN to that directory name.

vanelo commented 4 years ago

Any news here? I have the same problem

stamparm commented 4 years ago

Tried to setup the Oracle environment (from scratch - haven't had it installed on current machine) with all the provided information from above and haven't had any problems. If the information described here is too complicated, then I would suggest you to skip the sqlmap/cx_Oracle stuff altogether.

My machine is Ubuntu 20.04 (clean install instructions):

sudo su
mkdir -p /opt/oracle
cd /opt/oracle
wget https://download.oracle.com/otn_software/linux/instantclient/19800/instantclient-basic-linux.x64-19.8.0.0.0dbru.zip
unzip instantclient-basic-linux.x64-19.8.0.0.0dbru.zip
apt install libaio1
echo /opt/oracle/instantclient_19_8 > /etc/ld.so.conf.d/oracle-instantclient.conf
ldconfig
pip install cx_Oracle
exit

Results:

1

vanelo commented 4 years ago

Sorry, I already solved by setting my ORACLE_HOME and LD_LIBRARY_PATH environment variables