sqlmapproject / sqlmap

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

SQLAlchemy connection issue ('ModuleNotFoundError: No module named 'MySQLdb'') #5714

Closed TuAgT closed 2 weeks ago

TuAgT commented 2 weeks ago

Describe the bug

SQLAlchemy connection issue ('ModuleNotFoundError: No module named 'MySQLdb'') To Reproduce

  1. pipx install sqlmap

  2. sqlmap -d "mysql+pymysql://root:root@127.0.0.1:3306/information_schema"

    image
  3. pipx runpip sqlmap install PyMySQL

  4. sqlmap -d "mysql+pymysql://root:root@127.0.0.1:3306/information_schema"

    image
  5. pipx runpip sqlmap install SQLAlchemy

  6. sqlmap -d "mysql://root:root@127.0.0.1:3306/information_schema"

    image

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Running environment:

Target details:

Additional context

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting @ 23:03:02 /2024-05-16/

[23:03:03] [CRITICAL] SQLAlchemy connection issue ('ModuleNotFoundError: No module named 'MySQLdb'')

[*] ending @ 23:03:03 /2024-05-16/

docker-compose.yml

services:
  db:
    image: mysql:5.5
    platform: linux/amd64
    environment:
      - MYSQL_ROOT_PASSWORD=root
    ports:
      - "3306:3306"
stamparm commented 2 weeks ago

image image

stamparm commented 2 weeks ago

so, created everything from scratch. please, forgive me to not put links to letmegooglethatforyou in sqlmap output, especially in your case

so, TL;DR, this worked:

docker-compose up

virtualenv testsql
source testsql/bin/activate
python -m pip install sqlalchemy
python sqlmap.py -d "mysql://root:root@127.0.0.1:3306/information_schema"
python -m pip install pymysql
python sqlmap.py -d "mysql://root:root@127.0.0.1:3306/information_schema"

now, step by step, with some pictures:

image

literary first Google result shows this:

image

image