forked from OWASP/O-Saft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
o-saft-usr.pm
executable file
·175 lines (109 loc) · 3.13 KB
/
o-saft-usr.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/bin/perl -w
=pod
=head1 NAME
o-saft-usr.pm - module for o-saft.pl's user definable functions
=head1 SYNOPSIS
require "o-saft-usr.pm";
=head1 DESCRIPTION
Defines all function for user customization.
=head2 Functions defined herein
=over 4
=item usr_pre_file( )
At beginning, right before reading any L<RC-FILE> or L<DEBUG-FILE>
=item usr_pre_args( )
Right before reading command line arguments. All internal structures
and variables are initialized, all external files are read (except
configuration files specified witj I<--cfg_*=> option.
=item usr_pre_exec( )
All command line arguments are read. Right before executing myself.
=item usr_pre_cipher( )
Before getting list of ciphers.
=item usr_pre_main( )
Before executing commands.
=item usr_pre_host( )
Before starting loop over all given hosts.
=item usr_pre_info( )
DNS stuff and SNI connection checked. Before doing commands per host.
=item usr_pre_open( )
Before opening connection.
=item usr_pre_cmds( )
Before listing or checking anything. SSL connection is open and all
data available in $Net::SSLinfo::* .
=item usr_pre_data( )
All data according SSL connection and ciphers available in %data and
@results. Before doing any checks and before printing anything.
=item usr_pre_print( )
All checks are done, ready to print data from %checks also.
=item usr_pre_next( )
Host completely processed. Right before next host.
=item usr_pre_exit( )
Right before program exit.
=back
=head2 Variables which may be used herein
They must be defined as `our' in L<o-saft.pl>:
=over 4
=item $VERSION
=item $me $mename $mepath
=item %data
=item %cfg, i.e. trace, traceARG, traceCMD, traceKEY, verbose
=item %checks
=item %org
=back
Functions being used in L<o-saft.pl> shoudl be defined as empty stub there.
For example:
sub usr_pre_args() {}
=cut
my $SID = "@(#) o-saft-usr.pm 1.2 14/01/12 22:19:46";
no warnings 'redefine';
# must be herein, as most subroutines are already defined in main
# warnings pragma is local to this file!
package main; # ensure that main:: variables are used
sub _dbx { _trace(join(" ", @_)); } # requires --v
# user functions
# -------------------------------------
sub usr_pre_file() {
_dbx("usr_pre_file ...");
};
sub usr_pre_args() {
_dbx("usr_pre_args ...");
};
sub usr_pre_exec() {
_dbx("usr_pre_exec ...");
};
sub usr_pre_cipher(){
_dbx("usr_pre_cipher ...");
};
sub usr_pre_main() {
_dbx("usr_pre_main ...");
};
sub usr_pre_host() {
_dbx("usr_pre_host ...");
};
sub usr_pre_info() {
_dbx("usr_pre_info ...");
};
sub usr_pre_open() {
_dbx("usr_pre_open ...");
###
### sample code for using your own socket
###
#use IO::Socket;
#$Net::SSLinfo::socket = IO::Socket::INET->new(PeerHost=>'localhost', PeerPort=>443, Proto=>'tcp')
#or die "**ERROR usr_pre_open socket(): $!\n";
};
sub usr_pre_cmds() {
_dbx("usr_pre_cmds ...");
};
sub usr_pre_data() {
_dbx("usr_pre_data ...");
};
sub usr_pre_print() {
_dbx("usr_pre_print ...");
};
sub usr_pre_next() {
_dbx("usr_pre_next ...");
};
sub usr_pre_exit() {
_dbx("usr_pre_exit ...");
};
1;