This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [QUESTION] Blizzard Downloader  (Read 8363 times)

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
[QUESTION] Blizzard Downloader
« on: September 20, 2013, 07:09:12 pm »
I'm looking at the Blizzard downloader and I am confused as to how it functions.

There are four key directories that the Blizzard Downloader uses:

Code: [Select]
background*.torrent
updateDownloader.ini
updatePatchSequenceFile.txt
update*.mpq / exe

The downloader contains misc data:
Code: [Select]
[Downloader]
directDownloadThreshold=3500000
[DownloaderFast]
directDownloadThreshold=7000000
[BackgroundDownloader]
directDownloadThreshold=10000
[PortDefaultValues]
minPort=6881
maxPort=6999

The PatchSequenceFile points to what should be downloaded: http://us.version.worldofwarcraft.com/u ... ceFile.txt

However this is directly contradictory to how other sources document the Blizzard Downloader to be constructed (and how I found): http://www.wowwiki.com/Blizzard_Downloader#Structure

The executable has a .torrent file attached to the end of the file which can be extracted. It also has a MPQ attached that contains all the images the downloader uses.

The torrent file can be edited using any normal default torrent editor tool. However it also appears to have some unknown data attached to the end:



This seems to contain information such as the IP and file that is allowed to download this file (directly going to the URL will tell you that you cannot access that file). MD5, and such also appears to exist. There is also an image URL that overwrites the background for the Blizzard Downloader as well as the name of the file being downloaded.

I am requesting some clarity on all of this information:
  • Why there is two places the downloader can get the torrent from (URL & end of file)
  • The structure of the information at the end of the torrent file
  • Any other research done on the matter

With this information it should be possible to then just create a normal torrent tracker and to seed a torrent, then attach that torrent with the downloader info after to the installer executable.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #1 on: September 28, 2013, 11:45:00 am »
yo,

PatchSequenceFile is used by the launcher to know wich data are needed from the server for update. its seems unlikely the downloader use this file as torrent first's purpose is especially to allow client to download from somewhere else than the server, and if a .torrent file is embedded in the .exe then it doesnt need any other informations.

As everything is done through the launcher now i cant get hold of an official downloader.
Can u upload one from 1 version to another so I can take a look a this? (english locale if u have one)

thanks
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #2 on: September 28, 2013, 04:06:03 pm »
Quote from: "happyhack"
yo,

PatchSequenceFile is used by the launcher to know wich data are needed from the server for update. its seems unlikely the downloader use this file as torrent first's purpose is especially to allow client to download from somewhere else than the server, and if a .torrent file is embedded in the .exe then it doesnt need any other informations.

As everything is done through the launcher now i cant get hold of an official downloader.
Can u upload one from 1 version to another so I can take a look a this? (english locale if u have one)

thanks

Sure, if you login through WoW instead of launcher or download a game (not a patch) they still use the downloader system. I think the PatchSequenceFile was used on a different version of the Blizzard Downloader that didn't have the torrent attached - this is from a long time ago when I got it working before. This version seems to be more up to date and a better system.

Here is the Downloader I used to download WC3 from Blizzard last week, it is restricted to my IP as stated in the thread: https://dl.dropboxusercontent.com/u/110 ... s_enGB.zip

I haven't been able to do much testing yet as I have been moving houses which is a long and tiresome process. Once I am set up again I will begin doing some testing. I want to finish getting the Battle.net 2 protocol implemented (which I am half done on), the blizz downloader working, and then work on the Launcher. :)

Thanks.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #3 on: September 29, 2013, 03:22:40 pm »
Okay, I replaced the torrent file & unknown data with my own torrent file and attempted to test it that way. I just get the error message:

"There is nothing to download"

Now, so the unknown data is essential it seems in this version of the Blizz Downloader, or I am doing something very wrong.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #4 on: September 29, 2013, 07:55:35 pm »
the end of the torrent is at offset 0xD51A on ur screenshot.
unknown info are a list of struct similar to each blizzard files but they are written in reverse order :
- block data
- block header

header is as follow :
Code: [Select]
struct
{
    char          Name[4];
    signed int  Offset;   // offset of data from beggining of header (always negative)
};

so u see the unknown data contains several block of data :
RESP ( contain torrent file data? )
COKI ( list of key/values quite explicit. u can deduce the informations easily : ip, expires, access, md5)
PANE ( url of the image displayed )
MODE ( unknown 1 unsigned integer = 0x00000001)

there is one more block before torrent data named SKIN wich contain and MPQ file (holding ui data)

however... this downloader dont just download a file, it ask to select a folder, and probably do much more things. It seems much more complex than downloaders we used to obtain from Wow for update download and i suspect it to be notably different of the one used for updates.

What do u plan to do with the downloader? if u want to use it for update, i suggest u use an update downloader as its seems more generic (guess they didnt made code change from one update to another, just torrent change)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #5 on: September 30, 2013, 10:55:22 am »
Quote from: "happyhack"
What do u plan to do with the downloader? if u want to use it for update, i suggest u use an update downloader as its seems more generic (guess they didnt made code change from one update to another, just torrent change)

Thanks for the information.

Yeah I will try and use a different version of the downloader. :)

edit:

I downloaded the downloader from 3.3.5a -> 4.x.x by logging into retail. After removing the torrent they have attached and attaching my one I get 'There is nothing to download' still. There did not appear to be any structure after the torrent file which confuses me.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #6 on: October 01, 2013, 12:40:31 pm »
as said earlier, u can change the torrent file but u still have to add the header right after. on some downloader the COKI, PANE and MODE chunks are missing. leaving only torrent data, and skin data.

here is the utility i made for extracting/appending new torrent files (work on windows) http://www.filesplat.com/.happyhack/sha ... zDLasm.rar

BlizzDLasm.exe extract "example.downloader.exe" for extracting the torrent file
BlizzDLasm.exe compile "example.torrent" "out.exe" for creating a new downloader with the given torrent file

however when i change the torrent for another, the downloader seems to work correctly but dont download anything.

i found some informations about the downloader there http://www.networkuptime.com/wow/page02-09.html
Its said the downloader connect to blizzard's tracker.
Maybe the downloader try to connect to blizzard's tracker automatically and stop downloading if the torrent informations are not found... maybe blizzard's tracker is more than a simple torrent tracker and it send informations needed by the downloader to correctly complete the download process.... maybe it just check if the torrent's tracker match blizzard's one...

maybe i just did something wrong... I m afraid the downloader need informations only delivered by blizzard's tracker.

my knowledge in reversing are quite limited so i can do nothing more, sorry
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #7 on: October 01, 2013, 02:22:56 pm »
Interesting, thanks for the information.

It seems there are many different versions of the downloader. I have got it to work before a couple of years ago, 100%. I didn't need to attach a header and I believe it got the torrent file from a URL rather than attached. I'm going to see if I can find this version.

edit:

There is a BackgroundDownloader.exe inside the MPQs. I am going to do some experimenting with this version since it is shipped with the game.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #8 on: October 02, 2013, 02:41:44 pm »
This thread seems to have got it a version working as well: viewtopic.php?p=16499#p16499

This thread also explains it: viewtopic.php?p=1309#p1309

Also my post here from a while ago shows how I got it working: viewtopic.php?p=14826#p14826 (though I cannot remember doing this!)

I am simply unable to find the strings that point to the directory containing these folders now. :/ No log file is being created when I run the program either, only "Data for the next patch is unavailable."
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #9 on: October 03, 2013, 08:45:18 pm »
Quote
This thread seems to have got it a version working as well: viewtopic.php?p=16499#p16499
haha these screenshots  :lol:

on my side i finally make it work

here are all explanation :

you have to create a torrent file with :
- the announce field set to your tracker url (during my test i set it to http://127.0.0.1:3724/announce it just worked well)

several field are used by the downloader for additionnal informations (choose output path, launch executable after full download, etc...)


Blizzard's torrent tracker is customized so when u send a torrent request, the response will have additionnals informations : a http URL for direct download.

then, the downloader try to download from the direct http URL it just got from the tracker.

The file on the http server should be splitted in several files to match the "piece length" field in the torrent file.

the downloader try to download from the direct http url like that :
"http://direct_http_url/piece_nbr"
during my test i set the direct http url to "http://127.0.0.1/WoW-3.3.5.12213-to-3.3.5.12340-frFR-patch.exe"
so the downloader tried to access http://127.0.0.1/WoW-3.3.5.12213-to-3.3 ... atch.exe/0
then http://127.0.0.1/WoW-3.3.5.12213-to-3.3 ... atch.exe/1, etc...

here is a very tiny bittorrent tracker that does the job, and a splitter for the downloaded file, both written in c#.
http://www.filesplat.com/.happyhack/sha ... racker.rar

(u should not use this tracker for a working server. It does not implement the torrent protocol fully, it just does the job for this test)

a bittorrent tracker is very simple, i guess u could even make one with a single php script on a http server.

whether u choose to use one or another is up to you. I didnt read the topics u linked in ur last post in detail but it seems an easier solution. However if u want to do it the same way blizzard does, then here it is  ;)

tell me if u need any help
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #10 on: October 04, 2013, 12:21:27 am »
Quite some magic Internet points for you, happyhack.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #11 on: October 04, 2013, 05:26:48 pm »
Quote from: "happyhack"
Quote
...

Brilliant, thank you!

I set up a torrent file using uTorrent. I set the piece size to 1024 KB, added a HTTP link to the file, and set the tracker to localhost.

I replaced this torrent with the one in WoW-x.x.x.x-4.0.0.12911-Downloader (enUS) which is sent when logging into battle.net in build 12340 (3.3.5a).

I then added the downloader info such as Target, locale, etc as you have done. I changed the string lengths as appropriate.

I split the target file into 1024 KB chunks using the tool you provided.

The torrent program you wrote opens on the specified port correctly.

Now when I try to run the downloader, I am getting the error message "There is nothing to download!".

When I run the Blizzard one, I get the same error message for some strange reason. It should work as it is the one sent from Blizzard.

I have no idea what could be going wrong.



I was thinking it might be because the torrent created by uTorrent is not in the format that the Downloader requires but it doesn't answer why the original unedited version does not work.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #12 on: October 05, 2013, 12:56:17 pm »
Quote from: "schlumpf"
Quite some magic Internet points for you, happyhack.
behind a router  8-)

Quote from: "stoneharry"
Now when I try to run the downloader, I am getting the error message "There is nothing to download!".

i see on ur screenshot the headers are not set correctly. I know its confusing because what I called header is at the END of each chunk, not at the beggining.

Quote from: "happyhack"
here is the utility i made for extracting/appending new torrent files (work on windows) http://www.filesplat.com/.happyhack/sha ... zDLasm.rar

BlizzDLasm.exe extract "example.downloader.exe" for extracting the torrent file
BlizzDLasm.exe compile "example.torrent" "out.exe" for creating a new downloader with the given torrent file

plz use this utility, it does all the job for you and create a working downloader from a torrent file. (its yet in the last download in the folder "torrent + downloader" under the name "bwod.exe")
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #13 on: October 05, 2013, 02:35:59 pm »
Ah yes, it works great! :) Excellent.

It's connecting to the tracker fine and the filesplitter program makes sense.

The direct download URL is sent in the tracker response, however my downloader does not appear to be using it. At least, it's not downloading from it. The filesplitter would only be used for sending using the torrent protocol, correct?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: [QUESTION] Blizzard Downloader
« Reply #14 on: October 05, 2013, 05:52:55 pm »
Quote from: "stoneharry"
The filesplitter would only be used for sending using the torrent protocol, correct?
correct, almost  :D actually peers send pieces to each others trough TCP, not HTTP (if i remember well). But you are right, the downloader get same pieces from the http server than it would get from a peer.

Quote from: "stoneharry"
The direct download URL is sent in the tracker response, however my downloader does not appear to be using it
hmmm... does the downloader gives u any error or warning message?
are you sure the pieces are available to the downloader? can u download them through a browser?

Does the View > Connection info menu show u the correct url in the "Direct HTTP download" row?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »