ZIPThis is a page for ZIP file analysis (Header). Try sample file: Try an example
What are we looking for?For a ZIP file, we look for the byte sequence 504B0304 or the ASCII sequence of PK.. File contents analysisStarting tag (should be 0x504b0304): 3C21646F File signature analysis (Header analysis)Additional scanning signature analysisFile hex characters[00000000] 3C 21 64 6F 63 74 79 70 65 20 68 74 6D 6C 3E 0A <!doctype.html>. Base-64 conversionPCFkb2N0eXBlIGh0bWw+CjxodG1sIGRhdGEtYWRibG9ja2tleT0iTUZ3d0RRWUpLb1pJaHZj |
Sample code
public string getZip(System.IO.Stream file) { /* 0 4 Local file header signature = (read as a little-endian number) 4 2 Version needed to extract (minimum) 6 2 General purpose bit flag 8 2 Compression method 10 2 File last modification time 12 2 File last modification date 14 4 CRC-32 18 4 Compressed size 22 4 Uncompressed size 26 2 File name length (n) 28 2 Extra field length (m) 30 n File name 30+n m Extra field */ string TextBox1 = ""; byte[] b = ReadFully(file, file.Length); TextBox1 = "Starting tag (should be 0x504b0304): " + Global.intToHex(b[0]) + Global.intToHex(b[1]) + Global.intToHex(b[2]) + Global.intToHex(b[3]) + "<br/>"; TextBox1 += "Version: " + Global.intToHex(b[4]) + " " + Global.intToHex(b[5]) + "<br/>"; TextBox1 += "General purpose bit flag: " + Global.intToHex(b[6]) + " " + Global.intToHex(b[7]) + "<br/>"; TextBox1 += "Compression method: " + Global.intToHex(b[8]) + " " + Global.intToHex(b[9]) + "<br/>"; TextBox1 += "File last modification time: " + Global.intToHex(b[10]) + " " + Global.intToHex(b[11]) + "<br/>"; TextBox1 += "File last modification date: " + Global.intToHex(b[12]) + " " + Global.intToHex(b[13]) + "<br/>"; TextBox1 += "CRC: " + Global.intToHex(b[14]) + Global.intToHex(b[15]) + Global.intToHex(b[16]) + Global.intToHex(b[17]) + "<br/>"; TextBox1 += "Compessed size: " + Global.intToHex(b[18]) + Global.intToHex(b[19]) + Global.intToHex(b[20]) + Global.intToHex(b[21]) + "<br/>"; TextBox1 += "Uncompressed size: " + Global.intToHex(b[22]) + Global.intToHex(b[23]) + Global.intToHex(b[24]) + Global.intToHex(b[25]) + "<br/>"; TextBox1 += "File name length: " + Global.intToHex(b[26]) + Global.intToHex(b[27]) + "<br/>"; TextBox1 += "Extra field length: " + Global.intToHex(b[28]) + Global.intToHex(b[29]) + "<br/>"; TextBox1 += "Filename: "; for (int i = 0; i < b[26]; i++) TextBox1 += (char)b[30 + i]; TextBox1 += "<br/>"; return (TextBox1); }