diff --git a/requirements.in b/requirements.in index 4da3250f..a4809cdf 100644 --- a/requirements.in +++ b/requirements.in @@ -1,7 +1,7 @@ urllib3==1.25.11 requests==2.25.1 PyNaCl==1.4.0 -gevent==20.9.0 +gevent==20.12.1 Flask==1.1.2 PySocks==1.7.1 stem==1.8.0 diff --git a/requirements.txt b/requirements.txt index 865d9951..951e212a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -66,17 +66,31 @@ flask==1.1.2 \ --hash=sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060 \ --hash=sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557 \ # via -r requirements.in -gevent==20.9.0 \ - --hash=sha256:1628a403fc9c3ea9b35924638a4d4fbe236f60ecdf4e22ed133fbbaf0bc7cb6b \ - --hash=sha256:2269574444113cb4ca1c1808ab9460a87fe25e1c34a6e36d975d4af46e4afff9 \ - --hash=sha256:324808a8558c733f7a9734525483795d52ca3bbd5662b24b361d81c075414b1f \ - --hash=sha256:5f6d48051d336561ec08995431ee4d265ac723a64bba99cc58c3eb1a4d4f5c8d \ - --hash=sha256:a8733a01974433d91308f8c44fa6cc13428b15bb39d46540657e260ff8852cb1 \ - --hash=sha256:adbb267067f56696b2babced3d0856aa39dcf14b8ccd2dffa1fab587b00c6f80 \ - --hash=sha256:b07fcbca3e819296979d82fac3d8b44f0d5ced57b9a04dffcfd194da99c8eb2d \ - --hash=sha256:b2948566003a1030e47507755fe1f446995e8671c0c67571091539e01faf94cc \ - --hash=sha256:e11de4b4d107ca2f35000eb08e9c4c4621c153103b400f48a9ea95b96d8c7e0b \ - --hash=sha256:fb33dc1ab27557bccd64ad4bf81e68c8b0d780fe937b1e2c0814558798137229 \ +gevent==20.12.1 \ + --hash=sha256:0f9fa230c5878704b9e286ad5038bac3b70d293bf10e9efa8b2ae1d7d80e7e08 \ + --hash=sha256:19bd3fe60dec45fe6420b7772496950215f1b36701905876ba1644b6b2064163 \ + --hash=sha256:2d05f38a5ef1ebb7ceb692897674b11ba603914524765b989c65c020c7b08360 \ + --hash=sha256:4b0a5626c4e534d184cdf00d66f06de3885beafaaa5f7b98d47186ea175629a1 \ + --hash=sha256:4baecba0fd614e14dc1f3f8c35616cb248cdb893de576150ed1fc7fc66b8ba3d \ + --hash=sha256:60799fd7dcbb622f8435eb12436d48a8d27f8e7b3d23631e32ccc04ddd2097c2 \ + --hash=sha256:69ddc1767a02f68e71d5e0d3215aa4d28872187715627f71ff0eadd7b7a5e7f4 \ + --hash=sha256:7a808c63f065a303bbbe87c5c0754e06abb1e23e18752f418dce1eb3189cb43d \ + --hash=sha256:81e38ed46e21e0b00b930efce1a1ff46c7722ad83d84052f71a757f23cbed1c0 \ + --hash=sha256:895c76a89907d9d37fdfaf5321cb0fff0cba396f003bedb4f5fc13836da6f250 \ + --hash=sha256:89c583744f91052ae987356660f5ed0b8fc59a1230b051d6ccc10d37a155fe01 \ + --hash=sha256:99b68765767bb3e2244a66b012883899a6f17c23b6dc1cd80b793df341e15f08 \ + --hash=sha256:9d001fc899db6e140110ae7484e58cd74b0dfa5cee021a0347f00bb441ac78bd \ + --hash=sha256:b57586ad3fedf13d351d2559b70d6fe593c50400315d52bb3c072285da60fa37 \ + --hash=sha256:ba244028225ff8d3a58f344fcd16ab05b0e3642b34d81f51f7fa3c70761f6c34 \ + --hash=sha256:bf946a99e364ebcc95b82c794d5d1a67f13115adbefab7b9e12791f13184cfd5 \ + --hash=sha256:c3706a620e167c4bd007f16f113928324c4e07a7bae11d6d18d65f82abcd7a58 \ + --hash=sha256:c570a2e3100f758a5c2f9b993ecf870ee784390e44e1a292c361d6b32fb3ad4c \ + --hash=sha256:caec00914e8f21b2c77a29bbc2ef3abfeadf7515656e5451dfb14c2064733998 \ + --hash=sha256:e233ae153b586b61e492806d4cd1be2217de7441922c02053b67de14800bce96 \ + --hash=sha256:f020bfb34d57caa10029111be776524c378a4aac8417bc6fb1154b05e00fc220 \ + --hash=sha256:f3faf1834464f1b0731aa6346cd9f41029fa9e208d6ecbce4a736c19562c86aa \ + --hash=sha256:f857adbe1bf41e620d86173a53100f4ec328eba3089069a4815b3d9f4229dee8 \ + --hash=sha256:ffa1be13963db6aa55c50d2fd4a656c82f53a03a47e37aaa69e79a488123538d \ # via -r requirements.in greenlet==0.4.17 \ --hash=sha256:1023d7b43ca11264ab7052cb09f5635d4afdb43df55e0854498fc63070a0b206 \ diff --git a/src/rinseoff/README.md b/src/rinseoff/README.md index e501cae8..49aa8374 100644 --- a/src/rinseoff/README.md +++ b/src/rinseoff/README.md @@ -41,6 +41,7 @@ Then input the data to store through stdin. `$ rinseoffcli load /path/to/stored/data /path/to/key` If the key is valid, the plaintext will be outputted through stdout. +if data path is "stdin" it will be read from pipe according ## Securely erase data diff --git a/src/rinseoff/rinseoffcli/RinseOffCLI.cs b/src/rinseoff/rinseoffcli/RinseOffCLI.cs index 91e62fc6..adb64a71 100644 --- a/src/rinseoff/rinseoffcli/RinseOffCLI.cs +++ b/src/rinseoff/rinseoffcli/RinseOffCLI.cs @@ -24,7 +24,7 @@ namespace rinseoffcli { class Program { - public static string version = "1.0.0"; + public static string version = "2.0.0"; enum ErrorCode : byte { // Exit error codes indexed from 1 @@ -59,9 +59,26 @@ namespace rinseoffcli stderrStream.WriteLine(msg); stderrStream.Flush(); } + + static byte[] readUntilClose(){ + // Read binary from STDIN until close + var readData = new List(); + Stream inputStream = Console.OpenStandardInput(); + int inp; + while(true){ + inp = inputStream.ReadByte(); + if (inp != -1){ + readData.Add((byte) inp); + } + else{ + return readData.ToArray(); + } + } + } static void loadData(string filepath, string keypath){ // Load in an encrypted file and use a key file to decrypt it, then log bytes back to stdout byte[] plaintext = {}; + byte[] ciphertext = {}; byte[] readBytes(string file){ // Read bytes in from a file, exit with error message if not possible byte[] bytesToRead = {}; @@ -83,10 +100,17 @@ namespace rinseoffcli return bytesToRead; } var stdout = Console.OpenStandardOutput(); + + if (filepath.Equals("stdin")){ + ciphertext = readUntilClose(); + } + else{ + ciphertext = readBytes(filepath); + } try{ // Decrypt a file using a key file plaintext = RinseOff.decrypt_secret_bytes( - readBytes(filepath), + ciphertext, readBytes(keypath) ); } @@ -98,6 +122,7 @@ namespace rinseoffcli stderrWrite("Could not decrypt " + filepath + " with " + keypath); Environment.Exit((int)ErrorCode.InvalidKeyFile); } + ciphertext = null; // print the plaintext and exit foreach(byte b in plaintext){ stdout.WriteByte(b); @@ -116,21 +141,6 @@ namespace rinseoffcli stdout.Flush(); } - byte[] readUntilClose(){ - // Read binary from STDIN until close - var readData = new List(); - Stream inputStream = Console.OpenStandardInput(); - int inp; - while(true){ - inp = inputStream.ReadByte(); - if (inp != -1){ - readData.Add((byte) inp); - } - else{ - return readData.ToArray(); - } - } - } // Encrypt stdin with keyfile data then write out to output file try{ encryptedInput = RinseOff.encrypt_secret_bytes(readUntilClose(), File.ReadAllBytes(keypath));