Skip to main content


Showing posts from October, 2013

Serial Port Tricks

Bidirectional The Netcat program can shovel data bidirectionally to/from a serial port and over a network, which is very handy indeed. Set the serial port in raw mode and configure it: # stty -F /dev/ttyUSB0 raw # stty -F /dev/ttyUSB1 raw # stty -F /dev/ttyUSB0 19200 # stty -F /dev/ttyUSB1 19200 Set up a netcat listener that will send data to/from the one serial device: # nc -l 1234 < /dev/ttyUSB1 >/dev/ttyUSB1 Set up a netcat client that will send data to/from the other serial device: # nc listeneripaddress 1234 < /dev/ttyUSB0 >/dev/ttyUSB0 Unidirectional For debugging and scripting, you can also use ordinary cat, echo, head or even data definition to access the serial ports:   Send data one way only using the common kitty: # cat /dev/ttyUSB0 > /dev/ttyUSB1 Send a message out a port using echo: # echo Hello > /dev/ttyUSB0 Send data denoted as hexadecimal values and suppress the LF at the end of the line: # echo -en "\x12\x23\x45"

dBm to Watt

I tend to forget some of the values and is too lazy to calculate it. dBm to Watt Conversion Table dBm Watts dBm Watts dBm Watts 0 1.0 mW 16 40 mW 32 1.6 W 1 1.3 mW 17 50 mW 33 2.0 W 2 1.6 mW 18 63 mW 34 2.5 W 3 2.0 mW

The Philosopher's Cross

While touring through Europe, I could not fail to notice all the various styles of crosses displayed everywhere on countless steeples and memorials.  Most are obviously decorous, but one or two depictions struck me as being functional - with an engraved scale - but for what purpose? Driving around in the green countryside of Bavaria, I thought of the various English proverbs: Crossed, Double Crossed, Nailing a Philosopher to His Own Cross. That last one made me think - a Philosopher's Cross - hmm... Until medieval times, any learned man was called a philosopher and good philosophers learned pretty much everything there was to be learned.  The information explosion and the necessary specialization is a recent thing.  Ancient philosophers learned about astronomy and navigation, in addition to classic literature, logic and mathematics.  Navigational Aids Knowledge of navigation was essential in ancient times not only for navigating at sea where the only features are the nigh

Network Stress Testing

Stressing an Embedded Network Device Sometimes a new networked device behaves funny and you need to stress it to try and figure out where the bug is - firmware, hardware, software? If you feel like you need a big hammer to give the infernal device a good whack, then look no further - get nping , made by the friendly folks over at the nmap project. Get nping # yum install nmap While you are at it, you can also try another hammer called hping: # yum install hping3 Hammer it Now you can try hammering the device on its control port with good packets: $ nping -c 500000 --rate 10000 --tcp --data-length 1500 -g 2000 -p 2000   and with bad packets: $ nping -badsum-ip -c 500000 --rate 10000 --tcp --data-length 1500 -g 2000 -p 2000 And hopefully, that will cause the device to splutter and squeal and show you where the problem lies.  Even if it doesn't show you anything, hammering it will likely release some stress and make

Packet Sniffing

A Transparent Bridge It is sometimes necessary to capture packets on a network in order to see why a certain host or device is misbehaving. Depending on the setup, you could use Ettercap and ARP table spoofing to reroute interesting traffic to your test machine as described in another post, but usually it is best to physically insert the test machine between the unit under test and the ethernet switch as a transparent bridge and then capture or save the data using tcpdump or wireshark . If your test machine is a laptop computer, then it likely has only one ethernet port.  You can add a second one using either a cardbus or USB ethernet adaptor. Install the ethernet bridge utilities and create a transparent bridge br0 , then assign the two ethernet ports to it (find their names with ifconfig ). Building the Bridge Here is a bridge script that I used recently: #! /bin/bash echo Configure a transparent bridge for Wireshark or tcpdump. killall NetworkManager # Install ebtab