Substitution of Arrays in Bash

2015-02-25 by rem0te
Recently, I ran into a problem while writing a bigger bash script.

I planned to create a function that, when called, printed the content of an array from a starting number to an end number, but with the ability to choose from which array this would happen.

Here is the solution:

function print_list() {

while [ $var_start -le $var_stop ]; do
let var_start=var_start+1

# Strip last comma

echo "${output}"



$(print_list array_users 1 3)
# Output: dau2,dau3,dau4

$(print_list array_computers 0 1)
# Output: pc1,pc2

You might want to include a check that the array length is not smaller than var_stop and var_stop >= var_start.
Happy Hacking

Flipping the screen on a Thinkpad Helix

2014-09-15 by rem0te, tagged as fyi, linux
After a short struggel with I managed to flip the screen and touch input on my Thinkpad Helix, using the wacom driver and Xubuntu Linux. This will also enable multitouch support without all too much fiddeling with

:~# xinput
Virtual core pointer id=2 [master pointer (3)]
Virtual core XTEST pointer id=4 [slave pointer (2)]
Atmel Atmel maXTouch Digitizer touch id=10 [slave pointer (2)]
SynPS/2 Synaptics TouchPad id=12 [slave pointer (2)]
TPPS/2 IBM TrackPoint id=14 [slave pointer (2)]

The device we are looking for is the Atmel maXTouch Digitizer. Since Ubuntu detects the Pen as a wacom input in the first place, there should be a file called /usr/share/X11/xorg.conf.d/50-wacom.conf. Open it with an editor of your choice - and with that I mean vi. Add the device to the "MatchProduct" line.

Section "InputClass"
Identifier "Wacom class"
MatchProduct "Wacom|WACOM|Hanwang|PTK-540WL|ISD-V4|Atmel Atmel maXTouch Digitizer"
MatchDevicePath "/dev/input/event*"
Driver "wacom"

Once you have done that, safe the file and restart your X server. It works when the screen shows up in the device list.

:~$ xsetwacom --list
Atmel Atmel maXTouch Digitizer touch id: 10 type: TOUCH

You can download my screen rotation script here.

Results may vary

2014-09-02 by rem0te, tagged as stuff

To whom it may concern:
I am currently rewriting the css files and create new graphics to customize the theme. The blog may look different from time to time until I am done with it.

Some bonus points, some golden coints...

2014-08-25 by rem0te, tagged as arcade, project
Last week a person in the Z9, the house the CCC Hamburg is currently located in, approached me and a two fellow members. Someone moved out of a room in the third floor of the building and left some IT Equipment behind, including a IBM Model M keyboard (the Browning M2 of the keyboards), some old apple cases and a perfectly fine 42U, 106/80 Rack.

Being definitely interested in it, we decided to move the serverrack down into our hackerspace and later use it to house the hardware (TAL/TAE equipment, routers and switches) for the whole building. While maneuvering the rack through the hallways on the third level, we came across some piles of junk, parked bikes and other stuff that occupied nearly half the corridors width. Our contact walked to up us and just as we passed the bottleneck, she asked whether we would also be interested in "this thing", pointing at an old arcade cabinet between the junk.

"MINE!". Thats what I shouted instinctively, raising my hand. After we successfully moved the serverrack into our rooms, I managed to free the arcade, took a brief look at it and decided to move it down as well. After some struggle we realized that those arcades had two small wheels attached to their backside, so you could flip them over and push them around easily. Sadly because of its age - a 1980 italien model - and a variety of previous owners that didn't seem to care all too much about it, those wheels were barely usable. With combined powers the three of us finally pushed the cabinet into the hackerspace.

The next day was busy and I came in late to check the machine and transport it to my place. Sadly the internal systems weren't working, so I decided to remove the screen and fix the machine, using an emulator and todays hardware. This was also necessary to ensure a safe transport between the hackerspace and my place since the screen turned out to be 1/3 of the machines total weight. Once the rusty screws were removed and the wires cut, I transported the cabinet to my car.

Theory: Arcade 170x64x72cm, space in the car 150x120x70.
Practice: The damn car is shaped in a way that only 2/3 of the machine fitted in.

I was aware that my loading space was too small to properly transport the machine but in Germany you can go around with your boot lid open when the oversized cargo is safely towed to prevent it from moving, lid by night and marked with a red reflector when a certain length is exceeded. I managed to bring the baby home, unload it with some help and was finally able to take a sharp look at all the internals. The wooden frame is tough and has some minor scratches that won't bee too hard to fix. The side panels are plain white and therefore unusual for an old arcade. Somebody also scratched the white paint and wrote on it, using a marker. Parts of the original artwork are still in a perfect condition, as well as the glass, covering the screen opening. There are four buttons and a joystick that is sadly limited to one axis, so playing most 'modern' arcade games would be impossible. A mono speaker is located in the ceiling above the screen and a money slot on the bottom.

The plan is now:
- Remove every part of the old technique, including the money slot door.
- Repaint the sides using an 8 Bit pattern on a black background. I still haven't decided what exactly I want there.
- The small door to the money slot is removed. The plan is to put some plexiglas in its place and either place the mainboard and technique in it, or a small diorama with videogame heros, matching the machines painted theme.
- The mono speaker rocks but can't be used with todays technique, so I need to replace with a new one.
- An old 17'' CRT screen from a friend will replace the old monster.
- The buttons will be connected to the platine of a USB game controller or a MaKey MaKey to make them work. The joystick will be removed and replaced by a new USB model.

Operation in progress.

Why external harddisks with hardware encryption suck

2014-08-22 by rem0te
A friend of mine asked me recently to give him an opinion on an external harddisk. This is usually not a problem but I eventually ended up in explaining why using a harddisk with a keypad that encrypts the disk after receiving a code is a bad idea.

First of all: It's not a open standard. Without seeing some actual code you won't be able to tell wether this thing does the job it was designed to do the way it was advertised. It could use a simple XOR instead of AES-256 without you noticing it.

Also you can't tell if you can ever decrypt the device again, when the hardware - in this case a keypad and a crappy controller under it - are broken and might risk to loose personal data on a large scale. But you have a backup, right? Right.

But the most important reason to not use those devices is that they actually suck when it comes to generate some entropy. Aluc talked about the same issue with commercial home routers that are unable to generate enough "real" entropy because they lack physical components like a fan. Of course is a harddisk itself a perfectly fine source for some random numbers. It has a motor, an I/O rate, voltage and other sources you can collect data from. But in this particular case I can't see the software they are using, nor can I see where they get their number from, risking that the encryption is worthless due to bad entropy, a crappy implementation or worse a static key or a key that is directly generated from the password.

If you are in need of a mobile harddisk with encryption you might want to use LVS, encrypt a partition and place all the tools for opening it on a FAT16 partition so you can access it from any other operationsystem.



2014-08-21 by rem0te
It has been a while since I closed my old blog for various personal reasons. Ever since I didn't had the time or passion to properly set up a new system for myself nor did I had anything to write about that won't fit in the 140 character limit on Twitter.

But things and some people around me have changed this opinion. Within the last four years I discovered some new hobbies and started projects that I would like to share with you. Some fo those things will be not safe for work, some things will not be safe for anyone and as always: Don't copy code from a webblog on the interwebz. Especially not if it's for the linux shell. Especially not from this particular blog.

Happy hacking,