r/Pentesting • • 2d ago

Custom Python script for boolean-based Blind SQLi — worth building or a waste of time next to sqlmap?

Hi everyone,

I'm currently working through the Blind SQL Injection (boolean-based) lab on PortSwigger Academy, where you have to extract a password purely from true/false responses, character by character, using payloads like this:

' AND SUBSTRING((SELECT Password FROM Users WHERE Username = 'Administrator'), 1, 1) > 's

I was thinking that writing a custom Python script to automate this kind of extraction could save me time on future labs/programs, and would be a solid addition to a portfolio. Before diving in, I'd like your opinion: is it worth building this myself, given that tools like sqlmap already exist? Or would that be time better spent just learning to use existing tools well?

If it is worth doing, do you have any tips on how to approach it, especially on bridging Burp Suite (Repeater tab) with the Python script?

Thanks in advance for your input!

5 Upvotes

9 comments sorted by

7

u/CRam768 2d ago

Try it vs asking here. You’ll never know if you don’t do it. It’s a learning experience for a reason.

3

u/normalbot9999 2d ago

If you build your own one, you will know how it works and may be better able to customise it to tricky situations.

3

u/Remarkable_Pace8101 2d ago

It's absolutely 1,000,000% worth it to build your own script that does it because you were going to internalize the knowledge

If you run sqlmap you won't learn anything except how to be a tool monkey 

1

u/mikwebsterr 2d ago

It worth building. I've done something like that recently, checkout my github

https://github.com/redcorp0x/RedQuery

1

u/mikwebsterr 2d ago

Will appreciate your feedback 😊

1

u/Internal-Rise9852 22h ago

Hey! I just wanted to say thanks for sharing your GitHub repo. I spent some time reading through your code to help me learn, and it's really great work. Appreciate you making this open-source!

2

u/Emergency-Sound4280 2d ago

Sqlmap is a thing….

2

u/nv1t 2d ago

learning is also a thing! :)

1

u/Future_AGI 2d ago

For the Burp side, point the script's requests session at Burp as a proxy (proxies={'https': 'http://127.0.0.1:8080'} plus verify=False) and every payload lands in HTTP history, ready to send to Repeater when one looks odd. Binary-searching each character with your > payload instead of testing a-z and 0-9 in order also drops the requests per character from up to 36 to about 6.