Tag Archives: open-source

data.d – unmanaged memory wrapper for D

I have written a module containing classes to manage raw data in external memory. It provides semantics similar to built-in void[] arrays, but has the following advantages:

  • Faster allocation and deallocation, since memory is requested from the OS directly as whole pages
  • Greatly reduced chance of memory leaks due to stray pointers
  • Overall improved GC performance due to reduced size of managed heap
  • Memory is immediately returned to the OS when data is deallocated

Source and more info here: http://github.com/CyberShadow/data.d

Import Wikipedia page history to git

I’ve written a small tool which downloads the history of a Wikipedia article, converts it and imports it into a new git repository. The main motivation behind writing it is being able to perform a per-line blame of the article’s history. I had tried levitation, but that tool seemed to be oriented towards large imports (or it might just be buggy), as it attempted to create huge binary files and ran longer than my patience would allow when I gave it the history of just one article. Also, I wanted the tool to take care of the downloading and importing part – so I could be one command away from a git repository of any WP article.

The tool can be made faster (all the XML and string management stuff adds an overhead), but right now it’s fast enough for me. One thing that can be optimized is making it not load the entire input XML into memory – it’s possible to do the conversion by “streaming” the XML. Another current limitation is that it’s currently hard-wired to the English Wikipedia.

Requires curl and (obviously) git. You’ll need a D1 D2 compiler to compile the code.

August 2013 update: Updated to D2. Now creates the directory automatically. Added --keep-history switch.

Source, Windows binary.

GraphStudio fork

I have made a few improvements to GraphStudio, the open-source GraphEdit clone:

  • The limit for text entry in certain combo boxes has been removed
  • Basic XML graph saving support has been added (only filters and connections at the moment)
  • Pins are now referred by their indexes in XML rather than by ambiguous names
  • Added command-line /render parameter, which loads a graph, plays it and exits

XML support and /render allow scripted generation and rendering of XML graph files.

Source, download.

Update: Check out GraphStudioNext. Some or all of my patches have been merged into that project, and presumably will be in the next release (the one after

Announcing: RABCDAsm

RABCDAsm (Robust ABC (ActionScript Bytecode) [Dis-]Assembler) is a collection of utilities including an ActionScript 3 assembler/disassembler, and a few tools to manipulate SWF files.

This package was created due to lack of similar software out there.
Particularly, I needed an utility which would allow me to edit ActionScript 3 bytecode (used in Flash 9 and newer) with the following properties:

  • Speed. Less waiting means more productivity. rabcasm can assemble large projects (>200000 LOC) in under a second on modern machines.
  • Comfortably-editable output. Each class is decompiled to its own file, with files arranged in subdirectories representing the package hierarchy. Class files are #included from the main file.
  • Most importantly – robustness! If the Adobe AVM can load and run the file, then it must be editable – no matter if the file is obfuscated or otherwise mutilated to prevent reverse-engineering. RABCDAsm achieves this by using a textual representation closer to the ABC file format, rather than to what an ActionScript compiler would generate.

Read more on the project’s homepage on GitHub.

EnvMan – FAR plugin to manage your environment

Ever had to deal with annoying conflicts between various command-line utilities sharing the same name? Ever wanted to use different versions of the same command-line software package? Tired of manually editing the environment or using “development environment command line” batch files? Then this plugin is for you! Continue reading

Converting classic WinAMP skins to HTML/CSS

I wrote something that cuts up images from WinAMP classic skins to allow using them (with CSS) in web pages.
It allows variable content width/height, using the bitmap font in the “gen” title bar, and uses mouse “hover” effects.

Source: http://github.com/CyberShadow/WSZ2Web
Download: http://github.com/downloads/CyberShadow/WSZ2Web/wsz2web.zip
Examples: http://thecybershadow.net/misc/skins/

Reverse-engineering and deobfuscation of Flash apps

I probably should have known better when I started down this path with “cracking” a certain flash game. This has taken way more of my time than I had initially planned. On the other hand, now I know how to use Adobe Flash Builder, Adobe Flex SDK, XML schemas and JAXB and brushed up on my Java as well.

My previous versions of the cheat consisted of a Mozilla Firefox extension which redirected requests for the game SWF (and data.xml, a configuration file) to my server. The server (configured as a HTTP proxy) sent back an older version of the game SWF, which still had some debugging code left in which allowed you to edit the game board using hotkeys. The game developer has once changed the MD5 salt used to calculate validation checksums (after removing the debugging code), but I got away with it once by uncompressing (gzip) the SWF file, hex-editing the salt, and compressing it back. However, the latest build of the game was obfuscated, so no such tricks would pass this time.

In retrospect (as I wrote on the cheat page), I could have used simpler techniques such as memory editing and replay attacks, but all these could eventually be “patched up”. It would probably even have been simpler if I had written a bot (or just updated the old one) – there really isn’t much to do against screen-scraping bots, other than heuristics and changing the UI every once in a while. Still, I have written an ActionScript 3 deobfuscator.
Continue reading