18,19c18,23
< # 05-May-2004, ver 0.94 (check for new versions, http://www.brendangregg.com)
< # (or run a web search for "chaosreader")
---
> # 11-Sep-2011, ver 0.95
> # 24-Sep 2011, ver 0.95b
> # 04-Jan 2012, ver 0.95c
> # (http://www.brendangregg.com/chaosreader.html seems to be outdated.
> # E-mail to the address brendan@sun.com mentioned on that web site returned
> # with an error.)
32c36
< # USAGE: chaosreader [-aehikqrvxAHIRTUXY] [-D dir]
---
> # USAGE: chaosreader [-adehiknqrvxAHIRTUXY] [-D dir]
45a50
> # -d, --preferdns # Show DNS names instead of IP addresses
63a69
> # -n, --names # Include hostnames in hyperlinked HTTPlog (HTML)
199c205
< # SEE ALSO: ethereal (GUI packet viewer), dsniff (sniffing toolkit)
---
> # SEE ALSO: wireshark (GUI packet viewer), dsniff (sniffing toolkit)
201a208,209
> # Copyright (c) 2008 Indian Larry.
> # Copyright (c) 2011, 2012 Jens Lechtenbörger.
203,219c211,226
< # 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.
< #
< # You should have received a copy of the GNU General Public License
< # along with this program; if not, write to the Free Software Foundation,
< # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
< #
< # (http://www.gnu.org/copyleft/gpl.html)
< #
< # Author: Brendan Gregg [Sydney, Australia]
---
> # 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 3 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.
> #
> # You should have received a copy of the GNU General Public License
> # along with this program. If not, see .
> #
> # Authors: Brendan Gregg [Sydney, Australia]
> # Indian Larry [http://refrequelate.blogspot.com/]
> # Jens Lechtenbörger [Münster, Germany]
241c248,272
<
---
> #
> # 11-Sep-2011, Jens Lechtenbörger:
> # - Switch from GPLv2 to GPLv3
> # - Integrate diff from
> # http://refrequelate.blogspot.com/2008/07/more-de-chunking-chaosreader-patch.html
> # to reassemble chunked HTTP transfers.
> # - Parse linux cooked captures, which result from listening on "any"
> # interface. (Chaosreader0.94 does not produce any output for such
> # pcap files.)
> # - Use HTTP content-type to identify file types such as HTML, XML,
> # Javascript, CSS; use those types for better file extensions than
> # "data".
> # - Uncompress gzip'ed data.
> # - Add new command line switch to show host names in HTTPlog and to
> # create href-links from HTTPlog rows to the corresponding rows in
> # the table on index.html.
> # - Several minor improvements (see comments with "JL:").
> #
> # 24-Sep-2011, Jens Lechtenbörger:
> # - More systematic Content-Type handling based on MIME types.
> # - More image types included in Image Report based on MIME types.
> #
> # 4-Jan-2012, Jens Lechtenbörger:
> # - Parsing of DNS replies to show names instead of IP addresses (new
> # command line switch -d) and to save DNS replies as text files.
244a276,277
> use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
> use Net::DNS::Packet;
316c349,350
<
---
> &Set_MIME_Types(); #JL
> &Set_DNS(); #JL
861a896,900
> # JL: Try linux cooked capture
> ($lptype,$lladdr_type,$lladdr_len,
> $ether_src,$ll_dummy,$ether_type,$ether_data) =
> unpack('nnnH12nH4a*',$packet_data) unless $decoded;
> if ($ether_type ne "0800") {
862a902
> }
1342a1383,1387
> # JL: DNS parsing
> if (($udp_src_port == 53) || ($udp_dest_port == 53)) {
> &Process_DNS($udp_data, $session_id);
> }
>
1630c1675,1677
< $Index{HTML}[$number] = "
$number. | " .
---
> # JL: Added id attribute as link target
> $Index{HTML}[$number] = "
" .
> "$number. | " .
1758c1805
< &Process_HTTP($session_id);
---
> &Process_HTTP($session_id,$number);
1902a1950,1953
> if ($Arg{prefer_dns}) {
> $ip_src = &Get_Name_For_IP($ip_src);
> $ip_dest = &Get_Name_For_IP($ip_dest);
> }
1996a2048,2051
> if ($service == 53) {
> &Save_DNS_File($session_id,$number);
> }
>
2160a2216,2239
> # JL: Process_DNS - DNS processing. Look for DNS replies and store
> # names for IP addresses into %DNS.
> #
> sub Process_DNS {
> my $data = shift;
> my $session_id = shift;
>
> my $dns = Net::DNS::Packet->new(\$data);
>
> unless ($dns) {
> #print "Failed to create Net::DNS::Packet!\n";
> return;
> }
>
> $UDP{id}{$session_id}{DNS} = $dns->string;
> foreach my $rr ($dns->answer) {
> if ($rr->type eq "A") {
> $DNS{$rr->address} = $rr->name;
> }
> }
> }
>
>
>
2162a2242
> # JL: Added host parameter
2165c2245
< my ($junk,$var,$value,$term,$data,$request,$site,$post,$get,$reply);
---
> my ($junk,$var,$value,$term,$data,$request,$host,$site,$post,$get,$reply);
2173a2254
> my $number = shift;
2220a2302,2304
> ### JL: Get the host string
> ($host) = $request =~ /Host:\s(\S*)\s/is;
>
2225c2309,2314
< $site = "http://${dest}$site";
---
> # JL: Prefer hostname over IP address
> if ($Arg{httplog_html}) {
> $site = "http://${host}$site";
> } else {
> $site = "http://${dest}$site";
> }
2230,2231c2319,2321
< ($type) = $reply =~ /Content-Type:\s(\S*)/s;
< ($size) = $reply =~ /Content-Length:\s(\S*)/s;
---
> # JL: Be careful to use case insensitive matching
> ($type) = $reply =~ /Content-Type:\s(\S*)/is;
> ($size) = $reply =~ /Content-Length:\s(\S*)/is;
2238,2241c2328,2330
< sprintf("%9d.%03d %6d %s %s/%03d %d %s %s %s %s%s/%s %s\n",
< int($time),(($time - int($time))*1000),($duration*1000),
< $src,$result,$status,$size,"GET",$site,"-","NONE","",
< "-",$type);
---
> Print_Log_Line($number,$time,$duration,
> $src,$dest,$result,$status,$size,
> "GET",$site,"-","NONE","","-",$type);
2250a2340,2341
> ### JL: Get the host string
> ($host) = $request =~ /Host:\s(\S*)/is;
2254,2255c2345,2346
< ($type) = $reply =~ /Content-Type:\s(\S*)/s;
< ($size) = $reply =~ /Content-Length:\s(\S*)/s;
---
> ($type) = $reply =~ /Content-Type:\s(\S*)/is;
> ($size) = $reply =~ /Content-Length:\s(\S*)/is;
2262,2265c2353,2355
< sprintf("%9d.%03d %6d %s %s/%03d %d %s %s %s %s%s/%s %s\n",
< int($time),(($time - int($time))*1000),($duration*1000),
< $src,$result,$status,$size,"POST",$site,"-","NONE","",
< "-",$type);
---
> Print_Log_Line($number,$time,$duration,
> $src,$dest,$result,$status,$size,
> "POST",$site,"-","NONE","","-",$type);
2569c2659
< print "Chaosreader ver 0.94\n\n";
---
> print "Chaosreader ver 0.95c\n\n";
2648c2738
< HTTP Proxy Log
---
> HTTP Proxy Log
2934a3025,3056
> # JL: Print a line for the HTTPlog
> #
> sub Print_Log_Line {
> my $number = shift;
> my $time = shift;
> my $duration = shift;
> my $src = shift;
> my $dest = shift;
> my $result = shift;
> my $status = shift;
> my $size = shift;
> my $method = shift;
> my $site = shift;
> my $type = shift;
>
> if ($Arg{httplog_html}) {
> sprintf("%d" .
> " %9d.%03d %6d " .
> "%-15s %-15s %s/%03d %d %s %s %s %s%s/%s %s
\n",
> $number,$number,
> int($time),(($time - int($time))*1000),($duration*1000),
> $src,$dest,$result,$status,$size,
> $method,$site,"-","NONE","","-",$type);
> } else {
> sprintf("%9d.%03d %6d %s %s/%03d %d %s %s %s %s%s/%s %s\n",
> int($time),(($time - int($time))*1000),($duration*1000),
> $src,$result,$status,$size,
> $method,$site,"-","NONE","","-",$type);
> }
> }
>
>
2942c3064,3065
< # Create HTTPlog.text
---
> # Create httplog file
> # JL: Don't use hardcoded filename
2944,2945c3067
< open(FILE,">httplog.text") || die "ERROR29: creating HTTP log: $!\n";
<
---
> open(FILE,">$Arg{httplog_name}") || die "ERROR29: creating HTTP log: $!\n";
2962a3085
> elsif ($data =~ /^.PNG/) { $type = "png"; } # JL
2969a3093
> elsif ($data =~ / # JL: Use MIME types.
> return ($ext_types{$ext} eq "image");
5354a5477,5493
> ### JL: Chunk Check, patch from http://refrequelate.blogspot.com/2008/07/more-de-chunking-chaosreader-patch.html
> if ( $http_header =~ /Transfer-Encoding: chunked/ ) {
> my $new_http_data="";
> my $chunksize=-1;
> my $pos=0;
> until ($chunksize==0) {
> my $eolpos=index($http_data,"\r\n",$pos);
> $chunksize=hex(substr($http_data,$pos,$eolpos - $pos));
> $pos=($eolpos+2);
> if ($chunksize > 0) {
> $new_http_data.=substr($http_data,$pos,$chunksize);
> }
> $pos+=($chunksize+2);
> }
> $http_data=$new_http_data;
> }
>
5356c5495
< $http_type = &File_Type($http_data);
---
> my $http_type = &File_Type($http_data);
5359a5499,5515
> ### JL: Check for known MIME type in Content-Type
> my ($content_type) = $http_header =~ /Content-Type:\s+(\S*)/is;
> my $file_extension = "";
> if ($content_type ne "") {
> for my $pattern ( keys %mime_types ) {
> my $value = $mime_types{$pattern};
> if ( $content_type =~ /$pattern/i ) {
> $file_extension = $value;
> last;
> }
> }
> if ($file_extension eq "") {
> print "Unkown Content-Type $content_type.";
> print " May want to extend MIME types.\n";
> }
> }
>
5361,5362c5517,5524
< $filename = "session_${numtext}.part_$parttext${ext}." .
< "$http_type";
---
> # JL: Create filename based on Content-Type
> my $filename = "session_${numtext}.part_$parttext${ext}";
> if ($file_extension ne "") {
> $filename .= ".$file_extension";
> }
> if ( ($file_extension eq "") or ($http_type eq "gz") ) {
> $filename .= ".$http_type";
> }
5368a5531,5541
> ### JL: gz decompressing
> if ( $http_type eq "gz" ) {
> my $gunzipped = substr($filename, 0, length($filename) - 3);
> my $gunzip_failed = 0;
> gunzip $filename => $gunzipped
> or $gunzip_failed = 1;
> if ( $gunzip_failed == 0 ) {
> $filename = $gunzipped;
> }
> }
>
5375c5548,5549
< if (&Is_Image($http_type)) {
---
> if (&Is_Image($http_type) or
> &Is_Image($file_extension)) { # JL: Also check file ext.
5431a5606,5629
> # Save_DNS_File - Save DNS file.
> #
> sub Save_DNS_File {
> my ($filename);
> my $session_id = shift;
> my $number = shift;
> my $numtext = sprintf("%04d",$number);
> my $text = $UDP{id}{$session_id}{DNS};
>
> ### Output
> $filename = "session_${numtext}.domain.txt";
> open (OUT,">$filename") || die "ERROR52: file create, $filename: $!\n";
> print OUT $text;
> close OUT;
>
> ### Global Vars
> my $length = length($text);
> $Index{HTML}[$number] .= "$filename" .
> " $length bytes\n";
> $Index{Text}[$number] .= sprintf("%-4s %-45s %-10s %8s bytes\n",
> '"' , " $filename","",$length);
> }
>
>
5509a5708,5716
> # Retrieve DNS name for IP address based on DNS traffic of this capture.
> #
> sub Get_Name_For_IP {
> my $ip_addr = shift;
> if (defined $DNS{$ip_addr}) {
> return $DNS{$ip_addr};
> }
> return $ip_addr;
> }
5578a5786,5789
> if ($Arg{prefer_dns}) {
> $ip_src = &Get_Name_For_IP($ip_src);
> $ip_dest = &Get_Name_For_IP($ip_dest);
> }
5581a5793,5796
> if ($Arg{prefer_dns}) {
> $ip_src = &Get_Name_For_IP($ip_src);
> $ip_dest = &Get_Name_For_IP($ip_dest);
> }
6177a6393,6753
> # JL: Initialize Hostnames for IP addresses
> sub Set_DNS {
> %DNS = (
> "192.168.178.1" => "fritz.box"
> )
> }
>
> # JL: Set_MIME_Types - create hash of MIME types and file extensions.
> sub Set_MIME_Types {
> # Initialize with types seen in the wild but not covered below.
> %mime_types = (
> "application/binary" => "binary",
> "application/ocsp-response" => "ocsp",
> "application/pln" => "pln", # bahn.de schedule
> "application/vnd.google.safebrowsing-update" => "safebrowsing-update",
> "application/vnd.google.safebrowsing-chunk" => "safebrowsing-chunk",
> "application/vnd.ms-sync.wbxml" => "mssync", # MS ActiveSync
> "application/x-protobuffer" => "protobuffer", # google
> "application/x-smd" => "smd", # MapDroyd boundary
> "(application|text)/((x-)?javascript|(x-)?js)" => "js",
> "(application|text)/json" => "json",
> "image/bmp" => "bmp",
> "image/vnd.microsoft.icon" => "ico",
> "image/x-gif" => "gif",
> "(image/x-)?jp(e)?g" => "jpeg",
> "image/x-png" => "png",
> "text/xml" => "xml");
> # Following created with:
> # grep -o -P "^(text|application|audio|image|video).*\t+([a-z0-9]+)" /etc/mime.types > mime.types
> $raw_mime_types = < application/andrew-inset ez
> application/annodex anx
> application/atom+xml atom
> application/atomcat+xml atomcat
> application/atomserv+xml atomsrv
> application/bbolin lin
> application/cap cap
> application/cu-seeme cu
> application/davmount+xml davmount
> application/dsptype tsp
> application/ecmascript es
> application/futuresplash spl
> application/hta hta
> application/java-archive jar
> application/java-serialized-object ser
> application/java-vm class
> application/javascript js
> application/m3g m3g
> application/mac-binhex40 hqx
> application/mac-compactpro cpt
> application/mathematica nb
> application/msaccess mdb
> application/msword doc
> application/mxf mxf
> application/octet-stream bin
> application/oda oda
> application/ogg ogx
> application/pdf pdf
> application/pgp-keys key
> application/pgp-signature pgp
> application/pics-rules prf
> application/postscript ps
> application/rar rar
> application/rdf+xml rdf
> application/rss+xml rss
> application/rtf rtf
> application/smil smi
> application/xhtml+xml xhtml
> application/xml xml
> application/xspf+xml xspf
> application/zip zip
> application/vnd.android.package-archive apk
> application/vnd.cinderella cdy
> application/vnd.google-earth.kml+xml kml
> application/vnd.google-earth.kmz kmz
> application/vnd.mozilla.xul+xml xul
> application/vnd.ms-excel xls
> application/vnd.ms-pki.seccat cat
> application/vnd.ms-pki.stl stl
> application/vnd.ms-powerpoint ppt
> application/vnd.oasis.opendocument.chart odc
> application/vnd.oasis.opendocument.database odb
> application/vnd.oasis.opendocument.formula odf
> application/vnd.oasis.opendocument.graphics odg
> application/vnd.oasis.opendocument.graphics-template otg
> application/vnd.oasis.opendocument.image odi
> application/vnd.oasis.opendocument.presentation odp
> application/vnd.oasis.opendocument.presentation-template otp
> application/vnd.oasis.opendocument.spreadsheet ods
> application/vnd.oasis.opendocument.spreadsheet-template ots
> application/vnd.oasis.opendocument.text odt
> application/vnd.oasis.opendocument.text-master odm
> application/vnd.oasis.opendocument.text-template ott
> application/vnd.oasis.opendocument.text-web oth
> application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
> application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
> application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
> application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
> application/vnd.openxmlformats-officedocument.presentationml.template potx
> application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
> application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
> application/vnd.rim.cod cod
> application/vnd.smaf mmf
> application/vnd.stardivision.calc sdc
> application/vnd.stardivision.chart sds
> application/vnd.stardivision.draw sda
> application/vnd.stardivision.impress sdd
> application/vnd.stardivision.math sdf
> application/vnd.stardivision.writer sdw
> application/vnd.stardivision.writer-global sgl
> application/vnd.sun.xml.calc sxc
> application/vnd.sun.xml.calc.template stc
> application/vnd.sun.xml.draw sxd
> application/vnd.sun.xml.draw.template std
> application/vnd.sun.xml.impress sxi
> application/vnd.sun.xml.impress.template sti
> application/vnd.sun.xml.math sxm
> application/vnd.sun.xml.writer sxw
> application/vnd.sun.xml.writer.global sxg
> application/vnd.sun.xml.writer.template stw
> application/vnd.symbian.install sis
> application/vnd.visio vsd
> application/vnd.wap.wbxml wbxml
> application/vnd.wap.wmlc wmlc
> application/vnd.wap.wmlscriptc wmlsc
> application/vnd.wordperfect wpd
> application/vnd.wordperfect5.1 wp5
> application/x-123 wk
> application/x-7z-compressed 7z
> application/x-abiword abw
> application/x-apple-diskimage dmg
> application/x-bcpio bcpio
> application/x-bittorrent torrent
> application/x-cab cab
> application/x-cbr cbr
> application/x-cbz cbz
> application/x-cdf cdf
> application/x-cdlink vcd
> application/x-chess-pgn pgn
> application/x-cpio cpio
> application/x-csh csh
> application/x-debian-package deb
> application/x-director dcr
> application/x-dms dms
> application/x-doom wad
> application/x-dvi dvi
> application/x-httpd-eruby rhtml
> application/x-font pfa
> application/x-freemind mm
> application/x-futuresplash spl
> application/x-gnumeric gnumeric
> application/x-go-sgf sgf
> application/x-graphing-calculator gcf
> application/x-gtar gtar
> application/x-hdf hdf
> application/x-httpd-php phtml
> application/x-httpd-php-source phps
> application/x-httpd-php3 php3
> application/x-httpd-php3-preprocessed php3p
> application/x-httpd-php4 php4
> application/x-httpd-php5 php5
> application/x-ica ica
> application/x-info info
> application/x-internet-signup ins
> application/x-iphone iii
> application/x-iso9660-image iso
> application/x-jam jam
> application/x-java-jnlp-file jnlp
> application/x-jmol jmz
> application/x-kchart chrt
> application/x-killustrator kil
> application/x-koan skp
> application/x-kpresenter kpr
> application/x-kspread ksp
> application/x-kword kwd
> application/x-latex latex
> application/x-lha lha
> application/x-lyx lyx
> application/x-lzh lzh
> application/x-lzx lzx
> application/x-maker frm
> application/x-mif mif
> application/x-ms-wmd wmd
> application/x-ms-wmz wmz
> application/x-msdos-program com
> application/x-msi msi
> application/x-netcdf nc
> application/x-ns-proxy-autoconfig pac
> application/x-nwc nwc
> application/x-object o
> application/x-oz-application oza
> application/x-pkcs7-certreqresp p7r
> application/x-pkcs7-crl crl
> application/x-python-code pyc
> application/x-qgis qgs
> application/x-quicktimeplayer qtl
> application/x-redhat-package-manager rpm
> application/x-ruby rb
> application/x-sh sh
> application/x-shar shar
> application/x-shockwave-flash swf
> application/x-silverlight scr
> application/x-stuffit sit
> application/x-sv4cpio sv4cpio
> application/x-sv4crc sv4crc
> application/x-tar tar
> application/x-tcl tcl
> application/x-tex-gf gf
> application/x-tex-pk pk
> application/x-texinfo texinfo
> application/x-troff t
> application/x-troff-man man
> application/x-troff-me me
> application/x-troff-ms ms
> application/x-ustar ustar
> application/x-wais-source src
> application/x-wingz wz
> application/x-x509-ca-cert crt
> application/x-xcf xcf
> application/x-xfig fig
> application/x-xpinstall xpi
> audio/amr amr
> audio/amr-wb awb
> audio/amr amr
> audio/amr-wb awb
> audio/annodex axa
> audio/basic au
> audio/flac flac
> audio/midi mid
> audio/mpeg mpga
> audio/mpegurl m3u
> audio/ogg oga
> audio/prs.sid sid
> audio/x-aiff aif
> audio/x-gsm gsm
> audio/x-mpegurl m3u
> audio/x-ms-wma wma
> audio/x-ms-wax wax
> audio/x-pn-realaudio ra
> audio/x-realaudio ra
> audio/x-scpls pls
> audio/x-sd2 sd2
> audio/x-wav wav
> image/gif gif
> image/ief ief
> image/jpeg jpeg
> image/pcx pcx
> image/png png
> image/svg+xml svg
> image/tiff tiff
> image/vnd.djvu djvu
> image/vnd.wap.wbmp wbmp
> image/x-canon-cr2 cr2
> image/x-canon-crw crw
> image/x-cmu-raster ras
> image/x-coreldraw cdr
> image/x-coreldrawpattern pat
> image/x-coreldrawtemplate cdt
> image/x-corelphotopaint cpt
> image/x-epson-erf erf
> image/x-icon ico
> image/x-jg art
> image/x-jng jng
> image/x-ms-bmp bmp
> image/x-nikon-nef nef
> image/x-olympus-orf orf
> image/x-photoshop psd
> image/x-portable-anymap pnm
> image/x-portable-bitmap pbm
> image/x-portable-graymap pgm
> image/x-portable-pixmap ppm
> image/x-rgb rgb
> image/x-xbitmap xbm
> image/x-xpixmap xpm
> image/x-xwindowdump xwd
> text/cache-manifest manifest
> text/calendar ics
> text/css css
> text/csv csv
> text/h323 323
> text/html html
> text/iuls uls
> text/mathml mml
> text/plain asc
> text/richtext rtx
> text/scriptlet sct
> text/texmacs tm
> text/tab-separated-values tsv
> text/vnd.sun.j2me.app-descriptor jad
> text/vnd.wap.wml wml
> text/vnd.wap.wmlscript wmls
> text/x-bibtex bib
> text/x-boo boo
> text/x-c++hdr h
> text/x-c++src c
> text/x-chdr h
> text/x-component htc
> text/x-csh csh
> text/x-csrc c
> text/x-dsrc d
> text/x-diff diff
> text/x-haskell hs
> text/x-java java
> text/x-literate-haskell lhs
> text/x-moc moc
> text/x-pascal p
> text/x-pcs-gcd gcd
> text/x-perl pl
> text/x-python py
> text/x-scala scala
> text/x-setext etx
> text/x-sh sh
> text/x-tcl tcl
> text/x-tex tex
> text/x-vcalendar vcs
> text/x-vcard vcf
> video/3gpp 3gp
> video/annodex axv
> video/dl dl
> video/dv dif
> video/fli fli
> video/gl gl
> video/mpeg mpeg
> video/mp4 mp4
> video/quicktime qt
> video/ogg ogv
> video/vnd.mpegurl mxu
> video/x-flv flv
> video/x-la-asf lsf
> video/x-mng mng
> video/x-ms-asf asf
> video/x-ms-wm wm
> video/x-ms-wmv wmv
> video/x-ms-wmx wmx
> video/x-ms-wvx wvx
> video/x-msvideo avi
> video/x-sgi-movie movie
> video/x-matroska mpv
> END
> %ext_types = ();
> foreach $line (split(/\n/, $raw_mime_types)) {
> my ($mime_type, $extension) = split(/\t+/, $line);
> # Beware. "+" needs to be escaped in patterns.
> $mime_type =~ s/\+/\\\+/g;
> $mime_types{$mime_type} = $extension;
> my ($type, $sub_type) = split(/\//, $mime_type);
> # We check whether we already have a value for this extension.
> # We don't care if application is overwritten.
> if ((defined $ext_types{$extension}) &&
> ($ext_types{$extension} ne $type) &&
> ($ext_types{$extension} ne "application")) {
> print "$extension already has $ext_types{$extension}.";
> print "Should now become $type. Fix mime.types?\n"
> }
> else {
> $ext_types{$extension} = $type;
> }
> }
> }
>
>
6302a6879,6881
> $Arg{prefer_dns} = 0; # JL: Prefer DNS names over IP addresses?
> $Arg{httplog_html} = 0; # JL: Should we create HTTPlog in HTML?
> $Arg{httplog_name} = "httplog.text"; # JL: Old default as variable
6312a6892
> "d|preferdns" => \$opt_d, # JL: new option
6316a6897
> "n|names" => \$opt_n, # JL: new option
6365a6947,6949
> $Arg{prefer_dns} = 1 if $opt_d;
> $Arg{httplog_html} = 1 if $opt_n;
> $Arg{httplog_name} = "httplog.html" if $opt_n;
6521c7105
< print "USAGE: chaosreader [-aehikqrvxAHIRTUXY] [-D dir]
---
> print "USAGE: chaosreader [-adehiknqrvxAHIRTUXY] [-D dir]
6545c7129
< print "Version 0.94, 01-May-2004
---
> print "Version 0.95c, 4-Jan-2012
6547c7131
< USAGE: chaosreader [-aehikqrvxAHIRTUXY] [-D dir]
---
> USAGE: chaosreader [-adehiknqrvxAHIRTUXY] [-D dir]
6560a7145
> -d, --preferdns # Show DNS names instead of IP addresses
6578a7164
> -n, --names # Include hostnames in hyperlinked HTTPlog (HTML)