Prog 5: fixing the corrupt file

Put your programming skills to the test in these challenges.

Prog 5: fixing the corrupt file

Post by thejasper on Mon Jul 28, 2008 4:55 am
([msg=8507]see Prog 5: fixing the corrupt file[/msg])

Hello

First i read some theory about the difference about uploading in ascii and binary. I understand now what's wrong with the file but that's all :p I made a corrupt file myself and compared it with the original in a hex viewer but that didn't help me. It's pretty difficult... i think i have to program something that 'bruteforces' every 8 bit from all the bytes till the file isn't corrupt anymore... Can anyone give me some advice please, or a good hint?

thx
Jasper
thejasper
New User
New User
 
Posts: 3
Joined: Sat May 24, 2008 2:38 pm
Blog: View Blog (0)


Re: Prog 5: fixing the corrupt file

Post by BhaaL on Mon Jul 28, 2008 11:14 am
([msg=8533]see Re: Prog 5: fixing the corrupt file[/msg])

thejasper wrote:First i read some theory about the difference about uploading in ascii and binary. I understand now what's wrong with the file but that's all :p


You should be able to tell what is broken. Theres a good amount of them in the challenge file, you just dont have to fix each and every of them.
BhaaL
Poster
Poster
 
Posts: 270
Joined: Sun Apr 13, 2008 11:16 am
Blog: View Blog (0)


Re: Prog 5: fixing the corrupt file

Post by aalpie on Sun Aug 03, 2008 2:41 pm
([msg=8774]see Re: Prog 5: fixing the corrupt file[/msg])

BhaaL wrote:
thejasper wrote:First i read some theory about the difference about uploading in ascii and binary. I understand now what's wrong with the file but that's all :p


You should be able to tell what is broken. Theres a good amount of them in the challenge file, you just dont have to fix each and every of them.


I understand why not all of them should be changed. How do I however find which ones need to be changed and which not? can anyone please give me a hint?
aalpie
New User
New User
 
Posts: 2
Joined: Tue Jul 15, 2008 11:01 am
Blog: View Blog (0)


Re: Prog 5: fixing the corrupt file

Post by BhaaL on Mon Aug 04, 2008 6:03 am
([msg=8822]see Re: Prog 5: fixing the corrupt file[/msg])

aalpie wrote:I understand why not all of them should be changed. How do I however find which ones need to be changed and which not? can anyone please give me a hint?

Theres no general rule of thumb, "change this one but leave that". You have to go and brute-force it. Knowing that, you should be able to make a "smart" brute-forcing algorithm tho, because all possibilities are far too many.
BhaaL
Poster
Poster
 
Posts: 270
Joined: Sun Apr 13, 2008 11:16 am
Blog: View Blog (0)


Re: Prog 5: fixing the corrupt file

Post by dummy_user on Sun Aug 31, 2008 7:43 am
([msg=10706]see Re: Prog 5: fixing the corrupt file[/msg])

I'm stuck on this one.

I guess the basic problem is: There's this guy \ronald who is very protective about his girl \nancy. Whenever she wants to go out, he comes with her. Now, when I see them together, I have to guess if Nancy rather wants to go out alone (which she usually does), and, if so, get her rid of Ronald.

I've got a program to solve the Ronald problem. It works great with my test data, but it can't solve the mission.

Am I missing something?
dummy_user
New User
New User
 
Posts: 2
Joined: Fri Aug 29, 2008 4:41 am
Blog: View Blog (0)


Re: Prog 5: fixing the corrupt file

Post by darilma2 on Sun Oct 05, 2008 7:37 pm
([msg=13218]see Re: Prog 5: fixing the corrupt file[/msg])

I uploaded some files to an ftp server and dowladed them back, which in result produced currupt files. I could fix this files very easy but when I tryed the same method on given files it did not work. And now I am stuck and do not have any hints what am I missing.

thanks for any help
darilma2
New User
New User
 
Posts: 4
Joined: Tue Sep 09, 2008 11:09 am
Blog: View Blog (0)


Re: Prog 5: fixing the corrupt file

Post by dummy_user on Mon Nov 10, 2008 7:13 pm
([msg=14783]see Re: Prog 5: fixing the corrupt file[/msg])

I finally got it. Accidently removing a line had caused my program to keep at most one Ronald-Nancy pair and remove Ronald from all the other pairs.
dummy_user
New User
New User
 
Posts: 2
Joined: Fri Aug 29, 2008 4:41 am
Blog: View Blog (0)


Re: Prog 5: fixing the corrupt file

Post by dwmead03 on Mon Mar 16, 2009 5:42 pm
([msg=20065]see Re: Prog 5: fixing the corrupt file[/msg])

darilma2 wrote:I uploaded some files to an ftp server and dowladed them back, which in result produced currupt files. I could fix this files very easy but when I tryed the same method on given files it did not work. And now I am stuck and do not have any hints what am I missing.

thanks for any help


I was having the same problem to begin with. For an example file try zipping a larger PNG file and sending that. My problem was that my files only required one ronald and nancy pair which is not the case for this mission.

BhaaL wrote:Theres no general rule of thumb, "change this one but leave that". You have to go and brute-force it. Knowing that, you should be able to make a "smart" brute-forcing algorithm tho, because all possibilities are far too many.


Ok. I understand that I have to brute force it, but the way I'm doing seems like it may be impossible to complete within the time limit. My actual algorithm runs plenty fast, but I check each brute attempt by trying to extract the PNG file. This takes a long time when trying to process many different files. I also have done a little research on the orientation of bz2 files; more importantly, the location of the checksum's for the file. I haven't exactly figured out which bytes make up the data for the checksum so I can't thoroughly test this technique with about a bit more work. My question is whether or not I should stick with the checksum route or look for an alternative way to check if the file is still corrupt?

Currently, the code is in C# and I just create a new bz2.exe process which tries to unzip the newly created bz2 file and on success my program stops and the mission is completed. The part that is disabling me from completing the mission within the time frame is the lengthy time it takes to create and complete the bz2.exe process.
User avatar
dwmead03
New User
New User
 
Posts: 30
Joined: Mon Apr 14, 2008 11:34 pm
Location: KY
Blog: View Blog (0)


Re: Prog 5: fixing the corrupt file

Post by BhaaL on Tue Mar 17, 2009 1:19 pm
([msg=20098]see Re: Prog 5: fixing the corrupt file[/msg])

You might want to download a few of those files and do some tests to narrow down possibilities.

I also used C# and called bunzip for the generated files, and my runtime is about 11 seconds. Plenty of time to submit the answer.
BhaaL
Poster
Poster
 
Posts: 270
Joined: Sun Apr 13, 2008 11:16 am
Blog: View Blog (0)


Re: Prog 5: fixing the corrupt file

Post by damage_case on Mon Mar 23, 2009 4:14 am
([msg=20356]see Re: Prog 5: fixing the corrupt file[/msg])

All my experiments show that the conversion can be just reversed. However just removing Ronald from all the pairs doesn't help and you guys talking about bruteforcing. So I guess actually Ronald shouldn't be removed always. But I can't understand why (as soon as he's always added to Nancy when I do test downloads). Any hints?
Maybe E**D*C is used on the server side?
damage_case
New User
New User
 
Posts: 7
Joined: Wed Mar 18, 2009 3:41 am
Blog: View Blog (0)


Next

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron