line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#! /usr/bin/perl |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# $Id: Dump.pm 75 2009-08-12 22:08:28Z lem $ |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Net::Radius::Server::Dump; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1394
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
9
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
10
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
11
|
1
|
|
|
1
|
|
848
|
use IO::File; |
|
1
|
|
|
|
|
2086
|
|
|
1
|
|
|
|
|
145
|
|
12
|
1
|
|
|
1
|
|
6
|
use File::Spec; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
13
|
1
|
|
|
1
|
|
1299
|
use Time::HiRes qw/gettimeofday/; |
|
1
|
|
|
|
|
2171
|
|
|
1
|
|
|
|
|
6
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = do { sprintf "%0.3f", 1+(q$Revision: 75 $ =~ /\d+/g)[0]/1000 }; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
295
|
use Net::Radius::Server::Base qw/:set/; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
14
|
|
18
|
1
|
|
|
1
|
|
42
|
use base qw/Net::Radius::Server::Set/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
794
|
|
19
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/basepath basename result/); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub set_basepath |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
my $self = shift; |
24
|
|
|
|
|
|
|
my $r_data = shift; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->basename('packet-') unless $self->basename; |
27
|
|
|
|
|
|
|
my $time = join('-', gettimeofday); |
28
|
|
|
|
|
|
|
my $file = File::Spec->catfile($self->basepath, $self->basename . $time); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
if (-f $file) |
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
$self->log(2, "$file already exists. Won't overwrite"); |
33
|
|
|
|
|
|
|
return; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $fh = new IO::File($file, "w"); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
unless ($fh) |
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
$self->log(2, "Can't create $file: $!"); |
41
|
|
|
|
|
|
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
print $fh "*** RADIUS Request:\n"; |
45
|
|
|
|
|
|
|
print $fh $r_data->{request}->str_dump, "\n\n"; |
46
|
|
|
|
|
|
|
print $fh "*** RADIUS Response:\n"; |
47
|
|
|
|
|
|
|
print $fh $r_data->{response}->str_dump, "\n\n"; |
48
|
|
|
|
|
|
|
close $fh; |
49
|
|
|
|
|
|
|
$self->log(4, "Packet dump stored at $file"); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
42; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |