Home » #Technology » Top 10 Ethical Hacking Techniques with Bash Scripts Using Kali Linux

Top 10 Ethical Hacking Techniques with Bash Scripts Using Kali Linux

Kali Linux stands as a powerful platform for cybersecurity professionals, ethical hackers, and penetration testers. This tech concept walks through the top 10 ethical hacking techniques and provides ready-to-run bash script snippets for each. These scripts are ideal for information gatheringvulnerability discovery, and penetration test preparation, all within a secure and legal context.

Over the past 20 years, I’ve seen how code can transform ideas into reality. From building products to leading tech-driven change, I’ve lived the journey. I’m here to share what I’ve learned—so you can build, grow, and make your mark too.

1. Reconnaissance (Information Gathering)

Reconnaissance is the first step in ethical hacking. Tools like nmap and theHarvester help gather host, subdomain, and email information about a target.

Bash Script for Reconnaissance

#!/bin/bash
read -p "Enter target domain or IP: " target
echo "[*] Running nmap host discovery..."
nmap -sP $target

echo "[*] Harvesting emails and subdomains..."
theHarvester -d $target -b google -l 50

2. Vulnerability Scanning

Scanning for known vulnerabilities helps uncover weak software versions or configurations. Nikto is effective for detecting outdated web servers and misconfigurations.

Bash Script for Web Vulnerability Scanning

#!/bin/bash
read -p "Enter target URL (e.g., http://192.168.0.1): " url
echo "[*] Running Nikto scan..."
nikto -h $url

3. Exploitation Research

Before launching any exploit, it’s important to identify known vulnerabilities in services. searchsploit queries exploit-db for public exploit scripts.

Bash Script for Exploit Discovery

#!/bin/bash
read -p "Enter software/service name (e.g., vsftpd 2.3.4): " software
echo "[*] Searching exploit-db for: $software"
searchsploit "$software"

4. Wireless Network Attacks

Wireless testing is crucial for evaluating Wi-Fi security. Tools like wash identify routers vulnerable to WPS-based attacks.

Bash Script for WPS Discovery

#!/bin/bash
read -p "Enter wireless monitor interface (e.g., wlan0mon): " iface
echo "[*] Scanning for WPS-enabled APs (20 seconds)..."
timeout 20 wash -i $iface

5. Social Engineering Simulations

Social engineering tests human vulnerabilities. Social-Engineer Toolkit (SET) helps simulate phishing and fake login attacks.

Bash for Launching SET

#!/bin/bash
echo "[*] Launching Social Engineering Toolkit..."
sudo setoolkit

Note: SET runs in an interactive menu, making it unsuitable for full automation.

6. Password Attacks

Testing password strength is vital for identifying weak authentication. Hydra performs brute-force or dictionary attacks on login services.

Bash Script for SSH Password Brute-Force

#!/bin/bash
read -p "Enter target IP: " ip
read -p "Enter username: " user
hydra -l $user -P /usr/share/wordlists/rockyou.txt ssh://$ip

7. Web Application Testing

Web applications often contain vulnerabilities like SQL injection. sqlmap helps detect and exploit such flaws automatically.

Bash Script for SQL Injection Testing

#!/bin/bash
read -p "Enter vulnerable URL with parameter (e.g., http://site.com/page.php?id=1): " url
sqlmap -u "$url" --batch --banner

8. Privilege Escalation Checks

Privilege escalation occurs when attackers move from user to root access. The linux-exploit-suggester script identifies such opportunities on Linux systems.

Bash Script for Exploit Suggestions

#!/bin/bash
curl -O https://raw.githubusercontent.com/mzet-/linux-exploit-suggester/master/linux-exploit-suggester.sh
chmod +x linux-exploit-suggester.sh
./linux-exploit-suggester.sh

9. Network Sniffing and Spoofing

Analyzing network traffic helps identify sensitive data leaks. tcpdump captures real-time packets on a given interface.

Bash Script for Packet Sniffing

#!/bin/bash
read -p "Enter network interface (e.g., eth0 or wlan0): " iface
echo "[*] Capturing packets (Ctrl+C to stop)..."
sudo tcpdump -i $iface -nn

10. Post-Exploitation Access

After gaining access, ethical hackers often establish persistence. Meterpreter, via Metasploit, allows ongoing control and data extraction.

Bash Script to List Meterpreter Sessions

#!/bin/bash
msfconsole -q -x "sessions -i"

My Tech Advice: Each of these bash scripts is designed for authorized use in ethical hacking scenarios, such as penetration testing, red teaming, and vulnerability research. Kali Linux provides a versatile and battle-tested environment to implement these techniques securely and effectively. If you are serious about ethical hacking, consider bundling these into a modular toolkit or integrating them into a reporting workflow using tools like Dradis or Faraday.

Ready to build your own ethical solution ? Try the above tech concept, or contact me for a tech advice!

#AskDushyant
Note: The example and pseudo code is for illustration only. You must modify and experiment with the concept to meet your specific needs.
#TechConcept #TechAdvice #EthicalHacking #Coding #Scripting #Linux #KaliLinux

Leave a Reply

Your email address will not be published. Required fields are marked *