From fb7016100e986ab3574baf44075713d1bafd439c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 28 Dec 2012 07:10:00 +0100 Subject: m + implementation of removal of mbr code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- bootcleanse.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bootcleanse.py b/bootcleanse.py index a65229f..60feb36 100644 --- a/bootcleanse.py +++ b/bootcleanse.py @@ -6,17 +6,17 @@ import sys from subprocess import Popen, PIPE -mbr = [] +mbrs = [] for arg in sys.argv[1:]: - mbr.append(mbr) + mbrs.append(arg) print('Remove MBR code from ' + arg) if not (('a' <= arg[-1]) and (arg[-1] <= 'z') and (arg[:-1] in ('/dev/sd', '/dev/hd'))): print('\033[01;33mWarning:\033[21;39m Does not match /dev/(sd|hd)[a-z]') print() print('If you are not sure what you are doing, you may want') -print('to back up the first 512 of each defected file.') +print('to back up the first 512 byte of each defected file.') print('To back up run `dd if=DEVICE bs=512 count=1 > DEV.backup`.') print('To restore run `dd of=DEVICE bs=512 count=1 is=DEV.backup`.') print() @@ -30,3 +30,7 @@ while True: exit(128) print('Only ‘yes’ and ‘no’ is valid') + +for mbr in mbrs: + Popen(['sudo' 'dd', 'if=/dev/zero', 'of=' + mbr, 'bs=440', 'count=1'], stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate() + -- cgit v1.2.3-70-g09d2