summaryrefslogtreecommitdiff
path: root/lib/parser.py
diff options
context:
space:
mode:
authorjvoisin2011-06-25 19:06:55 +0200
committerjvoisin2011-06-25 19:06:55 +0200
commit321b024daee08992495a80e2f998a5913c5b0a49 (patch)
treee2a26b8e3c411764b1aadb1878b2ee60103a5e0c /lib/parser.py
parent9ebc62273ec8abfc4520660597fa80fe3de40203 (diff)
Add a binding to shred. Rudimentary protection against shell injection.
Diffstat (limited to 'lib/parser.py')
-rw-r--r--lib/parser.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/parser.py b/lib/parser.py
index 12ef15a..c7e189e 100644
--- a/lib/parser.py
+++ b/lib/parser.py
@@ -7,7 +7,7 @@ import hachoir_parser
7import hachoir_editor 7import hachoir_editor
8import sys 8import sys
9import os 9import os
10import shutil 10import subprocess
11 11
12POSTFIX = ".cleaned" 12POSTFIX = ".cleaned"
13 13
@@ -23,10 +23,9 @@ class Generic_parser():
23 ''' 23 '''
24 securely remove the file 24 securely remove the file
25 ''' 25 '''
26 #FIXME : not secure at all ! 26 #FIXME : Vulnerable to shell injection ?
27 try: 27 try:
28 shutil.rmtree(self.filename) 28 subprocess.call('shred --remove %s' % self.filename, shell=True)
29 #shutil.subprocess('shutil' , '--remove', 'self.filename')
30 except: 29 except:
31 print('Unable to remove %s' % self.filename) 30 print('Unable to remove %s' % self.filename)
32 31