bash
8 lines · 1 tab
Kai Nakamura
Apr 2026
1 tab
#!/usr/bin/env bash
sqlmap \
-r login-request.txt \
--risk=2 \
--level=3 \
--batch \
--threads=4 \
--technique=BEUSTQ
1 file · bash
Explain with highlit
Automated SQL injection testing is useful when it is tightly scoped and coordinated. I keep requests reproducible, use captured traffic as the starting point, and avoid reckless options that create unnecessary blast radius. Tools are not the problem here; discipline is.
Related snips
ruby
# Vulnerable: user input is concatenated directly into SQL.
email = params[:email]
password = params[:password]
sql = "SELECT * FROM users WHERE email = '#{email}' AND password_hash = '#{password}'"
user = ActiveRecord::Base.connection.execute(sql).first
SQL injection prevention with unsafe and safe query patterns
sql-injection
owasp
database
by Kai Nakamura
3 tabs
python
import psycopg
with psycopg.connect(conninfo) as connection:
with connection.cursor() as cursor:
cursor.execute(
'SELECT id, email FROM users WHERE email = %s',
Parameterized queries in Python with psycopg
python
sql-injection
psycopg
by Kai Nakamura
1 tab
ruby
class ReportQuery
SQL = <<~SQL.freeze
SELECT date_trunc('day', events.created_at) AS day,
count(*) AS total,
count(*) FILTER (WHERE events.kind = 'purchase') AS purchases
FROM events
Safe Raw SQL with exec_query + Binds
rails
activerecord
sql
by codesnips
2 tabs
typescript
import express from 'express';
import cookieParser from 'cookie-parser';
import { issueCsrfToken, csrfProtection } from './csrf';
import { transfersRouter } from './routes/transfers';
const app = express();
CSRF protection with double-submit cookie
security
express
csrf
by codesnips
3 tabs
bash
#!/usr/bin/env bash
nmap -Pn -sV -O --top-ports 1000 10.10.20.15
nmap -Pn -sC -sV api.internal.example.com
nmap -Pn -sU --top-ports 50 dns.internal.example.com
Nmap reconnaissance profiles for safe internal assessments
nmap
reconnaissance
pentesting
by Kai Nakamura
1 tab
plaintext
SecRuleEngine On
SecRequestBodyAccess On
SecResponseBodyAccess Off
SecRule ARGS|REQUEST_HEADERS|XML:/* "@detectSQLi" \
"id:1001,phase:2,deny,status:403,log,msg:'Potential SQLi detected'"
ModSecurity WAF rules for common web attack patterns
waf
modsecurity
web-security
by Kai Nakamura
1 tab
Share this code
Here's the card — post it anywhere.