History

leaking_addresses: remove command line options

Currently script accepts files to skip. This was added to make running the script faster (for repeat runs). We can remove this functionality in preparation for adding sub commands (scan and format) to the script. Remove command line options.

Tobin C. Harding committed 9 years ago

Commit ecd39db1 parent fa31a581 file · +0 −58Browse files

Unified · Split

scripts/leaking_addresses.pl+0−58
@@ -7,25 +7,6 @@ · 6 unmodified lines
77 # - Scans dmesg output.
88 # - Walks directory tree and parses each file (for each directory in @DIRS).
99 #
10−# You can configure the behaviour of the script;
11−#
12−# - By adding paths, for directories you do not want to walk;
13−# absolute paths: @skip_walk_dirs_abs
14−# directory names: @skip_walk_dirs_any
15−#
16−# - By adding paths, for files you do not want to parse;
17−# absolute paths: @skip_parse_files_abs
18−# file names: @skip_parse_files_any
19−#
20−# The use of @skip_xxx_xxx_any causes files to be skipped where ever they occur.
21−# For example adding 'fd' to @skip_walk_dirs_any causes the fd/ directory to be
22−# skipped for all PID sub-directories of /proc
23−#
24−# The same thing can be achieved by passing command line options to --dont-walk
25−# and --dont-parse. If absolute paths are supplied to these options they are
26−# appended to the @skip_xxx_xxx_abs arrays. If file names are supplied to these
27−# options, they are appended to the @skip_xxx_xxx_any arrays.
28−#
2910 # Use --debug to output path before parsing, this is useful to find files that
3011 # cause the script to choke.
3112 #
@@ -50,8 +31,6 @@ my @DIRS = ('/proc', '/sys'); · 18 unmodified lines
5031 # Command line options.
5132 my $help = 0;
5233 my $debug = 0;
53−my @dont_walk = ();
54−my @dont_parse = ();
5534
5635 # Do not parse these files (absolute path).
5736 my @skip_parse_files_abs = ('/proc/kmsg',
@@ -96,20 +75,9 @@ Version: $V · 38 unmodified lines
9675
9776 Options:
9877
99− --dont-walk=<dir> Don't walk tree starting at <dir>.
100− --dont-parse=<file> Don't parse <file>.
10178 -d, --debug Display debugging output.
10279 -h, --help, --version Display this help and exit.
10380
104−If an absolute path is passed to --dont_XXX then this path is skipped. If a
105−single filename is passed then this file/directory will be skipped when
106−appearing under any subdirectory.
107−
108−Example:
109−
110− # Just scan dmesg output.
111− scripts/leaking_addresses.pl --dont_walk_abs /proc --dont_walk_abs /sys
112−
11381 Scans the running (64 bit) kernel for potential leaking addresses.
11482
11583 EOM
@@ -117,8 +85,6 @@ EOM · 1 unmodified line
11785 }
11886
11987 GetOptions(
120− 'dont-walk=s' => \@dont_walk,
121− 'dont-parse=s' => \@dont_parse,
12288 'd|debug' => \$debug,
12389 'h|help' => \$help,
12490 'version' => \$help
@@ -126,8 +92,6 @@ GetOptions( · 1 unmodified line
12692
12793 help(0) if ($help);
12894
129−push_to_global();
130−
13195 parse_dmesg();
13296 walk(@DIRS);
13397
@@ -138,28 +102,6 @@ sub dprint · 4 unmodified lines
138102 printf(STDERR @_) if $debug;
139103 }
140104
141−sub push_in_abs_any
142−{
143− my ($in, $abs, $any) = @_;
144−
145− foreach my $path (@$in) {
146− if (File::Spec->file_name_is_absolute($path)) {
147− push @$abs, $path;
148− } elsif (index($path,'/') == -1) {
149− push @$any, $path;
150− } else {
151− print 'path error: ' . $path;
152− }
153− }
154−}
155−
156−# Push command line options to global arrays.
157−sub push_to_global
158−{
159− push_in_abs_any(\@dont_walk, \@skip_walk_dirs_abs, \@skip_walk_dirs_any);
160− push_in_abs_any(\@dont_parse, \@skip_parse_files_abs, \@skip_parse_files_any);
161−}
162−
163105 sub is_false_positive
164106 {
165107 my ($match) = @_;