Working Notes: SEC335: Week 2 - eliminmax/cncs-journal GitHub Wiki
Week 2
Overview
Did Assignment 2.1 and Labs 2.1 and 2.2.
Assignment 2.1
Assignment 2.1 was unremarkable. While I removed my working notes from last semester, they're still in the Git history. My notes on Assignment 2.1 last semester were as follows:
Working Notes/Tech Journal for Activity 2.1 - Host Discovery
Not much to say about this one - it went smoothly.
Figuring out the fping command was very simple thanks to a quick reference to the tldr page - like a man page, but far shorter with only the most common use cases documented. I used the tldr command provided by the Debian package of the same name - the upstream repository is psibi/tldr-hs
The only things that I'd change are as follows:
- this semester, instead of reading the TLDR page, I simply looked at my screenshots from last semester.
- I'm now using the official python client for TLDR pages, at tldr-pages/tldr-python-client.
Lab 2.1
One of the things of note that I had to do during this lab was to somehow enhance the following script:
#!/bin/bash
hostfile=$1
portfile=$2
echo "host,port"
for host in $(cat $hostfile); do
for port in $(cat $portfile); do
timeout .1 bash -c "echo >/dev/tcp/$host/$port" 2>/dev/null &&
echo "$host,$port"
done
done
I decided to have a bit of fun with my improvement, creating an overengineered monstrosity of a script, which can be found here. (I'm linking to the version I uploaded in commit a31df7c, with the expectation that I'm going to update it to fix the xargs
issue mentioned in the next paragraph)
More time was spent debugging the script then on the rest of my work for this week, combined, and as I'm writing this, I realize I forgot a minor part - it depends on xargs
, but xargs
is not included in the dependency checking portion of the script. Not a big deal, but I'd rather my script fail right away with a clear error message than fail in the middle of things.