You are here

ATTN Wraithdu (EraserDrop hacking)

7 posts / 0 new
Last post
BuddhaChu
BuddhaChu's picture
Offline
Last seen: 5 years 1 month ago
Joined: 2006-11-18 10:26
ATTN Wraithdu (EraserDrop hacking)

Hack: I hacked some code into the EraserDrop v2.1 source to include the ability to wipe the freespace of network devices. This only works if the UNC share using the device name (or even better the IP number and share name) are mapped to a drive letter in Windows. (ex: \\MyNAS\MyShare or \\192.169.1.101\MyShare mapped to z:)

Patch (diff) from the 2.1.0.0 source using WinMergePortable:

919a920
> 	; and get network storage devices mapped to a drive letter
921a923
> 	Local $drivesnet = DriveGetDrive("NETWORK")
927a930,934
> 		Next
> 	EndIf
> 	If IsArray($drivesnet) Then
> 		For $i = 1 To $drivesnet[0]
> 			$drives = $drives & "|" & $drivesnet[$i]

If that doesn't work for ya, here's a source snippet from the Freespace() function:

	Local $drives = "" ; empty variable
	; get fixed and removable drives, convert to a string
	; and get network storage devices mapped to a drive letter
	Local $drivesfix = DriveGetDrive("FIXED")
	Local $drivesrem = DriveGetDrive("REMOVABLE")
	Local $drivesnet = DriveGetDrive("NETWORK")
	For $i = 1 To $drivesfix[0]
		$drives = $drives & "|" & $drivesfix[$i]
	Next
	If IsArray($drivesrem) Then
		For $i = 1 To $drivesrem[0]
			$drives = $drives & "|" & $drivesrem[$i]
		Next
	EndIf
	If IsArray($drivesnet) Then
		For $i = 1 To $drivesnet[0]
			$drives = $drives & "|" & $drivesnet[$i]
		Next
	EndIf

Background: I haven't been able to find a free program to wipe the freespace on my NAS device. I had created a large file on my Linux box using the output of /dev/random and then was going to write a VBScript to randomly change it's name and copy it multiple times to the NAS until it's full. I never got around the to the script writing part and in the meantime I ran EraserDrop to wipe the freespace of my local hard drive. I noticed it was doing *exactly* what I was attempting to do creating multiple files to fill the drive up and then deleting them thereby "wiping" the freespace of the target drive. I looked at the AutoIt code and did an internet search on the DriveGetDrive() function and what do you know, they have a NETWORK option. The code just adds to the already existing code by enumerating the drives that show up as a network drives in Windows Explorer and adds them to the dropbox picklist so you can choose them in the program. Pretty simple 'hack' actually.

Outstanding Issue: The EraserDrop code swells by 162KB just by me compiling the original EraserDrop code with or without my code addition. I'm using the latest AutoIt package (v3.3.0.0) to compile with and UPX is compressing the .exe at the end so I don't know how Wraithdu is getting it down to 310KB in size. Not a big deal, just weird.

Testing: Testing here with my local network NAS is sketchy at best. I've had issues for a while now with my gaming rig not playing nice-nice with my NAS on both WinXP and now Win7. Copying large files or the EraserDrop wiping process will be working great and then they randomly quit with a "network resource not found error". I did create a share on my netbook and mapped it to a drive letter on the gaming rig and wiped the entire 120GBs of freespace on the first try with no issues so I know the program works fine and the issue is still with my equipment somewhere. Anyways, don't make this thread abouty my hardware issues, please stay on topic (hacking EraserDrop and wiping NAS drives) Wink

Erik: Thanks for a great little utility! I'll leave the decision to incorporate this code into the main branch up to you.

wraithdu
Offline
Last seen: 8 years 5 months ago
Developer
Joined: 2007-06-27 20:22
I can incorporate that, no

I can incorporate that, no problem. I bet wiping 120 GBs over a network took more than a few minutes... Wink

BuddhaChu
BuddhaChu's picture
Offline
Last seen: 5 years 1 month ago
Joined: 2006-11-18 10:26
cool beans

Sweet! Hopefully we can get some experienced testers that have SMB/CIFS storage devices to wipe the freespace and see how it goes and get some feedback.

(120GB did take quite a while even over Gigabit Ethernet Wink )

Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!

wraithdu
Offline
Last seen: 8 years 5 months ago
Developer
Joined: 2007-06-27 20:22
BTW, I don't think there's

BTW, I don't think there's way to merge patches with WinMerge, only to create the diff. I think you need to use diffutils (or similar) to do the merge. What diff format did you use to create that? I doesn't look like the usual unified format.

BuddhaChu
BuddhaChu's picture
Offline
Last seen: 5 years 1 month ago
Joined: 2006-11-18 10:26
I loaded the "before" and

I loaded the "before" and "after" code in WinMerge and used the "Tools" -> "Generate Patch" option. I didn't use a real diff'er like Unix's diff program. You can just copy/paste the second code listing I posted though.

Now that I think about it, they need to add an option in WinMerge to actually utilize the patches they create. That's kinda odd to be able to make a patch but not be able to use one once it's created.

Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!

BuddhaChu
BuddhaChu's picture
Offline
Last seen: 5 years 1 month ago
Joined: 2006-11-18 10:26
BTW: I downloaded the

BTW: I downloaded the GnuWin32 diff utility and it outputs what's in the first block above.

diff before.au3 after.au3 > EraserDrop.diff

919a920
> 	; and get network storage devices mapped to a drive letter
921a923
> 	Local $drivesnet = DriveGetDrive("NETWORK")
929a932,936
> 	If IsArray($drivesnet) Then
> 		For $i = 1 To $drivesnet[0]
> 			$drives = $drives & "|" & $drivesnet[$i]
> 		Next
> 	EndIf

Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!

wraithdu
Offline
Last seen: 8 years 5 months ago
Developer
Joined: 2007-06-27 20:22
Try 'diff.exe -u' (use the -u

Try 'diff.exe -u' (use the -u switch) to output a unified diff format file. Not that it really matters, but the unified format is the standard I see most often.

Log in or register to post comments