kopia lustrzana https://github.com/robinmoisson/staticrypt
Merge pull request #103 from robinmoisson/password_template
add option to use custom password template file, close #102pull/105/head
commit
8e75419a2d
25
README.md
25
README.md
|
@ -14,31 +14,36 @@ StatiCrypt generates a static, password protected page that can be decrypted in-
|
|||
|
||||
StatiCrypt basically encrypts your page and puts everything with a user-friendly way to use a password in the new file.
|
||||
|
||||
AES-256 is state of the art but brute-force/dictionary attacks would be trivial to do at a really fast pace: **use a long, unusual passphrase!**
|
||||
AES-256 is state of the art but brute-force/dictionary attacks would be trivial to do at a really fast pace: **use a long, unusual passphrase**.
|
||||
|
||||
The concept is simple but this is a side project - not purporting to be bulletproof, feel free to contribute or report any thought to the GitHub project !
|
||||
The concept is simple and should work ok but I am not a cryptographer, feel free to contribute or report any thought to the GitHub project !
|
||||
|
||||
## CLI
|
||||
|
||||
Staticrypt is available through npm as a CLI, install with `npm install -g staticrypt` and use as follow:
|
||||
|
||||
Usage: staticrypt <input> <password> [options]
|
||||
Usage: staticrypt <filename> <passphrase> [options]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
-e, --embed Whether or not to embed crypto-js in the page (or use an
|
||||
external CDN) [boolean] [default: false]
|
||||
-o, --output File name / path for generated encrypted file
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
-e, --embed Whether or not to embed crypto-js in the page (or use an
|
||||
external CDN) [boolean] [default: false]
|
||||
-o, --output File name / path for generated encrypted file
|
||||
[string] [default: null]
|
||||
-t, --title Title for output HTML page
|
||||
-t, --title Title for output HTML page
|
||||
[string] [default: "Protected Page"]
|
||||
-i, --instructions Special instructions to display to the user.
|
||||
-i, --instructions Special instructions to display to the user.
|
||||
[string] [default: null]
|
||||
-f, --file-template Path to custom HTML template with password prompt.
|
||||
[string] [default: "[...]/cli/password_template.html"]
|
||||
|
||||
|
||||
Example usages:
|
||||
|
||||
- `staticrypt test.html mysecretpassword` -> creates a `test_encrypted.html` file
|
||||
- `find . -type f -name "*.html" -exec staticrypt {} mypassword \;` -> create encrypted files for all HTML files in your directory
|
||||
|
||||
You can use a custom template for the password prompt - just copy `cli/password_template.html` and modify it to suit your presentation style and point to your template file with the `-f` flag. Be careful to not break the encrypting javascript part, the variables replace by staticrypt are between curly brackets: `{instructions}`.
|
||||
|
||||
Thanks [Aaron Coplan](https://github.com/AaronCoplan) for bringing the CLI to life !
|
||||
|
|
|
@ -14,7 +14,7 @@ StatiCrypt basically encrypts your page and puts everything with a user-friendly
|
|||
|
||||
AES-256 is state of the art but brute-force/dictionary attacks would be trivial to do at a really fast pace: **use a long, unusual passphrase!**
|
||||
|
||||
The concept is simple but this is a side project - if you have extra sensitive banking data you might want to use something else :)
|
||||
The concept is simple and should work ok but I am not a cryptographer, if you have extra sensitive banking data you might want to use something else :)
|
||||
|
||||
Feel free to contribute or report any thought to the [GitHub project](https://robinmoisson.github.io/staticrypt) !
|
||||
|
||||
|
@ -22,21 +22,25 @@ Feel free to contribute or report any thought to the [GitHub project](https://ro
|
|||
|
||||
Staticrypt is available through npm as a CLI, install with `npm install -g staticrypt` and use as follow:
|
||||
|
||||
Usage: staticrypt <input file> <password> [options]
|
||||
Usage: staticrypt <filename> <passphrase> [options]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
-e, --embed Whether or not to embed crypto-js in the page (or use an
|
||||
external CDN) [boolean] [default: false]
|
||||
-o, --output File name / path for generated encrypted file
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
-e, --embed Whether or not to embed crypto-js in the page (or use an
|
||||
external CDN) [boolean] [default: false]
|
||||
-o, --output File name / path for generated encrypted file
|
||||
[string] [default: null]
|
||||
-t, --title Title for output HTML page
|
||||
-t, --title Title for output HTML page
|
||||
[string] [default: "Protected Page"]
|
||||
-i, --instructions Special instructions to display to the user.
|
||||
-i, --instructions Special instructions to display to the user.
|
||||
[string] [default: null]
|
||||
-f, --file-template Path to custom HTML template with password prompt.
|
||||
[string] [default: "[...]/cli/password_template.html"]
|
||||
|
||||
Example usages:
|
||||
|
||||
- `staticrypt test.html mypassword` -> creates a `test_encrypted.html` file
|
||||
- `find . -type f -name "*.html" -exec staticrypt {} mypassword \;` -> create encrypted files for all HTML files in your directory (recursively)
|
||||
|
||||
You can use a custom template for the password prompt - just copy `cli/password_template.html` and modify it to suit your presentation style and point to your template file with the `-f` flag. Be careful to not break the encrypting javascript part, the variables replace by staticrypt are between curly brackets: `{instructions}`.
|
||||
|
|
10
cli/index.js
10
cli/index.js
|
@ -10,7 +10,7 @@ const SCRIPT_URL = 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/cry
|
|||
const SCRIPT_TAG = '<script src="' + SCRIPT_URL + '" integrity="sha384-lp4k1VRKPU9eBnPePjnJ9M2RF3i7PC30gXs70+elCVfgwLwx1tv5+ctxdtwxqZa7" crossorigin="anonymous"></script>';
|
||||
|
||||
const namedArgs = Yargs
|
||||
.usage('Usage: staticrypt <input> <password> [options]')
|
||||
.usage('Usage: staticrypt <filename> <passphrase> [options]')
|
||||
.demandCommand(2)
|
||||
.option('e', {
|
||||
alias: 'embed',
|
||||
|
@ -36,6 +36,12 @@ const namedArgs = Yargs
|
|||
describe: 'Special instructions to display to the user.',
|
||||
default: ''
|
||||
})
|
||||
.option('f', {
|
||||
alias: 'file-template',
|
||||
type: 'string',
|
||||
describe: 'Path to custom HTML template with password prompt.',
|
||||
default: __dirname + '/password_template.html'
|
||||
})
|
||||
.argv;
|
||||
|
||||
if(namedArgs._.length !== 2){
|
||||
|
@ -90,7 +96,7 @@ genFile(data);
|
|||
*/
|
||||
function genFile(data){
|
||||
try{
|
||||
var templateContents = FileSystem.readFileSync(__dirname + '/password_template.html', 'utf8');
|
||||
var templateContents = FileSystem.readFileSync(namedArgs.f, 'utf8');
|
||||
}catch(e){
|
||||
console.log("Failure: could not read template!");
|
||||
process.exit(1);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "staticrypt-cli",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "staticrypt",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"description": "Based on the [crypto-js](https://github.com/brix/crypto-js) library, StatiCrypt uses AES-256 to encrypt your input with your passphrase and put it in a HTML file with a password prompt that can decrypted in-browser (client side).",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
|
Ładowanie…
Reference in New Issue