Do not download large corrupted files again, Fix them with

Status
Not open for further replies.

rajas700

Youngling
Do not download large corrupted files again, Fix them with WinHex & Curl:



Bug in the download manager.
Bad proxy server.
Bad web server.
Problems with your own computer.

Re-downloading corrupted files, specially those sized over 500 MB are really painful for most of us. And there is no guarantee that the re-downloaded file will be free of corruption as far as you are using the same configuration.

In such cases, its best to fix them manually instead of downloading again. The whole process is very simple, but requries enough concentration. Once you have mastered it, you will never have to worry about corrupted files.

Tools Required:

WinHex _http://www.winhex.com/winhex.zip
CURL _http://curl.haxx.se/latest.cgi?curl=win32-nossl-sspi
CommonSenseâ„¢ (I don't have any link for this one)

Steps required in brief:

Make a backup copy of the corrupted file and open it with WinHex.

Identify corrupted segments. Large sequences of zeros are all we have to search for in most cases.

Re-download the corrupted segments with CURL.

Write the retrieved data on appropiate offsets.

Step-by-step example:

Let us assume that we have a corrupted file named corrupted.rar. We open it WinHex, and do the following things:

Switch the offset representation from hex to decimal by clicking once on the offset area.


*img415.imageshack.us/img415/354/11mo.th.gif



Now we search for corrupted segments. Most of the time they will be sequences of zeros. As we can see from the first bytes of the opened file, it's a rar file. Files we download over the Internet are mostly compressed formats. By design, a fresh file should not contain sequences of zeros or other repeating bytes after the header part. So, we scroll a few pages down.


*img407.imageshack.us/img407/4756/29ku.th.gif


Now we start searching for such sequences with CTRL+ALT+F.


*img498.imageshack.us/img498/8043/38fb.th.gif


The search takes us to a place where we can see some zeros and repeating bytes. Surely this is one of the corrupted segments.


*img493.imageshack.us/img493/1885/43yi.th.gif


So, now we have to download the missing data using CURL. It's always a good idea to retrieve the data with some margin. In our case, we get the bytes from 01094304 to 01094512 in order to cover the screenshot size. In real case it should be even higher. So, we start command prompt and issue the command "curl -r 1094304-1094512 _http://badserver.com/mygoodfile.rar -o 01094304.bin" to download the mentioned segment of the original file, and save it to a file named 01094304.bin. For details, curl manual can help. After it's done, curl will terminate and we will have our file 01094304.bin right inside CURL's folder.


*img462.imageshack.us/img462/5250/59go.th.gif


Now we open the downloaded segment 01094304.bin with WinHex.
Copy the whole file with CTRL+A -> CTRL+C.


*img368.imageshack.us/img368/4259/62dy.th.gif


Switch back to our corrupted file and go to the starting offset of our retrieved segment. CTRL+G -> 01094304

*img393.imageshack.us/img393/2205/70cn.th.gif


Now press CTRL+B to write the copied data over this offset. It is very important to determine correct offset. One offset left or right can ruin everything. Our retrieved segment starts with 18 1E BD 3D, and the offset we are going to write here also starts with 18 1E BD 3D.

*img371.imageshack.us/img371/2918/86gb.th.gif


After we are done, we save the file using CTRL+S. For larger files, it is better to switch the edit mode to in-place mode. F6 -> In-place mode.
Now we can see that the corrupted part has been filled with original data, and it's fixed. In this example we had only of such segment. But in real cases, there might be several segments like this. In that case the whole procedure is to be repeated for each corrupted segment. Also note that, the length of zero sequences to find for can be chosen to be smaller or larger than the length used here.



TRY IT....
 

[lokesh]

Journeyman
Great tut man!... :) thanks ! I got frustrated many times due to this. That will really help out many.

P.S. : A small software can be made for the steps you mentioned using vb or any such. It will be much more easier to fix them. I too willl try on it.
 

paul_007

Padawan
thnx rajas700
this is da best tut i have ever seen :D :D

here is da workin link 4 CURL

*curl.haxx.se/download/curl-7.15.1.zip
 

wizrulz

GUNNING DOWN TEAMS
U2 said:
hey this thing is copied from devil board

I thought this dude rajas700 has great brain to work this out and explain to us members, but if its copied then please do give the credit in ur post :evil:



PS- this rajas700 has 600 od posts to his name means had been member for long time and also knows the rule sof forum......he has a banned tagged.....may be broken rules.....but y do old members do break the rules? :roll:
 

Darthvader

Back From Deathstar
@wiz rulz : dont u see that he has joined the same time as u and me and has 600 posts when we .....
DOesnt thiz tell u somethnn.....

Srry if i am rude or strayed off the topic
 

Dharmil

Right off the assembly line
Works great for my 100 mb download file
Just some instructions :
After you have downloaded curl from the link extract it to windows\system32 and in start=> run=> curl -r 1094304-1094512 *badserver.com/mygoodfile.rar -o 01094304.bin . In orginial post there is underscore (_) here : 1094512 _http but it works without underscore
 
Last edited:
Status
Not open for further replies.
Top Bottom