BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-20-2007, 10:54 AM   #1 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Feb 2007
Location: Toronto
Model: 9800
Carrier: Rogers
Posts: 319
Post Thanks: 2
Thanked 5 Times in 5 Posts
Default Any Perl coder out here ?

Please Login to Remove!

hi there, need some help with Perl coding, following code grabs URLs visited by a user through MDS, and reports it back in a text file, i want to add corresponding Device PIN as well, i have spend couple of days trying to tweak it but no go , appreciate your help here


use strict;



# change the $mds_log variable to your log file

my $mds_log = "BESNAME_MDAT_01_20050607_0002.txt";



my $http_data = {};



open MDS, $mds_log;

while (<MDS>) {

chomp;

my $id = "";

my $host = "";

my $get = "";

if (/EVENT = ReceivedFromDevice/ and

/HTTPTRANSMISSION = Host:([^>]+)>/) {

$host = $1;

($id) = (/CONNECTIONID = (\d+),/);

$http_data->{$id}->{host} = $host;

} elsif (/EVENT = SentToServer/ and

/HTTPTRANSMISSION = GET (.+) HTTP\/1\.1>/) {

$get = $1;

($id) = (/CONNECTIONID = (\d+),/);

$http_data->{$id}->{get} = $get;

}

}

close MDS;



my %urls = ();

foreach my $id (keys %{ $http_data }) {

my $host = $http_data->{$id}->{host};

my $get = $http_data->{$id}->{get};

next if not $host and $get;

my $url = "http://$host" . $get;

$urls{$url}++;

}



foreach my $url (sort { $urls{$b} <=> $urls{$a} } keys %urls) {

print "$urls{$url}\t$url\n";

}
Offline  
Old 08-20-2007, 07:48 PM   #2 (permalink)
rsk
Thumbs Must Hurt
 
Join Date: Jan 2007
Model: 9630
Carrier: Sprint
Posts: 134
Post Thanks: 0
Thanked 1 Time in 1 Post
Default

just emailed you the modified code, let me know if that is what you wanted.

rich.
Offline  
Old 08-21-2007, 09:30 AM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Feb 2007
Location: Toronto
Model: 9800
Carrier: Rogers
Posts: 319
Post Thanks: 2
Thanked 5 Times in 5 Posts
Default

Quote:
Originally Posted by rsk View Post
just emailed you the modified code, let me know if that is what you wanted.

rich.
yes i got the file thanks alot , you saved my day, i owe you one if you are in toronto some day or time, let me know will buy you a beer
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.