Me: Jehan-Guillaume (ioguix) de Rorthais
Activities:
IRC: ioguix
Contact: [email protected]
“Extract and mess with PostgreSQL messages from network dump”
Initially based on PDML output from tshark (Wireshark project)
⇒ tshark + PgSQL == pgShark
Original goal:
Solution: extract SQL from network dump and test them.
New goals:
use pgShark::Core
my $shark = pgShark::Core->new({ 'procs' => { 'Query' => \&Query, 'Execute' => \&Execute, }, 'host' => $args{'host'}, 'port' => $args{'port'} }); sub Query { my $pg_msg = shift; printf "QUERY query=%s\n", $pg_msg->{'query'}; } sub Execute { my $pg_msg = shift; printf "EXECUTE name='%s', nb_rows=%d\n", $pg_msg->{'name'}, $pg_msg->{'nb_rows'}; }
# message informations hash my $pg_msg = { 'sess_hash' => $session_hash, # basically IP+src port 'timestamp' => $timestamp, # timestamps of the message 'type' => $type, # one-char type from pg proto 'data' => $data, # the message data w/o type and length ## other fields specifics to each messages are added bellow };
Authentication* BackendKeyData Bind BindComplete CancelRequest Close CloseComplete CommandComplete CopyData CopyDone CopyFail CopyInResponse CopyOutResponse DataRow Describe EmptyQueryResponse ErrorResponse Execute Flush NoData NoticeResponse NotificationResponse ParameterDescription ParameterStatus Parse ParseComplete PasswordMessage PortalSuspended Query ReadyForQuery RowDescription SSLAnswer+ SSLRequest+ StartupMessage Sync Terminate