skip to Main Content

I cloned this tool sqlmap from GitHub in my debian 12 terminal using sudo apt.

with following steps

  1. git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev

there after a folder created in my home directory. I can see it in graphical user interface. thereafter I cd/ sqlmap-dev in terminal. when I was trying to run sqlmap commands it throwing me bash: python command not found. I’m providing below code please look into these issue.

david@debian:~$ cd sqlmap-dev
david@debian:~/sqlmap-dev$ python sqlmap.py -u "https://www.hacksplaining.com/lessons/sql-injection" --smart
bash: python: command not found
david@debian:~/sqlmap-dev$ python sqlmap.py -h
bash: python: command not found
david@debian:~/sqlmap-dev$

what went wrong with my installation of Sqlmap ?

Perhaps I missed to trying python3 install sqlmap as it has python dependencies ? I don’t know since there is git clone instruction. I just git cloned and started trying to run sqlmap through entering into directory cd/sqlmap-dev. then I tried to run sqlmap commands it throws me bash python command not found.

2

Answers


  1. It looks like you’re either missing Python on your machine or it’s Python 3.x that you have.

    First try the following to ensure it’s indeed the case:

    python3 sqlmap.py -u "https://www.hacksplaining.com/lessons/sql-injection" --smart
    

    If it still doesn’t work then you’d have to install Python on your machine:

    Run the following commands in a shell:

    sudo apt update
    sudo apt install python3
    

    And for future convenience; ensure pip (package manager) is installed as well:

    sudo apt install python3-pip
    

    After running the following command, the following should work fine and sqlmap should be installed on your machine:

    python3 sqlmap.py -u "https://www.hacksplaining.com/lessons/sql-injection" --smart
    
    Login or Signup to reply.
  2. as your python is not in your path so please use the absolute path of your python installation to run sqlmap

    cd sqlmap-dev
    /usr/bin/python3 sqlmap.py -h
    

    or if you want to setup your path just to use python3 sqlmap.py -h you need to add your path to .bashrc or .zshrc file, in your case probably .bashrc

    nano ~/.bashrc
    

    add this line at the end of the file

    export PATH="/usr/bin/python3:$PATH"
    

    and exit the nano editor with ctrl + x and y

    apply the change by doing

    source ~/.bashrc
    

    or simply restarting the terminal

    to verify path is correctly set use following command in the terminal :

    echo $PATH
    

    and you can simply use the short command python3 sqlmap.py -h without absolute path. make sure you are inside the sqlmap-dev direcotry

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search