#!/usr/bin/perl # dbb-read.pl 0.5 # (c) 2007 nhjm449 # needs much work my $chunkSize = 256; # 256 512 1024 2048 4096 8192 16384 my $username = "nhjm449"; my $skypeaccount = "nhjm449"; open(DBB, ">>>>> $i <<<<<<\n\n"; $info{"chunkLength"} = unpack("L", substr($chunk, 4, 4)); next if ($info{"chunkLength"} eq ''); $info{"number"} = unpack("L", substr($chunk, 8, 4)); $info{"msgbody"} = substr($chunk, 12, $info{"chunkLength"} - 4); #print "\n{{ msgbody: $info{msgbody} }}\n\n"; $info{"number2"} = unpack("L", substr($chunk, 12, 4)); #$info{"chatroom"} = substr($chunk, 20, index($chunk, $null, 20)-20); if ($info{"msgbody"} =~ /\x03\xe0\x03((?:.|\n)+?)\x00/) { $info{"chatroom"} = $1; } if ($info{"msgbody"} =~ /\x03\xe8\x03((?:.|\n)+?)\x00/) { $info{"username"} = $1; } if ($info{"msgbody"} =~ /\x03\xec\x03((?:.|\n)+?)\x00/) { $info{"friendlyname"} = $1; } if ($info{"msgbody"} =~ /\x03\xf4\x03((?:.|\n)+?)\x00/) { if ($1 eq $username) { $info{"invited"} = $1; print "--- $1 was invited\n"; } else { $info{"join"} = $1; print "--- starting message with $1\n"; } } #f1030400 if ($info{"msgbody"} =~ /\xf1\x03\x04\x00/) { $info{"leave"} = $info{"username"}; } if ($info{"msgbody"} =~ /\x03\xfc\x03((?:.|\n)+?)\x00+\xf1\x03\x03/ || $info{"msgbody"} =~ /\xf1\x03\x03\x03\xfc\x03((?:.|\n)+?)\x00/) { $info{"message"} = $1; } if ($info{"msgbody"} =~ /\x03\xfc\x03((?:.|\n)+?)\x00+\xf1\x03\x07/ || $info{"msgbody"} =~ /\xf1\x03\x07\x03\xfc\x03((?:.|\n)+?)\x00/) { $info{"action"} = $1; } if ($info{"msgbody"} =~ /\x03\xfc\x03((?:.|\n)+?)\x00+\xf1\x03\x05/ || $info{"msgbody"} =~ /\xf1\x03\x05\x03\xfc\x03((?:.|\n)+?)\x00/) { $info{"topic"} = $1; } if (!$info{"message"} && !$info{"action"} && !$info{"topic"} && $info{"msgbody"} =~ /\x03\xfc\x03((?:.|\n)+?)\x00/) { $info{"message"} = $1; } print "chunkLength: ".$info{"chunkLength"}.", number: ".$info{"number"}.", length: (".length($chunk).")\n"; print ">> chatroom: ".$info{"chatroom"}."\n"; print ">> username: ".$info{"username"}."\n"; print ">> friendlyname: ".$info{"friendlyname"}."\n"; if ($info{"invited"}) { print ">> invited: ".$info{"invited"}."\n"; } elsif ($info{"join"}) { print ">> join: ".$info{"join"}."\n"; } elsif ($info{"leave"}) { print ">> leave: ".$info{"leave"}."\n"; } else { print ">> message: ".$info{"message"}."\n" if ($info{"message"}); print ">> action: ".$info{"action"}."\n" if ($info{"action"}); print ">> topic: ".$info{"topic"}."\n" if ($info{"topic"}); print "!! error: unknown message type! (blank? corrupt?)\n" if (!$info{"message"} && !$info{"action"} && !$info{"topic"}); } #print ">> data: ".$info{"data"}."\n"; #$chunk =~ s/$null+$//; #print "\n".$chunk."\n---\n"; %info = ( ); undef($chunk); } # 03e003 - chatroom # 04 03e803 - username # 03ec03 - friendlyname # 03f403 - start msg w/ username (join) # 03fc03 f10303 - message # 03fc03 f10307 - action message # 03fc03 f10305 - topic message #x 810404 - leave #x 810402 - speak # offset 660: 00 f1 03 80 08 00 <-- unknown! # f1030400 f9030600 - user leaves print "\n"x50; #232 = username #236 = nickname