Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 14 Dec 2018, 02:23
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Filesystem
afo - Aggressive file obliterator
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 4 [53 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Author Message
scientist

Joined: 23 May 2015
Posts: 864

PostPosted: Fri 18 Mar 2016, 20:00    Post subject:  

I really like Afo.

Would it be hard to have it work with Thunar ?

_________________
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar
Back to top
View user's profile Send private message 
april

Joined: 14 Sep 2013
Posts: 1241
Location: Green Island baby!

PostPosted: Sun 12 Jun 2016, 16:42    Post subject: Trying to clean USB stick  

I was cleaning a USB stick that had a puppy install ansd a few other files . You will see all the things I tried (sorry lost this fixing size of attachment-bloody too restrictive).The rox directory picture shows nothing in there

After all of this and getting and installing the latest from the first post i still have data reading in the properties as if it is still there? How do I fix this ? Use gparted maybe but I thought after obliterating the files they would no longer show anywhere.

When I opened it in gparted the data still showed also ?

Code:
# afo

   afo  - (Agressive File Obliterator)
Overwrite directories/files with random gibberish, then delete.
Usage: afo [-c N (# of overwrites, default=1)] file spec
Example: # afo -c 2 DirectoryName
Example: # afo *.bak
Example: # afo -c 5 *


# afo  /mnt/sdc1
# afo  /mnt/sdc1/*.*
# afo -c /mnt/sdc1/*.*

 ! Note this is not the correct order just copied them in now
afo_result2.png
 Description   
 Filesize   52.82 KB
 Viewed   299 Time(s)

afo_result2.png

afo_result.png
 Description   
 Filesize   38.48 KB
 Viewed   299 Time(s)

afo_result.png

Back to top
View user's profile Send private message Yahoo Messenger 
jafadmin

Joined: 19 Mar 2009
Posts: 859

PostPosted: Sat 18 Jun 2016, 21:07    Post subject:  

Hi April,

Check it again with Rox and have it show hidden files. There is still something pretty big on that thumb drive (1.6Gig?).

It might be easier and faster to just use dd to wipe the flash drive and then just reformat back to Fat32.

dd bs=4096 of=/dev/sdd if=/dev/zero

afo /mnt/sdd1/*
Back to top
View user's profile Send private message 
april

Joined: 14 Sep 2013
Posts: 1241
Location: Green Island baby!

PostPosted: Thu 23 Jun 2016, 17:02    Post subject:  

Yes it was a movie file just to test.

I redid everything with another thumb drive and got the same result (below). Showing hidden files revealed nothing hence the two rox filers below and this was a couple of movies also. So for some reason it is not clearing them properly . I suggest you give it a try please . The files were mov and mkv if that affects anything.

I can get the drive clean by other methods OK I just thought to help get this doing it right . I like AFO and would like to rely on it . I have a use in mind in the security field which is what I do.

While you are here perhaps you can explain something to me .
/dev/zero as with many other files in /dev shows as a character file with no bytes in it so, when you use it as above, how does it write a value to the output file and what is that value?
AFOResultagain.png
 Description   
 Filesize   203.57 KB
 Viewed   233 Time(s)

AFOResultagain.png

Back to top
View user's profile Send private message Yahoo Messenger 
jafadmin

Joined: 19 Mar 2009
Posts: 859

PostPosted: Thu 23 Jun 2016, 21:00    Post subject:  

Hi again, April.

The syntax for afo is: afo -c N filespec ('N' means a number)

afo /mnt/sdc1/* (to delete everything on the drive using defaults)

Do not use *.* as it will not delete files unless they have a "name.name". In linux, to delete everything, just use '*'.

the "-c" switch expects a numeric argument to follow (i.e 1,2,3, etc.) or ("-c2")This tells afo how many times to overwrite the file. The default value if the switch isn't specified by you is 1.
Back to top
View user's profile Send private message 
april

Joined: 14 Sep 2013
Posts: 1241
Location: Green Island baby!

PostPosted: Fri 24 Jun 2016, 14:07    Post subject:  

Yes I understand all that . I just used that exact command on the exact same drive and it still has content on the drive.

I was just showing you what else I tried to erase the contents . It still shows content no matter what I do with AFO

Certainly I can reformat it and have it clean but I am trying to get AFO to do it in one hit . Its supposed to read a file , write rubbish over it as many times as I wish then delete the file ,

Yes , I am trying to impress on you that doing all this still leaves something on the drive which I wish you would just try and see for yourself please .

At least then we will be on the same page!
Back to top
View user's profile Send private message Yahoo Messenger 
jafadmin

Joined: 19 Mar 2009
Posts: 859

PostPosted: Fri 24 Jun 2016, 19:37    Post subject:  

The problem, April, is that I can't duplicate the problem.

If I type:
Code:
afo /mnt/sdb1/*

Everything on sdb1 gets deleted and scrambled.

If I type: "ls /mnt/sdb1", it shows nothing. If I look in rox and tell it to show hidden files as well, it shows nothing. If I check it with "df" it shows nothing, and if I look at it with gparted, it shows nothing.

See, the thing is, if the entry for a file is deleted from the partition table, none of these utilities will show it as being there.

Try this and see if it changes anything:
Code:
rm /mnt/sdb1/*


All afo does is scramble the contents of the file before deleting it.
Back to top
View user's profile Send private message 
april

Joined: 14 Sep 2013
Posts: 1241
Location: Green Island baby!

PostPosted: Sun 26 Jun 2016, 04:38    Post subject:  

I see . maybe its in the way I am getting the properties in precise 5.7.1
I open a rox filer for the stick , then go up a directoy in the rox so it shows sdc1 , then I right click for properties and that's the window that shows content.

If I open it with gparted it still shows content on the drive so I am at a loss why you are not seeing this ? That's the only thing I am looking at atm so its probably doing the scramble OK but the deletion is not showing up for me .

I'll have a go at recovering the deleted files and see if there is anything still recognisable on it . Strange indeed . What release are you trying a duplication on ?
Back to top
View user's profile Send private message Yahoo Messenger 
jafadmin

Joined: 19 Mar 2009
Posts: 859

PostPosted: Sun 26 Jun 2016, 17:21    Post subject:  

Just for grins, try this, April; remove the stick then navigate to /mnt/sdc1 and see if anything is in there. If not, you may have a messed up USB thumb drive. Confused

If rox and the "ls" commands say there are no files on the drive, but gparted is saying it's half full, I think it must be messed up. I'm all out of suggestions.

If it was mine, I'd zero it out with "dd", then reformat it.
Back to top
View user's profile Send private message 
april

Joined: 14 Sep 2013
Posts: 1241
Location: Green Island baby!

PostPosted: Sun 26 Jun 2016, 18:12    Post subject:  

OK I repeat ,for the 4th time , I can get it clean . That's not my problem .
What I am trying to do is understand why content is being left on the stick by afo in my precise situation (pun).

I want to use it in a script that wont work if there is content left on it in any form.
You didn't answer what system you are running to test it.
Can you give me the code that runs afo or the script .Whatever and I'll see if I can extract the pertinent parts for my script.

Nothing wrong with my USB stick .
When I went to /mnt/sdc1 I got the list of files that were last used there in april so I don't underdstand that ?

I deleted all that was there anyway and put a few small files on the stick and used AFO again . Watched them being deleted fine
Looked at results again and got the same from "properties" but I noticed "gparted" gives different "used" sizes to "properties"

With the stick unmounted and removed /mnt/sdc1 gives an empty directory now too

Also you have not answered my question
Quote:
While you are here perhaps you can explain something to me .
/dev/zero as with many other files in /dev shows as a character file with no bytes in it so, when you use it as above, how does it write a value to the output file and what is that value?
AFOresult3.png
 Description   
 Filesize   176.06 KB
 Viewed   156 Time(s)

AFOresult3.png

Back to top
View user's profile Send private message Yahoo Messenger 
jafadmin

Joined: 19 Mar 2009
Posts: 859

PostPosted: Mon 27 Jun 2016, 12:23    Post subject:  

The above shows the correct result for an empty 2Gig USB flash drive. It's the same as I get when I re-format one with ext4. The 64k shown as "in use" is used by the ext4 filesystem itself.

I think clearing out /mnt/sdc1 with the flash drive removed fixed your problem. The mount point was actually not empty when your flash drive mounted to it. The mount points should always be kept empty when not in use.

When you right-click for the properties of a mount point (/mnt/sdb1, etc) it will show the volume used by the mounted device plus the static files in the mount point prior to mounting the device. This is a common mistake that happens in linux. People often accidentally put files in the directory that is the mount point without a device being mounted to it. The most often cause is people using symlinks to the mount point in scripts, and the script runs without the device actually being mounted.

/dev/zero, /dev/null, /dev/random, and /dev/urandom are character based psuedo devices.
https://en.wikipedia.org/wiki/Device_file

The "afo" utility was written in the C programming language, and the source code for the utility is in the first post of this thread.
Back to top
View user's profile Send private message 
april

Joined: 14 Sep 2013
Posts: 1241
Location: Green Island baby!

PostPosted: Tue 28 Jun 2016, 04:29    Post subject:  

Thank You ,Ill go research ,thats very helpful .

One thing though it says 64Meg used in gparted not 64K and the Rox filer properties dialog shows 2936K used so its all a bit confusing
I'm getting the impression its all a bit too hard and you are guessing some sorry.
Back to top
View user's profile Send private message Yahoo Messenger 
jafadmin

Joined: 19 Mar 2009
Posts: 859

PostPosted: Tue 28 Jun 2016, 11:29    Post subject:  

april wrote:

I'm getting the impression its all a bit too hard and you are guessing some sorry.

This is essentially correct. Since I am unable to duplicate problem, all I can do is speculate.

I'd recommend the following to get you to where your script is tested and set up right:
1) Write the script initially using the "rm" command. This will delete the files normally without overwriting them, but that's ok for testing the script.

2) Once the script is debugged and working properly, overwrite the storage media with dd to zero it out, then reformat it.

3) Replace the "rm" command in the script with the "afo" command.

What this accomplishes is a separation of the script debugging from the confusion over whether "afo" is working right or not. If you get it working right with "rm" it should work the same way with "afo". THERE IS ONE IMPORTANT DIFFERENCE THOUGH: "afo" takes a LOT longer to run than "rm" because "afo" has to overwrite every byte in the file, while "rm" just removes the file name from the file system.
Back to top
View user's profile Send private message 
april

Joined: 14 Sep 2013
Posts: 1241
Location: Green Island baby!

PostPosted: Tue 28 Jun 2016, 18:57    Post subject:  

jafadmin wrote:
april wrote:

I'm getting the impression its all a bit too hard and you are guessing some sorry.

This is essentially correct. Since I am unable to duplicate problem, all I can do is speculate.


As I asked before ,are you able to do this in Precise 5.7.1 ? ,because I get it every time and have done it at least 20 times on 3 different file types (fat 32 ,ext 2 and ext4) of pre-formated usb sticks . So its very easy to duplicate.

I have not, however, tried it on any other distros, and there is always the possibility that my save file is corrupted somehow . I will eliminate that possibility soon by trying with a clean start.

Maybe this should give us a clue .Why would Precise 5.7.1 handle AFO differently?
The code is quite complex (well for me anyway). Did you write it or is it snippets borrowed?
Back to top
View user's profile Send private message Yahoo Messenger 
jafadmin

Joined: 19 Mar 2009
Posts: 859

PostPosted: Tue 28 Jun 2016, 20:01    Post subject:  

Hi April,

Yes, 64Meg is the correct ext4 reserve area. I mistyped above. Feel free to try the same experiment with an ext2 FS and see the differences.

The "afo" utility was developed on Precise 5.7.1. All testing I have done with you here has been on Precise 5.7.1.

You have probably noticed by now that when you format a flash drive (or any drive, for that matter) from scratch that regardless of the format type the flash drives show some of the file system in use. This is reserved area for the file system's table to hold the names of directories and files. When a file is deleted, this is where the entry for that file is deleted from.

As with many of the other contributers on this puppy project, I have been a software engineer for many years, and contribute to linux because it makes me smile to do so.

The only complicated part of the "afo" source code is the recursion part. Recursion is necessary to traverse the directory levels.
https://en.wikipedia.org/wiki/Recursion
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 4 [53 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Filesystem
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0793s ][ Queries: 12 (0.0185s) ][ GZIP on ]