Friday, March 12, 2010

Flash/Shockwave Game Download Tools

So, you may be wondering how I download Flash or Shockwave games that may contain dozens of dependent files on a server. Well, it's quite simple. I use a custom Java program based on the JPcap (packet capture) library to spit out all the requests that are being sent over a network connection. I look through the requests, find the files I want, then download them with wget.


(Tcpdump allows you to see all the crud a modern Flash game loads. And download it!)

It works something like this:
java Tcpdump 2 >> .\output.txt
(The number "2" indicates which network interface to use; generally either a WiFi connection or Ethernet port.)

And ".\output.txt" will contain text such as this:
GET>> www.cartoonnetwork.com/games/naruto/battleforleafvillage/characters.xml
GET>> www.cartoonnetwork.com/games/naruto/battleforleafvillage/naruto3.swf
GET>> www.cartoonnetwork.com/games/naruto/battleforleafvillage/tracker.swf
I replace "GET>>" with wget instructions to make it into this:
wget -nc -x www.cartoonnetwork.com/games/naruto/battleforleafvillage/characters.xml
wget -nc -x www.cartoonnetwork.com/games/naruto/battleforleafvillage/naruto3.swf
wget -nc -x www.cartoonnetwork.com/games/naruto/battleforleafvillage/tracker.swf
The flag "nc" prevents overwriting of existing files and "x" forces the creation of directories. These changes are saved to a .BAT file and run in the same directory as wget.

On top of this, I have Mozilla Firefox equipped with the FlashBlock plugin. This enables me to control when a Flash or Shockwave item is loaded, thus making my "output.txt" file neat and clean. Otherwise, dozens of non-related requests would need to be discarded to obtain a game.

To make things easy, I've packaged together all of the files that I use (except for Java and FlashBlock, of course; that would just be silly). The WinPcap library must be installed before installing the Jpcap library as one is dependent on the other. The Windows version of wget is included since most people can't be bothered to search around for it. After that, the Tcpdump* application can be run from .BAT files if the command line is too esoteric.

I'm sure there are other/better tools out there, but this has worked fairly well for me. There's only one major pitfall: some games only load resources as they need them, meaning that you're required to play through the entire game to obtain all the files. Some filenames can be guessed, but others can't be.

Download:
*This is a misnomer in that my version doesn't dump whole TCP packets, but that's just the name I've kept ever since experimenting with an example program.

No comments:

Post a Comment

Comment moderation kicks-in after 30 days for old posts, so don't worry if a message doesn't appear.