Practical Penetration Testing
Penetration Testing Workflow
graph TD
A[Penetration Testing Workflow] --> B[Reconnaissance]
A --> C[Scanning]
A --> D[Vulnerability Assessment]
A --> E[Exploitation]
A --> F[Post-Exploitation]
Reconnaissance with Nmap
Network Mapping
## Comprehensive network discovery
nmap -sn -oN network_map.txt 192.168.1.0/24
## Detailed network inventory
nmap -sV -sC -oX network_inventory.xml 192.168.1.0/24
Advanced Scanning Techniques
Vulnerability Detection Strategies
Scanning Strategy |
Nmap Command |
Purpose |
Script Scanning |
nmap --script vuln 192.168.1.100 |
Detect known vulnerabilities |
Service Enumeration |
nmap -sV -p- 192.168.1.100 |
Comprehensive service discovery |
Aggressive Scanning |
nmap -A 192.168.1.100 |
Detailed OS and service detection |
Scripting and Automation
Custom Nmap Scripts
## Using Nmap Scripting Engine (NSE)
nmap --script ssh-brute --script-args userdb=users.txt,passdb=passwords.txt 192.168.1.100
Penetration Testing Scenarios
Web Service Vulnerability Assessment
## Detect web vulnerabilities
nmap --script http-enum 192.168.1.100 -p 80,443
Database Service Scanning
## Identify database services
nmap -sV -p 3306,5432,1521 192.168.1.0/24
Stealth and Advanced Techniques
Evasion Techniques
## Fragmentation to bypass firewall
nmap -f 192.168.1.100
## Decoy scanning
nmap -D RND:10 192.168.1.100
Reporting and Documentation
graph LR
A[Penetration Test Report] --> B[Network Topology]
A --> C[Discovered Vulnerabilities]
A --> D[Risk Assessment]
A --> E[Remediation Recommendations]
Ethical Considerations
- Always obtain explicit permission
- Maintain confidentiality
- Follow legal and ethical guidelines
- Provide constructive recommendations
Learning with LabEx
LabEx provides immersive cybersecurity environments where you can practice advanced penetration testing techniques, helping you develop practical skills in ethical hacking and network security assessment.
Best Practices
- Use the latest Nmap version
- Keep scanning non-intrusive
- Respect network integrity
- Document all findings comprehensively