• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

"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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



Yes.
 
reply
    Bookmark Topic Watch Topic
  • New Topic