@@ -50,10 +50,12 @@ def init_logging(verbose):
50
50
logging .basicConfig (level = logging .WARNING )
51
51
52
52
53
- def populate_store (store , gc_roots , paths , requisites = True ):
53
+ def populate_store (store , gc_roots , memory , paths , requisites = True ):
54
54
"""Load derivations from nix store depending on cmdline invocation."""
55
55
if gc_roots :
56
56
store .add_gc_roots ()
57
+ if memory :
58
+ store .add_memory_roots ()
57
59
for path in paths :
58
60
store .add_path (path )
59
61
return store
@@ -74,6 +76,8 @@ def run(nvd, store):
74
76
# what to scan
75
77
@click .option ('-S' , '--system' , is_flag = True ,
76
78
help = 'Scan the current system.' )
79
+ @click .option ('-M' , '--memory' , is_flag = True ,
80
+ help = 'Scan currently-running process.' )
77
81
@click .option ('-G' , '--gc-roots' , is_flag = True ,
78
82
help = 'Scan all active GC roots (including old ones).' )
79
83
@click .option ('-f' , '--from-file' , type = click .File (mode = 'r' ),
@@ -108,14 +112,14 @@ def run(nvd, store):
108
112
help = '(obsolete; kept for compatibility reasons)' )
109
113
@click .option ('-F' , '--notfixed' , is_flag = True ,
110
114
help = '(obsolete; kept for compatibility reasons)' )
111
- def main (verbose , gc_roots , system , from_file , path , mirror , cache_dir ,
115
+ def main (verbose , gc_roots , memory , system , from_file , path , mirror , cache_dir ,
112
116
requisites , whitelist , write_whitelist , version , json ,
113
117
show_whitelisted , default_whitelist , notfixed ):
114
118
if version :
115
119
print ('vulnix ' + pkg_resources .get_distribution ('vulnix' ).version )
116
120
sys .exit (0 )
117
121
118
- if not (gc_roots or system or path or from_file ):
122
+ if not (gc_roots or memory or system or path or from_file ):
119
123
howto ()
120
124
sys .exit (3 )
121
125
@@ -141,7 +145,7 @@ def main(verbose, gc_roots, system, from_file, path, mirror, cache_dir,
141
145
for drv in from_file .readlines ():
142
146
paths .append (drv .strip ())
143
147
if paths :
144
- populate_store (store , gc_roots , paths , requisites )
148
+ populate_store (store , gc_roots , memory , paths , requisites )
145
149
with NVD (mirror , cache_dir ) as nvd :
146
150
with Timer ('Update NVD data' ):
147
151
nvd .update ()
0 commit comments