diff options
| author | jvoisin | 2011-06-25 19:06:55 +0200 |
|---|---|---|
| committer | jvoisin | 2011-06-25 19:06:55 +0200 |
| commit | 321b024daee08992495a80e2f998a5913c5b0a49 (patch) | |
| tree | e2a26b8e3c411764b1aadb1878b2ee60103a5e0c /lib/parser.py | |
| parent | 9ebc62273ec8abfc4520660597fa80fe3de40203 (diff) | |
Add a binding to shred. Rudimentary protection against shell injection.
Diffstat (limited to 'lib/parser.py')
| -rw-r--r-- | lib/parser.py | 7 |
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 | |||
| 7 | import hachoir_editor | 7 | import hachoir_editor |
| 8 | import sys | 8 | import sys |
| 9 | import os | 9 | import os |
| 10 | import shutil | 10 | import subprocess |
| 11 | 11 | ||
| 12 | POSTFIX = ".cleaned" | 12 | POSTFIX = ".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 | ||
