逆向分析中将分析结果的 byte[ ] 以十六进制的形式打印出来,常常会遇到这样的格式:
1F8B08000000000000002597C712ABBC0E809FE69C。。。。。。省略N多。。。。。。。
看其格式就知道是GZIP压缩的格式。
根据目前我逆向分析的好几个APP应用,它们使用网络请求时,基本上都使用了GZIP压缩技术对其请求返回数据进行GZIP压缩或解压处理。
压缩和解压分别使用了两个IO流:
GZIP压缩:GZIPOutputStream
GZIP解压:GZIPInputStream
示例代码:
public class Gzip {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
String str="hello world";
byte[ ] bytes=str.getBytes();
System.out.println("压缩前长度:"+bytes.length);
byte[ ] gzipBytes=gzip(bytes);
System.out.println("压缩后长度:"+gzipBytes.length);
System.out.println("压缩后:"+byteToHexString(gzipBytes));
byte[ ] unGzipBytes=unGzip(gzipBytes);
System.out.println("解压后:"+by