How do I start this now…

Steg. The name of the app I built during the summer break and was too tied down by schoolwork to chronicle till Christmas vac. I got the name from a practice Elliot from Mr. Robot does, steganography. The art of hiding something within another. That’s pretty much what Steg does.

Now most of my summer break was spent in school. We had to do some training, some of which involved report writing, my age old enemy. Of course that needed PDFs to plagiarize so I ended up downloading a number of those. On starting the report, everything else became 23.49% more interesting than they normally are (I checked), and I found myself wondering about the PDF file format I was viewing (after previous other wonderings that will not be recounted here for sake of the reader’s sanity). Having a terminal handy, I ran the file command on one of the files and it returned the filetype and version. Now I know the file command works by using the file’s magic bits so I did a bit of messing around and got the smallest file possible that’d still pass off as a PDF file by the file command. And then I had an idea.

Now WhatsApp is a pretty popular application here and why not, it’s cheap, efficient and easy to use. But being a programmer you start to notice some things that most tend to overlook. The fact that pictures and videos are always previewed before they can be sent. The fact that if you forward a file you just sent to someone, a link to the file’s location is sent instead of the whole file getting uploaded again. And the fact that it allows you to send invalid links and corrupt PDF files. This was my way in.

Developing a POC was pretty easy, took me like ten minutes and a terminal to see that I could append data to my really small PDF file (that’s actually just magic bits) and Whatsapp would let it through, and the receiver could then remove the bits at the front and get the original file. This would simplify having to send unsupported files through email to people and instead just send it directly during chat.

Few weeks of hacking it together into an Android app brought Steg.
How do I end this now…




Python Script that plays Piano Tiles

Last week, I tried playing the first, original piano tiles. I never really was a fan of the second one. It looked like a good idea completely squeezed for every thing it’s got. Too loud visuals and the whole concept of “life”. The two developing companies were even different. Umoni (part 1) looking like a bunch of guys just wanting to share a simple, fun game. Cheetahmobile doing it’s best to pump the flawless version full of bloat while trying to make as much cash as they can, without being too obvious of course.

Anyway, nuff about that. I got the two year old backup of the game from my hard drive (of backups), installed and got to playing. Needless to say I enjoyed it very much. So much I completely ignored the Calculus test I have next week. Eventually after about an hour’s play, I considered if the game was predictable enough to be played by a computer. I’d being thinking about that with Flappy Bird and Amazing Brick. Both very good classics. But implementing this seemed much easier as I noticed the tile color and position could be known beforehand. Modding the game seemed too much work so I considered this as a sort of AI project. A computer gamer. It’d look at the screen and then know where to press. Pretty much like your regular human. But flawlesser. Yes, I’m keeping that.

Language? Well I’d mostly being using Java for most projects but deciding I needed to try something in Python as it’d been a while since I used it. Android sort of mostly forces(?) Java for apps. So Python it was. Basics of implementation, get the color of the tile (constant) and the four possible positions (also constant). Next was visual. The program needs to see what it’s doing. As I had a rooted phone handy, I tried a loop to see the interval between successive screenshots. About one capture per sec. Not practical enough for high speeds. But as the only other alternative was probably having to go through the phone’s graphics buffer and parsing it to get only a section of the screen, and this was mostly “Proof of Concept” code, I had to go with the screenshot method. Joining all this together and looping it brought me pretty impressive code and in 16 lines no less (Hurray Python!). Ran it and the rest is history. Feel free to optimize if you wish. The m (master) variable is a tuple for tuples of the four x,y coordinates to check for the black tile. Also the source code for the screencap command might be worth a look/edit if you’re interested in optimizing this or making game-playing programs. I suppose I should go read for that test.




Python Script that plays Piano Tiles

MTK ADB, ADB without a PC

I started working on a project last month that allows you to use ADB directly on your device. Figured this was useful because all the weird Chinese apps that give you root never do it cleanly and I like my device not being messed by anyone other than me. It’s no longer just an su binary and SuperUser APK. They replace system binaries now and multiple “temp” files including logs and helper binaries and libraries that they don’t clean up after the root process. Even the UnRoot process you’d think would take care of these files doesn’t. Just removes the su binary. Same goes for One Click Unroot apps. I’m particularly annoyed about this because I got a new device running Android One that I recently rooted and now I can’t install any updates because my system files have been messed with and an update would brick the phone. The app pretty much gives you ADB access directly on your device at just a click. And no changes to your device. It only works for MediaTek devices running Android 4.x and can give you Shell or Root access through ADB on your device. It’s worth mentioning that some devices allow ADB to run as Root and some only as Shell but it all depends on the manufacturer of your device. I have five devices and two of them allow Root access. The rest get default ADB (Shell access).

You can get it on XDA

Here’s the video

MTK ADB, ADB without a PC