Book review: Practical Packet Analysis – Using Wireshark to solve real-world network problems

Networks​ are a dark art and to truly understand them you must practise by analysing packets. Like Harry and friends in Dumbledore’s Army found that book learning, classroom learning isn’t sufficient alone. This book, doesn’t get bogged down in the minutiae but uses walked through examples to teach directly. In fact, nearly two-thirds of the book is the examples and while SANS “Intrusion Detection In-Depth” (which I attended in 2011) provides more details the examples mean that this book is ‘practical’.

The first third of the book, race through the groundwork of what is Packet Analysis, the OSI model, types of Traffic, and what is a, and types of, Network Taps at a rapid pace. Moving quickly onto what is and why Wireshark. Then we have a Wireshark tutorial that is terse but covers all the main areas you will need. With online help and documentation being more update it is always a hard thing to balance but in this case I think the author has put just the right amount of ‘How to …’ to get the reader up and running with Wireshark without regurgitating a manual. Then we have a quick diversion into Packet Analysis on the Command Line using TShark and tcpdump.

The next few chapters, concentrate on Protocol looking at Network, Transport and some Common upper layer Protocols like:

  • ARP
  • IPv4
  • IPv6
  • ICMP
  • TCP
  • UDP
  • DHCP
  • DNS
  • HTTP
  • SMTP

All with worked through packet captures (available here).

The rest of the book is analysis of some Basic and Advanced Scenarios including:

  • Missing Web Content
  • Inconsistent Printer
  • Slow Network
  • Finding Malware

The book finishes with a discussion of sniffing Wireless Traffic.

This is the 3rd edition of the book and I wish I had known of its predecessors because it is rare that I have to slice and dice packets nowadays and having this will get me upto speed without the fumbling in the dark. The book is clear written and is both an easy read and valuable resource when you have to do Packet Analyse.

Book Review: Wicked Cool Shell Scripts

This book was a revelation a book with the subtitle ‘101 Scripts for Linux, OS X, and UNIX Systems’ doesn’t suggest a riveting read. However, I was so engrossed that my original plan to review the book, to read the first two sections and then pick a script out of the each of the next 14 to review went out of the window and I devoured the whole book.

101 Scripts for Linux, OS X, and UNIX Systems by Dave Taylor and Brandon Perry The authors (Dave Taylor and Brandon Perry) show a love and depth of knowledge of the subject bursts out of the page.

The book has 16 sections number from 0 to 15 that contain 101 example scripts (though for some reason the scripts aren’t Zero-based) plus 3 extra scripts in the Appendices. The introduction chapter 0 hooked me straight off with a section that I wish I had had months ago when my work spun up new machines that were configured differently to the old ones. Many hours of frustration could have been avoided had I read ‘Configuring Your Login Script‘ which contains the gem:

The login script will be .login, .profile, .bashrc or .bash_profile,
depending on your system. To find out which of these files is the 
login script, add a line like the following to each file:

echo this is .profile

My current day job has a variety of CLI tools written in Bash, Perl and Python. Previous to reading this book I wasn’t confident in modifying the old Bash scripts and would rewrite them in Perl or Python. Now I have more confidence and understanding.

Currently, I spend ~8 hours a day looking at a bash terminal on remote computers and am in the process of automating my work. Having this book by my side is making my life easier. With the port of Bash in Windows 10 more people will be wanting to know more about shell scripting and this is the perfect book to start.

Book Review: Python Crash Course

Book Cover

Python Crash Course:
A Hands-On, Project-Based Introduction To Programming

by Eric Matthes

no starch press
ISBN: 978-1-59327-603-4

no starch press is rapidly becoming one of my favourite tech publishers. This book is quiet long but there isn’t much fat to trim. To find ~500 pages of useful technical information is a very difficult thing to do and yet Eric and his editors have managed it.

This book is based on Python 3 but explains where Python 2.7 differs. The book is divided in to two parts:

  • Part I: Basics
  • Part II: Projects
    • Project I: Alien Invasion
    • Project II: Data Visualisation
    • Project III: Web Applications

Full Disclosure I have only read Part I and have skimmed Part II for this review. When I have time I will go through the second part and write the code.

In each topic the author starts small and slowly builds on that part to show how to build better code. From:

def greet_user():
"""Displaying a simple greeting."""
print("Hello!")

greet_user()

to:

def greet_user(username):
"""Displaying a simple greeting."""
print("Hello," + username.title() + "!")

greet_user(‘jesse’)

explaining each line as you go. The explanations are really clear and it is now my goto resource for explaining things when Stack Overflow is not clear.

Last week, I wrote my first Python class and though I have been playing with Python for a few years I had never understood when and where to use a class. Over the next few weeks I expect I will be referencing the book more as I will be building more programs in Python.

I would recommend this book if:

    • like me, you have had no formal training in Python or,
    • like me, you have not encountered Python 3 before
    • you have to do implement any of the projects!

Though the highest recommendation is that I will be lending it to my nephew as he has been doing some Python courses at University and this book would make a great addition for any science student because the future of much science is Data Analysis and Python is a great (free) tool for that.

Black Hat Python


Black Hat Python: ‘Python Programming for Hackers and Pentesters’ by Justin Seitz

This is a great follow-up to ‘Gray Hat Python’ from the same author. If you aren’t a Black Hat or Grey Hat don’t let the titles put you off as these books are for all hues of hatted security researchers. While the examples may espouse grey/black uses they are tools that can be set to defense as well as offense.

Knowing how to slice and dice network packets with Python has universal usage and seeing how to do it well will give you ideas to slice and dice other objects. A main theme of the book is that when you setup a quick and dirty environment then you may fine your favourite tools missing. Having the skill set to improvise with Python will be useful and for both attackers and defending point-of-views the Python scripts will have different hashes/identifiers. Malware checking for an VM will not know your scripts and similar for scanning software.

I find that though there are plenty of resources for finding examples: Stackoverflow, ActiveState etc. but having example scripts to:

  • replace Netcat
  • to SSH
  • sniff packets
  • hack HTML
  • create a keylogger
  • do privilege escalation

at your finger tips is useful too. More useful than the scripts is the methodology and explanations.

Write a script, harden it and test it. Repeat the process adding more parts until you have a finished program or stop when you have a good enough solution. Every section has a paragraph or two called ‘Kicking the tyres’ that explains the process.

I have never really been taught programming and hacking others code is how I learn. So for me and other like me having well written, well documented code like this in a easily digestible form is a godsend.

Keep Java updated! Erroneous information from BBC.

Over the weekend while trying to find programs to keep my children quiet I stumbled across one of the Click videos on terrestrial TV. I normally only ever watch these videos while stuck in a hotel but I had to re-find this episode to confirm what I thought I saw.

      Keep your browser — updated Check
      Keep Java updated — What!!
      Run antivirus software — Check

I agree with two out of three of the recommendations but ‘Keep Java Updated’ is equivalent to making tea in a chocolate teapot. Currently, security advice is to uninstall Java or at least disable it in the browser.

Oracle are currently patching Java quarterly and the number of zero days this year alone is larger than all other common software applications. Security messages are are to formulate because there are always codicils but in this case the path of least harm is to say:

UNINSTALL JAVA