Hi guys, we are back to the series of Cybersecurity Ops with Bash: Defensive workshop solution.
Note: This is only workshop solution, NOT A SUMMARY OF DEFENSIVE BASH!!! I do not own the book, I am just reading/learning it and published the solution ONLY.
Before you read the workshop solution, it is good if you have read the Defensive chapter of the book, so it gives you an idea what the chapter is about.
Chapter 9
- When comparing two scan files, account for files of different lengths or with a different set of IP addresses/hostnames.
Comparing the file, I will take the easy route which is comparing the length of the 2 files.
Using wc command to count the number of lines in the file to determine the difference in length of the 2 files. - Use /dev/tcp to create a rudimentary Simple Mail Transfer Protocol (SMTP) client so the script does not need the mail command.
I didn’t really use /dev/tcp, what I really did was to use ssmtp command to send the email to the intended receiver.
Hope you have a nice day and that this solution will help you in the journey of bash scripting.
Author: Derek