Today, a funny thing happened, a friend issued a password-protected zip file to me, but do not give me the password, I wonder how this can ' guess ' to the password?After a series of attempts, we finally use Python to ' guess ' the password. to write a script to crack the password need to know about Python ZipFile Library, where the resources of Baidu is very much, I will directly to everyone on the code one by one explanation. Import zipfilefrom Thre
class is used to read entries from a zip fileZipinputstream // input stream for reading files in ZIP FormatZipoutputstream // This class writes files in ZIP file format to implement output streamAnd so on. Some other classes are related to verification, and some do not understand. They are not used in basic usage.
Zipentry indicates a project in a zip file (including directories and files), zipfile indicates a zip compressed file, and the
[Java Basics] use the java.util.zip package to compress and decompress filesThe import java.util.zip. * package in Java API contains all Java operations on compressed files. We can use the methods in this package to perform File compression and decompression operations based on the relevant knowledge in IO. Each compressed file in ZipFilejava can be represented by ZipFile.
File file = new File ("F:/zippath.zip");
The problem report at the front level is here http://blog.csdn.net/richytang/article/details/12257467 (第4-5 Guan)
6th off: http://www.pythonchallenge.com/pc/def/channel.html
The name is: Now there are the pairs. There is only one picture in the clearance, it is a zipper. Only the first line in the source code is useful information. A note, is a zip.
It really made me start without a clue. Later on the web, the comments were placed in the first line, allowing you to replace the HTML in the URL wi
Document directory
Zipfile
Compressing a single file
Compressing multiple files (folders)
Decompress a single file
Decompress multiple files
The import java.util.zip. * package in Java API contains all Java operations on compressed files.
We can use the methods in this package to perform File compression and decompression operations based on the relevant knowledge in Io.Each compressed file in zipfilejava can be represented by
Java.util.zip package for getting started with extracting fileswork idle, inadvertently point a bit of java.util.zip package below some source read a look. Know the scope of its use is for our dailyfile compression and decompression operations. Wrote a number of commonly used compressed files (compression of individual files and multiple files), unzip files (unzip individual files and folders)Little Demo. Package com.clark.zip;Import Java.io.File;Import Java.io.FileInputStream;Import Java.io.Fil
+ "Hello.txt");
char[] ch = {' A ', ' B ', ' C '};
DataOutputStream out = null;
out = new DataOutputStream (new FileOutputStream (file));
for (char temp:ch) {
Out.writechar (temp);
}
Out.close ();
}
"Case" Zipoutputstream class
Let's take a look at the inheritance relationship of the Zipoutputstream class
Java.lang.Object
Java.io.OutputStream
Java.io.FilterOutputStream
Java.util.zip.DeflaterOutputStream
Java.util.zip.ZipOutputStream
Im
This article mainly introduces the Python implementation of compression and decompression zip file method, combined with a specific example of the Python operation zip file compression and decompression of the common operating skills, the need for friends can refer to the next
The examples in this article describe how Python implements the compression and decompression of zip files. Share to everyone for your reference, as follows:
Sometimes we need to use a zip file in Python, and in version 1
* Private parse analysis of two zip file contents
* Private Check check zip file is correct
* Private Check_handler Check if the server is installed unzip
*/
Class zipcompare{//Class start
/** Compare zip file contents, list different parts
* @param String $zipfile 1 zip file 1
* @param String $zipfile 2 zip file 2
* @return Array
*/
Public Function Compare ($
* Func: * Public Compare Compare zip file contents * Private GetInfo Get zip inside file list * Private Parse Analysis two zip file contents * Private Check Check zip file Correct * Private Check_handler check if the server is installed unzip*/ classzipcompare{//class Start/** Compare zip file contents, list different parts * @param string $zipfile 1 zip file 1 * @param string $zipfile 2 zip file 2 * @retur
* author:fdipzone * ver:1.0 * Www.jbxue . com* Func: * Public Compare Compare zip file contents * Private GetInfo Get zip inside file list * Private Parse Analysis two zip file contents * Private Check Check zip file Correct * Private Check_handler check if the server is installed unzip*/ classzipcompare{//class Start/** Compare zip file contents, list different parts * @param string $zipfile 1 zip file 1 * @param string $
1.0 using Os.system to compress will depend on the computer outside of the program, using the ZipFile built-in module to create a compressed document is a good improvement, in addition to use date time to name the compressed file is not very comprehensive, you want to increase the user input file name and enhance the document archiving function.ZipFile module Zipfile.write (filename[, arcname[, Compress_type])Adds the specified file to the zip documen
Through the python built-in zipfile module to extract the zip file, add material to complete password cracking. This article mainly introduces the use of Python brute force to crack the zip file password of the relevant information, the text through the sample code introduced in very detailed, to everyone's study or work has a certain reference learning value, hope to help everyone.
Objective
The ZipFile m
From a simple perspective, the zip format will be a good choice, and Python's support for the ZIP format is simple and easy to use.
1) Simple Application
If you only want to use python for compression and decompression, you don't need to repeat the document. Here we provide a simple usage for you to understand at a glance.
Import zipfile
F = zipfile.zipfile('filename.zip ', 'w', zipfile. zip_deflated)
F
ze;
byte[] data = new Byte[bytelength];
for (File f:files) {//Recursive compressed directory if (F.isdirectory ()) {Pack (Srcpath, F.listfiles (), Zos); else if (F.getname (). IndexOf ().
Ds_store ")!=-1) {continue;
else {//Get the path String subpath = F.getabsolutepath () of the compressed file relative to the zip file;
int index = Subpath.indexof (Srcpath);
if (index!=-1) {subpath = Subpath.substring (Srcpath.length () +file.separator.length ());
}//Compressed file
Online search for a long time, and finally found three kinds of good methods:
1, the JDK comes with the package java.util.zip.ZipOutputStream, the deficiency, the file (folder) name with Chinese,
There is a garbled problem, the implementation code is as follows:
/*** Function: To compress all the files in the SourceDir directory in zip format, save as the specified zip file* @param sourcedir If the directory, Eg:d:\\myeclipse\\first\\testfile, then compressed all the files in the directory;* If
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.