I'm trying to extract images from a game pack file. It worked fine on the trial/demo version of the game, but fails on the full version of the game [ https://thepiratebay.se/torrent/7512447/ ]
Posts full page of dense, disgusting C code with manual string handling "DOESN'T WORK" no error message no explanation no test data <sup>HAX MY ANUS</sup>
Name:
Anonymous2012-08-07 23:15
HOLY SHIT I BBCODE FAILED
That's what I get for not going on /prog/ for years :(
Name:
Anonymous2012-08-08 0:36
>>8
It compiles and runs fine. It just can't extract the archive properly on the full-game version, but works on the trial.
If you bothered to read the entire post you would have seen that.
Name:
Anonymous2012-08-08 0:51
>>6
If the language has an O(1) substring operation (e.g. Perl and BASIC), strings are character arrays. C strings are more like cdr-coded linked lists.
>>16
Did you delete your shitpost on /jp/ or did the janitor do it?
Please respond, it's very important.
Name:
Anonymous2012-08-08 22:23
>>18
I went to bed like an hour after asking (my IP changed anyways so I couldn't delete it if I wanted to), I think it got pruned off the board automatically from no replies.
>>15,17
Seriously, did you illiterates not read the whole thing or just didn't notice the fclose()?
And if there's a leak in the C library, then that's not my problem because how the bloody fuck is one supposed to free that memory without having received a pointer to it? If your C library is knackered, I'm not going to care one bit!
>>16
If the file sizes look fine they may have added another encryption layer on top. Can't help you there. Or can I? Maybe if you give more information, like uploading some of the samples of output it's produced, or at least pieces of the header. Anything that can be used as evidence that you're not just being an idiotthere's another layer of encryption.
>>21
I assumed you would have just download the data.pack and tried to debug on it. Seems like it'd be easier than sending a corrupted image onto some filelocker. http://www.mediafire.com/?iezcmmgxay641oe
>>23
Lots of ciphers use xor with plaintext as their final step. Unless you found that 64KB block directly embedded in the file I would say it's probably a keystream generated from a much more concise description.
>>24
I'm not downloading 600M+ to solve someone else's problem.
>>30
I'm sure there are poorfag internet plans in Finlan too.
Name:
Anonymous2012-08-10 19:56
>>31
No. It's illegal to offer such plans, unless you're not the only company that provides service to that area. And all plans on all ISPs are about the same because the government pretty much forces competition like that. It's nice.
>>32
Glad I don't live in a communist shithole then.
Name:
Anonymous2012-08-10 20:52
>>33
No, it's cheap as fuck. Also if you're poor they provide you with basic service (1/1 Mbit), and in 2015 it will be 100/100 Mbit minimum. Price stays low; basic plan (aka minimum they offer) is less than 5€/year, and is given free to those on our welfare system which also pays very generously.
>>38
>Is there really 64KB of key in the executable?
I don't know. What does it change?
Name:
Anonymous2012-08-11 23:00
>>38 want to do that work?
Sure, I'd love to do it, but I have no knowledge of how to do stuff like this, and I've boggled my mind at it already.
You did it just fine the first time, and even said it was easy to do. What's the issue now? Cudder !MhMRSATORI!!FBeUS42x4uM Thu Dec 01 03:52:03 2011 Does it contains large changes in brightness? Cudder !MhMRSATORI!!FBeUS42x4uM Thu Dec 01 04:19:04 2011 That was easy.
I'm not trying to be an asshole, I'm just confused why you did it before with "little gain", and now you won't simply see what was changed and modify your code so this shit can be extracted.
>>42
It works. Thanks very much. I have no real idea how you did it though. Would you happen to have some sort of general idea on where I should get started if I want to learn more about that kind of stuff, i.e. what methods you used to find the key? I like to learn from my stupid "questions".
>>42
That code is buggy and inefficient. If fread() returns anything less than a full buffer (which it can, according to the spec) you'll desync the keystream and garbage appears in the output. And the least you could do is make it write out a block at a time, like the original. Also you haven't noticed that the key is a power of 2 and so you can just use a 16-bit index that will automatically wrap around.
>>46
You're very lucky. All good ciphers will have keystream periods longer than the maximum filesizes of any filesystem in existence (which is also larger than the capacity of any suitable storage device in existence.) I'm still highly doubtful there is 64KB of key in there; a flawed PRNG is more likely.
>>45
You're also lucky fread() didn't return a nonfull buffer halfway, but there will be up to 4KB of garbage at the end of all the extracted files. Disassemble the executable, find the filesystem routines (searching for "KCAP" and where it's used is a good start), and figure out where the decryption happens. You'll probably be much better than >>42 as you can find the PRNG itself and incorporate that into the code (usually a few dozen bytes to ~128 bytes at most) instead of bloating it with over 65 thousand bytes.
>>48
And you should have done the loop yourself.
It was your code and it would have taken you no more than 5 minutes. But no, you have to write a wall of text just to prove your point.