summaryrefslogtreecommitdiff
path: root/lib/mat.py
diff options
context:
space:
mode:
authorjvoisin2011-06-27 17:42:42 +0200
committerjvoisin2011-06-27 17:42:42 +0200
commit6c5cad3f96a1bbe20b668730ba66dfb43eb14b08 (patch)
tree152001b274384ec6a9d16a493ced84009412b525 /lib/mat.py
parent7c05c4edef20cc7438a8a90f2e9f1b507e82c132 (diff)
Add is_clean() method to archives, and move the 'secure_remove' function from parser.py to mat.py
Diffstat (limited to 'lib/mat.py')
-rw-r--r--lib/mat.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/mat.py b/lib/mat.py
index 9624511..c9547c1 100644
--- a/lib/mat.py
+++ b/lib/mat.py
@@ -6,6 +6,7 @@
6 6
7import sys 7import sys
8import os 8import os
9import subprocess
9 10
10import hachoir_core.cmd_line 11import hachoir_core.cmd_line
11import hachoir_parser 12import hachoir_parser
@@ -29,6 +30,17 @@ strippers = {
29 hachoir_parser.archive.bzip2_parser.Bzip2Parser: archive.Bzip2Stripper, 30 hachoir_parser.archive.bzip2_parser.Bzip2Parser: archive.Bzip2Stripper,
30} 31}
31 32
33def secure_remove(filename):
34 '''
35 securely remove the file
36 '''
37 #FIXME : Vulnerable to shell injection ?
38 try:
39 subprocess.call('shred --remove %s' % filename, shell=True)
40 except:
41 print('Unable to remove %s' % filename)
42
43
32def is_secure(filename): 44def is_secure(filename):
33 ''' 45 '''
34 Prevent shell injection 46 Prevent shell injection