100km

At the end of this month they will stop running buses to where I live, it seems basic services aren't available to those that aren't quite rural enough. Preempting the hard switch over I started cycling to work this week.

Work is not close (hence the whole bus thing), at 20km a day commuting I have done the first 100km week of what will probably be many. Week one has seen two puncture from a hole in my tyre, hopefully I will have better luck next week.


Reading: The Difference Engine

3 Commands to bhyve

Get a vm image and decompress it:

$ fetch http://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/11.0-RELEASE/amd64/Latest/FreeBSD-11.0-RELEASE-amd64.raw.xz
$ xz -d FreeBSD-11.0-RELEASE-amd64.raw.xz

3 commands to FreeBSD runningin bhyve on FreeBSD:

# kldload vmm
# ifconfig tap0 create
# sh /usr/share/examples/bhyve/vmrun.sh -c 4 -m 1024M -t tap0 -d FreeBSD-11.0-RELEASE-amd64.raw test

Of course that misses out loads of stuff, the network won't work for one. Real instructions are in the handbook . Following in Hiren Panchasara's foot steps I am going to use bhyve to test and develop some network modification in FreeBSD.

I might try and automate the deployment a bit, so I can run a single command and have fresh vms on a configured network up and running. I suspect I will have to make some changes that involve rebuilding the whole world tree, if that is the case I will be trying to figure out how to get builds much much faster.


Reading: Gun Machine, The Difference Engine

UDP Options with Scapy

I am working on an implementation of the UDP Options draft at work, this morning I got the udp_input side of processing building. This needs to be test and gotten working before moving on, before setting up some VMs to test this I need a way to generate packets with UDP Option data appended.

This seemed like a great occasion to use go a little more. There is the gopacket library from google that provides raw packet stuff.

images/

I tried for ages to put together a send example that didn't depend on linux. Eventually I got to the point where I could form crazy malformed arp packets. I got to the point of generating the above traces in wireshark , for some reason go was sticking 16 bytes into the address fields and creating madness. You will note in the above arp packet that the length is much longer, that is because go is appending some extra data for shits and giggles.

Giving up on go I had a look at the python libraries for generating packets, they are all about the same level of insanity. The pathspider project has some test probes for UDP Options using scapy .

pathspider is a lot of stuff to pull in to generate UDP datagrams, I extracted out the relevant stuff to use with scapy directly:

from scapy.all import IP
from scapy.all import UDP 
from scapy.all import *

if __name__ == "__main__":

    ip = IP(src="139.133.204.4", dst="139.133.204.64")
    udp = UDP(sport=2600, dport=2600)

    pkt = ip/udp/"Hello world"

    pkt.getlayer(1).len = len(pkt.getlayer(1)) #force UDP len
    send((pkt/"\x01\x01\x01\x00"))

You can add the numbers together to find that the extra option space is include, you can also see the 01 01 01 00 bytes at the end of the packet which are the options I add.


Reading: Gun Machine, The Difference Engine

Dewatering a pdf

There is this pdf ebook that I want to read, but it has a really annoying 'DRAFT' water mark on every page. I looked for an automatic way to remove the watermark and found a really handly superuser answer that completely covers it.

$ pdftk original.pdf output uncompressed.pdf uncompress 
$ sed -e "s/watermarktextstring/ /" uncompressed.pdf > unwatermarked.pdf
$ pdftk unwatermarked.pdf output fixed.pdf compress

Before I ran that I tried grepping through the pdf for the string 'DRAFT', now the pdf was compressed so I didn't find anything. I wanted to make sure the watermark was just a string so I extract just the first page with pdfseperate .

$ pdfseparate -f 1 -l 1 ipv6_for_ipv4_experts_en_a4.pdf out.pdf

I opened out.pdf with inkscape and played with editing the watermark, which was indeed just text. I then round tripped the pdf through pdftk and generated a watermark free pdf.


Reading: Gun Machine, The Difference Engine

GSM CellID

With installing my new desktop I am also going to move my 4G modem. I wanted to get some signal strength numbers so I could be sure I wasn't completely ruining things for myself. My router has a hand status page that among sensitive private information has signal strength, SNR and noise numbers.

On that page there is also a CELL_ID field. The field is the unique network id of the base station you are connected to. This is apparently useful for location lookups, the wikipedia page has a list of databases that use this field.

I tried to feed my CELL_ID into some of these databases, but they all wanted more information. MCC and MCN are pretty easy to find, there is a big table on the wikipedia page . I was not able to resolve down a LAC from anywhere. There are apps I could try, but I don't really want to install any of them on my phone.


Reading: Gun Machine, The Difference Engine