<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2367798662337577860</id><updated>2011-04-21T10:42:06.231-07:00</updated><category term='mac os x'/><category term='reverse engineering'/><category term='dashboard'/><category term='api'/><category term='ordbogen.com'/><category term='dansk engelsk'/><title type='text'>This geek</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thisgeek.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2367798662337577860/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://thisgeek.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ralle</name><uri>http://www.blogger.com/profile/02443770236713120307</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2367798662337577860.post-8986287187812631293</id><published>2009-01-04T07:28:00.001-08:00</published><updated>2009-01-04T07:33:49.514-08:00</updated><title type='text'>Which phone provider to choose from</title><content type='html'>I live in Denmark and when the iPhone 3G came out there, you only (legally) had one choice of phone provider. A company called telia which has the worst 3g coverage of all the companies. It also costs 100$ (600 DKK) per month to have which is quite a lot. After the first 6 months you start to pay 67$ (400 DKK) but I am looking out for other providers.&lt;br /&gt;I have looked at https://www.bibob.dk/ which has very phone calls and text messages but 1 MB costs 17 USD cents (1 DKK). So I am currently checking out to see how many MBs I use when I browse the internet one hour using PdaNet on my jailbroken iPhone. I am writing this blogpost while waiting that hour.&lt;br /&gt;The company that provides the best 3G coverage in Denmark is soon going to make an offer for all the iPhone owners and I am very excited about what they will provide and at what cost.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2367798662337577860-8986287187812631293?l=thisgeek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thisgeek.blogspot.com/feeds/8986287187812631293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thisgeek.blogspot.com/2009/01/which-phone-provider-to-choose-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2367798662337577860/posts/default/8986287187812631293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2367798662337577860/posts/default/8986287187812631293'/><link rel='alternate' type='text/html' href='http://thisgeek.blogspot.com/2009/01/which-phone-provider-to-choose-from.html' title='Which phone provider to choose from'/><author><name>Ralle</name><uri>http://www.blogger.com/profile/02443770236713120307</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2367798662337577860.post-3587413577786661886</id><published>2009-01-01T12:37:00.000-08:00</published><updated>2009-01-01T12:49:59.766-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='api'/><category scheme='http://www.blogger.com/atom/ns#' term='ordbogen.com'/><category scheme='http://www.blogger.com/atom/ns#' term='mac os x'/><category scheme='http://www.blogger.com/atom/ns#' term='reverse engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='dashboard'/><category scheme='http://www.blogger.com/atom/ns#' term='dansk engelsk'/><title type='text'>Reverse engineering a nonpublic API</title><content type='html'>I have been a user of &lt;a title="Ordbogen.com" href="http://www.ordbogen.com"&gt;ordbogen.com&lt;/a&gt; for quite a while. For those who don't know what it is, it's an online dictionary that is not free, however it's the best one yet, supporting danish (my main language). The site has a quick word translate widget for Windows, but nothing for Mac OS X which has been bothering me for some time.&lt;br /&gt;&lt;br /&gt;Recently I learned how to develope widgets for Mac OS X and I wanted to make my own ordbogen.com widget. I emailed their staff asking for an API, however they couldn't really help except for giving me ideas (sounds like they are not against the idea either). So I started brainstorming.&lt;br /&gt;I came to the thought that there must be some way to find out what the Windows Widget did, to get its information. I was certain that the information was at ordbogen.com itself so I found out what to do.&lt;br /&gt;I wanted to know the link, which the program accessed so I figured I could modify my hosts file, stored in C:\Windows\System32\drivers\etc\hosts . This file allows you to tie IPs to hostnames. So I tied ordbogen.com to 127.0.0.1 (localhost) which means that the program will try to access the webserver on my local computer, instead of ordbogen.com's own webserver.&lt;br /&gt;&lt;pre&gt;127.0.0.1       ordbogen.com&lt;br /&gt;127.0.0.1       www.ordbogen.com&lt;/pre&gt;&lt;br /&gt;I needed to catch the program's intentions, so I installed &lt;a title="Wampserver" href="http://www.wampserver.com/en/index.php"&gt;WAMP&lt;/a&gt; which means Windows+Apache+MySQL+PHP. Which is the most common website setup. So now the program will connect to my webserver.&lt;br /&gt;Since I did not know where on the webserver, the program wanted acccess, I had to catch it in any case, so I enabled mod_rewrite on the server, and added a .htaccess file with the following contents:&lt;br /&gt;&lt;pre&gt;RewriteEngine On&lt;br /&gt;RewriteCond %{REQUEST_URI} !=/test.php [NC]&lt;br /&gt;RewriteRule  ^(.*)$ /test.php?file=$1&lt;/pre&gt;&lt;br /&gt;which basically tells the webserver that whatever page is requested, will be sent to my test.php file, which then would log what the program had to say. So I made my test.php file:&lt;br /&gt;&lt;pre&gt;&amp;lt;?php// start output&lt;br /&gt;ob_start();&lt;br /&gt;// print everything form-posted&lt;br /&gt;echo "Post ";&lt;br /&gt;print_r($_POST);&lt;br /&gt;echo "\n";&lt;br /&gt;// print everything in-url posted&lt;br /&gt;echo "Get ";&lt;br /&gt;print_r($_GET);&lt;br /&gt;echo "\n";&lt;br /&gt;// get everything outputted&lt;br /&gt;$d = ob_get_contents();&lt;br /&gt;// clean output&lt;br /&gt;ob_end_clean();&lt;br /&gt;// start logging&lt;br /&gt;$saved = false;&lt;br /&gt;$n = 0;&lt;br /&gt;while($saved == false) {&lt;br /&gt;    $n++;&lt;br /&gt;    $name = 'log_'.$n.'.txt';&lt;br /&gt;    if(!file_exists($name)) {&lt;br /&gt;        file_put_contents($name,$d);&lt;br /&gt;        $saved = true;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;/pre&gt;&lt;br /&gt;To understand the code, read the comments (//) in the code. This file just logs everything you tell it.&lt;br /&gt;&lt;br /&gt;I then opened the ordbogen.com program and instantly a new logfile was created, containing the following contents:&lt;br /&gt;&lt;pre&gt;Post Array&lt;br /&gt;(&lt;br /&gt;    [username] =&amp;gt; MyUsername&lt;br /&gt;    [password] =&amp;gt; MyPassword&lt;br /&gt;    [key] =&amp;gt;&lt;br /&gt;)&lt;br /&gt;Get Array&lt;br /&gt;(&lt;br /&gt;    [file] =&amp;gt; plus/login3.php&lt;br /&gt;)&lt;/pre&gt;&lt;br /&gt;This told me everything I needed to know. The program sends the username and password I had defined in the settings of the program, and sent it to ordbogen.com/plus/login3.php&lt;br /&gt;The program then gave me an error, saying that it was missing a header, so I installed &lt;a title="Live HTTP Headers" href="http://livehttpheaders.mozdev.org/"&gt;Live HTTP Headers&lt;/a&gt; in FireFox to see which headers the website sent when logging in, but first I had to fake the login myself. So I created a HTML form to connect to login3.php :&lt;br /&gt;&lt;pre&gt;&amp;lt;form method="POST" action="http://www.ordbogen.com/plus/login3.php"&amp;gt;&amp;lt;input type="text" name="username" /&amp;gt;&lt;br /&gt;&amp;lt;input type="password" name="password" /&amp;gt;&lt;br /&gt;&amp;lt;input type="submit" value="Login" /&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;/pre&gt;&lt;br /&gt;I read through the headers and found this:&lt;br /&gt;&lt;pre&gt;Set-Cookie: PHPSESSID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (removed for security)&lt;/pre&gt;&lt;br /&gt;This is the header that tells you to basically know that you are logged in, which is what the program wanted to know.&lt;br /&gt;So I just added session_start() to my test.php file and the program didn't complain anymore.&lt;br /&gt;&lt;br /&gt;Now I needed to know what to do next, when I pressed "Login" on my little form I got the following details:&lt;br /&gt;&lt;pre&gt;00x######## (I hid the numbers cause I didn't want to reveal my account)&lt;br /&gt;http://www.ordbogen.com/kundecenter/program/ordbogen-1.5.2.10.exe&lt;br /&gt;daen=- Dansk-Engelsk&lt;br /&gt;enda=- Engelsk-Dansk&lt;br /&gt;a000=Auto. Dansk/Engelsk&lt;br /&gt;dasp=- Dansk-Spansk&lt;br /&gt;ddno=- Den Danske Netordbog&lt;br /&gt;dase=- Dansk-Svensk&lt;br /&gt;auto=Automatisk&lt;/pre&gt;&lt;br /&gt;This just tells you what dictionaries you have permission to use. So I edited my test.php file and added this:&lt;br /&gt;&lt;pre&gt;if(isset($_POST['username'])) {&lt;br /&gt;    session_start();&lt;br /&gt;    echo '0&lt;br /&gt;0x########&lt;br /&gt;http://www.ordbogen.com/kundecenter/program/ordbogen-1.5.2.10.exe&lt;br /&gt;daen=- Dansk-Engelsk&lt;br /&gt;enda=- Engelsk-Dansk&lt;br /&gt;a000=Auto. Dansk/Engelsk&lt;br /&gt;dasp=- Dansk-Spansk&lt;br /&gt;ddno=- Den Danske Netordbog&lt;br /&gt;dase=- Dansk-Svensk&lt;br /&gt;auto=Automatisk';&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;This will be the response, when the program logs on to my fake server.&lt;br /&gt;&lt;br /&gt;So now, I wanted to know what the program wanted to do next, so I restarted the program, it logged in successfully (my fake server didn't check passwords, so it's easy to remember the login) and then I typed in a word to look up in the dictionary, and instantly a new log file appeared in my web root:&lt;br /&gt;&lt;pre&gt;Post Array&lt;br /&gt;(&lt;br /&gt;    [dict] =&amp;gt; daen (danish -&amp;gt; english)&lt;br /&gt;    [word] =&amp;gt; words (what I entered)&lt;br /&gt;    [PHPSESSID] =&amp;gt; xxxxxxxxxxxxxxxxxxxxxxx (removed for security))&lt;br /&gt;&lt;br /&gt;Get Array&lt;br /&gt;(&lt;br /&gt;    [file] =&amp;gt; plus/opslag3.php&lt;br /&gt;)&lt;/pre&gt;&lt;br /&gt;So now I know how to send the query to the server about which dictionary to use and which word to translate and I will have to send my Session ID aswell, to ordbogen.com/plus/opslag3.php .&lt;br /&gt;&lt;br /&gt;I went to edit my test.php file to fake this part of the server aswell, I added this to my code:&lt;br /&gt;&lt;pre&gt;if(isset($_POST['word'])) {&lt;br /&gt;    session_start();&lt;br /&gt;    echo 'You have looked up the word '.$_POST['word'];&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;I now opened up the dictionary program from ordbogen.com, it logged in, I typed a word and voila:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_q7wn89RTdVk/SV0p95-n1VI/AAAAAAAAAL8/GXTjsyOWOAs/s1600-h/ordbogen.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 138px;" src="http://2.bp.blogspot.com/_q7wn89RTdVk/SV0p95-n1VI/AAAAAAAAAL8/GXTjsyOWOAs/s320/ordbogen.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5286427681115067730" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have later found out that the widget contacts http://www.ordbogen.com/plus/keepalive.php and posts the session id to keep the php session alive.&lt;br /&gt;&lt;br /&gt;I will now begin to develope my Mac OS X widget..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2367798662337577860-3587413577786661886?l=thisgeek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thisgeek.blogspot.com/feeds/3587413577786661886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thisgeek.blogspot.com/2009/01/reverse-engineering-nonpublic-api.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2367798662337577860/posts/default/3587413577786661886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2367798662337577860/posts/default/3587413577786661886'/><link rel='alternate' type='text/html' href='http://thisgeek.blogspot.com/2009/01/reverse-engineering-nonpublic-api.html' title='Reverse engineering a nonpublic API'/><author><name>Ralle</name><uri>http://www.blogger.com/profile/02443770236713120307</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_q7wn89RTdVk/SV0p95-n1VI/AAAAAAAAAL8/GXTjsyOWOAs/s72-c/ordbogen.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2367798662337577860.post-3276611466478254176</id><published>2009-01-01T12:30:00.001-08:00</published><updated>2009-01-01T12:35:15.864-08:00</updated><title type='text'>First post</title><content type='html'>Hello everybody!&lt;br /&gt;I have often felt like writing what I am doing. Mostly to keep track of my thoughts so I do not care much who reads this.&lt;br /&gt;I am 19 years old and live in Denmark.&lt;br /&gt;I am very interested in the evolution of hardware and the different companies that manufacture it.&lt;br /&gt;I currently own a Macbook Pro (late 2007), a PC running Windows Vista (3 GB Ram, 2.2 Ghz C2D E4500, GTX 260 Core 216).&lt;br /&gt;&lt;br /&gt;I hope to be posting now and then about the different things I do around the interwebs. The stuff I develope, the games I play and my hardware.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2367798662337577860-3276611466478254176?l=thisgeek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thisgeek.blogspot.com/feeds/3276611466478254176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thisgeek.blogspot.com/2009/01/first-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2367798662337577860/posts/default/3276611466478254176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2367798662337577860/posts/default/3276611466478254176'/><link rel='alternate' type='text/html' href='http://thisgeek.blogspot.com/2009/01/first-post.html' title='First post'/><author><name>Ralle</name><uri>http://www.blogger.com/profile/02443770236713120307</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
