#!/usr/bin/perl

################################################################################
# privoxy-log-parser
#
# A parser for Privoxy log messages. For incomplete documentation run
# perldoc privoxy-log-parser(.pl), for fancy screenshots see:
#
# http://www.fabiankeil.de/sourcecode/privoxy-log-parser/
#
# $Id: privoxy-log-parser.pl,v 1.124 2011/11/13 16:54:10 fabiankeil Exp $
#
# TODO:
#       - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting
#       - create fancy statistics
#       - grep through Privoxy sources to find unsupported log messages
#       - hunt down substitutions that match content from variables which
#         can contain stuff like ()?'[]
#       - replace $h{'foo'} with h('foo') where possible
#       - hunt down XXX comments instead of just creating them
#       - add example log lines for every regex and mark them up for
#         regression testing
#       - Handle incomplete input without Perl warning about undefined variables.
#       - Use generic highlighting function that takes a regex and the
#         hash key as input.
#       - Add --compress and --decompress options.
#
# Copyright (c) 2007-2010 Fabian Keil <fk@fabiankeil.de>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
################################################################################

use strict;
use warnings;
use Getopt::Long;

use constant {
    PRIVOXY_LOG_PARSER_VERSION => '0.7',
    # Feel free to mess with these ...
    DEFAULT_BACKGROUND => 'black',  # Choose registered colour (like 'black')
    DEFAULT_TEXT_COLOUR => 'white', # Choose registered colour (like 'black')
    HEADER_DEFAULT_COLOUR => 'yellow',
    REGISTER_HEADERS_WITH_THE_SAME_COLOUR => 1,

    CLI_OPTION_DEFAULT_TO_HTML_OUTPUT => 0,
    CLI_OPTION_TITLE => 'Privoxy-Log-Parser in da house',
    CLI_OPTION_NO_EMBEDDED_CSS => 0,
    CLI_OPTION_NO_MSECS => 0,
    CLI_OPTION_NO_SYNTAX_HIGHLIGHTING => 0,
    CLI_OPTION_SHORTEN_THREAD_IDS => 0,
    CLI_OPTION_SHOW_INEFFECTIVE_FILTERS => 0,
    CLI_OPTION_ACCEPT_UNKNOWN_MESSAGES => 0,
    CLI_OPTION_STATISTICS => 0,
    CLI_OPTION_UNBREAK_LINES_ONLY => 0,
    CLI_OPTION_URL_STATISTICS_THRESHOLD => 0,
    CLI_OPTION_HOST_STATISTICS_THRESHOLD => 0,

    SUPPRESS_SUCCEEDED_FILTER_ADDITIONS => 1,
    SHOW_SCAN_INTRO => 0,
    SHOW_FILTER_READIN_IN => 0,
    SUPPRESS_EMPTY_LINES => 1,
    SUPPRESS_SUCCESSFUL_CONNECTIONS => 1,
    SUPPRESS_ACCEPTED_CONNECTIONS => 1,
    SUPPRESS_GIF_NOT_CHANGED => 1,
    SUPPRESS_NEED_TO_DE_CHUNK_FIRST => 1,

    DEBUG_HEADER_REGISTERING => 0,
    DEBUG_HEADER_HIGHLIGHTING => 0,
    DEBUG_TICKS => 0,
    DEBUG_PAINT_IT => 0,
    DEBUG_SUPPRESS_LOG_MESSAGES => 0,

    PUNISH_MISSING_LOG_KNOWLEDGE_WITH_DEATH => 0,
    PUNISH_MISSING_HIGHLIGHT_KNOWLEDGE_WITH_DEATH => 1,

    LOG_UNPARSED_LINES_TO_EXTRA_FILE => 0,
    ERROR_LOG_FILE => '/var/log/privoxy-log-parser',

    # You better leave these alone unless you know what you're doing.
    COLOUR_RESET      => "\033[0;0m",
    ESCAPE => "\033[",
};

# For performance reasons, these are global.

my $t;
my %req; # request data from previous lines
my %h;
my %thread_colours;
my @all_colours;
my @time_colours;
my $thread_colour_index = 0;
my $header_colour_index = 0;
my $time_colour_index = 0;
my %header_colours;
my $no_special_header_highlighting;
my %reason_colours;
my %h_colours;
my $header_highlight_regex = '';

my $html_output_mode;
my $no_msecs_mode; # XXX: should probably be removed
my $shorten_thread_ids;
my $line_end;

sub prepare_our_stuff () {

    # Syntax Higlight hash
    @all_colours = (
        'redES ut of memory decompressing iob bufsize >= skip_size    Unexpected end of compressed iob. Using what we got so far. Buffer limit reached while decompressing iob    zstr.avail_out == tmpbuf + bufsize - (char *)zstr.next_out  (char *)zstr.next_out == tmpbuf + ((char *)oldnext_out - buf)   Inconsistent stream state after decompression: %s   Unexpected error while decompressing to the buffer (iob): %s    Decompression successful. Old size: %d, new size: %d.   Decompression didn't result in any content. Unexpected error decompressing the buffer (iob): %d==%d, %d>%d, %d<%d   Failed to read a multi-line header properly: '%s'   Out of memory while appending multiple headers. Merged multiple header lines to: '%s'   Reducing white space in '%s'    Converting tab to space in '%s' Ignoring single quote in '%s'   header_list header_name Content-Type:   ((void *)0) != get_header_value(csp->headers, "Content-Type:")  Multiple Content-Type headers. Removing and ignoring: '%s'  text/   plain   script  image/gif   Content-Type:   Modified: %s!   %s not replaced. It doesn't look like a content type that should be filtered. Enable force-text-mode if you know what you're doing. Action bits updated accordingly.    No action bits update necessary.    scan: %s    Inconsistent configuration: tagging enabled, but no taggers available.  Tagger %s has empty joblist. Nothing to do. ((void *)0) != header   Problems with tagger '%s' and header '%s': %s   Tagger '%s' created an empty tag. Ignored.  Insufficient memory to add tag '%s', based on tagger '%s' and header '%s'   Tagger '%s' added tag '%s'. %s  Tagger '%s' didn't add tag '%s'. Tag already present    Content modified with no Content-Length header set. Created: %s.    parameter != ((void *)0)    Referer crunched!   New host is: %s. Crunching %s!  Parameter: +hide-referrer{%s} is a bad idea, but I don't care.  Referer replaced with: %s   Host:   No "Host:" header found.    Out of memory while parsing "Host:" header  Destination extracted from "Host:" header. New request URL: %s  HTTP/   set-cookie: connection: Content-MD5:    Content-Encoding:   Content-Length: Keep-Alive: Proxy-Connection:   Transfer-Encoding:  content-disposition:    Last-Modified:  *   referer:    user-agent: ua- from:   x-forwarded-for:    Accept-Encoding:    TE: if-modified-since:  proxy-connection:   max-forwards:   Accept-Language:    if-none-match:  Request-Range:  If-Range:   X-Filter:   %a, %d-%b-%y %H:%M:%S   %a, %d %b %Y %H:%M:%S   %a, %d-%b-%Y %H:%M:%S   %A, %d-%b-%Y %H:%M:%S   %A %b %d %H:%M:%S %Y    $Id: ssplit.h,v 1.10 2011/09/04 11:10:56 fabiankeil Exp $   $Id: ssplit.c,v 1.12 2011/09/04 11:10:56 fabiankeil Exp $   free_http_request                                    ! #$%&'()*+,-./0123456789:; = ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ ] _ abcdefghijklmnopqrstuvwxyz   ~        `  ( 4 < D L T \ d l t                 $ compile_pattern create_url_spec $Id: urlmatch.h,v 1.18 2011/11/06 11:41:05 fabiankeil Exp $ $Id: urlmatch.c,v 1.65 2011/11/06 11:41:34 fabiankeil Exp $ urlmatch.c  More than SZ(vec) components in domain or none at all.   
 The only supported HTTP versions are 1.0 and 1.1. This rules out: %s    CONNECT Unknown HTTP method detected: %s    %s$ %s\.?$  ^%s Invalid anchoring in compile_pattern %d error compiling %s from %s: %s  strlen(pattern) < sizeof(rebuf) - 2 TAG:    POST    PUT PROPFIND    PROPPATCH   MOVE    COPY    MKCOL   LOCK    UNLOCK  BCOPY   BMOVE   BDELETE BPROPFIND   BPROPPATCH  SUBSCRIBE   UNSUBSCRIBE NOTIFY  POLL    VERSION-CONTROL REPORT  CHECKOUT    CHECKIN UNCHECKOUT  MKWORKSPACE UPDATE  LABEL   MERGE   BASELINE-CONTROL    MKACTIVITY  ! ! " P" " "                                                                                            " " " # ,# P# p# # pcrs_compile_replacement    pcrs_execute_single_command pcrs_compile_dynamic_command    ... [too long, truncated]   $Id: pcrs.h,v 1.17 2009/05/16 13:27:20 fabiankeil Exp $ $Id: pcrs.c,v 1.38 2011/09/04 11:10:56 fabiankeil Exp $ (pcrs:) Everything's just fine. Thanks for asking.  Unknown error. Privoxy out of sync with PCRE?   tnrfae0 0123456789ABCDEF    ascii_value > 0 pcrs.c  ascii_value < 256   '`+&    ><#+*~%^-:;!@    ((void *)0) != v->value ((void *)0) == (__extension__ (__builtin_constant_p (d) && !__builtin_constant_p (v->name) && (d) == '\0' ? (char *) __rawmemchr (v->name, d) : __builtin_strchr (v->name, d))) s%c\$%s%c%s%cgT ret >= 0    %s%cgT  ret == trailer_size - 1 sizeof(buf) == strlen(buf) + 1  (pcrs:) At least one variable was too big and has been truncated before compilation (pcrs:) Backreference out of range  (pcrs:) Bad job - NULL job, pattern or substitute   (pcrs:) PCRE error while studying the pattern   (pcrs:) Syntax error while parsing command  (pcrs:) No memory   (pcre:) Match limit reached (pcre:) Fire in power supply    (pcre:) No memory   (pcre:) Bad node in pattern (pcre:) Bad magic number in code    (pcre:) Unrecognized option bit (pcre:) NULL code or subject or ovector (pcre:) Water in power supply   (                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               d  H               O                              
   .    ܮ                      oԅ     @       
   K                                                      o  o   o                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          `           A)   aeabi    4T 	, .shstrtab .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .text .fini .rodata .ARM.exidx .eh_frame .init_array .fini_array .jcr .dynamic .got .data .bss .ARM.attributes                                                   T  T                             h  h                     !             $                  8             (               4   o   ԅ                   >           	  P              F         @  @  K                 N   o       
               [   o       p                j   	                          s   	                 
         |                               w                                        "  8                         .                             .                        p   #                            #                             ܮ ܮ                                                                                                                                               0                                                    p          *                                J                                                                                                                                                                                                                                                                                                                                                                                       ./usr/bin/                                                                                          0000755 0000000 0000000 00000000000 12652736077 011311  5                                                                                                    ustar   root                            root                                                                                                                                                                                                                   ./usr/bin/privoxy-log-parser                                                                        0000755 0000000 0000000 00000261461 12652736077 015042  0                                                                                                    ustar   root                            root                                                                                                                                                                                                                   #!/usr/bin/perl

################################################################################
# privoxy-log-parser
#
# A parser for Privoxy log messages. For incomplete documentation run
# perldoc privoxy-log-parser(.pl), for fancy screenshots see:
#
# http://www.fabiankeil.de/sourcecode/privoxy-log-parser/
#
# $Id: privoxy-log-parser.pl,v 1.124 2011/11/13 16:54:10 fabiankeil Exp $
#
# TODO:
#       - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting
#       - create fancy statistics
#       - grep through Privoxy sources to find unsupported log messages
#       - hunt down substitutions that match content from variables which
#         can contain stuff like ()?'[]
#       - replace $h{'foo'} with h('foo') where possible
#       - hunt down XXX comments instead of just creating them
#       - add example log lines for every regex and mark them up for
#         regression testing
#       - Handle incomplete input without Perl warning about undefined variables.
#       - Use generic highlighting function that takes a regex and the
#         hash key as input.
#       - Add --compress and --decompress options.
#
# Copyright (c) 2007-2010 Fabian Keil <fk@fabiankeil.de>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
################################################################################

use strict;
use warnings;
use Getopt::Long;

use constant {
    PRIVOXY_LOG_PARSER_VERSION => '0.7',
    # Feel free to mess with these ...
    DEFAULT_BACKGROUND => 'black',  # Choose registered colour (like 'black')
    DEFAULT_TEXT_COLOUR => 'white', # Choose registered colour (like 'black')
    HEADER_DEFAULT_COLOUR => 'yellow',
    REGISTER_HEADERS_WITH_THE_SAME_COLOUR => 1,

    CLI_OPTION_DEFAULT_TO_HTML_OUTPUT => 0,
    CLI_OPTION_TITLE => 'Privoxy-Log-Parser in da house',
    CLI_OPTION_NO_EMBEDDED_CSS => 0,
    CLI_OPTION_NO_MSECS => 0,
    CLI_OPTION_NO_SYNTAX_HIGHLIGHTING => 0,
    CLI_OPTION_SHORTEN_THREAD_IDS => 0,
    CLI_OPTION_SHOW_INEFFECTIVE_FILTERS => 0,
    CLI_OPTION_ACCEPT_UNKNOWN_MESSAGES => 0,
    CLI_OPTION_STATISTICS => 0,
    CLI_OPTION_UNBREAK_LINES_ONLY => 0,
    CLI_OPTION_URL_STATISTICS_THRESHOLD => 0,
    CLI_OPTION_HOST_STATISTICS_THRESHOLD => 0,

    SUPPRESS_SUCCEEDED_FILTER_ADDITIONS => 1,
    SHOW_SCAN_INTRO => 0,
    SHOW_FILTER_READIN_IN => 0,
    SUPPRESS_EMPTY_LINES => 1,
    SUPPRESS_SUCCESSFUL_CONNECTIONS => 1,
    SUPPRESS_ACCEPTED_CONNECTIONS => 1,
    SUPPRESS_GIF_NOT_CHANGED => 1,
    SUPPRESS_NEED_TO_DE_CHUNK_FIRST => 1,

    DEBUG_HEADER_REGISTERING => 0,
    DEBUG_HEADER_HIGHLIGHTING => 0,
    DEBUG_TICKS => 0,
    DEBUG_PAINT_IT => 0,
    DEBUG_SUPPRESS_LOG_MESSAGES => 0,

    PUNISH_MISSING_LOG_KNOWLEDGE_WITH_DEATH => 0,
    PUNISH_MISSING_HIGHLIGHT_KNOWLEDGE_WITH_DEATH => 1,

    LOG_UNPARSED_LINES_TO_EXTRA_FILE => 0,
    ERROR_LOG_FILE => '/var/log/privoxy-log-parser',

    # You better leave these alone unless you know what you're doing.
    COLOUR_RESET      => "\033[0;0m",
    ESCAPE => "\033[",
};

# For performance reasons, these are global.

my $t;
my %req; # request data from previous lines
my %h;
my %thread_colours;
my @all_colours;
my @time_colours;
my $thread_colour_index = 0;
my $header_colour_index = 0;
my $time_colour_index = 0;
my %header_colours;
my $no_special_header_highlighting;
my %reason_colours;
my %h_colours;
my $header_highlight_regex = '';

my $html_output_mode;
my $no_msecs_mode; # XXX: should probably be removed
my $shorten_thread_ids;
my $line_end;

sub prepare_our_stuff () {

    # Syntax Higlight hash
    @all_colours = (
        'redES ut of memory decompressing iob bufsize >= skip_size    Unexpected end of compressed iob. Using what we got so far. Buffer limit reached while decompressing iob    zstr.avail_out == tmpbuf + bufsize - (char *)zstr.next_out  (char *)zstr.next_out == tmpbuf + ((char *)oldnext_out - buf)   Inconsistent stream state after decompression: %s   Unexpected error while decompressing to the buffer (iob): %s    Decompression successful. Old size: %d, new size: %d.   Decompression didn't result in any content. Unexpected error decompressing the buffer (iob): %d==%d, %d>%d, %d<%d   Failed to read a multi-line header properly: '%s'   Out of memory while appending multiple headers. Merged multiple header lines to: '%s'   Reducing white space in '%s'    Converting tab to space in '%s' Ignoring single quote in '%s'   header_list header_name Content-Type:   ((void *)0) != get_header_value(csp->headers, "Content-Type:")  Multiple Content-Type headers. Removing and ignoring: '%s'  text/   plain   script  image/gif   Content-Type:   Modified: %s!   %s not replaced. It doesn't look like a content type that should be filtered. Enable force-text-mode if you know what you're doing. Action bits updated accordingly.    No action bits update necessary.    scan: %s    Inconsistent configuration: tagging enabled, but no taggers available.  Tagger %s has empty joblist. Nothing to do. ((void *)0) != header   Problems with tagger '%s' and header '%s': %s   Tagger '%s' created an empty tag. Ignored.  Insufficient memory to add tag '%s', based on tagger '%s' and header '%s'   Tagger '%s' added tag '%s'. %s  Tagger '%s' didn't add tag '%s'. Tag already present    Content modified with no Content-Length header set. Created: %s.    parameter != ((void *)0)    Referer crunched!   New host is: %s. Crunching %s!  Parameter: +hide-referrer{%s} is a bad idea, but I don't care.  Referer replaced with: %s   Host:   No "Host:" header found.    Out of memory while parsing "Host:" header  Destination extracted from "Host:" header. New request URL: %s  HTTP/   set-cookie: connection: Content-MD5:    Content-Encoding:   Content-Length: Keep-Alive: Proxy-Connection:   Transfer-Encoding:  content-disposition:    Last-Modified:  *   referer:    user-agent: ua- from:   x-forwarded-for:    Accept-Encoding:    TE: if-modified-since:  proxy-connection:   max-forwards:   Accept-Language:    if-none-match:  Request-Range:  If-Range:   X-Filter:   %a, %d-%b-%y %H:%M:%S   %a, %d %b %Y %H:%M:%S   %a, %d-%b-%Y %H:%M:%S   %A, %d-%b-%Y %H:%M:%S   %A %b %d %H:%M:%S %Y    $Id: ssplit.h,v 1.10 2011/09/04 11:10:56 fabiankeil Exp $   $Id: ssplit.c,v 1.12 2011/09/04 11:10:56 fabiankeil Exp $   free_http_request                                    ! #$%&'()*+,-./0123456789:; = ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ ] _ abcdefghijklmnopqrstuvwxyz   ~        `  ( 4 < D L T \ d l t                 $ compile_pattern create_url_spec $Id: urlmatch.h,v 1.18 2011/11/06 11:41:05 fabiankeil Exp $ $Id: urlmatch.c,v 1.65 2011/11/06 11:41:34 fabiankeil Exp $ urlmatch.c  More than SZ(vec) components in domain or none at all.   
 The only supported HTTP versions are 1.0 and 1.1. This rules out: %s    CONNECT Unknown HTTP method detected: %s    %s$ %s\.?$  ^%s Invalid anchoring in compile_pattern %d error compiling %s from %s: %s  strlen(pattern) < sizeof(rebuf) - 2 TAG:    POST    PUT PROPFIND    PROPPATCH   MOVE    COPY    MKCOL   LOCK    UNLOCK  BCOPY   BMOVE   BDELETE BPROPFIND   BPROPPATCH  SUBSCRIBE   UNSUBSCRIBE NOTIFY  POLL    VERSION-CONTROL REPORT  CHECKOUT    CHECKIN UNCHECKOUT  MKWORKSPACE UPDATE  LABEL   MERGE   BASELINE-CONTROL    MKACTIVITY  ! ! " P" " "                                                                                            " " " # ,# P# p# # pcrs_compile_replacement    pcrs_execute_single_command pcrs_compile_dynamic_command    ... [too long, truncated]   $Id: pcrs.h,v 1.17 2009/05/16 13:27:20 fabiankeil Exp $ $Id: pcrs.c,v 1.38 2011/09/04 11:10:56 fabiankeil Exp $ (pcrs:) Everything's just fine. Thanks for asking.  Unknown error. Privoxy out of sync with PCRE?   tnrfae0 0123456789ABCDEF    ascii_value > 0 pcrs.c  ascii_value < 256   '`+&    ><#+*~%^-:;!@    ((void *)0) != v->value ((void *)0) == (__extension__ (__builtin_constant_p (d) && !__builtin_constant_p (v->name) && (d) == '\0' ? (char *) __rawmemchr (v->name, d) : __builtin_strchr (v->name, d))) s%c\$%s%c%s%cgT ret >= 0    %s%cgT  ret == trailer_size - 1 sizeof(buf) == strlen(buf) + 1  (pcrs:) At least one variable was too big and has been truncated before compilation (pcrs:) Backreference out of range  (pcrs:) Bad job - NULL job, pattern or substitute   (pcrs:) PCRE error while studying the pattern   (pcrs:) Syntax error while parsing command  (pcrs:) No memory   (pcre:) Match limit reached (pcre:) Fire in power supply    (pcre:) No memory   (pcre:) Bad node in pattern (pcre:) Bad magic number in code    (pcre:) Unrecognized option bit (pcre:) NULL code or subject or ovector (pcre:) Water in power supply   (                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               d  H               O                              
   .    ܮ                      oԅ     @       
   K                                                      o  o   o                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          `           A)   aeabi    4T 	, .shstrtab .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .text .fini .rodata .ARM.exidx .eh_frame .init_array .fini_array .jcr .dynamic .got .data .bss .ARM.attributes                                                   T  T                             h  h                     !             $                  8             (               4   o   ԅ                   >           	  P              F         @  @  K                 N   o       
               [   o       p                j   	                          s   	                 
         |                               w                                        "  8                         .                             .                        p   #                            #                             ܮ ܮ                                                                                                                                               0                                                    p          *                                J                                                                                                                                                                                                                                                                                                                                                                                       ./usr/bin/                                                                                          0000755 0000000 0000000 00000000000 12652736077 011311  5                                                                                                    ustar   root                            root                                                                                                                                                                                                                   ./usr/bin/privoxy-log-parser                                                                        0000755 0000000 0000000 00000261461 12652736077 015042  0                                                                                                    ustar   root                            root                                                                                                                                                                                                                   #!/usr/bin/perl

################################################################################
# privoxy-log-parser
#
# A parser for Privoxy log messages. For incomplete documentation run
# perldoc privoxy-log-parser(.pl), for fancy screenshots see:
#
# http://www.fabiankeil.de/sourcecode/privoxy-log-parser/
#
# $Id: privoxy-log-parser.pl,v 1.124 2011/11/13 16:54:10 fabiankeil Exp $
#
# TODO:
#       - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting
#       - create fancy statistics
#       - grep through Privoxy sources to find unsupported log messages
#       - hunt down substitutions that match content from variables which
#         can contain stuff like ()?'[]
#       - replace $h{'foo'} with h('foo') where possible
#       - hunt down XXX comments instead of just creating them
#       - add example log lines for every regex and mark them up for
#         regression testing
#       - Handle incomplete input without Perl warning about undefined variables.
#       - Use generic highlighting function that takes a regex and the
#         hash key as input.
#       - Add --compress and --decompress options.
#
# Copyright (c) 2007-2010 Fabian Keil <fk@fabiankeil.de>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
################################################################################

use strict;
use warnings;
use Getopt::Long;

use constant {
    PRIVOXY_LOG_PARSER_VERSION => '0.7',
    # Feel free to mess with these ...
    DEFAULT_BACKGROUND => 'black',  # Choose registered colour (like 'black')
    DEFAULT_TEXT_COLOUR => 'white', # Choose registered colour (like 'black')
    HEADER_DEFAULT_COLOUR => 'yellow',
    REGISTER_HEADERS_WITH_THE_SAME_COLOUR => 1,

    CLI_OPTION_DEFAULT_TO_HTML_OUTPUT => 0,
    CLI_OPTION_TITLE => 'Privoxy-Log-Parser in da house',
    CLI_OPTION_NO_EMBEDDED_CSS => 0,
    CLI_OPTION_NO_MSECS => 0,
    CLI_OPTION_NO_SYNTAX_HIGHLIGHTING => 0,
    CLI_OPTION_SHORTEN_THREAD_IDS => 0,
    CLI_OPTION_SHOW_INEFFECTIVE_FILTERS => 0,
    CLI_OPTION_ACCEPT_UNKNOWN_MESSAGES => 0,
    CLI_OPTION_STATISTICS => 0,
    CLI_OPTION_UNBREAK_LINES_ONLY => 0,
    CLI_OPTION_URL_STATISTICS_THRESHOLD => 0,
    CLI_OPTION_HOST_STATISTICS_THRESHOLD => 0,

    SUPPRESS_SUCCEEDED_FILTER_ADDITIONS => 1,
    SHOW_SCAN_INTRO => 0,
    SHOW_FILTER_READIN_IN => 0,
    SUPPRESS_EMPTY_LINES => 1,
    SUPPRESS_SUCCESSFUL_CONNECTIONS => 1,
    SUPPRESS_ACCEPTED_CONNECTIONS => 1,
    SUPPRESS_GIF_NOT_CHANGED => 1,
    SUPPRESS_NEED_TO_DE_CHUNK_FIRST => 1,

    DEBUG_HEADER_REGISTERING => 0,
    DEBUG_HEADER_HIGHLIGHTING => 0,
    DEBUG_TICKS => 0,
    DEBUG_PAINT_IT => 0,
    DEBUG_SUPPRESS_LOG_MESSAGES => 0,

    PUNISH_MISSING_LOG_KNOWLEDGE_WITH_DEATH => 0,
    PUNISH_MISSING_HIGHLIGHT_KNOWLEDGE_WITH_DEATH => 1,

    LOG_UNPARSED_LINES_TO_EXTRA_FILE => 0,
    ERROR_LOG_FILE => '/var/log/privoxy-log-parser',

    # You better leave these alone unless you know what you're doing.
    COLOUR_RESET      => "\033[0;0m",
    ESCAPE => "\033[",
};

# For performance reasons, these are global.

my $t;
my %req; # request data from previous lines
my %h;
my %thread_colours;
my @all_colours;
my @time_colours;
my $thread_colour_index = 0;
my $header_colour_index = 0;
my $time_colour_index = 0;
my %header_colours;
my $no_special_header_highlighting;
my %reason_colours;
my %h_colours;
my $header_highlight_regex = '';

my $html_output_mode;
my $no_msecs_mode; # XXX: should probably be removed
my $shorten_thread_ids;
my $line_end;

sub prepare_our_stuff () {

    # Syntax Higlight hash
    @all_colours = (
        'redES ut of memory decompressing iob bufsize >= skip_size    Unexpected end of compressed iob. Using what we got so far. Buffer limit reached while decompressing iob    zstr.avail_out == tmpbuf + bufsize - (char *)zstr.next_out  (char *)zstr.next_out == tmpbuf + ((char *)oldnext_out - buf)   Inconsistent stream state after decompression: %s   Unexpected error while decompressing to the buffer (iob): %s    Decompression successful. Old size: %d, new size: %d.   Decompression didn't result in any content. Unexpected error decompressing the buffer (iob): %d==%d, %d>%d, %d<%d   Failed to read a multi-line header properly: '%s'   Out of memory while appending multiple headers. Merged multiple header lines to: '%s'   Reducing white space in '%s'    Converting tab to space in '%s' Ignoring single quote in '%s'   header_list header_name Content-Type:   ((void *)0) != get_header_value(csp->headers, "Content-Type:")  Multiple Content-Type headers. Removing and ignoring: '%s'  text/   plain   script  image/gif   Content-Type:   Modified: %s!   %s not replaced. It doesn't look like a content type that should be filtered. Enable force-text-mode if you know what you're doing. Action bits updated accordingly.    No action bits update necessary.    scan: %s    Inconsistent configuration: tagging enabled, but no taggers available.  Tagger %s has empty joblist. Nothing to do. ((void *)0) != header   Problems with tagger '%s' and header '%s': %s   Tagger '%s' created an empty tag. Ignored.  Insufficient memory to add tag '%s', based on tagger '%s' and header '%s'   Tagger '%s' added tag '%s'. %s  Tagger '%s' didn't add tag '%s'. Tag already present    Content modified with no Content-Length header set. Created: %s.    parameter != ((void *)0)    Referer crunched!   New host is: %s. Crunching %s!  Parameter: +hide-referrer{%s} is a bad idea, but I don't care.  Referer replaced with: %s   Host:   No "Host:" header found.    Out of memory while parsing "Host:" header  Destination extracted from "Host:" header. New request URL: %s  HTTP/   set-cookie: connection: Content-MD5:    Content-Encoding:   Content-Length: Keep-Alive: Proxy-Connection:   Transfer-Encoding:  content-disposition:    Last-Modified:  *   referer:    user-agent: ua- from:   x-forwarded-for:    Accept-Encoding:    TE: if-modified-since:  proxy-connection:   max-forwards:   Accept-Language:    if-none-match:  Request-Range:  If-Range:   X-Filter:   %a, %d-%b-%y %H:%M:%S   %a, %d %b %Y %H:%M:%S   %a, %d-%b-%Y %H:%M:%S   %A, %d-%b-%Y %H:%M:%S   %A %b %d %H:%M:%S %Y    $Id: ssplit.h,v 1.10 2011/09/04 11:10:56 fabiankeil Exp $   $Id: ssplit.c,v 1.12 2011/09/04 11:10:56 fabiankeil Exp $   free_http_request                                    ! #$%&'()*+,-./0123456789:; = ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ ] _ abcdefghijklmnopqrstuvwxyz   ~        `  ( 4 < D L T \ d l t                 $ compile_pattern create_url_spec $Id: urlmatch.h,v 1.18 2011/11/06 11:41:05 fabiankeil Exp $ $Id: urlmatch.c,v 1.65 2011/11/06 11:41:34 fabiankeil Exp $ urlmatch.c  More than SZ(vec) components in domain or none at all.   
 The only supported HTTP versions are 1.0 and 1.1. This rules out: %s    CONNECT Unknown HTTP method detected: %s    %s$ %s\.?$  ^%s Invalid anchoring in compile_pattern %d error compiling %s from %s: %s  strlen(pattern) < sizeof(rebuf) - 2 TAG:    POST    PUT PROPFIND    PROPPATCH   MOVE    COPY    MKCOL   LOCK    UNLOCK  BCOPY   BMOVE   BDELETE BPROPFIND   BPROPPATCH  SUBSCRIBE   UNSUBSCRIBE NOTIFY  POLL    VERSION-CONTROL REPORT  CHECKOUT    CHECKIN UNCHECKOUT  MKWORKSPACE UPDATE  LABEL   MERGE   BASELINE-CONTROL    MKACTIVITY  ! ! " P" " "                                                                                            " " " # ,# P# p# # pcrs_compile_replacement    pcrs_execute_single_command pcrs_compile_dynamic_command    ... [too long, truncated]   $Id: pcrs.h,v 1.17 2009/05/16 13:27:20 fabiankeil Exp $ $Id: pcrs.c,v 1.38 2011/09/04 11:10:56 fabiankeil Exp $ (pcrs:) Everything's just fine. Thanks for asking.  Unknown error. Privoxy out of sync with PCRE?   tnrfae0 0123456789ABCDEF    ascii_value > 0 pcrs.c  ascii_value < 256   '`+&    ><#+*~%^-:;!@    ((void *)0) != v->value ((void *)0) == (__extension__ (__builtin_constant_p (d) && !__builtin_constant_p (v->name) && (d) == '\0' ? (char *) __rawmemchr (v->name, d) : __builtin_strchr (v->name, d))) s%c\$%s%c%s%cgT ret >= 0    %s%cgT  ret == trailer_size - 1 sizeof(buf) == strlen(buf) + 1  (pcrs:) At least one variable was too big and has been truncated before compilation (pcrs:) Backreference out of range  (pcrs:) Bad job - NULL job, pattern or substitute   (pcrs:) PCRE error while studying the pattern   (pcrs:) Syntax error while parsing command  (pcrs:) No memory   (pcre:) Match limit reached (pcre:) Fire in power supply    (pcre:) No memory   (pcre:) Bad node in pattern (pcre:) Bad magic number in code    (pcre:) Unrecognized option bit (pcre:) NULL code or subject or ovector (pcre:) Water in power supply   (                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               d  H               O                              
   .    ܮ                      oԅ     @       
   K                                                      o  o   o                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          `           A)   aeabi    4T 	, .shstrtab .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .text .fini .rodata .ARM.exidx .eh_frame .init_array .fini_array .jcr .dynamic .got .data .bss .ARM.attributes                                                   T  T                             h  h                     !             $                  8             (               4   o   ԅ                   >           	  P              F         @  @  K                 N   o       
               [   o       p                j   	                          s   	                 
         |                               w                                        "  8                         .                             .                        p   #                            #                             ܮ ܮ                                                                                                                                               0                                                    p          *                                J                                                                                                                                                                                                                                                                                                                                                                                       ./usr/bin/                                                                                          0000755 0000000 0000000 00000000000 12652736077 011311  5                                                                                                    ustar   root                            root                                                                                                                                                                                                                   ./usr/bin/privoxy-log-parser                                                                        0000755 0000000 0000000 00000261461 12652736077 015042  0                                                                                                    ustar   root                            root                                                                                                                                                                                                                   #!/usr/bin/perl

################################################################################
# privoxy-log-parser
#
# A parser for Privoxy log messages. For incomplete documentation run
# perldoc privoxy-log-parser(.pl), for fancy screenshots see:
#
# http://www.fabiankeil.de/sourcecode/privoxy-log-parser/
#
# $Id: privoxy-log-parser.pl,v 1.124 2011/11/13 16:54:10 fabiankeil Exp $
#
# TODO:
#       - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting
#       - create fancy statistics
#       - grep through Privoxy sources to find unsupported log messages
#       - hunt down substitutions that match content from variables which
#         can contain stuff like ()?'[]
#       - replace $h{'foo'} with h('foo') where possible
#       - hunt down XXX comments instead of just creating them
#       - add example log lines for every regex and mark them up for
#         regression testing
#       - Handle incomplete input without Perl warning about undefined variables.
#       - Use generic highlighting function that takes a regex and the
#         hash key as input.
#       - Add --compress and --decompress options.
#
# Copyright (c) 2007-2010 Fabian Keil <fk@fabiankeil.de>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
################################################################################

use strict;
use warnings;
use Getopt::Long;

use constant {
    PRIVOXY_LOG_PARSER_VERSION => '0.7',
    # Feel free to mess with these ...
    DEFAULT_BACKGROUND => 'black',  # Choose registered colour (like 'black')
    DEFAULT_TEXT_COLOUR => 'white', # Choose registered colour (like 'black')
    HEADER_DEFAULT_COLOUR => 'yellow',
    REGISTER_HEADERS_WITH_THE_SAME_COLOUR => 1,

    CLI_OPTION_DEFAULT_TO_HTML_OUTPUT => 0,
    CLI_OPTION_TITLE => 'Privoxy-Log-Parser in da house',
    CLI_OPTION_NO_EMBEDDED_CSS => 0,
    CLI_OPTION_NO_MSECS => 0,
    CLI_OPTION_NO_SYNTAX_HIGHLIGHTING => 0,
    CLI_OPTION_SHORTEN_THREAD_IDS => 0,
    CLI_OPTION_SHOW_INEFFECTIVE_FILTERS => 0,
    CLI_OPTION_ACCEPT_UNKNOWN_MESSAGES => 0,
    CLI_OPTION_STATISTICS => 0,
    CLI_OPTION_UNBREAK_LINES_ONLY => 0,
    CLI_OPTION_URL_STATISTICS_THRESHOLD => 0,
    CLI_OPTION_HOST_STATISTICS_THRESHOLD => 0,

    SUPPRESS_SUCCEEDED_FILTER_ADDITIONS => 1,
    SHOW_SCAN_INTRO => 0,
    SHOW_FILTER_READIN_IN => 0,
    SUPPRESS_EMPTY_LINES => 1,
    SUPPRESS_SUCCESSFUL_CONNECTIONS => 1,
    SUPPRESS_ACCEPTED_CONNECTIONS => 1,
    SUPPRESS_GIF_NOT_CHANGED => 1,
    SUPPRESS_NEED_TO_DE_CHUNK_FIRST => 1,

    DEBUG_HEADER_REGISTERING => 0,
    DEBUG_HEADER_HIGHLIGHTING => 0,
    DEBUG_TICKS => 0,
    DEBUG_PAINT_IT => 0,
    DEBUG_SUPPRESS_LOG_MESSAGES => 0,

    PUNISH_MISSING_LOG_KNOWLEDGE_WITH_DEATH => 0,
    PUNISH_MISSING_HIGHLIGHT_KNOWLEDGE_WITH_DEATH => 1,

    LOG_UNPARSED_LINES_TO_EXTRA_FILE => 0,
    ERROR_LOG_FILE => '/var/log/privoxy-log-parser',

    # You better leave these alone unless you know what you're doing.
    COLOUR_RESET      => "\033[0;0m",
    ESCAPE => "\033[",
};

# For performance reasons, these are global.

my $t;
my %req; # request data from previous lines
my %h;
my %thread_colours;
my @all_colours;
my @time_colours;
my $thread_colour_index = 0;
my $header_colour_index = 0;
my $time_colour_index = 0;
my %header_colours;
my $no_special_header_highlighting;
my %reason_colours;
my %h_colours;
my $header_highlight_regex = '';

my $html_output_mode;
my $no_msecs_mode; # XXX: should probably be removed
my $shorten_thread_ids;
my $line_end;

sub prepare_our_stuff () {

    # Syntax Higlight hash
    @all_colours = (
        'redES ut of memory decompressing iob bufsize >= skip_size    Unexpected end of compressed iob. Using what we got so far. Buffer limit reached while decompressing iob    zstr.avail_out == tmpbuf + bufsize - (char *)zstr.next_out  (char *)zstr.next_out == tmpbuf + ((char *)oldnext_out - buf)   Inconsistent stream state after decompression: %s   Unexpected error while decompressing to the buffer (iob): %s    Decompression successful. Old size: %d, new size: %d.   Decompression didn't result in any content. Unexpected error decompressing the buffer (iob): %d==%d, %d>%d, %d<%d   Failed to read a multi-line header properly: '%s'   Out of memory while appending multiple headers. Merged multiple header lines to: '%s'   Reducing white space in '%s'    Converting tab to space in '%s' Ignoring single quote in '%s'   header_list header_name Content-Type:   ((void *)0) != get_header_value(csp->headers, "Content-Type:")  Multiple Content-Type headers. Removing and ignoring: '%s'  text/   plain   script  image/gif   Content-Type:   Modified: %s!   %s not replaced. It doesn't look like a content type that should be filtered. Enable force-text-mode if you know what you're doing. Action bits updated accordingly.    No action bits update necessary.    scan: %s    Inconsistent configuration: tagging enabled, but no taggers available.  Tagger %s has empty joblist. Nothing to do. ((void *)0) != header   Problems with tagger '%s' and header '%s': %s   Tagger '%s' created an empty tag. Ignored.  Insufficient memory to add tag '%s', based on tagger '%s' and header '%s'   Tagger '%s' added tag '%s'. %s  Tagger '%s' didn't add tag '%s'. Tag already present    Content modified with no Content-Length header set. Created: %s.    parameter != ((void *)0)    Referer crunched!   New host is: %s. Crunching %s!  Parameter: +hide-referrer{%s} is a bad idea, but I don't care.  Referer replaced with: %s   Host:   No "Host:" header found.    Out of memory while parsing "Host:" header  Destination extracted from "Host:" header. New request URL: %s  HTTP/   set-cookie: connection: Content-MD5:    Content-Encoding:   Content-Length: Keep-Alive: Proxy-Connection:   Transfer-Encoding:  content-disposition:    Last-Modified:  *   referer:    user-agent: ua- from:   x-forwarded-for:    Accept-Encoding:    TE: if-modified-since:  proxy-connection:   max-forwards:   Accept-Language:    if-none-match:  Request-Range:  If-Range:   X-Filter:   %a, %d-%b-%y %H:%M:%S   %a, %d %b %Y %H:%M:%S   %a, %d-%b-%Y %H:%M:%S   %A, %d-%b-%Y %H:%M:%S   %A %b %d %H:%M:%S %Y    $Id: ssplit.h,v 1.10 2011/09/04 11:10:56 fabiankeil Exp $   $Id: ssplit.c,v 1.12 2011/09/04 11:10:56 fabiankeil Exp $   free_http_request                                    ! #$%&'()*+,-./0123456789:; = ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ ] _ abcdefghijklmnopqrstuvwxyz   ~        `  ( 4 < D L T \ d l t                 $ compile_pattern create_url_spec $Id: urlmatch.h,v 1.18 2011/11/06 11:41:05 fabiankeil Exp $ $Id: urlmatch.c,v 1.65 2011/11/06 11:41:34 fabiankeil Exp $ urlmatch.c  More than SZ(vec) components in domain or none at all.   
 The only supported HTTP versions are 1.0 and 1.1. This rules out: %s    CONNECT Unknown HTTP method detected: %s    %s$ %s\.?$  ^%s Invalid anchoring in compile_pattern %d error compiling %s from %s: %s  strlen(pattern) < sizeof(rebuf) - 2 TAG:    POST    PUT PROPFIND    PROPPATCH   MOVE    COPY    MKCOL   LOCK    UNLOCK  BCOPY   BMOVE   BDELETE BPROPFIND   BPROPPATCH  SUBSCRIBE   UNSUBSCRIBE NOTIFY  POLL    VERSION-CONTROL REPORT  CHECKOUT    CHECKIN UNCHECKOUT  MKWORKSPACE UPDATE  LABEL   MERGE   BASELINE-CONTROL    MKACTIVITY  ! ! " P" " "                                                                                            " " " # ,# P# p# # pcrs_compile_replacement    pcrs_execute_single_command pcrs_compile_dynamic_command    ... [too long, truncated]   $Id: pcrs.h,v 1.17 2009/05/16 13:27:20 fabiankeil Exp $ $Id: pcrs.c,v 1.38 2011/09/04 11:10:56 fabiankeil Exp $ (pcrs:) Everything's just fine. Thanks for asking.  Unknown error. Privoxy out of sync with PCRE?   tnrfae0 0123456789ABCDEF    ascii_value > 0 pcrs.c  ascii_value < 256   '`+&    ><#+*~%^-:;!@    ((void *)0) != v->value ((void *)0) == (__extension__ (__builtin_constant_p (d) && !__builtin_constant_p (v->name) && (d) == '\0' ? (char *) __rawmemchr (v->name, d) : __builtin_strchr (v->name, d))) s%c\$%s%c%s%cgT ret >= 0    %s%cgT  ret == trailer_size - 1 sizeof(buf) == strlen(buf) + 1  (pcrs:) At least one variable was too big and has been truncated before compilation (pcrs:) Backreference out of range  (pcrs:) Bad job - NULL job, pattern or substitute   (pcrs:) PCRE error while studying the pattern   (pcrs:) Syntax error while parsing command  (pcrs:) No memory   (pcre:) Match limit reached (pcre:) Fire in power supply    (pcre:) No memory   (pcre:) Bad node in pattern (pcre:) Bad magic number in code    (pcre:) Unrecognized option bit (pcre:) NULL code or subject or ovector (pcre:) Water in power supply   (                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               d  H               O                              
   .    ܮ                      oԅ     @       
   K                                                      o  o   o                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          `           A)   aeabi    4T 	, .shstrtab .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .text .fini .rodata .ARM.exidx .eh_frame .init_array .fini_array .jcr .dynamic .got .data .bss .ARM.attributes                                                   T  T                             h  h                     !             $                  8             (               4   o   ԅ                   >           	  P              F         @  @  K                 N   o       
               [   o       p                j   	                          s   	                 
         |                               w                                        "  8                         .                             .                        p   #                            #                             ܮ ܮ                                                                                                                                               0                                                    p          *                                J                                                                                                                                                                                                                                                                                                                                                                                       ./usr/bin/                                                                                          0000755 0000000 0000000 00000000000 12652736077 011311  5                                                                                                    ustar   root                            root                                                                                                                                                                                                                   ./usr/bin/privoxy-log-parser                                                                        0000755 0000000 0000000 00000261461 12652736077 015042  0                                                                                                    ustar   root                            root                                                                                                                                                                                                                   #!/usr/bin/perl

################################################################################
# privoxy-log-parser
#
# A parser for Privoxy log messages. For incomplete documentation run
# perldoc privoxy-log-parser(.pl), for fancy screenshots see:
#
# http://www.fabiankeil.de/sourcecode/privoxy-log-parser/
#
# $Id: privoxy-log-parser.pl,v 1.124 2011/11/13 16:54:10 fabiankeil Exp $
#
# TODO:
#       - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting
#       - create fancy statistics
#       - grep through Privoxy sources to find unsupported log messages
#       - hunt down substitutions that match content from variables which
#         can contain stuff like ()?'[]
#       - replace $h{'foo'} with h('foo') where possible
#       - hunt down XXX comments instead of just creating them
#       - add example log lines for every regex and mark them up for
#         regression testing
#       - Handle incomplete input without Perl warning about undefined variables.
#       - Use generic highlighting function that takes a regex and the
#         hash key as input.
#       - Add --compress and --decompress options.
#
# Copyright (c) 2007-2010 Fabian Keil <fk@fabiankeil.de>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
################################################################################

use strict;
use warnings;
use Getopt::Long;

use constant {
    PRIVOXY_LOG_PARSER_VERSION => '0.7',
    # Feel free to mess with these ...
    DEFAULT_BACKGROUND => 'black',  # Choose registered colour (like 'black')
    DEFAULT_TEXT_COLOUR => 'white', # Choose registered colour (like 'black')
    HEADER_DEFAULT_COLOUR => 'yellow',
    REGISTER_HEADERS_WITH_THE_SAME_COLOUR => 1,

    CLI_OPTION_DEFAULT_TO_HTML_OUTPUT => 0,
    CLI_OPTION_TITLE => 'Privoxy-Log-Parser in da house',
    CLI_OPTION_NO_EMBEDDED_CSS => 0,
    CLI_OPTION_NO_MSECS => 0,
    CLI_OPTION_NO_SYNTAX_HIGHLIGHTING => 0,
    CLI_OPTION_SHORTEN_THREAD_IDS => 0,
    CLI_OPTION_SHOW_INEFFECTIVE_FILTERS => 0,
    CLI_OPTION_ACCEPT_UNKNOWN_MESSAGES => 0,
    CLI_OPTION_STATISTICS => 0,
    CLI_OPTION_UNBREAK_LINES_ONLY => 0,
    CLI_OPTION_URL_STATISTICS_THRESHOLD => 0,
    CLI_OPTION_HOST_STATISTICS_THRESHOLD => 0,

    SUPPRESS_SUCCEEDED_FILTER_ADDITIONS => 1,
    SHOW_SCAN_INTRO => 0,
    SHOW_FILTER_READIN_IN => 0,
    SUPPRESS_EMPTY_LINES => 1,
    SUPPRESS_SUCCESSFUL_CONNECTIONS => 1,
    SUPPRESS_ACCEPTED_CONNECTIONS => 1,
    SUPPRESS_GIF_NOT_CHANGED => 1,
    SUPPRESS_NEED_TO_DE_CHUNK_FIRST => 1,

    DEBUG_HEADER_REGISTERING => 0,
    DEBUG_HEADER_HIGHLIGHTING => 0,
    DEBUG_TICKS => 0,
    DEBUG_PAINT_IT => 0,
    DEBUG_SUPPRESS_LOG_MESSAGES => 0,

    PUNISH_MISSING_LOG_KNOWLEDGE_WITH_DEATH => 0,
    PUNISH_MISSING_HIGHLIGHT_KNOWLEDGE_WITH_DEATH => 1,

    LOG_UNPARSED_LINES_TO_EXTRA_FILE => 0,
    ERROR_LOG_FILE => '/var/log/privoxy-log-parser',

    # You better leave these alone unless you know what you're doing.
    COLOUR_RESET      => "\033[0;0m",
    ESCAPE => "\033[",
};

# For performance reasons, these are global.

my $t;
my %req; # request data from previous lines
my %h;
my %thread_colours;
my @all_colours;
my @time_colours;
my $thread_colour_index = 0;
my $header_colour_index = 0;
my $time_colour_index = 0;
my %header_colours;
my $no_special_header_highlighting;
my %reason_colours;
my %h_colours;
my $header_highlight_regex = '';

my $html_output_mode;
my $no_msecs_mode; # XXX: should probably be removed
my $shorten_thread_ids;
my $line_end;

sub prepare_our_stuff () {

    # Syntax Higlight hash
    @all_colours = (
        'redES ut of memory decompressing iob bufsize >= skip_size    Unexpected end of compressed iob. Using what we got so far. Buffer limit reached while decompressing iob    zstr.avail_out == tmpbuf + bufsize - (char *)zstr.next_out  (char *)zstr.next_out == tmpbuf + ((char *)oldnext_out - buf)   Inconsistent stream state after decompression: %s   Unexpected error while decompressing to the buffer (iob): %s    Decompression successful. Old size: %d, new size: %d.   Decompression didn't result in any content. Unexpected error decompressing the buffer (iob): %d==%d, %d>%d, %d<%d   Failed to read a multi-line header properly: '%s'   Out of memory while appending multiple headers. Merged multiple header lines to: '%s'   Reducing white space in '%s'    Converting tab to space in '%s' Ignoring single quote in '%s'   header_list header_name Content-Type:   ((void *)0) != get_header_value(csp->headers, "Content-Type:")  Multiple Content-Type headers. Removing and ignoring: '%s'  text/   plain   script  image/gif   Content-Type:   Modified: %s!   %s not replaced. It doesn't look like a content type that should be filtered. Enable force-text-mode if you know what you're doing. Action bits updated accordingly.    No action bits update necessary.    scan: %s    Inconsistent configuration: tagging enabled, but no taggers available.  Tagger %s has empty joblist. Nothing to do. ((void *)0) != header   Problems with tagger '%s' and header '%s': %s   Tagger '%s' created an empty tag. Ignored.  Insufficient memory to add tag '%s', based on tagger '%s' and header '%s'   Tagger '%s' added tag '%s'. %s  Tagger '%s' didn't add tag '%s'. Tag already present    Content modified with no Content-Length header set. Created: %s.    parameter != ((void *)0)    Referer crunched!   New host is: %s. Crunching %s!  Parameter: +hide-referrer{%s} is a bad idea, but I don't care.  Referer replaced with: %s   Host:   No "Host:" header found.    Out of memory while parsing "Host:" header  Destination extracted from "Host:" header. New request URL: %s  HTTP/   set-cookie: connection: Content-MD5:    Content-Encoding:   Content-Length: Keep-Alive: Proxy-Connection:   Transfer-Encoding:  content-disposition:    Last-Modified:  *   referer:    user-agent: ua- from:   x-forwarded-for:    Accept-Encoding:    TE: if-modified-since:  proxy-connection:   max-forwards:   Accept-Language:    if-none-match:  Request-Range:  If-Range:   X-Filter:   %a, %d-%b-%y %H:%M:%S   %a, %d %b %Y %H:%M:%S   %a, %d-%b-%Y %H:%M:%S   %A, %d-%b-%Y %H:%M:%S   %A %b %d %H:%M:%S %Y    $Id: ssplit.h,v 1.10 2011/09/04 11:10:56 fabiankeil Exp $   $Id: ssplit.c,v 1.12 2011/09/04 11:10:56 fabiankeil Exp $   free_http_request                                    ! #$%&'()*+,-./0123456789:; = ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ ] _ abcdefghijklmnopqrstuvwxyz   ~        `  ( 4 < D L T \ d l t                 $ compile_pattern create_url_spec $Id: urlmatch.h,v 1.18 2011/11/06 11:41:05 fabiankeil Exp $ $Id: urlmatch.c,v 1.65 2011/11/06 11:41:34 fabiankeil Exp $ urlmatch.c  More than SZ(vec) components in domain or none at all.   
 The only supported HTTP versions are 1.0 and 1.1. This rules out: %s    CONNECT Unknown HTTP method detected: %s    %s$ %s\.?$  ^%s Invalid anchoring in compile_pattern %d error compiling %s from %s: %s  strlen(pattern) < sizeof(rebuf) - 2 TAG:    POST    PUT PROPFIND    PROPPATCH   MOVE    COPY    MKCOL   LOCK    UNLOCK  BCOPY   BMOVE   BDELETE BPROPFIND   BPROPPATCH  SUBSCRIBE   UNSUBSCRIBE NOTIFY  POLL    VERSION-CONTROL REPORT  CHECKOUT    CHECKIN UNCHECKOUT  MKWORKSPACE UPDATE  LABEL   MERGE   BASELINE-CONTROL    MKACTIVITY  ! ! " P" " "                                                                                            " " " # ,# P# p# # pcrs_compile_replacement    pcrs_execute_single_command pcrs_compile_dynamic_command    ... [too long, truncated]   $Id: pcrs.h,v 1.17 2009/05/16 13:27:20 fabiankeil Exp $ $Id: pcrs.c,v 1.38 2011/09/04 11:10:56 fabiankeil Exp $ (pcrs:) Everything's just fine. Thanks for asking.  Unknown error. Privoxy out of sync with PCRE?   tnrfae0 0123456789ABCDEF    ascii_value > 0 pcrs.c  ascii_value < 256   '`+&    ><#+*~%^-:;!@    ((void *)0) != v->value ((void *)0) == (__extension__ (__builtin_constant_p (d) && !__builtin_constant_p (v->name) && (d) == '\0' ? (char *) __rawmemchr (v->name, d) : __builtin_strchr (v->name, d))) s%c\$%s%c%s%cgT ret >= 0    %s%cgT  ret == trailer_size - 1 sizeof(buf) == strlen(buf) + 1  (pcrs:) At least one variable was too big and has been truncated before compilation (pcrs:) Backreference out of range  (pcrs:) Bad job - NULL job, pattern or substitute   (pcrs:) PCRE error while studying the pattern   (pcrs:) Syntax error while parsing command  (pcrs:) No memory   (pcre:) Match limit reached (pcre:) Fire in power supply    (pcre:) No memory   (pcre:) Bad node in pattern (pcre:) Bad magic number in code    (pcre:) Unrecognized option bit (pcre:) NULL code or subject or ovector (pcre:) Water in power supply   (                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               d  H               O                              
   .    ܮ                      oԅ     @       
   K                                                      o  o   o                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          `           A)   aeabi    4T 	, .shstrtab .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .text .fini .rodata .ARM.exidx .eh_frame .init_array .fini_array .jcr .dynamic .got .data .bss .ARM.attributes                                                   T  T                             h  h                     !             $                  8             (               4   o   ԅ                   >           	  P              F         @  @  K                 N   o       
               [   o       p                j   	                          s   	                 
         |                               w                                        "  8                         .                             .                        p   #                            #                             ܮ ܮ                                                                                                                                               0                                                    p          *                                J                                                                                                                                                                                                                                                                                                                                                                                       ./usr/bin/                                                                                          0000755 0000000 0000000 00000000000 12652736077 011311  5                                                                                                    ustar   root                            root                                                                                                                                                                                                                   ./usr/bin/privoxy-log-parser                                                                        0000755 0000000 0000000 00000261461 12652736077 015042  0                                                                                                    ustar   root                            root                                                                                                                                                                                                                   #!/usr/bin/perl

################################################################################
# privoxy-log-parser
#
# A parser for Privoxy log messages. For incomplete documentation run
# perldoc privoxy-log-parser(.pl), for fancy screenshots see:
#
# http://www.fabiankeil.de/sourcecode/privoxy-log-parser/
#
# $Id: privoxy-log-parser.pl,v 1.124 2011/11/13 16:54:10 fabiankeil Exp $
#
# TODO:
#       - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting
#       - create fancy statistics
#       - grep through Privoxy sources to find unsupported log messages
#       - hunt down substitutions that match content from variables which
#         can contain stuff like ()?'[]
#       - replace $h{'foo'} with h('foo') where possible
#       - hunt down XXX comments instead of just creating them
#       - add example log lines for every regex and mark them up for
#         regression testing
#       - Handle incomplete input without Perl warning about undefined variables.
#       - Use generic highlighting function that takes a regex and the
#         hash key as input.
#       - Add --compress and --decompress options.
#
# Copyright (c) 2007-2010 Fabian Keil <fk@fabiankeil.de>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
################################################################################

use strict;
use warnings;
use Getopt::Long;

use constant {
    PRIVOXY_LOG_PARSER_VERSION => '0.7',
    # Feel free to mess with these ...
    DEFAULT_BACKGROUND => 'black',  # Choose registered colour (like 'black')
    DEFAULT_TEXT_COLOUR => 'white', # Choose registered colour (like 'black')
    HEADER_DEFAULT_COLOUR => 'yellow',
    REGISTER_HEADERS_WITH_THE_SAME_COLOUR => 1,

    CLI_OPTION_DEFAULT_TO_HTML_OUTPUT => 0,
    CLI_OPTION_TITLE => 'Privoxy-Log-Parser in da house',
    CLI_OPTION_NO_EMBEDDED_CSS => 0,
    CLI_OPTION_NO_MSECS => 0,
    CLI_OPTION_NO_SYNTAX_HIGHLIGHTING => 0,
    CLI_OPTION_SHORTEN_THREAD_IDS => 0,
    CLI_OPTION_SHOW_INEFFECTIVE_FILTERS => 0,
    CLI_OPTION_ACCEPT_UNKNOWN_MESSAGES => 0,
    CLI_OPTION_STATISTICS => 0,
    CLI_OPTION_UNBREAK_LINES_ONLY => 0,
    CLI_OPTION_URL_STATISTICS_THRESHOLD => 0,
    CLI_OPTION_HOST_STATISTICS_THRESHOLD => 0,

    SUPPRESS_SUCCEEDED_FILTER_ADDITIONS => 1,
    SHOW_SCAN_INTRO => 0,
    SHOW_FILTER_READIN_IN => 0,
    SUPPRESS_EMPTY_LINES => 1,
    SUPPRESS_SUCCESSFUL_CONNECTIONS => 1,
    SUPPRESS_ACCEPTED_CONNECTIONS => 1,
    SUPPRESS_GIF_NOT_CHANGED => 1,
    SUPPRESS_NEED_TO_DE_CHUNK_FIRST => 1,

    DEBUG_HEADER_REGISTERING => 0,
    DEBUG_HEADER_HIGHLIGHTING => 0,
    DEBUG_TICKS => 0,
    DEBUG_PAINT_IT => 0,
    DEBUG_SUPPRESS_LOG_MESSAGES => 0,

    PUNISH_MISSING_LOG_KNOWLEDGE_WITH_DEATH => 0,
    PUNISH_MISSING_HIGHLIGHT_KNOWLEDGE_WITH_DEATH => 1,

    LOG_UNPARSED_LINES_TO_EXTRA_FILE => 0,
    ERROR_LOG_FILE => '/var/log/privoxy-log-parser',

    # You better leave these alone unless you know what you're doing.
    COLOUR_RESET      => "\033[0;0m",
    ESCAPE => "\033[",
};

# For performance reasons, these are global.

my $t;
my %req; # request data from previous lines
my %h;
my %thread_colours;
my @all_colours;
my @time_colours;
my $thread_colour_index = 0;
my $header_colour_index = 0;
my $time_colour_index = 0;
my %header_colours;
my $no_special_header_highlighting;
my %reason_colours;
my %h_colours;
my $header_highlight_regex = '';

my $html_output_mode;
my $no_msecs_mode; # XXX: should probably be removed
my $shorten_thread_ids;
my $line_end;

sub prepare_our_stuff () {

    # Syntax Higlight hash
    @all_colours = (
        'redES ut of memory decompressing iob bufsize >= skip_size    Unexpected end of compressed iob. Using what we got so far. Buffer limit reached while decompressing iob    zstr.avail_out == tmpbuf + bufsize - (char *)zstr.next_out  (char *)zstr.next_out == tmpbuf + ((char *)oldnext_out - buf)   Inconsistent stream state after decompression: %s   Unexpected error while decompressing to the buffer (iob): %s    Decompression successful. Old size: %d, new size: %d.   Decompression didn't result in any content. Unexpected error decompressing the buffer (iob): %d==%d, %d>%d, %d<%d   Failed to read a multi-line header properly: '%s'   Out of memory while appending multiple headers. Merged multiple header lines to: '%s'   Reducing white space in '%s'    Converting tab to space in '%s' Ignoring single quote in '%s'   header_list header_name Content-Type:   ((void *)0) != get_header_value(csp->headers, "Content-Type:")  Multiple Content-Type headers. Removing and ignoring: '%s'  text/   plain   script  image/gif   Content-Type:   Modified: %s!   %s not replaced. It doesn't look like a content type that should be filtered. Enable force-text-mode if you know what you're doing. Action bits updated accordingly.    No action bits update necessary.    scan: %s    Inconsistent configuration: tagging enabled, but no taggers available.  Tagger %s has empty joblist. Nothing to do. ((void *)0) != header   Problems with tagger '%s' and header '%s': %s   Tagger '%s' created an empty tag. Ignored.  Insufficient memory to add tag '%s', based on tagger '%s' and header '%s'   Tagger '%s' added tag '%s'. %s  Tagger '%s' didn't add tag '%s'. Tag already present    Content modified with no Content-Length header set. Created: %s.    parameter != ((void *)0)    Referer crunched!   New host is: %s. Crunching %s!  Parameter: +hide-referrer{%s} is a bad idea, but I don't care.  Referer replaced with: %s   Host:   No "Host:" header found.    Out of memory while parsing "Host:" header  Destination extracted from "Host:" header. New request URL: %s  HTTP/   set-cookie: connection: Content-MD5:    Content-Encoding:   Content-Length: Keep-Alive: Proxy-Connection:   Transfer-Encoding:  content-disposition:    Last-Modified:  *   referer:    user-agent: ua- from:   x-forwarded-for:    Accept-Encoding:    TE: if-modified-since:  proxy-connection:   max-forwards:   Accept-Language:    if-none-match:  Request-Range:  If-Range:   X-Filter:   %a, %d-%b-%y %H:%M:%S   %a, %d %b %Y %H:%M:%S   %a, %d-%b-%Y %H:%M:%S   %A, %d-%b-%Y %H:%M:%S   %A %b %d %H:%M:%S %Y    $Id: ssplit.h,v 1.10 2011/09/04 11:10:56 fabiankeil Exp $   $Id: ssplit.c,v 1.12 2011/09/04 11:10:56 fabiankeil Exp $   free_http_request                                    ! #$%&'()*+,-./0123456789:; = ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ ] _ abcdefghijklmnopqrstuvwxyz   ~        `  ( 4 < D L T \ d l t                 $ compile_pattern create_url_spec $Id: urlmatch.h,v 1.18 2011/11/06 11:41:05 fabiankeil Exp $ $Id: urlmatch.c,v 1.65 2011/11/06 11:41:34 fabiankeil Exp $ urlmatch.c  More than SZ(vec) components in domain or none at all.   
 The only supported HTTP versions are 1.0 and 1.1. This rules out: %s    CONNECT Unknown HTTP method detected: %s    %s$ %s\.?$  ^%s Invalid anchoring in compile_pattern %d error compiling %s from %s: %s  strlen(pattern) < sizeof(rebuf) - 2 TAG:    POST    PUT PROPFIND    PROPPATCH   MOVE    COPY    MKCOL   LOCK    UNLOCK  BCOPY   BMOVE   BDELETE BPROPFIND   BPROPPATCH  SUBSCRIBE   UNSUBSCRIBE NOTIFY  POLL    VERSION-CONTROL REPORT  CHECKOUT    CHECKIN UNCHECKOUT  MKWORKSPACE UPDATE  LABEL   MERGE   BASELINE-CONTROL    MKACTIVITY  ! ! " P" " "                                                                                            " " " # ,# P# p# # pcrs_compile_replacement    pcrs_execute_single_command pcrs_compile_dynamic_command    ... [too long, truncated]   $Id: pcrs.h,v 1.17 2009/05/16 13:27:20 fabiankeil Exp $ $Id: pcrs.c,v 1.38 2011/09/04 11:10:56 fabiankeil Exp $ (pcrs:) Everything's just fine. Thanks for asking.  Unknown error. Privoxy out of sync with PCRE?   tnrfae0 0123456789ABCDEF    ascii_value > 0 pcrs.c  ascii_value < 256   '`+&    ><#+*~%^-:;!@    ((void *)0) != v->value ((void *)0) == (__extension__ (__builtin_constant_p (d) && !__builtin_constant_p (v->name) && (d) == '\0' ? (char *) __rawmemchr (v->name, d) : __b