Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SP Perkim Inject - Go Stress Testing Tool

Browserless stress testing tool for Sekampadi survey system with TLS fingerprinting and realistic data randomization.

🎯 Purpose

Legitimate stress testing tool for the Sekampadi survey system (sekampadi.kalbarprov.go.id) to test system performance, load capacity, and reliability under concurrent user load.

✨ Features

  • Browserless HTTP Client: No headless browser, uses HTTP client with TLS fingerprinting
  • TLS Fingerprinting: Chrome macOS profile for anti-bot bypass
  • Realistic Data Randomization: Indonesian names, phone numbers, ages, and feedback
  • Concurrent Execution: Configurable worker pool for parallel requests
  • CSRF Token Handling: Automatic token extraction and session management
  • Progress Tracking: Real-time progress bar during execution
  • Graceful Shutdown: Handles SIGINT/SIGTERM for clean cancellation
  • Metrics Collection: Success rate, duration metrics, HTTP status codes
  • Custom Payload Support: JSON-based custom payload configuration

πŸš€ Quick Start

Prerequisites

  • Go 1.25 or higher
  • Windows/macOS/Linux

Installation

  1. Clone the repository
git clone https://github.com/yourusername/SP_Perkim_Inject.git
cd SP_Perkim_Inject
  1. Build the tool
go build -o bin/stress.exe ./cmd/stress
  1. Run the tool
# Basic usage
./bin/stress.exe -n 10 -c 5

# With random data
./bin/stress.exe -n 10 -c 5 -random

# With custom payload
./bin/stress.exe -n 10 -c 5 -payload custom.json

πŸ“– Usage

Command-Line Flags

-n <int>        Total number of requests (default: 10)
-c <int>        Number of concurrent workers (default: 5)
-payload <file> Custom payload JSON file (optional)
-random          Use random realistic data for each request
-timeout <dur>  Request timeout (default: 30s)

Examples

Basic stress test

./bin/stress.exe -n 5 -c 1

Moderate load with random data

./bin/stress.exe -n 50 -c 10 -random

High load test

./bin/stress.exe -n 200 -c 50 -random

Custom payload

./bin/stress.exe -n 20 -c 5 -payload custom.json

Custom Payload Format

{
  "penyandang_disabilitas": "tidak",
  "id_satker": 35,
  "id_layanan": 99,
  "umur": 30,
  "jk": "lk",
  "id_pekerjaan": 3,
  "id_pendidikan": 5,
  "no_hp": "081234567890",
  "u1": 4,
  "u2": 4,
  "u3": 4,
  "u4": 4,
  "u5": 4,
  "u6": 4,
  "u7": 4,
  "u8": 4,
  "u9": 4,
  "penilaian_umum": 4,
  "transparan": 4,
  "integritas": 4,
  "saran": "Custom feedback"
}

πŸ—οΈ Architecture

Project Structure

SP_Perkim_Inject/
β”œβ”€β”€ cmd/stress/
β”‚   └── main.go               # CLI entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ httpx/
β”‚   β”‚   β”œβ”€β”€ client.go         # HTTP client with TLS
β”‚   β”‚   β”œβ”€β”€ profile.go        # Browser profile (macOS)
β”‚   β”‚   └── cookie/
β”‚   β”‚       └── jar.go        # Cookie jar
β”‚   β”œβ”€β”€ parser/
β”‚   β”‚   └── token.go          # CSRF token extraction
β”‚   β”œβ”€β”€ payload/
β”‚   β”‚   └── builder.go        # Survey payload builder
β”‚   β”œβ”€β”€ engine/
β”‚   β”‚   └── worker.go         # Worker pool engine
β”‚   └── metrics/
β”‚   β”‚   └── collector.go      # Metrics collection
β”œβ”€β”€ bin/
β”‚   └── stress.exe            # Compiled binary
β”œβ”€β”€ go.mod
β”œβ”€β”€ go.sum
β”œβ”€β”€ README.md
└── AGENTS.md

Flow Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   CLI Start     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Parse Flags     β”‚
β”‚ -n, -c, -random β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Load Payload    β”‚
β”‚ Default/Random  β”‚
β”‚ Custom JSON     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Init HTTP Clientβ”‚
β”‚ TLS Fingerprint β”‚
β”‚ Chrome macOS    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Worker Pool     β”‚
β”‚ Concurrency     β”‚
β”‚ Semaphore       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ For Each Worker β”‚
β”‚                 β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ GET Request β”‚ β”‚
β”‚ β”‚ CSRF Token  β”‚ β”‚
β”‚ β”‚ Cookies     β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚        β”‚        β”‚
β”‚        β–Ό        β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ POST Requestβ”‚ β”‚
β”‚ β”‚ Survey Data β”‚ β”‚
β”‚ β”‚ + Token     β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Collect Metrics β”‚
β”‚ Success/Fail    β”‚
β”‚ Duration        β”‚
β”‚ Status Codes    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Print Report    β”‚
β”‚ Summary Stats   β”‚
β”‚ Performance     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

  1. CLI Input: Parse command-line flags and load payload
  2. HTTP Client: Initialize with TLS fingerprinting (Chrome macOS)
  3. Worker Pool: Create goroutines with semaphore-based rate limiting
  4. GET Request: Fetch CSRF token and session cookies
  5. POST Request: Submit survey data with token and cookies
  6. Metrics Collection: Track success rate, duration, HTTP status codes
  7. Report Generation: Display comprehensive summary statistics

πŸ”§ Configuration

Browser Profile

Default: Chrome macOS (Chrome 146)

  • User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36
  • TLS Profile: Chrome 146
  • Sec-CH-UA: Google Chrome v146

Target Configuration

const (
    targetURL    = "https://sekampadi.kalbarprov.go.id"
    getEndpoint  = "/survey2?opd=MzU%3D"
    postEndpoint = "/survey2"
)

Random Data Ranges

  • Age: 18-60 years
  • Phone: Indonesian mobile numbers (0812, 0813, 0857, etc.)
  • Service ID: 99-101 (Data, Consultation, Complaint)
  • Job ID: 1-6 (ASN, Military, Private, etc.)
  • Education ID: 1-6 (SD to S2/S3)
  • Scores: 1-4 (for all survey questions)

πŸ“Š Output Example

πŸš€ SP Perkim Inject - Stress Testing Tool
========================================
Requests:          10
Concurrency:       5
Timeout:           30s
========================================

βœ… Using random payload for each request
πŸ”„ Initializing HTTP client with browser TLS fingerprinting...
βœ… HTTP client initialized
πŸš€ Starting stress test...

Progress: [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘] 50.0% (5/10)
βœ… Stress test completed

========================================
       STRESS TEST SUMMARY REPORT       
========================================
Total Requests:    10
Successful:        10 (100.0%)
Failed:            0
Cancelled:         0

--- Duration Metrics ---
Average:           1.12s
Minimum:           527ms
Maximum:           1.81s
P95:               1.81s
P99:               1.81s

--- HTTP Status Codes ---
200:                10
========================================

⚠️ Troubleshooting

Common Issues

403 Forbidden

  • Server anti-bot protection active
  • Try with different IP or wait some time
  • TLS fingerprinting helps but not 100% effective

419 Page Expired

  • CSRF token expired or invalid
  • Tool automatically handles this with GET β†’ POST flow
  • Check if target website structure changed

Connection Timeout

  • Network connectivity issues
  • Increase timeout with -timeout flag
  • Check if target server is accessible

High Failure Rate

  • Server under heavy load
  • Reduce concurrency with -c flag
  • Check server status manually

Debug Mode

# Test single request
./bin/stress.exe -n 1 -c 1

# Increase timeout
./bin/stress.exe -n 5 -c 1 -timeout 60s

# Test with default payload
./bin/stress.exe -n 5 -c 1

πŸ”’ Security & Legal

⚠️ DISCLAIMER: This tool is designed for legitimate stress testing and performance evaluation. Ensure you have proper authorization before using on production systems.

πŸ›‘οΈ Security Features:

  • βœ… TLS fingerprinting for anti-bot bypass
  • βœ… CSRF token handling
  • βœ… Session management
  • βœ… No data persistence
  • βœ… HTTPS communication

πŸ“‹ Legal Considerations:

  • Use only on systems you own or have permission to test
  • Respect rate limits and server capacity
  • Do not use for malicious purposes
  • Comply with local laws and regulations

πŸ“ž Support

Getting Help

  1. Check troubleshooting section
  2. Review AGENTS.md for detailed flow
  3. Test with single request first
  4. Check network connectivity

Contributing

  1. Fork the repository
  2. Create feature branch
  3. Test thoroughly
  4. Submit pull request

πŸš€ Performance Tips

Optimal Concurrency

  • Start with -c 5 for initial testing
  • Increase gradually based on server response
  • Monitor success rate and adjust accordingly

Load Testing Strategy

  1. Baseline: Single request to verify functionality
  2. Light Load: 10 requests with 2-3 workers
  3. Moderate Load: 50 requests with 10 workers
  4. Heavy Load: 200+ requests with 50+ workers

Monitoring

  • Watch success rate (should be >90%)
  • Monitor response times (should be <2s)
  • Check for increasing failure rates
  • Adjust concurrency based on results

πŸš€ Built with Go 1.25 for performance and reliability

Last updated: July 2026

About

idek.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages