[Tutor] Substitution function needed

Chad Perry cperry172 at hotmail.com
Fri Jan 15 12:07:58 EST 2016


#The function for writing random data to the disk.
def random():
   print ""
   os.system("/sbin/fdisk -l")
   print ""
   print "Please choose a device to kill.  Remember if you want to"
   print "wipe the whole drive and not just a partition, you can"
   print "remove the number appended.  Example /dev/sdc1 becomes /dev/sdc ."
   print ""
   device=raw_input("Enter device: ")
   print ""
   count=input("How many times would you like to wipe the device? ")
   print ""
   print "Writing changes to disk.  All data on %s will be lost."%(device)
   print ""
   raw_input("Press Enter to continue, or Ctrl+C to exit: ")
   print ""
   lap=1
   for i in range(count):
       print "Processing wipe count %s of %s..."%(lap, count)
       os.system(("dd if=/dev/urandom of=%s")%(device))
       lap=lap+1

I need to know how to substitute for the drive letter for the following drives.

sad-sdp
also will need to wipe data from /dev/md1

I believe that the script is sound just sub's


More information about the Tutor mailing list