3 days ago I discovered a cool easy to use java tool for working with zip files.
It is called Zip4j.
Have a look at this super simple example that will allow you to unzip a file into a given path in your computer:
Use this if the unzip file has a password:
That was easy and cool.
Are you now thinking the same as I am thinking?...
Let's go brute force zip passwords!!! :P
Hahaha.... I am just joking don't do that, this is not a hacking blog( yet! :p ) I hope you enjoyed this post. Use Zip4j with care.
It is called Zip4j.
Have a look at this super simple example that will allow you to unzip a file into a given path in your computer:
String source = "folder/source.zip";
String destination = "folder/source/";
try {
ZipFile zipFile = new ZipFile(source);
zipFile.extractAll(destination);
} catch (ZipException e) {
e.printStackTrace();
}
Use this if the unzip file has a password:
String source = "folder/source.zip";
String destination = "folder/source/";
String password = "password";
try {
ZipFile zipFile = new ZipFile(source);
if (zipFile.isEncrypted()) {
zipFile.setPassword(password);
}
zipFile.extractAll(destination);
} catch (ZipException e) {
e.printStackTrace();
}
That was easy and cool.
Are you now thinking the same as I am thinking?...
Let's go brute force zip passwords!!! :P
Hahaha.... I am just joking don't do that, this is not a hacking blog( yet! :p ) I hope you enjoyed this post. Use Zip4j with care.
when i try to call these functions zipFile.getName(), zipFile.getEntry(fileName) i am getting this error
ReplyDeleteThe method getEntry(String).getName() is undefined for the type ZipFile
You are probably using a different an old version of the library... Which version of the library are you using? I found a related answer in stackoverflow, maybe you find it useful:
Deletehttp://stackoverflow.com/questions/18974389/extracting-files-with-zip4j-temporarily-extracted-for-reading-but-not-visible
This comment has been removed by the author.
ReplyDelete