installationsqlmap

while running sqlmap in my terminal it showing me bash: python: command not found?


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.


Solution

  • 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 directory