PDA

View Full Version : RAR file library for c++/java/perl/python help



SadaraX
January 25th, 2009, 03:21 PM
I want to make a password cracking program using brute force against RAR files. I need help getting a library to extract (or at least test passwords) on RAR files. I also need help using the library.

I downloaded unrarsrc from RarLabs but I am completely baffled how to write my own program to include their code and use their functionality.

If anyone knows how to use that, please help.

But any RAR library in C++ or Java or Perl or Python will fine. Though C++ is preferred for speed purposes.

A code example like this would be wonderful:



#include<rarlib>
...
int main()
{
...
Rar my_rar("input.rar");
my_rar.setPassword("password1");
my_rar.extractTo("output_directory/");
...
}

bruce89
January 25th, 2009, 08:19 PM
As rar is a non-free format, you'll struggle to find a library that can do this.

Reiger
January 25th, 2009, 09:07 PM
You don't require a library for this (of course, performance wise it will likely be better if you use one) because all you need to know is if your program 'got it right'. Any simple extraction test will therefore suffice, hence any archive extractor capable of handling RAR archives (preferably one that can inspect archives without decompressing the entire thing) at a decent speed will suffice provided it has a commandline option for the job. You could try 7zip.

EDIT: Come to think of it, 7zip being Open Source you can check out how 7zip communicates with its unRAR functions and make a wrapper for that in your program: http://www.7-zip.org/download.html.

slavik
January 25th, 2009, 09:10 PM
I suggest you start at the rar format specs ...