On Shell Scripting
What is a shell?
What is a script?
Shell scripts
Where shell scripting is useful
UNIX, Linux, and OS X shell scripting
Shell availability and choices
Working with shells
Bash basics
Hello World
Variables
Arguments
Control statements
Putting it all together with bash
Adding /dev/tcp/ support to bash
Building a port scanner with bash
Improving the script
Windows scripting
Shell availability and choices
Command.com and CMD.exe
PowerShell
Cygwin
Other shells
PowerShell basics
Hello World
Variables
Arguments
Control statements
Conditionals
Looping
Putting it all together with PowerShell
Building a port scanner with PowerShell
Improving the script
Summary
Endnotes
CHAPTER 2 Introduction to Python
What is Python?
Where do we get Python?
Where is Python useful?
Multiplatform scripting
Network scripting
Extensive modules
Reusable code that is easy to create
Python basics
Getting started
Variables
Modules
Arguments
Lists
Dictionaries
Control statements
Functions
File manipulation
Exception handling
Network communications
Client communications
Server communications
Scapy
Summary
Endnotes
CHAPTER 3 Introduction to Perl
Where Perl is useful
Handling text
Gluing applications together
Working with Perl
Editing tools
Extending Perl scripts
GUIs in Perl
Perl basics
Hello World
Variables
Shell commands
Arguments
Control statements
Regular expressions
File input and output
Putting it all together
Building an SNMP scanner with Perl
Improving the script
Summary
Endnotes
CHAPTER 4 Introduction to Ruby
Where Ruby is useful
Ruby basics
Variables
Arrays and hashes
Control statements
Functions
Building classes with Ruby
Building a class
Extending a class
Accessing class data
File manipulation
Database basics
Using DBI
Using Active Record
Network operations
Client communications
Server communications
Putting it all together
Summary
Endnotes
CHAPTER 5 Introduction to Web scripting with PHP
Where Web scripting is useful
Getting started with PHP
Scope
PHP basics
Functions
Handling forms with PHP
File handling and command execution
File handling
Command execution
Putting it all together
Summary
CHAPTER 6 Manipulating Windows with PowerShell
Dealing with execution policies in PowerShell
Execution policies
Bypassing the policies
Getting in
Penetration testing uses for PowerShell
Controlling processes and services
Interfacing with the event logs
Getting and sending files over the network
Interfacing with the Registry
PowerShell and Metasploit
PowerShell-oriented Metasploit modules
PowerDump
Windows gather PowerShell environment setting
enumeration
Making use of the modules
Summary
Endnotes
CHAPTER 7 Scanner scripting
Working with scanning tools
Netcat
Nmap
Nessus/OpenVAS
Netcat
Implementations of Netcat
Simple Netcat usage
Building a Web server with Netcat
Transferring files with Netcat
Nmap
Working with service probes in Nmap
The Nmap scripting engine
Building Nmap NSE files
Nessus/OpenVAS
NASL in Nessus and OpenVAS
Nessus attack scripting language (NASL)
Summary
Endnotes
CHAPTER 8 Information gathering
Information gathering for penetration testing
Sources of information
Patterns in information
Metadata
What can we do with the information?
Talking to Google
Google hacking
Advanced operators
Automating Google discovery
Web automation with Perl
Pulling information from Web sites
Working with metadata
Finding metadata
Document metadata
Metadata in media files
Putting it all together
Summary
Endnotes
CHAPTER 9 Exploitation scripting
Building exploits with Python
Getting software
Setting up debugging
Causing our first crash
Using pattern_offset
Controlling EIP
Adding shellcode
Getting our shell
Creating Metasploit Exploits
Starting a template
Porting the exploit code
Executing the exploit
Exploiting PHP scripts
Remote File Inclusion
Command execution vulnerabilities
Cross-Site Scripting
What is XSS?
Exploiting XSS
Summary
CHAPTER 10 Post-exploitation scripting
Why post-exploitation is important
Windows shell commands
User management
Gathering network information
Windows network information gathering
Linux network information gathering
Scripting Metasploit Meterpreter
Getting a shell
Building a basic script
Executing the script
Database post-exploitation
What is SQL injection?
MySQL
SQL injection on Microsoft SQL Server
Summary
Appendix
Index
