29c3 day1

image0 image1 image2 image3 image4 image5 image6 image7 image8 image9 image10 image11 image12 image13 image14 image15 image16 image17 image18 image19 image20 image21 image22 image23 image24 image25 image26 image27 image28 image29 image30 image31 image32 image33 image34 image35 image36 image37 image38 image39 image40 image41

29c3 day0

image0 image1 image2 image3 image4 image5 image6 image7

I bought a book

I bought a book I didn't read before. On the Internet. Paying person I don't personally know, basing on his reputation only. Believing he would send me a paper copy of his words from the remote land I've never even visited. On the other hand he trusted me to write this review and gave me the discount for the very fact. And yet everything worked out pretty well. I transferred the money, got the book, read it and I'm writing the promised review right now. How is that possible ? How does people trust each other in this "trust no one" place of the 'nets ? Liars and Outliers try to answer that questions. Is this a good read, breathtaking one ? No, I sometimes struggled to get through. Does it need to be so intriguing though ? Also no. It is a solid collection of examples on how does the trust work in our societies and where it did all come from. It tries to categorize the situations in which trusting is needed and provides a look into how such can be exploited by some. If you are even somewhat interested in the cogs moving the society, this book might make some of your implicit, intuitive knowledge into explicit one.

How to build minimalistic REST server in .Net

Install "Microsoft ASP.NET Web API Self Host" and all of its dependencies via NuGet.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.SelfHost;

namespace resttest
    public class ExampleData { public int Id { get; set; } }

    public class ExampleController : ApiController
        // /api/job
        public IEnumerable<ExampleData> Get()
            return new List<ExampleData>()
                new ExampleData(){ Id = 2 },
                new ExampleData(){ Id = 4 }

        // /api/job/3
        public ExampleData Get(int id)
            return new ExampleData() { Id = 3 };


    class Program
        static void Main(string[] args)
            var configuration = new HttpSelfHostConfiguration("http://localhost:1337");
            //Setup the routes
                name: "DefaultApiRoute",
                routeTemplate: "api/{controller}/{id}",
                defaults: new
                    { controller = "ExampleController", id = RouteParameter.Optional }
            var server = new HttpSelfHostServer(configuration);

            Console.Out.WriteLine("Press ESC to quit");
                while (!Console.KeyAvailable)
            } while (Console.ReadKey(true).Key != ConsoleKey.Escape);

We can launch it and query it using any http-enabled client:

$ curl http://localhost:1337/api/Example [{"Id":2},{"Id":4}]

C'est volia

Boosting your WiFi signal with cooking utensils

I love cooking and well made utensils. That is a part of the solution. And the problem ? Boosting WiFi signal. Get WiFi USB dongle and put it where the bowl's focal point is. Or near it, wherever you get strongest signal boost. I get up to 2x stronger reception with the antenna presented.


Enabling wireless on Dell Latitude 2110 under CrunchBang Linux

Some time ago I got my hands on CrunchBang Linux distro, which is great. Like really. Try it. The only annoying thing is missing proper wireless driver for my Broadcom BCM43224 WiFi card. But I'm used to it, as many Linux distros do not provide it. Or even worse, provide broken driver from somewhere in between b43/brcm80211 drivers snafu. As I happen to know from my Fedora experiences that it is resolved in kernel version 3.4 . Also as that kernel tends to be generally faster on my machine, I decided to compile just this one. Here you are. Vanilla 3.4.4 kernel, compiled for Intel Atom and with BCM43224 support. This is a 64bit kernel. Download `crunchbanglinux-kernel-3.4.4-intel\_atom.tar.bz2 <>`__ and:

dpkg --remove firmware-linux
dpkg --remove firmware-linux-nonfree
tar jxf crunchbanglinux-kernel-3.4.4-intel_atom.tar.bz2
cd linux-3.4.4-intel_atom/
dpkg -i *.deb

Should work for Debian Squeeze also but not tested on that system. Write me if you'd like it compiled any other way, e.g. for another processor.

Docutils System Messages

System Message: ERROR/3 (<string>); backlink

Anonymous hyperlink mismatch: 1 references but 0 targets. See "backrefs" attribute for IDs.

Bitcoin wallet recovery using Photorec

Ever cried over damaged disk holding your bitcoin wallet ? Ever formatted storage holding a perfectly valid and the only copy of your wallet.dat ? Yes, me too. Well, there's Photorec, opensource file recovery software. It just skips the partition and filesystem info and scans for plain file signatures on the disk. Unfortunately it does not recognize Bitcoin's Wallet as a file format. Bitcoin wiki states that wallet.dat is just a good old BerkeleyDB. Just let me check that with the famous file command:

[cyryl@uglybook ~]$ file .bitcoin/wallet.dat
.bitcoin/wallet.dat: Berkeley DB (Btree, version 9, native byte-order)

That is right. Photorec however, has its own file-type detection magic, for the reason unknown to me. Let's see whether it works on the wallet.

[cyryl@uglybook ~]$ fidentify .bitcoin/wallet.dat
.bitcoin/wallet.dat: unknown

Uhoh. Do not abandon hope for not all is lost ! Photorec provides a way for you to add custom signatures. The only missing ingredient appears to be the knowledge of file. Just check your linux installation for file's detection signatures. On my system these are to be found under /usr/share/misc/magic We need file extensions, offset and some magic number for Photorec to work. Well, extension is .dat, magics and offsets are stored in the file mentioned above. Translate offsets from decimal-based to hexs and take care of endianess et volia

[cyryl@uglybook ~]# cat .photorec.sig
dat 0x0 0x00061561
dat 0x0 0x61150600
dat 0x0 0x00053162
dat 0x0 0x62310500
dat 0xc 0x00061561
dat 0xc 0x61150600
dat 0xc 0x00053162
dat 0xc 0x62310500
dat 0xc 0x00042253
dat 0xc 0x53220400
dat 0xc 0x00040988
dat 0xc 0x88090400

That is it. Happy wallet recovery.

Disassembling Pioneer SE-50 headphones

Today's story is a photostory ! Here's how to disassemble Pioneer SE-50 headphones, as I found this task quite difficult, mainly because no info available on the internet on how to open the can from the back. As you can see Pioneer signs on the side of each can are removable. Take them off to uncover the screws. Research made possible by kabanosy - best multitool ever. Some more info on the headphones: Manual scan Produced between '68 and '72 Two speakers per can ! Photos taken after replacing the cable and before pots rejuvenation.

See the gallery

Configuring Tor non-exit relay

I'm for privacy. I'm for cryptography. I do provide Tor relays for the good of all people. Here's how to configure a classic non-exit Tor relay on your machine. In my case I got it running on the VPS server, with 2 IP addresses and some bandwidth quota applied. I wanted the Tor traffic to be easily recognizable from outside as different from the 'normal' traffic coming from my server. Second requirement was to make Tor not use my whole traffic quota up. Here's my config, with some notes

cyryl@serv:~$ cat /etc/tor/torrc
SocksPort 0 # what port to open for local application connections
SocksListenAddress # accept connections only from localhost
RunAsDaemon 1

DataDirectory /var/lib/tor

ORPort 9001 #switches Tor to server mode
ORListenAddress tor.cyplo.net
OutboundBindAddress #what IP address use to direct the outbound traffic
Nickname cyplonet
Address tor.cyplo.net
ExitPolicy reject *:* # no exits allowed
AccountingStart day 09:00
AccountingMax 2 GB

MyFamily cyplonethome, cyplonet

Ubuntu 11.10 Beta1

What do I think ? Easy to install, hard to disable Unity, some programs crash sometimes and some things are weird. Despite that I have the faith in the Ubuntu guys that the system would be ready when 11.10 comes.
As whining itself never got anybody anywhere, I've reported all of these here:

I've even got one OOPS. However, since I'm writing this post under 11.10, it seems usable, even the OOPS was not of disturbance as it got nice GUI window displayed and no system crash then.