Skip to content

Commit

Permalink
Remove the useless arg of xor_me for XLS detection
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Jun 5, 2011
1 parent 66fb14e commit 35eeec2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
8 changes: 2 additions & 6 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ nHash cc1f
Try some password on this file.

$ ./xor_me toto 0xd10d 0Xcc1f
Algorithm XOR MS Word
Key: d10d
Hash: cc1f
FAIL! toto

Try the good password on this file.

$ ./xor_me 0824 0xd10d 0Xcc1f
Algorithm XOR MS Word
Key: d10d
Hash: cc1f
Good guess: 0824
Expand All @@ -39,16 +37,14 @@ WARNING: little endian, you should permute bytes

Try some password on this file.

$ ./xor_me 4242 0x499a 0Xcc61 1
Algorithm XOR MS Excel
$ ./xor_me 4242 0x499a 0Xcc61
Key: 499a
Hash: cc61
FAIL! 4242

Try the good password on this file.

$ ./xor_me 1950 0x499a 0Xcc61 1
Algorithm XOR MS Excel
$ ./xor_me 1950 0x499a 0Xcc61
Key: 499a
Hash: cc61
Good guess: 1950
Expand Down
15 changes: 4 additions & 11 deletions xor_me.cxx
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#include "binarycodec.cxx"

int main(int argc, char ** argv) {

oox::core::BinaryCodec_XOR::CodecType algo;
unsigned char * pwdToTest = reinterpret_cast<unsigned char *>(argv[1]);
if (argc < 4) {
std::cout << "Usage: " << argv[0] << " <passwd_to_test> <0xKey> <0xHash> [1 for XLS]" << std::endl;
std::cout << "Usage: " << argv[0] << " <passwd_to_test> <0xKey> <0xHash>" << std::endl;
return EXIT_FAILURE;
} else if (argc >= 5) {
algo = oox::core::BinaryCodec_XOR::CODEC_EXCEL;
std::cout << "Algorithm XOR MS Excel" << std::endl;
} else {
algo = oox::core::BinaryCodec_XOR::CODEC_WORD;
std::cout << "Algorithm XOR MS Word" << std::endl;
}

unsigned char * pwdToTest = reinterpret_cast<unsigned char *>(argv[1]);
unsigned short nKey;
std::istringstream issk(argv[2]);
issk >> std::hex >> nKey;
Expand All @@ -24,7 +17,7 @@ int main(int argc, char ** argv) {
std::cout << std::hex << "Key: " << nKey << std::endl;
std::cout << std::hex << "Hash: " << nHash << std::endl;

oox::core::BinaryCodec_XOR x(algo);
oox::core::BinaryCodec_XOR x(oox::core::BinaryCodec_XOR::CODEC_WORD);
x.initKey(pwdToTest);

if (x.verifyKey(nKey, nHash)) {
Expand Down

0 comments on commit 35eeec2

Please sign in to comment.