iOS FAT binaries
I just got by reverse-engineering some iOS apps and wanted to make some FAT-notes (ha ha) about the FAT binaries – and of course share them as well.
First of all, the magic numbers, here’s a quick list:
- 0xFEEDFACE, Mach-O executable, Big Endian
- 0xCEFAEDFE, Mach-O executable, Little Endian
- 0xCAFEBABE, Universal Binary, FAT
Universal binaries have a header with a length of 0×1000 (4096 bytes). They are built up like (I borrowed this from http://hohle.net, though I changed the value to match a random iOS app):
cafe babe # Fat Binary Magic Number 0000 0002 # Number of archives 0000 000C # CPU Type # Archive 1 0000 0006 # CPU Subtype 0000 1000 # Archive Offset 000C 4500 # Archive Size 0000 000C # Alignment 0000 000C # CPU Type # Archive 2 0000 0009 # CPU Subtype 000C 6000 # Archive Offset 000C 12F0 # Archive Size 0000 000C # Alignment
The remaining places up to 0×1000 is filled up with zero’s.
Danske Bank API
Hello! So I got this comment from Kristian in my latest post about a peak inside the Danske Bank iPhone app. To share my efforts, you can download my DanskeBankAPI in .NET here. At the time it supports checking your accounts, searching and paging through transactions etc., but not actually making an transaction.The example app to show some functionality is:
A simple example code for using the API is (actually the code for the above form):
- db.createSession();
- db.login(textBox1.Text, textBox2.Text);
- Models.Account[] acc = db.getAccounts();
- if (acc.Length > 0) label1.Text = acc[0].Balance.ToString();
The first line creates a session (required) and the next line logins using two textboxes (and the CPR and mobilbank code). The latest two lines simple gets the accounts and prints the first accounts balance to a label.
Download and test out the project if you want, all the source is right there, so take a look if you are suspicious.
Texas Instruments LaunchPad
So I saw this new product that TI had announced: the LaunchPad. A $4.30 value serie development board for MSP430 microprocessors. To the low price of $4.30 – I end up ordering two.
The package was received only 5 days after ordering – even though they said it was not in stock. I am truly amazed of the work Texas Instrument have put in this development board and their service distributing it to the world. For only $4.30 you get two microprocessors, USB cable, pin headers, a crystal and even some jumpers, if you need someone for your harddisk. For that price, you might not even be able to buy the jumpers or pin headers on the board in Denmark – and certainly not the USB cable. I cannot figure out how this should ever count as an income to TI. The last time I had something shipped with International Priority the shipping costs from USA was more than $30 bucks. At the same time I have also bought an Atmel AVR-Dragon – and this comes with nothing but a paper box for the price of $100 (and it is even the value line of AVR programmers). I know it is two completely different product and therefore only the quality and the service is compared – not the tools.
The TI LaunchPad comes preprogrammed with a temperature application and there is two different (but completely free) tools for programming it. I haven’t had the time to program it yet, but I can see there is samples for the “Hello World” / Blink.. So it should be very easy to get started.
If you want to buy one, you can get one at the TI eStore. Once again, thanks and great job Texas Instruments! *tap on your back*
A peak inside Danske Bank iPhone app
In couriosity I have looked inside the Danske Mobilbank app for the iPho
ne, and I just wanted to share this. The first and obvious thing to do is to SSH into the phone and look inside the application folder. After having downloaded the application, I started out checking the preference folder. The only thing here interesting is the file called danskebankgroup.mobilebank.danskebank.plist, which contains some informations on which phone number to call and whether the camera is enabled or not.
Immediately after I looked inside the read more…
Adding a serial port to DIR-615 D3
I originally bought a WRT54GL but found this D-Link router to be cheaper and more powerfull – however without the knowledge if there would be a serial port to talk to my microprocessors. I quickly installed DD-WRT without any troubles and then opened the case with the two screws under the small plastic protectors at the bottom. I couldn’t find any visible serial port at first, but just before I gave up, I found a small rectangle marked JP1. After measuring, I could quickly find VCC and GND. RX and TX was a bit more tweaky. I removed the ATmega chip from my Arduino and connected it reverse to the different pins during the routers boot (so Arduino TX -> Router TX for use as a usb2serial converter, see the Arduino schematics for details). So I found that the port was called /dev/tts/1 and the TX pin was the one most to the back. RX was obviously the last, but to be sure I programmed my ATmega chip to send a “Hello World\n” every second, connected the Arduino correct (TX -> RX) and got response via SSH to the router using:
In many iPhone applications it’s necessary to have a server running some scripts. I have some of my servers running scripts for parsing and for scraping data from other sites. That way, I don’t have to update my iPhone application if the host I scrape from changes their HTML, but I can just change a bit of code on the server-script.
To debug your .NET applications remote, you can publish them to a local IIS server and then attatch the debugger to the current process – but thats slow and it didn’t work out for me quite well.
Suddenly I found someone writing about the application SPI Port Forward, which simply forwarts a incoming connection. This application works very well with .NET debugging. You can set up the port forwarding application to accept any incoming port and then redirect it to the local development server port for ASP.NET applications.
OCR Engine for Bingo Banko
From a request from Leif in my recent blog post, I will share my OCR Engine for Bingo Banko plates with you.
The OCREngine is downloadable here.
It is designed in VB.NET and have two public properties: ReadBoard and ReadBrick.
The ReadBoard function takes a Image object and returns the board serialized. Hope this is useful for anyone out there
EDIT: TV2 has changed their image generator so it now randomly twists some of the numbers. My OCREngine can only read the numbers not twisted and is therefore not very useful for a cheat-application.
Slow email sending in Exchange 2010
We recently got our Exchange 2010 up and running at my workplace. After changing from 2007 to 2010, the email sending from web- and win-applications could take up to 20 seconds for each. The problem lies in the acknowledgement delay at the new Exchange 2010 server, which is documented on Microsoft TechNet. The problem lies in the SmtpClient.Send function, which could time the requests out. Sending emails to internal accounts on the Exchange could be very speedy, while some specific email-adresses could take very long.
Without any deep study, I think the AcknowledgementDelay is some kind of trying to verify if the email was send/received correctly. The default value for the acknowledgement delay is 30 seconds, so if you SmtpClient.Send hangs in 30 seconds, you might have the same problem as we had.
Disable the acknowledgement in the exchange console using the command:
Set-ReceiveConnector "Receive connector name here" -MaxAcknowledgementDelay 0
And you can enable it to default (30s), if it didn’t work out for you with this command:
Set-ReceiveConnector "Receive connector name here" -MaxAcknowledgementDelay 00:00:30
A little thing about Bingo Banko
I have recently heard about Bingo Banko, which appears to be a TV-show where you can print generated bingo (or banko) plates at home and play along while they pull the numbers on TV.
The limitations for the player is how many plates he can manage with his eyes and his hands. But hey! The plates is online generated – why not just generate a hell lot of plates and let the computer do all the work? You should be a sure winner in that case – the only problem will then be to get through with the phone call. And right now, they don’t mention anything about computer-help in their rules. The bingo plates have 27 fields and look like this:
I have recently made a (very very fast) custom designed OCR Engine for this purpose and another script for downloading 300 plates at a time. However in the middle of the development, I discovered that even though I download 300 plates, I only got about 11 unique plates. If I make 300 requests the next day, I get 11 more unique plates. Damnit!
To make a successfull robot-helper for BingoBanko, you have to make a cronjob that requests plates every day for a week or so. This way you will get so many unique plates as possible. Thereafter they should be put in the OCR engine and just needs a “player” to get ready next saturday
I have developed an application in .NET where I have used used XPTable for displaying data. However, when publishing data – like in iPhone applications – who would like to send and publish two files, when one single EXE is enough?
Luckily for you Microsoft have developed ILMerge which allows you to embed DLL and other references into one single file. You can download ILMerge here. It is a command-line application, so you could compile these files: read more…




