Quick ones
Motorcycling
The riding season is open, last thursday I got my bike back from the shop where they were installing side panniers, friday and saturday I made some shortish rides (It's cold and my weatherproof riding pants are undergoing maintenance [re-proofing etc]) then the weather got sour and I spent my easter playing God of War in stead. Anyways if weather is not intolerable I ride to work.
Linux tips & tricks
The main reason to write this entry is not to forget I nifty thing I finally figured how to do with NetCat, in debugging the new SyncML connector for OpenPSA 2 we need to see what the device and server are really sending each other, NetCat is the obvious choice but making a logging proxy with it is not as simple as one might think at first (the first time I tried to figure it out by myself I didn't succeed).
Anyways here is a shell script to set a logging proxy up (some ideas blatantly ripped from NetCat tutorial here (use tail -F inflow outflow [preferably in another window] to view the traffic after starting the proxy):
#!/bin/bash
FROMPORT=8081;
TOPORT=8080;
TOHOST=localhost;
mknod backpipe p
STATUS=0;
while [ $STATUS -eq 0 ];
do
echo "$FROMPORT -> $TOHOST:$TOPORT"
nc -l -p $FROMPORT 0<backpipe | tee -a inflow | nc $TOHOST $TOPORT | tee -a outflow 1>backpipe
STATUS=$?;
done
rm backpipe
We use the mknod to create a FIFO we can use to pass data between the tees and NetCats (at first I also tried with pipes but soon realized that they are uni-directional and thus do not work for this), use ctrl-c to exit the loop (also happens if NetCat terminates abnormally), the FIFO is cleared then but the inflow and outflow logs are left in place.
Update, this can of course be adapted to SSL/TLS services as well using stunnel, the one below makes local plaintext socket and connects to remote SSL/TLS service (in the example case LDAP)
#!/bin/bash
FROMPORT=389;
TOPORT=636;
TOHOST=;
mknod backpipe p
STATUS=0;
while [ $STATUS -eq 0 ];
do
echo "$FROMPORT -> $TOHOST:$TOPORT"
nc -l -p $FROMPORT 0<backpipe | tee -a inflow | stunnel -c -r $TOHOST:$TOPORT | tee -a outflow 1>backpipe
STATUS=$?;
done
rm backpipe
Converting this the other way around (listening on local secure socket and connecting to remote plaintext service) is left as an exercise to the reader (hint: use -d instead -c and switch the command places, then you still need to configure the certificate, see stunnel manual)
Electronics
I've also been playing around with this GPS datalogger on my spare time, trying to get it to work with any serial NMEA source, so far the "easy ways" have been shown not to work, next I need to try a MAX232/233 based solution for changing the signalling from RS232 to 3.3V TTL (I sure hope I have not friend the corresponding input pins on the controller with my earlier experiments but I live in the belief that if something would be fried it would be the whole uC).
I also have some ideas on improving the firmware of the same (check it out, it's dead simple, even for my very limited "may understand what he reads" C skills), but first I need to figure out how to compile (this should be doable with GNU gcc) my changes and then flash (in circuit, this is the hard part) them onto the chip, without paying trough the nose for "professional" tools.