Overview
Thearachni_scan_remote.bat script connects to a remote Linux server running Arachni, executes a comprehensive vulnerability scan, generates HTML reports, and downloads the results. It uses PuTTY tools (plink and pscp) for SSH communication.
Parameters
| Parameter | Position | Description |
|---|---|---|
Proyecto | 1 | Project name for identification |
URL | 2 | Target URL to scan |
Documentacion | 3 | Local output directory for reports |
Timestamp | 4 | Timestamp for file naming |
NRO | 5 | Scan number identifier |
Server | 6 | Remote server hostname or IP address |
Username | 7 | SSH username for remote server |
Password | 8 | SSH password for authentication |
Usage
Prerequisites
Required tools in script directory:
- plink.exe - PuTTY command-line SSH client
- pscp.exe - PuTTY secure copy (SCP) client
- Login_fast.rb - Login script template (copied to remote server)
- Arachni installed and in PATH
- SSH server running on port 22
- Write access to /tmp directory
- Ruby installed (for login scripts)
Script Workflow
1. Upload Login Script
Copies the local login script to the remote server:%~dp0Login_fast.rb → Destination: /tmp/Login on remote server
2. Execute Arachni Scan
Runs a comprehensive Arachni scan on the remote server:3. Generate HTML Report
Converts the Arachni Framework Report (.afr) to HTML:4. Download and Cleanup
Retrieves the report and removes remote files:Scan Configuration
Default Platform Settings
The script is configured for Windows/IIS/ASP.NET applications:Scope Exclusion
The script excludes logout pages to prevent session termination:User Agent
Default user agent:Audit Modules
The script enables all audit modules:| Module | Description |
|---|---|
--audit-links | Audit links and query parameters |
--audit-forms | Audit HTML forms |
--audit-cookies | Audit cookies for vulnerabilities |
--audit-headers | Audit HTTP headers |
--audit-jsons | Audit JSON inputs |
--audit-xmls | Audit XML inputs |
--audit-ui-inputs | Audit UI input elements |
--audit-ui-forms | Audit UI form elements |
--checks=* | Run all vulnerability checks |
Login Script Configuration
The script uses thelogin_script plugin with /tmp/Login for authenticated scanning.
Fast Login (No Browser)
Example login script structure inLogin_fast.rb:
Browser-Based Login (Commented)
For complex login forms requiring JavaScript, see comments at arachni_scan_remote.bat:32-44:Alternative: AutoLogin Plugin
For simple form-based authentication, use theautologin plugin (see comments at arachni_scan_remote.bat:63-65):
HTTP Authentication
For HTTP Basic/Digest authentication, uncomment and configure arachni_scan_remote.bat:16-19:Output Files
Local Report
Downloaded to:Remote Files (Auto-Deleted)
/tmp/Login- Login script/tmp/ArachniReport - {Timestamp}.afr- Arachni Framework Report/tmp/ArachniReport - {Timestamp}.zip- HTML report archive
Example Usage Scenarios
Windows/IIS Application
Linux/Apache/PHP Application
Modify platform at arachni_scan_remote.bat:23, then:Multiple Scans with Different Logins
Create custom login scripts for different applications:Security Considerations
Using SSH Keys Instead
Modify the script to use Pageant (PuTTY’s SSH agent) or convert to use SSH keys:Troubleshooting
SSH Connection Failed
Symptoms: Script hangs or shows connection errors Solutions:- Verify server hostname/IP is reachable:
ping SERVER - Check SSH is running on port 22
- Verify credentials are correct
- Test manual connection:
plink.exe -ssh -P 22 -l USERNAME -pw PASSWORD SERVER
Arachni Command Not Found
Symptoms: Remote command fails with “arachni: command not found” Solutions:- Install Arachni on remote server
- Ensure Arachni is in PATH:
which arachni - Use full path:
/opt/arachni/bin/arachni
Login Script Errors
Symptoms: Scan completes but misses authenticated pages Solutions:- Test login script manually on remote server
- Verify session check pattern matches logged-in state
- Check credentials in Login_fast.rb are correct
- Review Arachni scan log for authentication errors
Report Download Fails
Symptoms: pscp.exe fails to download report Solutions:- Verify local
Documentacionpath exists and is writable - Check remote /tmp has sufficient space
- Ensure firewall allows SCP traffic
- Test manual download:
pscp.exe -P 22 -l USER -pw PASS SERVER:/tmp/test.txt C:\
Insufficient Disk Space
Symptoms: Scan fails or report generation fails Solutions:- Check remote /tmp disk space:
plink.exe ... SERVER "df -h /tmp" - Clean up old scan files in /tmp
- Configure Arachni to use different output directory with more space