User blog:Crazy teitoku/Guide to netgame assets ripping via Kancolle

Currently this guide is for Google Chrome users and would give a bit of a bonus to those who uses KC3 Kai. However in theory it is possible replicate the set up mentioned here according to your needs without too much of a hassle other than just consulting manuals where needed.

=Preface=

I have seen discussions on how to extract data from kancolle servers here and there with loose bits and pieces of information which seems like it lacks some form of unification. Gradually over time however these bits and pieces of information becomes harder to find, along with at least two other limiting factors such as either the users are unable to find the resources themselves on how to do it and/or the way wikia searches work is very archaic to say at best.

The methods I shall discuss from here on in maybe a repeat or reiteration of what others may have said. Therefore please do not make a rant about how you have read the steps before and that it was a waste of blog entry blah blah blah. The purpose of this blog entry was to really collate all the bits and pieces of information into almost a "one-stop shop" for virtually anyone interested.

For now, I intend to only cover the extraction of data from SWF files or better known as Shockwave files. These files usually contain sprites, key animations and other information. However there are exceptions such as cases like these whereby the topic is about a game, SWF is basically a container for various game assets and probably a good way to organise how such assets are to be stored within a filesystem as opposed to having several hundreds and thousands of small files. The method could also be easily applied for extracting images, audio or virtually any other data that may be of an interest as once the fundamentals are explained the rest is just a matter of guess work.

=Technique= What you will need:
 * A browser that you are familiar with and can make it reveal various assets that is required for a browser to load up and render a page.
 * A download manager to download those game assets as you may not want to have your browser download them. Browsers tend to "open" files once they have been downloaded/cached and that they are readable for the browser.
 * A SWF decompiler program. There are two known variants, one is Sothink's Flash decompiler (Proprietary) and the other is JPEXS Flash decompiler (Free and open source).

The guide will be using Chromium web browser (which is basically the same as Google Chrome but without all the bells and whistles from Google), a command line download manager which can also be used to mirror websites known as "wget" and as well JPEXS Flash decompiler.

 1.  First off, you will need to open up your developer tools panel. Google Chrome/Chromium and Mozilla Firefox should be F12, alternative shortcut key is Ctrl+Shift+J for Google Chrome/Chromium. Otherwise refer to your browser's manual/help file on how to make it show assets that the browser needs to load in order to view a page.

With Google Chrome/Chromium the moment you open up developer tools panel you may have a random tab opened, tabs are the buttons on the top of the separate window with words like Network, Console, Resources, etc. If you are not on the Network tab, go there.

Ideally you should have your web page already on the netgame and that the flash game is loading (not after). In the following screenshot which is using KC3 Kai (a Kancolle viewer and is also a Chrome extension) via DMM frame. The same method may also work with playing via API key.

In the following screenshot you will notice that I have Network tab opened, and that I have highlighted in red box the game assets which appear to be interesting for download and extraction.

 2.  Here I have the type of file sorted and instead shown a portion of the screenshot with some of the game assets highlighted in red box. These assets are usually transient assets (which means that they're bound to change more frequently compared to others) and that these alone does not comprise the entire assets the server has to offer. More data will be revealed depending on which area you visit within the game whilst you have Developer tools open along with it being in Network tab.

 3.  We click on one of the SWF assets, a new split window reveals where the browser has obtained the asset from followed by the name of the file as well as other interesting bit of information such as the version of the file.

I have "mogrified" the IP address of the server but the link to the asset is what you will need to throw into your download manager for it to download. If you can specify to the download manager to either output the name of the file as or rename the file to something else after it has downloaded, set it to a filename without the question mark "?" character along with the rest of the unneeded characters appended after the question mark character. This tends to upset JPEXS Flash decompiler when it comes to opening the SWF file later on.

Again if you are unsure about this you should probably consult with your download manager manual/help files.

 4.  After the file has been downloaded, just open it with your chosen flash decompiler program. The following screenshot is JPEXS Flash decompiler. Here I have opened up a SWF file known as SallyMain.swf and have went into the shapes section on the left panel from within the program.

Of course if you happen to use Sothink's version you may also want to their manual/help files on how to make it reveal the various assets hidden within the SWF file.

=Caveats=
 * Some assets within SWF file cannot be extracted out easily, in the case of Fonts.swf for my operating system (Linux) I was unable to extract the font assets into TTF (TrueType Font) but instead into WOFF file.
 * Core.swf cannot be decompiled or at least probably no useful stuff can be found within that file. A possible de-obfuscation method has been mentioned (Simplified Chinese only) here with a link discussing another viewer?
 * I also found this blog entry which may contain information but it seems old. Not sure if still relevant . More information from Ilufang here.


 * Not all assets can be found within SWF files. There are cases where files are stored as individual jpg, mp3, etc.

=Further reading=

Flash related links

 * Kancolle flash on Dragonjet's message wall
 * Need help: Background and flash extraction on Dragonjet's message wall
 * Downloading SWF Files from server by Dragonjet
 * Game Extracts by Dragonjet (deprecated)
 * Utilizing Wireshark for Kancolle Asset Grabbing by Martirsadota
 * A Rapid-fire Tutorial on Flash Decompiling (focuses mainly on JPEXS) by Martirsadota
 * Caching Kanmusu Sprite Files by Ar-cen-ciel
 * Decoded Core.swf by Ilufang
 * Analysis on Kancolle Code Obfuscation by Ilufang

Sound/music links

 * Sound Ripping Note by がか
 * Kancolle Start Screen Voice by Erupi
 * Misc Music & Sound Effect List by RedeyeTTK

API related links

 * Decoding the Ships Master Record by Dragonjet (deprecated)
 * β version Kancolle by Tel.ladder (old blog entry - only talks about API strings)
 * Guide to reading Raw API Data by Rephira

=External links=
 * (Japanese only) various game assets and how they are organised (old)
 * (Japanese only) some explanation of game assets. Not as concise as former link but may contain other interesting information. (old)
 * List of ships along with their API filename as well as the link to their respective swf by がか
 * (Japanese only) ongoing discussion of various in-game assets and where they are stored, etc.