| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Symantec::PCAnywhere::Profile::CIF; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
31374
|
use strict; |
|
|
2
|
|
|
|
|
13
|
|
|
|
2
|
|
|
|
|
80
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
122
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Symantec::PCAnywhere::Profile::CIF - Encodes and decodes Symantec pcAnywhere connection |
|
9
|
|
|
|
|
|
|
profiles |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Symantec::PCAnywhere::Profile::CIF; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Load CIF file from file |
|
16
|
|
|
|
|
|
|
my $cif = new Symantec::PCAnywhere::Profile::CIF(filename => $filename); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Load CIF data directly |
|
19
|
|
|
|
|
|
|
my $cif = new Symantec::PCAnywhere::Profile::CIF(data => $data); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my %results = $cif->get_attrs( |
|
22
|
|
|
|
|
|
|
CallerName, |
|
23
|
|
|
|
|
|
|
CallerPassword, |
|
24
|
|
|
|
|
|
|
DisplayName |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
while (my ($attr, $value) = each (%results)) { |
|
27
|
|
|
|
|
|
|
print "$attr\t= $value\n"; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Create an empty CIF |
|
31
|
|
|
|
|
|
|
my $cif = new Symantec::PCAnywhere::Profile::CIF; |
|
32
|
|
|
|
|
|
|
$cif->set_attrs( |
|
33
|
|
|
|
|
|
|
CallerName => 'JohnDoe', |
|
34
|
|
|
|
|
|
|
CallerPassword => 'acw938nrh!' |
|
35
|
|
|
|
|
|
|
); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Print the binary CIF file |
|
38
|
|
|
|
|
|
|
print $cif->encode; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This module is responsible for decoding of a pcAnywhere .CIF file that |
|
44
|
|
|
|
|
|
|
describes a caller that can connect to a pcAnywhere Host. CIF files seem to |
|
45
|
|
|
|
|
|
|
always be the same size (10504 bytes), which is helpful for decoding. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
See this module's base class (L) for more |
|
48
|
|
|
|
|
|
|
information on the decoding mechanism. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Version 0.06 |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
|
57
|
|
|
|
|
|
|
|
|
58
|
2
|
|
|
2
|
|
11
|
use base qw(Symantec::PCAnywhere::Profile); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
756
|
|
|
59
|
2
|
|
|
2
|
|
1219
|
use Compress::Zlib; |
|
|
2
|
|
|
|
|
78304
|
|
|
|
2
|
|
|
|
|
1925
|
|
|
60
|
2
|
|
|
2
|
|
901
|
use MIME::Base64; |
|
|
2
|
|
|
|
|
683
|
|
|
|
2
|
|
|
|
|
638
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Compressed and encoded template CIF |
|
63
|
|
|
|
|
|
|
my $cif_template = uncompress(decode_base64(<<'TEMPLATE')); |
|
64
|
|
|
|
|
|
|
eJztzrENQGAAhNFDYxMxhig0CisodCprGZI/ZpCI5L1Lrv7OK2n7pCqbu2QZh4zrvm9H+IX6+SnN |
|
65
|
|
|
|
|
|
|
xx3Ab1R18XUEAAAAAAAAAAC84wYJxwXN |
|
66
|
|
|
|
|
|
|
TEMPLATE |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my %FIELDS_CIF = ( |
|
69
|
|
|
|
|
|
|
# off len type |
|
70
|
|
|
|
|
|
|
# ---- --- ---- |
|
71
|
|
|
|
|
|
|
DisplayName => [ 16, 186, 0 ], |
|
72
|
|
|
|
|
|
|
FilePassword => [ 280, 128, 0 ], |
|
73
|
|
|
|
|
|
|
CallerName => [ 460, 128, 0 ], |
|
74
|
|
|
|
|
|
|
CallerPassword => [ 589, 128, 0 ], |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 METHODS |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Here is the public API; see this module's base class documentation for more |
|
80
|
|
|
|
|
|
|
information on the inner workings of the encoding and decoding process, as well |
|
81
|
|
|
|
|
|
|
as additional useful methods. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 4 |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item new |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $cif = new Symantec::PCAnywhere::Profile::CIF; |
|
88
|
|
|
|
|
|
|
my $cif = new Symantec::PCAnywhere::Profile::CIF(-filename => $filename); |
|
89
|
|
|
|
|
|
|
my $cif = new Symantec::PCAnywhere::Profile::CIF(filename => $filename); |
|
90
|
|
|
|
|
|
|
my $cif = new Symantec::PCAnywhere::Profile::CIF(-data => $cifdata); |
|
91
|
|
|
|
|
|
|
my $cif = new Symantec::PCAnywhere::Profile::CIF(data => $cifdata); |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The "new" constructor takes any number of arguments and sets the appropriate |
|
94
|
|
|
|
|
|
|
flags internally before returning a new object. The arguments are considered as |
|
95
|
|
|
|
|
|
|
a list of key-value pairs which are inserted into the object data. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub new { |
|
100
|
2
|
|
|
2
|
1
|
32
|
my $type = shift; |
|
101
|
2
|
|
|
|
|
14
|
my %defaults = ( |
|
102
|
|
|
|
|
|
|
fields => \%FIELDS_CIF, |
|
103
|
|
|
|
|
|
|
template => $cif_template, |
|
104
|
|
|
|
|
|
|
); |
|
105
|
|
|
|
|
|
|
|
|
106
|
2
|
|
|
|
|
24
|
my $self = $type->SUPER::new(%defaults, @_); |
|
107
|
2
|
|
|
|
|
9
|
return $self; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item _decode_pca_file |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Provided with XOR-encoded CIF data, un-obscure the whole |
|
113
|
|
|
|
|
|
|
thing into the "clear" format. The return value is the same |
|
114
|
|
|
|
|
|
|
length as the input string, but after XOR decoding. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub _decode_pca_file ($$) { |
|
119
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
|
120
|
1
|
|
|
|
|
3
|
my $rawdata = $self->{data}; |
|
121
|
|
|
|
|
|
|
|
|
122
|
1
|
|
|
|
|
3
|
my $part1 = substr($rawdata, 0, 444); |
|
123
|
1
|
|
|
|
|
5
|
my $part2 = substr($rawdata, 444); |
|
124
|
|
|
|
|
|
|
|
|
125
|
1
|
|
|
|
|
15
|
return $self->_rawdecode(255, 0, $part1) |
|
126
|
|
|
|
|
|
|
. $self->_rawdecode(255, 0x54, $part2); |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item _encode_pca_file |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Provided with XOR-unencoded CIF data, obscure the whole |
|
133
|
|
|
|
|
|
|
thing into the "encrypted" format. The return value is the |
|
134
|
|
|
|
|
|
|
same length as the input string, but after XOR encoding. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub _encode_pca_file ($$) { |
|
139
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
140
|
1
|
|
|
|
|
3
|
my $rawdata = $self->{decoded}; |
|
141
|
|
|
|
|
|
|
|
|
142
|
1
|
|
|
|
|
2
|
my $part1 = substr($rawdata, 0, 444); |
|
143
|
1
|
|
|
|
|
17
|
my $part2 = substr($rawdata, 444); |
|
144
|
|
|
|
|
|
|
|
|
145
|
1
|
|
|
|
|
8
|
return $self->_rawencode(255, 0, $part1) |
|
146
|
|
|
|
|
|
|
. $self->_rawencode(255, 0x54, $part2); |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=back |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This module is based very heavily on the work of Stephen Friedl at |
|
154
|
|
|
|
|
|
|
http://www.unixwiz.net/tools/pcainfo.htmlZ<>. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 TO DO |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Based on http://www.cpan.org/modules/00modlist.long.html#ID2_GuidelinesfZ<>, |
|
159
|
|
|
|
|
|
|
refactor code to pass references to lists instead of lists. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 BUGS / CAVEATS |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
They're in there somewhere. Let me know what you find. |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 AUTHOR |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Darren Kulp, Ekulp@thekulp.comE, based on code from |
|
168
|
|
|
|
|
|
|
Stephen J. Friedl, (http://unixwiz.net/) |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
This code is in the public domain. Contains code placed in the public domain |
|
173
|
|
|
|
|
|
|
2002 by Stephen Friedl. |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
"Symantec" and "pcAnywhere" are trademarks of Symantec Corp. |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
1; |
|
180
|
|
|
|
|
|
|
__END__ |