Practical applications and best practices
This section will further solidify your understanding of parallel processing in Bash by showing practical applications. This will be followed by best practices to help you get the most out of learning these concepts.
Practical applications of Bash parallel processing
In this section, we will use examples to show the real-world usage of Bash parallel processing in pentesting.
The first example uses GNU parallel for SQL injection testing, as shown in the following code:
#!/usr/bin/env bash urls=("http://example.com/login.php" "http://test.com/index.php" "http://site.com/search.php") echo "${urls[@]}" | parallel -j 3 'sqlmap -u {} --batch --crawl=2' echo "All SQL injection tests completed."
The code can be found in the book’s GitHub repository as ch07_parallel_2.sh
. Here’s an explanation:
urls
is an array of URLs to testecho "${urls[@]}"...