void print_info_type_02(FILE *fout, struct file *sFile) { unsigned int uncomp_size = 0; unsigned int real_size = 0; unsigned int treelevels = 0; struct file sFileuncomp; fprintf(fout, "--- (TYPE 02) Variable Length Compression ---\n\n"); uncomp_size = *(sFile->bMap + 1) | (*(sFile->bMap + 2) << 0x8) | (*(sFile->bMap + 3) << 0x10); treelevels = *(sFile->bMap + 4); fprintf(fout, "* Uncompressed Size : 0x%08X (%d)\n", uncomp_size, uncomp_size); fprintf(fout, "* Huffman Binary Tree Depths : %X (%d)\n", treelevels, treelevels); exec_decompressor(sFile); if (open_and_map("/tmp/out", &sFileuncomp) == 0) { clean_file(&sFileuncomp); fprintf(stderr, "[-] open_and_map failed : %s\n", "/tmp/out"); } real_size = *(unsigned int*)(sFileuncomp.bMap); if (real_size == uncomp_size) { fprintf(fout, "\n[+] Decompression OK!\n\n"); parse_type2(fout, &sFileuncomp); } else fprintf(fout, "\n[-] Real size not found in new header !\n\n"); fprintf(fout, "\n\nhexdump :\n\n"); hex_dump(fout, sFileuncomp.bMap, 0x40); clean_file(&sFileuncomp); }
/* * Analyze the proxy's HTTP response. This must be a HTTP/1.? 200 OK type * header */ void analyze_HTTP(PTSTREAM *pts) { char *p = strtok( buf, " "); /* Strip html error pages for faulty proxies (Stephane Engel <steph[at]macchiati.org>) */ while (strncmp( p, "HTTP/", 5) != 0 ) { if ( readline(pts) ) { p = strtok( buf, " "); } else { message( "analyze_HTTP: readline failed: Connection closed by remote host\n" ); exit(2); } } if (strcmp( p, "HTTP/1.0" ) != 0 && strcmp( p, "HTTP/1.1" ) != 0) { message( "Unsupported HTTP version number %s\n", p ); exit( 1 ); } p = strtok( NULL, " "); if( strcmp( p, "200" ) != 0 ) { if( ! args_info.quiet_flag ) message( "HTTP return code: %s ", p ); p += strlen( p ) + 1; if( ! args_info.quiet_flag ) message( "%s", p ); if (!ntlm_challenge && strcmp( p, "407") != 0) { do { readline(pts); if (strncmp( buf, "Proxy-Authenticate: NTLM ", 25) == 0) { if (parse_type2((unsigned char *)&buf[25]) < 0) exit(1); } } while ( strcmp( buf, "\r\n" ) != 0 ); } if (ntlm_challenge == 1) { proxy_protocol(pts); return; } exit( 1 ); } }