Creative Scripting for Hackers and Pentesters
Dolev Farhi, Nick Aleks

#Bash
#Black_Hat
#Linux
#Kali_Linux
#Network
#Defense
#Pentesters
Master the art of offensive bash scripting. This highly practical hands-on guide covers chaining commands together, automating tasks, crafting living-off-the-land attacks, and more!
In the hands of the penetration tester, bash scripting becomes a powerful offensive security tool. In Black Hat Bash, you’ll learn how to use bash to automate tasks, develop custom tools, uncover vulnerabilities, and execute advanced, living-off-the-land attacks against Linux servers. You’ll build a toolbox of bash scripts that will save you hours of manual work. And your only prerequisite is basic familiarity with the Linux operating system.
You’ll learn the basics of bash syntax, then set up a Kali Linux lab to apply your skills across each stage of a penetration test—from initial access to data exfiltration. Along the way, you’ll learn how to perform OS command injection, access remote machines, gather information stealthily, and navigate restricted networks to find the crown jewels. Hands-on exercises throughout will have you applying your newfound skills.
Key topics covered include:
Whether you’re a pentester, a bug bounty hunter, or a student entering the cybersecurity field, Black Hat Bash will teach you how to automate, customize, and optimize your offensive security strategies quickly and efficiently, with no true sorcery required.
Table of Contents
1. Bash Basics
2. Flow Control and Text Processing
3. Setting Up a Hacking Lab
4. Reconnaissance
5. Vulnerability Scanning and Fuzzing
6. Gaining a Web Shell
7. Reverse Shells
8. Local Information Gathering
9. Privilege Escalation
10. Persistence
11. Network Probing and Lateral Movement
12. Defense Evasion and Exfiltration
Dolev Farhi is a security engineer and author of Black Hat GraphQL (No Starch Press, 2023). He is a distinguished security engineer at Palo Alto Networks, where he uses bash daily to automate security tests and sift through network and application artifacts.
Nick Aleks has served as a distinguished security engineer at TD Bank and is the chief hacking officer at ASEC. He has extensive experience using bash scripting on red teams, in penetration tests, and in software development projects. Aleks is also coauthor of Black Hat GraphQL (No Starch Press, 2023).









