Turning of a Laptop's LCD Screen + Timed Shutdown in Linux
This is a short one:
Just use this command to turn off your screen:
1 |
xset dpms force off |
This won't only blank it, but really turn it off (no background lighting).
I like to keep the shortcut on the Desktop, so I can turn listen to podcasts without the screen lighting my room at night :P
And for a timed shutdown, I simply use this:
1 |
sleep 3600 && shutdown -h now |
(this will wait for 3600 seconds (aka: 1 hour) and then shut the PC down)
Accessing Raw Partitions in Virtualbox
I just wanted to resize an NTFS partition in Linux just to realize, that gparted had some problems resizing. Maybeit was an unclean unmount or a necessary chkdisk session. who knows.
The solution I had in mind was to simply "mount"; the partition inside a Windows 7 VM running in Virtualbox. Giving Windows 7 raw access to the partition should enable it to do its Windows NTFS specific stuff and even resize the partition for me.
First of all: enable read/write operations on the partition for my "normal"; user (because this is where VirtualBox will get its privileges from)
1 |
$ sudo chmod 777 /dev/sda3 |
After that, simply use the "VBoxManage"; utility (pay attention to the capitalization) utility to create a vmdk file pointing to the partition:
1 |
VBoxManage internalcommands createrawvmdk -filename /ntfs.vmdk -rawdisk /dev/sda -partitions 3 -relative -register |
This will create a file called ntfs.vmdk (and a ntfs-pt.vmdk) that point to the /dev/sda3 partition (which is the NTFS partition in question) and register it within the virtualbox harddisk manager thingy
The resulting vmdk file will probably look something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
$ cat WinHD.vmdk # Disk DescriptorFile version=1 CID=108af78c parentCID=ffffffff createType="partitionedDevice" # Extent description RW 63 FLAT "WinHD-pt.vmdk" RW 157581522 ZERO RW 551109825 FLAT "/dev/sda3" RW 63 FLAT "WinHD-pt.vmdk" 63 RW 265377672 ZERO RW 63 FLAT "WinHD-pt.vmdk" 126 RW 2698857 ZERO RW 5103 ZERO # The disk Data Base #DDB ddb.virtualHWVersion = "4" ddb.adapterType="ide" ddb.geometry.cylinders="16383" ddb.geometry.heads="16" ddb.geometry.sectors="63" ddb.uuid.image="d22d1f60-8f49-4050-94b4-ac427899a2e2" ddb.uuid.parent="00000000-0000-0000-0000-000000000000" ddb.uuid.modification="70447f47-959f-4ccd-a9a3-a0c1b699dd85" ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000" ddb.geometry.biosCylinders="1024" ddb.geometry.biosHeads="255" ddb.geometry.biosSectors="63" |
Next thing to do: Then simply add the created new vmdk image to your VM in question. This can be done via GUI or on the commandline:
1 |
VBoxManage modifyvm win7 --hdb /home/marc/WinHD.vmdk |
After doing that, you should be able to simply boot your VM and have chkdsk/whatever do it's magic.
p.s. as usual: this could destroy your partitions yadda yadda yadda
ZFS Presentation ("Ultra Large Sites" Lecture)
I gave a talk on ZFS in the "ultra large sites"; lecture.
As this wasn't graded and I basically volunteered to do the talk, I didn't spent that much time on designing the slides (I did put a lot of LOLCats in there though!)
Here is the PDF
Presentation: Multimedia Codecs - Dirac
Just finished a presentation in a lecture called "Multimedia Codecs";.
The topic was the "dirac"; video codec, a wavelet based open-source, patent- and royalty-free CODEC developed by the BBC.
I presented the topic together with Clemens Kern and Benjamin Gutbrod
Here is the PDF file
And here is the embedded slideshow (minus the animations)
My CSM Study WS09/10
Ok, seeing as the new "these are the lectures that will be available"; PDF file just got released, I have already started planning:
Lecture | ECTS | Prof |
Agiles Projektmanagement und Coaching | 9 | Kretzschmar |
Verteilte Architekturen und Middleware | 3 | Kriha |
System Engineering und Management | 3 | Kriha |
Spezielle Themen mobiler Kommunikationssysteme | 3 | Maucher |
Mediensicherheit und Digital Rights Management | 6 | Schmitz |
==> 25 ECTS (should in theory be enough. I think I only need 23)
Fixing Old Blogposts Thanks to Rails
Ever since I moved to the new blogging engine, some of the older posts had destroyed markup (thanks to a wild mixture of markdown, smartypants, html, wordpress, …).
I could easily fix single posts (e.g. the "Pages";) by opening them in the admin interface and clicking the save button. Enki (my current blogging engine) would then interpret the imported markup-code and save a plain xhtml version to the database. This repairs most of the linebreak/newline stuff.
As I don't want to do that on each and every post by hand, I decided to use the rails console to do that work for me :)
The console script is found in the "script/"; folder of a rails project and can be started by simply issuing a:
"ruby /script/console production";
This will open up IRB, the interactive Ruby shell, with all classes belonding to my Rails app preloaded.
Let's first check how many posts we have
1 2 3 4 5 |
Loading production environment (Rails 2.3.2) >> Post.all.class => Array >> Post.all.size => 1012 |
Awesome, we now know how we can get an Array containing all of our model objects.
To know which methods to call for each of those objects, we can take a short look at the "Posts"; model and see things like these:
1 2 3 4 5 6 7 8 9 |
def minor_edit @minor_edit ||= "1" end [...] def apply_filter self.body_html = EnkiFormatter.format_as_xhtml(self.body) end |
Knowing that we are using a Rails app, there should also be a save() method provided by Active Record.
If we now combine all of those things together, we end up with a way to simply go though all the posts, marking it as a minor edit (otherwise they'd show up again in RSS I guess), running the filter function and saving it back to the database:
1 2 3 4 5 |
Post.all.each do |single_post| single_post.minor_edit single_post.apply_filter single_post.save end |
Done :)
Hacking the Noxon 90elf [UPDATE]
Today I bought a Noxon 90elf on ebay for the nice price of 60 Euros.
It's a decent WLAN/LAN Internet Radio that is able to play via UPNP or the usual streaming stuff.
It is pretty cheap compared to the Noxon iRadio which looks exactly the same but has 2 differences:
- The first 4 channels are preset to live soccer transmission stations
- There is a startup sound playing when turning on the device ("welcome to the blablabla soccer blabla";)
While I haven't received the device yet, as far as I've heard, this can be quite annoying and as a person who doesn't care all that much about soccer, I intend to change that.
My first preliminary findings:
- The firmware of the 90elf and the iRadio are similar in big parts of the Binary-Image
- The device seems to get the startup jingle from the internet:
$ strings TerraTec_NOXON_90elf_Firmware_6921.bcd | grep .mp3 | grep Start
- There are a bunch of strings dealing with the startup process
$ strings TerraTec_NOXON_90elf_Firmware_6921.bcd | grep StartUp Enable StartUp URL -> System reset needed /cfg/Application/StartUp StartUpURLEnabled Disable StartUp URL -> System reset needed /cfg/Application/StartUp StartUpURLEnabled /cfg/Application/StartUp StartUpURLEnabled
- Looking at the hex-dump, you can see that the protected presets are predefined in the firmware image:
[Presets Enabled 1 NumberOfEntries 10 [Entry0 Entry protected 0 ] [Entry1 Entry
protected 1 ] [Entry2 Entry protected 1 ] [Entry3 Entry protected 1 ] [Entry4 Entry protected 1 ] [Entry5 Entry protected 0 ] [Entry6 Entry protected 0 ] [Entry7 Entry protected 0 ] [Entry8 Entry protected 0 ] [Entry9 Entry protected 0 ] ]
Initial thoughts:
Things to try:
- some simple firmware patching COULD do the trick.
- At least the startup sound could be blocked by disabling the URL in my router
- The firmware images are really similar, maybe cross-flashing could work. Might have to change some hardware ID in the image though
- Find a JTAG port, this could be having an active debug console
----->
UPDATE 1 <------
It arrived and so far, I'm pretty happy with the device. It has a really decent sound for such a small speaker (even a built-in woofer). It also plays the MP3 files on the external harddisc which is attached to my Fritzbox. The Fritzbox acts as a UPNP Media Server in this context. (awesome!)
I wasn't able to flash a modified image.
To flash an image, you boot the box into a bootloader mode that simply connects to the WLAN and waits for an image file (TFTP? Maybe sniffing the traffic would be useful). Trying to upload a modified image file will result in an error message along the lines of "Not a valid bcd file";. I'll have to check if it's some javascript code that does the verification or if it's transfered over to the box and checked.
What DID work though: simply block gatekeeper.my-noxon.net (217.115.128.138) in my router. Sadly, my Fritzbox hasn't got a a real URL filter (or even IPtables accessable), so I had to set a new Route:
1 2 3 |
Network: 217.115.128.138 Subnet: 255.255.255.255 Gateway: 127.0.0.1 |
This will result in timeouts when accidentally pushing "Favourites"; or "90elf"; in the menu, but it WILL also stop the jingle from playing. It may even interfere with saving channels.
Next steps:
- trying to find the checksum and alter it (should be a standard MD(4/5)/SHA1/… Hash of the image file.
- opening up the fritzbox using freetz and enable specific URL redirects / blocking
----->
UPDATE 2 <------
Looked at the flashing process. The Wireshark dumps indicate that the firmware is actually transfered to the device and then checked for correctness
Here's a port scan with the device in "normal"; mode:
1 2 3 4 |
PORT STATE SERVICE 80/tcp open http 6666/tcp open irc 8080/tcp open http-proxy |
Port 8080 seems to be used for the child protection stuff (proxy)
In the "ready to flash, awaiting firmware"; mode:
1 2 |
PORT STATE SERVICE 80/tcp open http |
UPDATE 2:
There is a lot more information over at the comments of the mydealz product page and the computerbase boards with a description of how to crossflash the device to the noxon 2 firmware or simply remove the limitations of the 90elf one
DOS'ed
Markus pointed it out to me that my server showed some "Bad Gateway"; errors. I ssh'ed to it and interestingly, my server also behaved REALLY sluggishly.
Lookind at my access logs for marc-seeger.de, I can only assume sombody went crazy for my site:
[…]
87.78.224.179 – - [14/Jun/2009:23:32:26 +0200] "GET / HTTP/1.1"; 200 13851 "-"; "JoeDog/1.00 [en] (X11; I; Siege 2.69)";
87.78.224.179 – - [14/Jun/2009:23:32:26 +0200] "GET / HTTP/1.1"; 200 13851 "-"; "JoeDog/1.00 [en] (X11; I; Siege 2.69)";
87.78.224.179 – - [14/Jun/2009:23:32:28 +0200] "GET / HTTP/1.1"; 200 13851 "-"; "JoeDog/1.00 [en] (X11; I; Siege 2.69)";
87.78.224.179 – - [14/Jun/2009:23:32:30 +0200] "GET / HTTP/1.1"; 200 13851 "-"; "JoeDog/1.00 [en] (X11; I; Siege 2.69)";
87.78.224.179 – - [14/Jun/2009:23:32:33 +0200] "GET / HTTP/1.1"; 200 13851 "-"; "JoeDog/1.00 [en] (X11; I; Siege 2.69)";
87.78.224.179 – - [14/Jun/2009:23:32:34 +0200] "GET / HTTP/1.1"; 200 13851 "-"; "JoeDog/1.00 [en] (X11; I; Siege 2.69)";
87.78.224.179 – - [14/Jun/2009:23:32:35 +0200] "GET / HTTP/1.1"; 200 13851 "-"; "JoeDog/1.00 [en] (X11; I; Siege 2.69)";
[…]
The JoeDog / SIege User agent seems to be part of a sofware used for performance testing.
Seems to be a DOS attack :-/
Let's look at the amount of data already used:
1 2 |
cat logs/marc_seeger_de.access.log | grep JoeDog | wc -l 2203 |
Now let's look at the IP:
1 2 3 |
Host xdsl-87-78-224-179.netcologne.de Location DE, Germany City Troisdorf, 07 - |
I wrote an abuse mail and dediced to simply block the referer in nginx using:
1 2 3 |
if ($http_user_agent * JoeDog) { return 403; } |
This reminds me, I need to implement more caching. Maybe Rack:Cache
June Mashup Mix 09
I know, I know… it has been a bit silent over the last few weeks. While I simply don't feel like writing about anything in particular at the moment, I think we can at least do something about the silence :)
Here we go:
Track 1: DJ Reno – ACDC vs Assasin
While I don't like french in particular, I think their rap sounds kinda interesting :)
And you can never really go wrong with ACDC
Track 2: Divide & Kreate – Smells like Teen Spirit
Going a little bit more electric on this one, I like the combination with an all time classic like Nirvana.
Track 3: pomDeter – Ghostbusters Vs Eminem Eminembusters
80s Music and a white rapper, go figure… ;)
Track 4: Elocnep – I Believe It's Not Fair
Scissor Sisters, wheeee!
Track 5: The Cure vs. Robyn – Close To Konichiwa Bitches [A plus D]
I love the original by Robyn. Also, check out the lipsync by vegas
Track 6 tone396 – Fire In A Bottle
"Just a cast away, an island lost at sea, yo!";
Track 7: Survivor vs the Commitments The Midnight Tiger (By Fissunix)
We're starting the slow ones…
Track 8:
Viva la Beat it Pheugoo
And we're ending it on yet another slow one. Coldplay and Michael Jackson
p.s. if you happen to know me, you know what to do
Blogging Engine Switch: Wordpress (PHP) -> Enki (Rails)
I decided to switch from Wordpress to Enki. Basically because I didn’t like the security vulnerabilities wordpress seems to have in every friggin new version they release.
Feature-wise, wordpress has clearly a lot more to offer, but for my purposes, Enki should be fine.
Also: I am able to hack Enki as I know Ruby (don’t know any PHP).
To import my Wordpress Database to Enki, I wrote a script that can be found on github.
Design and bugfixes will follow :)
UPDATE:
Added the Simple Beauty theme.
Comments don’t seem to work yet. The code is fine, seems to be a passenger/webserver (nginx) problem. Stay tuned :)
UPDATE 2:
By switching from SQLite to MySQL, I fixed some permission problems with passenger/nginx and now comments should work :)
UPDATE 3:
added a lame spam protection ("what is 2 times 2";)
UPDATE 4:
removed lame spam protection and added recaptcha. Basically followed this blog post
UPDATE 5:
New Design