tisdag 19 januari 2016

To ssh via a socks tunnel:

ssh -o ProxyCommand='nc -x myproxyserver.example.com:1080 %h %p' \ targetsshserver.example.com
This can be used 

tisdag 30 september 2014

bash vulnerability test


env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

torsdag 10 juli 2014

Floating point numbers ...

Floating point numbers have some unexpected properties.

Try this in your favourite language (if it has real floats)

Python:
>>> print 0.1 + 0.2 == 0.3
False
 C:
#include <stdio.h>
int main() {  printf("%s\n", 0.1 + 0.2 == 0.3 ? "True" : "False");

$ gcc float.c -o float && ./float 
False 



fredag 4 juli 2014

Installing a specific branch of a python package with pip



pip install --user 'git+git://github.com/llvmpy/llvmpy@llvm-3.4'

onsdag 14 maj 2014

Parallela16 temperature

Reading the temperature for the Xilinx Zynq chip is done as described in http://forums.parallella.org/viewtopic.php?t=930

with


python -c "T=open('/sys/bus/iio/devices/iio:device0/in_temp0_raw').read(); T = (float(T) / 4096. * 503.975) - 273.15; print T"


tisdag 28 januari 2014

ARM debugging with Qemu and gdb

To set up a pty to capture the serial port info, use socat
socat -d -d pty  pty
which prints out which pty to connect Qemu's virtual serial port to, for instance /dev/pts/1, and the other pty, for instance /dev/pty/6, to which one may for instance attach a GNU Screen
screen /dev/pty/6
Now run Qemu
QEMU_AUDIO_DRV=none qemu-system-arm \
-cpu cortex-a15 -machine vexpress-a15 \
-kernel /tmp/vmlinuz-3.10 -append "earlyprintk console=tty1 console=ttyAMA0" \
-nographic \
-gdb tcp:localhost:1234 -S -serial /dev/pts/1

which tells Qemu to start a gdb-server at port 1234 and wait (-S) until a gdb server attaches.

Make sure to have a gdb configured for arm targets, compiled with
./configure --target=arm-linux-gnueabi
make
and run it.  Connect to the qemu gdb-server with
target remote :1234 
To see the machine code, type
C-x a
to enable the terminal interface that shows code cursor, and enable asm with
layout asm