Giter Club home page Giter Club logo

removable-read-only's Introduction

removable-read-only

A small script to automate toggling read-only mode independently of partiton letter or drive 'rank'.

Primary Idea

This was inspired by the fact that most malware cannot override read-only mode because of the high required administrative privileges unless the whole system is taken-down already.

Disclaimer: This script is provided "AS IS", without any warranties and should be used at your own risk.

Example with output enabled

Getting Started

cd to your removable drive

PS X:> cd X

git clone this repository

PS X:> git clone https://github.com/Yiidiir/removable-read-only.git

cd to removable-read-only/examples

PS X:> cd removable-read-only/examples

Usage

PowerShell must have elevated privileges (Administrator) to access Set-disk -IsReadOnly

PS X:> .\read_only.ps1
usage: .\read_only.ps1 [-write] (BOOLEAN)

Set removable drive to read-only mode

required argument:
  -write            Allow writing in drive (must be explicitly declared)

Input

The only existing input is a boolean declaring whenever writing should be allowed or not:

PS X:> .\read_only.ps1 -write 0

Output

By default there will be no output.

PS X:\>

If you want to see a an output message, uncomment lines: 8,12,3 from read_only.ps1

**********************************************************
Read-Only Enabled: True
**********************************************************
PS F:\>

Credits

Useful resources i found while coding this:

TODO:

  • Auto-exit console
  • Add Help parameter
  • Add Output parameter
  • Support Linux
  • Self-elevating permission in PowerShell
  • Doing this with diskpart only?

Licensed under the MIT License

removable-read-only's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

removable-read-only's Issues

Random Read-write

Random switch to read-write when moving drive to another PC.
Investigating this issue...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.