Do: Extend your servicecheck function to receive a list of port/protocol (separated b check whether any open port is clo
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Do: Extend your servicecheck function to receive a list of port/protocol (separated b check whether any open port is clo
Example 192.168.10.133, 00:0c:29:bc:e8:3b, 135/tcp;139/tcp;445/tcp Building on the above code, your bash script will do the following For every line in input file, it first pings the IP, then checks to make sure that MAC address is valid, and then checks to make sure that ONLY the mentioned ports are open. This means to check that a port that should be open is not closed, and also any port that is not on the list is closed. It will report any other open port in the log file, in addition to the reports mentioned above. As always, your code must be commented out carefully. Respond: Make sure your code runs correctly. Try it with a bunch of inputs. Copy/paste your code in the following textbox. Also, copy/paste your test input file after that. Hint: To read from a file line by line, use the following code: input="/path/to/txt/file" while IFS= read -r line do echo "$line" done "$input"