aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTobin C. Harding <me@tobin.cc>2017-11-07 19:11:09 -0500
committerTobin C. Harding <me@tobin.cc>2017-11-13 17:29:27 -0500
commitecd39dbd27d6f2907630678cbff464374edff8fe (patch)
treed9a0eff30f91b3f108ef1ee0c1c43916f6819946 /scripts
parentfa31a58202c5d9ebb26f562913b17e81357fe0e7 (diff)
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. Signed-off-by: Tobin C. Harding <me@tobin.cc>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/leaking_addresses.pl58
1 files changed, 0 insertions, 58 deletions
diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
index 94b22d5b9237..719ed0aaede7 100755
--- a/scripts/leaking_addresses.pl
+++ b/scripts/leaking_addresses.pl
@@ -7,25 +7,6 @@
7# - Scans dmesg output. 7# - Scans dmesg output.
8# - Walks directory tree and parses each file (for each directory in @DIRS). 8# - Walks directory tree and parses each file (for each directory in @DIRS).
9# 9#
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#
29# Use --debug to output path before parsing, this is useful to find files that 10# Use --debug to output path before parsing, this is useful to find files that
30# cause the script to choke. 11# cause the script to choke.
31# 12#
@@ -50,8 +31,6 @@ my @DIRS = ('/proc', '/sys');
50# Command line options. 31# Command line options.
51my $help = 0; 32my $help = 0;
52my $debug = 0; 33my $debug = 0;
53my @dont_walk = ();
54my @dont_parse = ();
55 34
56# Do not parse these files (absolute path). 35# Do not parse these files (absolute path).
57my @skip_parse_files_abs = ('/proc/kmsg', 36my @skip_parse_files_abs = ('/proc/kmsg',
@@ -96,20 +75,9 @@ Version: $V
96 75
97Options: 76Options:
98 77
99 --dont-walk=<dir> Don't walk tree starting at <dir>.
100 --dont-parse=<file> Don't parse <file>.
101 -d, --debug Display debugging output. 78 -d, --debug Display debugging output.
102 -h, --help, --version Display this help and exit. 79 -h, --help, --version Display this help and exit.
103 80
104If an absolute path is passed to --dont_XXX then this path is skipped. If a
105single filename is passed then this file/directory will be skipped when
106appearing under any subdirectory.
107
108Example:
109
110 # Just scan dmesg output.
111 scripts/leaking_addresses.pl --dont_walk_abs /proc --dont_walk_abs /sys
112
113Scans the running (64 bit) kernel for potential leaking addresses. 81Scans the running (64 bit) kernel for potential leaking addresses.
114 82
115EOM 83EOM
@@ -117,8 +85,6 @@ EOM
117} 85}
118 86
119GetOptions( 87GetOptions(
120 'dont-walk=s' => \@dont_walk,
121 'dont-parse=s' => \@dont_parse,
122 'd|debug' => \$debug, 88 'd|debug' => \$debug,
123 'h|help' => \$help, 89 'h|help' => \$help,
124 'version' => \$help 90 'version' => \$help
@@ -126,8 +92,6 @@ GetOptions(
126 92
127help(0) if ($help); 93help(0) if ($help);
128 94
129push_to_global();
130
131parse_dmesg(); 95parse_dmesg();
132walk(@DIRS); 96walk(@DIRS);
133 97
@@ -138,28 +102,6 @@ sub dprint
138 printf(STDERR @_) if $debug; 102 printf(STDERR @_) if $debug;
139} 103}
140 104
141sub 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.
157sub 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
163sub is_false_positive 105sub is_false_positive
164{ 106{
165 my ($match) = @_; 107 my ($match) = @_;