Hacking the macOS Twitter client

Twitter recently dropped support for their macOS client. While there are many fine third-party Twitter clients, there are some things they don’t do as well, due to limitations in Twitter’s public API.

But just because Twitter has abandoned their software, that doesn’t mean it’s dead! In this post, I will walk you through how to make a small change: update the program to support 280-character tweets.

Getting started

First, of course, you will need the macOS Twitter client!

Second, you will need a disassembler. Here, I’ll be using Hopper, which is my favourite tool for exploring Objective-C programs.

In Hopper, choose FileRead Executable to Disassemble…, navigate to /Applications/Twitter.app/Contents/MacOS/, and open Twitter.

Screenshot of Hopper loading the Twitter executable
Hopper will begin to analyse the executable, and this might take a while.

Finding the relevant code

For a small change like this, it’s often enough to make a few educated guesses and search for them. We know the current Tweet character limit is 140 characters, so we could search for limit, maximum, or something like that.

Screenshot of Hopper searching for the relevant code
-[TwitterComposition characterLimit] sounds quite interesting, no? In the code, we can see that it also contains 0x8c, the old Twitter character limit in hexadecimal.
Screenshot of Hopper pseudocode
Hopper also has a pseudocode view, that you might find easier to read.

Making the change

Select the line with mov eax, 0x8c on it, and then use ModifyAssemble Instruction….

Screenshot of Hopper assembling a new instruction
Type in mov eax, 0x118 to change the character limit to 280 characters.

Next, select FileProduce new Executable…. Hopper will tell you that this file is a signed application that has been modified, and ask if you’d like to remove the signature. Choose yes, since the signature is no longer valid. Make a backup if you want, and then overwrite the old Twitter executable.

Trying it out

Launch the modified Twitter app, and try composing a new tweet!

Screenshot of Twitter client tweet composer with 280 character limit
You should now have a Twitter client that supports 280 character tweets. Enjoy!

Posted in reverse-engineering