Skip to main content

A simple SQL-injection detector based on ML

Project description

sqlidps

PyPI version PyPI downloads Build License Platform Wheel code style Python version

SQL Injection - Detection and Prevention System

SQLIDPS is a tool designed to detect and prevent SQL injection attacks in web applications. SQL injection is a common attack vector that allows attackers to execute arbitrary SQL code on a database, potentially leading to data breaches and other security issues. This project aims to provide a robust solution for identifying and mitigating such vulnerabilities.

Flow Chart

The data flow in SQLIDPS illustrates how user inputs are processed to detect and prevent SQL injection attacks.
Below is a detailed visualization of the flow:

Flowchart

📚 For more detailed documentation, visit deepwiki docs.

🚀 Performance Benchmark

🛡️ SQL Injection Check Time: 0.8ms per input

Usage

SQLi.check(data)

Checks if the provided data contains potential SQLi payloads. Raises PotentialSQLiPayload if a malicious input is detected.

  • Arguments:

    • data (str | list | dict): Input to be checked.
  • Example:

from sqlidps import SQLi

try:
    SQLi.check("SELECT * FROM users WHERE '1'='1' --")
except PotentialSQLiPayload as e:
    print("Blocked:", e)

SQLi.parse(data: dict, error="potential payload") → dict

Parses a dictionary and replaces any malicious values with a safe error string instead of raising an exception.

  • Arguments:

    • data (dict): Dictionary to scan.
    • error (str): Replacement string for detected payloads (default: "potential payload").
  • Returns:

    • A cleaned dictionary with malicious values replaced.
  • Example:

data = {
    "username": "admin",
    "password": "' OR '1'='1"
}

cleaned = SQLi.parse(data)
print(cleaned)
# Output: {'username': 'admin', 'password': 'potential payload'}

Installing

pip install sqlidps

Build from Source

cd sqlidps
pip install -r requirements.txt
flex -o sqlidps/lex.yy.c sqlidps/lexer.l
make sqlidps && make sqlidps clean
python sqlidps/train.py
pip install .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlidps-1.2.1.tar.gz (1.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sqlidps-1.2.1-cp312-cp312-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.12Windows x86-64

sqlidps-1.2.1-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.5+ x86-64

sqlidps-1.2.1-cp312-cp312-macosx_10_13_universal2.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

sqlidps-1.2.1-cp311-cp311-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.11Windows x86-64

sqlidps-1.2.1-cp311-cp311-manylinux1_x86_64.manylinux_2_5_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.5+ x86-64

sqlidps-1.2.1-cp311-cp311-macosx_10_9_universal2.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

sqlidps-1.2.1-cp310-cp310-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.10Windows x86-64

sqlidps-1.2.1-cp310-cp310-manylinux1_x86_64.manylinux_2_5_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.5+ x86-64

sqlidps-1.2.1-cp310-cp310-macosx_10_9_universal2.whl (1.1 MB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

sqlidps-1.2.1-cp39-cp39-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.9Windows x86-64

sqlidps-1.2.1-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.5+ x86-64

sqlidps-1.2.1-cp39-cp39-macosx_10_9_universal2.whl (1.1 MB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)

sqlidps-1.2.1-cp38-cp38-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8Windows x86-64

sqlidps-1.2.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.5+ x86-64

sqlidps-1.2.1-cp38-cp38-macosx_11_0_universal2.whl (1.1 MB view details)

Uploaded CPython 3.8macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file sqlidps-1.2.1.tar.gz.

File metadata

  • Download URL: sqlidps-1.2.1.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sqlidps-1.2.1.tar.gz
Algorithm Hash digest
SHA256 b78ebdd79c99e472c5eb24eb6d0aabb4fdd39850f54f59b049565ff87ee12bbd
MD5 10e3e9579df0a852d67c5fb855cf8939
BLAKE2b-256 3c4ce25d4bd31db5c8cb065132816030da5becadb12ed5f9d2f75dd90c737b96

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: sqlidps-1.2.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sqlidps-1.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3ce5df7d3435c7badb572141a8b5d39900c0513a73248ce50e119a19963a23b1
MD5 b8d273b7adaa9003a9aee75ebcdd7fd3
BLAKE2b-256 b60057b18e8dad5649b7662837d63ab1baf2a5bb31567696203f5d7aa94c4ff5

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 7e0264c77eb35bb04ba479e90335e3fe246439ec257ea4da68fd02d6f01fdf70
MD5 829560fa679a739c60adb2970353173a
BLAKE2b-256 cb43c5df7406cdad560056df6be903957abfcbb18b5feffe7034945b3dd7a303

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 af8cf45b33c176a61a493398d9b316c196454d5d0861fbe4688c198caa65a7c1
MD5 7dd83da9dd22a77ae051cbdb62ad0673
BLAKE2b-256 4fbd3a121f284dec6fbc6d25493438a9d2414755951398c7f4c35bc38086a7d3

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: sqlidps-1.2.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sqlidps-1.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 46a534ed3ab83a074d2a60d3ab4896f4d13b10d21722f22c0f41e9bfd7df3997
MD5 3b73f2beb6417460760a0aa06d9eba3d
BLAKE2b-256 cc89ac79670da5e80f72dd5637e858ea639c5c3db32cd50f90fe70701c5dcbb0

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp311-cp311-manylinux1_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp311-cp311-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 6f884a141abb31c9abeacfc7753dea8edc87cdc87c823decafb14ff6ae008916
MD5 8fbfdffc41d73accec6fd1ccaae0b2a6
BLAKE2b-256 4cdd359cfbce447c66a6735e39ede79c5588d327d72dc0bf4818eb9875359286

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 0d120630877391b7834514f99c7aeb3c45ef427bc27738f494642484548b471d
MD5 58e510d64ead5d9c951f6cd82d452908
BLAKE2b-256 8588ef2ccb27c4597696500454eb0485adf9f0cf4d68a35d2d26351a2a420195

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: sqlidps-1.2.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sqlidps-1.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2350fc1b1c1f86566b7b564839e56e5fd107fb1a74674152dcbf39c47fb29857
MD5 2e859261c4e5ee34d504436f6f4c85b4
BLAKE2b-256 b88c595d91332d0be8a09e7223023a07beeb7bff95b064c1b43346062578110a

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp310-cp310-manylinux1_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp310-cp310-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 912371d1b046d18db913cb0ae8af563d50d78533ff44aa6a6377f535913365be
MD5 2cde26ce35159a40dc0704c9f2221e2f
BLAKE2b-256 7ab20fb6aaab2cc19188db697459f13ba30705982bd45e97365142e6eb906b8d

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 efb6d964466bd733fa4c6ade268ffb926e9b98fad3c541a8c1971711cf546810
MD5 f0f718fce42c5e391a5f83692783f23b
BLAKE2b-256 42511d728a1f331a1ffa63925d6f1e3bc2a9d4ca3dcb785f606cffc669c0f5ef

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: sqlidps-1.2.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sqlidps-1.2.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6fe94da714d3b08c2c294ac094a069d65343a0ff104748ec5083e7a6cb08fe9e
MD5 ffe7b878d06ff60cf408d93a738fc196
BLAKE2b-256 2fcb258fb30dce6a94de4c8dd5fee7993efff44a8664cd832414d05f149efaaa

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 e064776bd79b8e64086eed1ad5bd54025b47c501571e5fefef283317327b2f87
MD5 777e1d87eaefed63647d0b41a9116e0b
BLAKE2b-256 edcf6862a77da3b7252c64b8d23a72e520c404f1e64f2417e919ae299d8a8208

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 56e9f9f8a8274789319d212c7d38b21471b22a9e467c0ab0666b55d523d230fd
MD5 67dd0756674a8f1382d99993631b5aa7
BLAKE2b-256 245e82441d22eb6507cf9bf76f59f99aecfdd1719667422d9eb3b18b04da326f

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: sqlidps-1.2.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sqlidps-1.2.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0b14249f756dff916b096191cc500f71afb21532b64dad8364c04678eac3a6e4
MD5 606e5ed1c85cbda25ad720e8d21b587f
BLAKE2b-256 c3a84b85985d700cfb1733f9360b4efed2d4041b3840030ecc63395bb4467868

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 692a17788de0cd1f67db46e7f03d07d0a247058ba0dc5bc071bfd9588a5511d6
MD5 0aaed86a3e7405c36c20716988fb4368
BLAKE2b-256 ec53cf63d585e0a57d5ee5fd377f6ccb05904ea7c2eebbf902be8a39b6d19434

See more details on using hashes here.

File details

Details for the file sqlidps-1.2.1-cp38-cp38-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for sqlidps-1.2.1-cp38-cp38-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 f98c4ec235a1ad476699388cacd941865442186b1f067f4f3f6c81a60c20f52a
MD5 660205a0acc4c5597da905c8fd62b927
BLAKE2b-256 f1d58d7817006ab83b2d82ed416d3ab9513834e59b69495b4b2de83a1a328a3b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page