• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

"Protect" a pen drive from malware using java code - please review my (working) code ?

 
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My pen-drive has no write-protect switch like the good old floppies. I wanted to make it protected so that those worms and viruses dont infect it when i put it in other computers.
So, to make it write-protected, i made a java program that generates a dummy file. We can see the empty space of the pen drive and create a dummy of that size and put it in the pen drive.

Minor problem with code - You fill the drive with a dummy file. Even after doing that there is some small space left in the drive. I have to run the code again and make a dummy of that size. Then, the pen drive is completely filled.

Can anyone add these features for me ?

(1) Detect pen-drive empty space and generate a file of the exact size in one attempt.
(2) make it GUI based.

Anything else you can think of (issues, suggestions etc) ?


Here is the code, it is console based :

 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regardless of your code, how can you use your pen drive now? You can't write anything to it.
 
Ranch Hand
Posts: 49
Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hes wants to use it "read-only" on those machines he consideres unsafe.
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jon Avadis wrote:Hes wants to use it "read-only" on those machines he consideres unsafe.



Yes.
 
He's giving us the slip! Quick! Grab this tiny ad!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic