#!/usr/bin/perl -w # find-zlib - scan for zlib tables in compiled code # Copyright (C) 2002 RUS-CERT, University of Stuttgart. # Written by Florian Weimer . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # $Id: find-zlib,v 1.9 2002/03/17 17:24:42 rusfw Exp $ # use strict; if (@ARGV == 0 or $ARGV[0] eq '-h') { print <; close FILE; if ($data =~/inflate ([0-9][ 0-9a-zA-Z.\-]{1,100}[0-9a-zA-Z.\-])/) { print "$file: inflate version: \"$1\"\n"; $found = 0; } if ($verbose and $data =~/deflate ([0-9][ 0-9a-zA-Z.\-]{1,100}[0-9a-zA-Z.\-])/) { print "$file: deflate version: \"$1\"\n"; $found = 0; } if ($data =~ /$cplens_table_le/o) { print "$file: zlib cplens table, little endian\n"; $found = 0; } if ($data =~ /$cplens_table_be/o) { print "$file: zlib cplens table, big endian\n"; $found = 0; } if ($data =~ /$cplext_table_092/o) { print "$file: zlib cplext table (version 0.1 to 0.92)\n"; $found = 0; } if ($data =~ /$cplext_table_104/o) { print "$file: zlib cplext table (version 0.93 to 1.0.4)\n"; $found = 0; } if ($data =~ /$cplext_table_114/o) { print "$file: zlib cplext table (version 1.0.5 to 1.1.4)\n"; $found = 0; } next if not $verbose; if ($data =~ /$config_table_le_32/o) { print "$file: zlib configuration table, little endian, 32 bit\n"; $found = 0; } if ($data =~ /$config_table_be_32/o) { print "$file: zlib configuration table, big endian, 32 bit\n"; $found = 0; } if ($data =~ /$config_table_le_64/o) { print "$file: zlib configuration table, little endian, 64 bit\n"; $found = 0; } if ($data =~ /$config_table_be_64/o) { print "$file: zlib configuration table, big endian, 64bit\n"; $found = 0; } my $msg = 0; my $total = 0; $msg++ if $data =~ /empty distance tree with lengths/; $total++; $msg++ if $data =~ /incomplete distance tree/; $total++; $msg++ if $data =~ /incomplete dynamic bit lengths tree/; $total++; $msg++ if $data =~ /incomplete literal\/length tree/; $total++; $msg++ if $data =~ /incorrect data check/; $total++; $msg++ if $data =~ /incorrect header check/; $total++; $msg++ if $data =~ /invalid bit length repeat/; $total++; $msg++ if $data =~ /invalid block type/; $total++; $msg++ if $data =~ /invalid stored block lengths/; $total++; $msg++ if $data =~ /invalid stored block lengths/; $total++; $msg++ if $data =~ /invalid window size/; $total++; $msg++ if $data =~ /need dictionary/; $total++; $msg++ if $data =~ /oversubscribed distance tree/; $total++; $msg++ if $data =~ /oversubscribed dynamic bit lengths tree/; $total++; $msg++ if $data =~ /oversubscribed literal\/length tree/; $total++; $msg++ if $data =~ /too many length or distance symbols/; $total++; $msg++ if $data =~ /too many length or distance symbols/; $total++; $msg++ if $data =~ /unknown compression method/; $total++; if ($msg > 0) { print "$file: $msg out of $total messages\n"; $found = 0; } } exit $found;