Giter Club home page Giter Club logo

sleuthql's Introduction

SleuthQL Description

SleuthQL is a python3 script to identify parameters and values that contain SQL-like syntax. Once identified, SleuthQL will then insert SQLMap identifiers (*) into each parameter where the SQL-esque variables were identified.

Supported Request Types

SleuthQL requires an export of Burp's Proxy History. To gain this export, simply navigate to your proxy history tab, highlight every item and click "Save Items". Ensure that each request is saved using base64 encoding. When SleuthQL scans the proxy history file, outside of the regular URL parameters, it will be able to identify vulnerable parameters from the following request content-types:

  • application/json
  • application/x-www-form-urlencoded
  • multipart/form-data

There are cases where this tool will break down. Namely, if there is nested content-types (such as a base64 encoded parameter within JSON data), it will not be able to identify those parameters. It also does not cover Cookies, as too often something such as CloudFlare will flag a parameter we're not interested in.

Why not Burp Pro?

Burp Pro's scanner is great, but isn't as full featured as SQLMap. Thus, if we can prioritize requests to feed into SQLMap in a batch-like manner and look for results this way, we can increase the detection rate of SQL injection.

Usage

Usage: 
                .:/+ssyyyyyyso+/:.                
            -/s                    s/.            
         .+|        SleuthQL         |y+.         
       -s| SQL Injection Discovery Tool |s-       
     .shh|                              |ohs.     
    +hhhho+shhhhhhhhhhhs/hhhhhhhhhhhhhhhh.-hh/    
  `shhhhhhy:./yo/:---:/:`hhhhhhhhhhhhhhhs``ohho   
  shhhhhhhhh-`-//::+os: +hhhhhhhhh+shhhh.o-/hhho  
 +hhhhhhhhh:+y/.:shy/  /hhhhhhhhh/`ohhh-/h-/hhhh/ 
.hhhhhhhhhsss`.yhhs` .shhhhhhhh+-o-hhh-/hh`ohhhhh`
+hhhhhhhhhhhhyoshh+. `shhhhhs/-oh:ohs.ohh+`hhhhhh/
shhhhhhhhhhhhhhhhhhh/  -//::+yhy:oy::yhhy`+hhhhhho
yhhhhhhhhhhhhhhhhhhh:-:.   `+y+-/:/yhhhy.-hhhhhhhs
shhhhhhhhhhhhhhhhhhh+ :/o+:.``  -hhhhhs`.hhhhhhhho
+hhhhhhhs/hhhhhhhhhhy::/:/yhhhy: .+yy/ :hhhhhhhhh/
.hhhhhhh:.hhhhhhhhhhhhhhhhhhhhhhs/-  -shhhhhhhhhh`
 +hhhhhh+ /hhhhhhhhhhhhhhhhhhhhho/:`+hhhhhhhhhhh/ 
  shhhhy+  -shhhhhhhhhhhhhhhhhhh.// yhhhhhhhhhho  
  `ohh+://+/.`-/++ooooooooooyhhhhy.`hhhhhhhhhho   
    /hhhhhhhhhso++//+++oooo+:`sh+`-yhhhhhhhhh/    
     .s                                    s.     
       -s      Rhino Security Labs       s-       
         .+y    Dwight  Hohnstein     y+.         
            ./s                    s/.            
                .:/+osyyyyyyso+/-.                

sleuthql.py -d example.com -f burpproxy.xml

SleuthQL is a script for automating the discovery of requests matching
SQL-like parameter names and values. When discovered, it will display
any matching parameters and paths that may be vulnerable to SQL injection.
It will also create a directory with SQLMap ready request files.



Options:
  -h, --help            show this help message and exit
  -d DOMAINS, --domains=DOMAINS
                        Comma separated list of domains to analyze. i.e.:
                        google.com,mozilla.com,rhinosecuritylabs.com
  -f PROXY_XML, --xml=PROXY_XML
                        Burp proxy history xml export to parse. Must be base64
                        encoded.
  -v, --verbose         Show verbose errors that occur during parsing of the
                        input XML.

Output Files

For each potentially vulnerable request, the SQLMap parameterized request will be saved under $(pwd)/$domain/ as text files.

Video Demo

https://youtu.be/Sp3FevOAmCs

License

This code is licensed under the BSD 3-Clause Clear License, which limits liability, warranty and patent use of this code. See license.txt for more details.

sleuthql's People

Contributors

djhohnstein avatar eur0pa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sleuthql's Issues

Needs a try/except to catch IndexError

This statement

if lines[i][-1] != "*":
needs to be enclosed in a try / except IndexError block, or it will raise exceptions under some circumstances (not yet clear why):

[+] Loading data from x/sleuthql.xml...
[+] Found 575 requests from proxy history.
[+] Found 540 requests matching x.com hostname.
[+] Found 11 requests matching x.org hostname.
[+] Found 5 requests matching x.net hostname.


[+] Sorting...
Traceback (most recent call last):
  File "sleuthql.py", line 815, in <module>
    main()
  File "sleuthql.py", line 788, in main
    results = createResults(parsed_xml_results)
  File "sleuthql.py", line 704, in createResults
    sqlData = findSQLParams(params)
  File "sleuthql.py", line 628, in findSQLParams
    insertion_point, req = getSQLInsertionPoint(req, loc, key=key)
  File "sleuthql.py", line 526, in getSQLInsertionPoint
    if lines[i][-1] != "*":
IndexError: string index out of range

CLI update

Hi,

The CLI in the video is wrong. It should be:

find . -name "*.txt" -exec sqlmap --batch -r {} \; 

Just saying.

Base64 checking

Hi, I really like the idea of this tool. I also noticed that the base64 encoding is broken so I had a couple ideas for you;

This regex will be able to tell; ([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==) of course there are issues with this because a string that looks like base64 will be returned as true.

You can check the length of the string and see if it’s divisible by 4;

def is_64(string):
    if len(string) % 4 == 0:
        try:
            base64.b64decode(string)
        except:
            return False
    return False;

You could also do a mixture of both if you wanted. Good luck and good job!

Invalid video in documentation

From the README (and official web), we are getting:

This video is no longer available because the uploader has closed their YouTube account.

Can we get reupload or something?

Thanks.

icon

sleuthql

doing distro ebuild.. any rate i'd offer the icon back...

[Desktop Entry]
Name=SleuthQL
GenericName=SleuthQL-cli
Exec=xterm -E /usr/bin/sleuthql
#/opt/SleuthQL/sleuthql.py @ SYM /usr/bin/sleuthql
StartupNotify=true
X-Enlightenment-WaitExit=false
Icon=/usr/share/icons/SleuthQL.PNG
Type=Application
Comment=Python3 Burp History parsing tool to discover potential SQL injection points. To be used in tandem with SQLmap.
Path=/opt/sitebroker
Terminal=false
Exec=sudo -E 
Categories=Pentoo;X-Exploit;

add support of burp project files

burp project file is a single "live" file which records all logs automatically and this is the preferable way.
The current approach (to export logs manually) seems not very practical.

btw, sqlmap can parse burp/webscarab log files, see:
sqlmap -l LOGFILE

So ideally, you should push your work back to sqlmap instead of creating yet another one-day script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.