diff --git a/app/index.js b/app/index.js index d69cc21..d216abb 100644 --- a/app/index.js +++ b/app/index.js @@ -9,14 +9,6 @@ const Db = require('./src/Db') const MasterPass = require('./src/MasterPass') const MasterPassKey = require('./src/MasterPassKey') const _ = require('lodash') -const logger = require('./script/logger') -// change exec path -logger.info(`AppPath: ${app.getAppPath()}`) -logger.info(`UseData Path: ${app.getPath('userData')}`) -process.chdir(app.getAppPath()) -logger.info(`Changed cwd to: ${process.cwd()}`) -logger.info(`Electron node v${process.versions.node}`) - // adds debug features like hotkeys for triggering dev tools and reload require('electron-debug')() @@ -33,6 +25,14 @@ global.views = { setup: `file://${__dirname}/static/setup.html`, crypter: `file://${__dirname}/static/crypter.html` } +const logger = require('./script/logger') + +// change exec path +logger.info(`AppPath: ${app.getAppPath()}`) +logger.info(`UseData Path: ${app.getPath('userData')}`) +process.chdir(app.getAppPath()) +logger.info(`Changed cwd to: ${process.cwd()}`) +logger.info(`Electron node v${process.versions.node}`) /** * Promisification of initialisation diff --git a/app/script/logger.js b/app/script/logger.js index cf39412..1d697b1 100644 --- a/app/script/logger.js +++ b/app/script/logger.js @@ -6,16 +6,16 @@ const winston = require('winston') const moment = require('moment') const fs = require('fs-extra') -const path = require('path') -let debugDir = path.join(__dirname,'/debug') +let debugDir = `${global.paths.userData}/debug` fs.ensureDirSync(debugDir) winston.emitErrs = true const fileTransport = new (winston.transports.File)({ filename: `${debugDir}/CS_debug_${moment().format('DD.MM@HH:MM').trim()}.log`, handleExceptions: true, maxsize: 5242880, // 5MB - colorize: false + colorize: false, + level: 'verbose' }) module.exports = (!process.env.TEST_RUN) ? new (winston.Logger)({ diff --git a/app/src/crypto.js b/app/src/crypto.js index 3a2021e..40bc92c 100644 --- a/app/src/crypto.js +++ b/app/src/crypto.js @@ -7,7 +7,7 @@ const fs = require('fs-extra') const path = require('path') const scrypto = require('crypto') -const logger = require('../script/logger') +const logger = require('winston') const Readable = require('stream').Readable const tar = require('tar-fs') const CRYPTER_REGEX = /^Crypter(.*)$/igm @@ -28,7 +28,6 @@ exports.crypt = function (origpath, masterpass) { // Resolve the destination path for encrypted file exports.encrypt(origpath, masterpass) .then((creds) => { - logger.info(`Encrypt creds: ${JSON.stringify(creds)}`) resolve({ op: 'Encrypted', // Crypter operation name: path.basename(origpath), // filename @@ -62,7 +61,7 @@ exports.encrypt = function (origpath, mpkey) { fs.mkdirs(tempd, function (err) { if (err) reject(err) - logger.info(`Created ${tempd} successfully`) + logger.verbose(`Created ${tempd} successfully`) // readstream to read the (unencrypted) file const origin = fs.createReadStream(origpath) // create data and creds file @@ -119,7 +118,7 @@ exports.encrypt = function (origpath, mpkey) { if (err) reject(err) // return all the credentials and parameters used for encryption - logger.info('Successfully deleted tempd!') + logger.verbose('Successfully deleted tempd!') resolve({ salt: dcreds.salt, key: dcreds.key, @@ -181,17 +180,15 @@ exports.decrypt = function (origpath, mpkey) { const iv = new Buffer(creds[1], 'hex') const authTag = new Buffer(creds[2], 'hex') const salt = new Buffer(creds[3], 'hex') - logger.info(`iv: ${iv}, authTag: ${authTag}, salt: ${salt}`) + logger.verbose(`Extracted data, iv: ${iv}, authTag: ${authTag}, salt: ${salt}`) // Read encrypted data stream const dataOrig = fs.createReadStream(dataOrigPath) // derive the original encryption key for the file exports.deriveKey(mpkey, salt, defaults.iterations) .then((dcreds) => { try { - logger.info(`Derived encryption key ${dcreds.key.toString('hex')}`) let decipher = scrypto.createDecipheriv(defaults.algorithm, dcreds.key, iv) decipher.setAuthTag(authTag) - logger.info(`authTag: ${authTag.toString('hex')}`) const dataDest = fs.createWriteStream(dataDestPath) dataOrig.pipe(decipher).pipe(dataDest) diff --git a/app/static/crypter.html b/app/static/crypter.html index fea9766..fadbdc6 100644 --- a/app/static/crypter.html +++ b/app/static/crypter.html @@ -21,7 +21,7 @@

Crypter

- Select a file + Select or drop file

@@ -90,7 +90,7 @@

{{op}} {{name}}

var dialog = remote.dialog var BrowserWindow = remote.BrowserWindow var paths = remote.getGlobal('paths') - var logger = require('../script/logger.js') + var logger = require('winston') var Handlebars = require('handlebars') var path = require('path') var errLabel = $('#errLabel') @@ -111,7 +111,9 @@

{{op}} {{name}}

fileInputD.ondragleave = fileInputD.ondragend = function () { return false } + turnFileInputOn () + $('.navigationLink').each(function (index) { $(this).click(function () { navigate(this.getAttribute('data-target')) diff --git a/app/static/styles/crypter.css b/app/static/styles/crypter.css index 0c25d42..9f23876 100644 --- a/app/static/styles/crypter.css +++ b/app/static/styles/crypter.css @@ -1 +1 @@ -@import "../../bower_components/normalize-css/normalize.css";@keyframes colorTrans{from{border-bottom:1px solid #DDDDDD}to{border-bottom:1px solid #333333}}body{font-family:"Roboto","HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,"Lucida Grande",sans-serif;font-weight:300;margin:0;padding:0;background-color:#FFFFFF;width:100%;height:100vh;overflow:hidden}p{margin:0}div.none{display:none}.left{-webkit-align-self:flex-start;align-self:flex-start !important}.right{margin-left:auto !important}button,.button{background-color:#FFFFFF;border:1px solid #DDDDDD;width:100%;padding:.3rem;font-weight:400;outline:none}button:active,.button:active,button:hover,.button:hover{background-color:#DDDDDD}button.fancy{margin-top:.2rem;border:none;color:#FFFFFF;width:30% !important;background:linear-gradient(to right, #EEA849, #F46B45);background-size:200% 200%;animation:OrangeAnimGrad 3s ease infinite}button.fancy:active,button.fancy:hover{opacity:.8}.fancy{border:none;color:#FFFFFF;background:linear-gradient(to right, #EEA849, #F46B45);background-size:200% 200%;animation:OrangeAnimGrad 3s ease infinite}.fancy:active,.fancy:hover{opacity:.8}img.info{padding-left:.2rem;height:.8rem}p.info{display:block;width:100%;box-sizing:border-box;max-height:0;overflow:hidden;transition:max-height .5s,padding .3s;background-color:#DDDDDD;font-size:.8rem}img.info:hover+p.info{max-height:100%;padding:.2rem}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-Italic.eot');src:url('../fonts/Roboto-Italic.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-Italic.woff') format('woff'),url('../fonts/Roboto-Italic.ttf') format('truetype');font-weight:normal;font-style:italic}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-BlackItalic.eot');src:url('../fonts/Roboto-BlackItalic.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-BlackItalic.woff') format('woff'),url('../fonts/Roboto-BlackItalic.ttf') format('truetype');font-weight:900;font-style:italic}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-Bold.eot');src:url('../fonts/Roboto-Bold.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-Bold.woff') format('woff'),url('../fonts/Roboto-Bold.ttf') format('truetype');font-weight:bold;font-style:normal}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-Thin.eot');src:url('../fonts/Roboto-Thin.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-Thin.woff') format('woff'),url('../fonts/Roboto-Thin.ttf') format('truetype');font-weight:100;font-style:normal}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-Medium.eot');src:url('../fonts/Roboto-Medium.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-Medium.woff') format('woff'),url('../fonts/Roboto-Medium.ttf') format('truetype');font-weight:500;font-style:normal}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-Light.eot');src:url('../fonts/Roboto-Light.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-Light.woff') format('woff'),url('../fonts/Roboto-Light.ttf') format('truetype');font-weight:300;font-style:normal}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-Regular.eot');src:url('../fonts/Roboto-Regular.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-Regular.woff') format('woff'),url('../fonts/Roboto-Regular.ttf') format('truetype');font-weight:normal;font-style:normal}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-ThinItalic.eot');src:url('../fonts/Roboto-ThinItalic.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-ThinItalic.woff') format('woff'),url('../fonts/Roboto-ThinItalic.ttf') format('truetype');font-weight:100;font-style:italic}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-BoldItalic.eot');src:url('../fonts/Roboto-BoldItalic.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-BoldItalic.woff') format('woff'),url('../fonts/Roboto-BoldItalic.ttf') format('truetype');font-weight:bold;font-style:italic}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-Black.eot');src:url('../fonts/Roboto-Black.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-Black.woff') format('woff'),url('../fonts/Roboto-Black.ttf') format('truetype');font-weight:900;font-style:normal}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-MediumItalic.eot');src:url('../fonts/Roboto-MediumItalic.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-MediumItalic.woff') format('woff'),url('../fonts/Roboto-MediumItalic.ttf') format('truetype');font-weight:500;font-style:italic}@font-face{font-family:'Roboto';src:url('../fonts/Roboto-LightItalic.eot');src:url('../fonts/Roboto-LightItalic.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-LightItalic.woff') format('woff'),url('../fonts/Roboto-LightItalic.ttf') format('truetype');font-weight:300;font-style:italic}header{margin:0}header>p{color:#222222}h1{font-size:1.4rem;margin-bottom:.1rem}h3{margin-top:0}p{margin:0}a{font-size:.8rem;color:#222222;text-decoration:none;outline:none}#crypt{height:100%;min-height:20rem;width:100%;background-color:#FFFFFF;text-align:center;overflow:hidden}.crypto{width:8rem;height:auto;bottom:0}p.intrfo{color:#9D9D9D;font-size:.8rem;margin:.4rem}#crypted-container{height:84vh;overflow-y:scroll;overflow-x:hidden}#fileInput{margin-top:6vh;width:100%;height:38vh;text-align:center;display:flex;flex-flow:column}#fileInput p{line-height:38vh;color:#FFFFFF}.panel-container{position:relative}.panel-container>div{position:absolute;text-align:center;transform:translateX(-110%);transition:transform .5s}.panel-container>div>button{margin-top:1rem}.panel-container>div.current{width:100%;height:100vh;overflow:hidden;transform:none;position:relative}.panel-container>div.current~div{transform:translateX(110%)}.panel-container header{margin-top:2rem}div#panel-crypted #finfo{margin:1rem}div#panel-crypted #finfo table{width:100%;font-size:.8rem}div#panel-crypted #finfo table tr{margin-top:.4rem}div#panel-crypted #finfo table tr .bttline{vertical-align:inherit}div#panel-crypted #finfo table tr td{vertical-align:top}div#panel-crypted #finfo table tr td input[type="text"]{width:95%}div#panel-crypted #finfo table tr td a>img{height:1rem;margin-left:.1rem}div#panel-crypted #finfo table tr td:first-child{text-align:left;color:#7e7e7e}div#panel-crypted #finfo table tr td:last-child{text-align:left;padding-left:.2rem}input[type=text]{border:none;border-bottom:1px solid #DDDDDD;outline:none;vertical-align:top}input[type=text]:focus{animation-name:colorTrans;animation-duration:2s;border-bottom:1px solid #333333}p.info{display:block;width:100%;box-sizing:border-box;max-height:0;overflow:hidden;padding:0 .5rem;transition:max-height .3s,padding .3s;background-color:#efefef;font-size:.8rem}img.info{float:right;height:.9rem}img.info:hover+p.info{max-height:10rem;padding-top:.5rem;padding-bottom:.5rem}a.back{float:left}a.back>img{height:1rem;width:auto}div.forgotMP{padding:.2rem .2rem 0 0;text-align:right}footer{display:flex;clear:both;position:absolute;border-top:1px solid #DDDDDD;width:100%;padding-bottom:0;background-color:#FFFFFF;bottom:0;left:0}footer>a{float:right;padding:.2rem}p#errLabel{display:none;display:inline-block;font-size:.8rem;padding:: 0.2rem;color:#9F3A38} \ No newline at end of file +@import "../../bower_components/normalize-css/normalize.css";.button,body,button{background-color:#FFF;width:100%}.fancy,button.fancy{color:#FFF;animation:OrangeAnimGrad 3s ease infinite}.fancy:active,.fancy:hover,button.fancy:active,button.fancy:hover{opacity:.8}#crypt,body{overflow:hidden}#crypt,#fileInput{text-align:center}@keyframes colorTrans{from{border-bottom:1px solid #DDD}to{border-bottom:1px solid #333}}body{font-family:Roboto,HelveticaNeue-Light,"Helvetica Neue Light","Helvetica Neue",Helvetica,"Lucida Grande",sans-serif;font-weight:300;margin:0;padding:0;height:100vh}div.none{display:none}.left{-webkit-align-self:flex-start;align-self:flex-start!important}.right{margin-left:auto!important}.button,button{border:1px solid #DDD;padding:.3rem;font-weight:400;outline:0}.button:active,.button:hover,button:active,button:hover{background-color:#DDD}button.fancy{margin-top:.2rem;border:none;width:30%!important;background:linear-gradient(to right,#EEA849,#F46B45);background-size:200% 200%}.fancy{border:none;background:linear-gradient(to right,#EEA849,#F46B45);background-size:200% 200%}a,header>p{color:#222}img.info{padding-left:.2rem}img.info:hover+p.info{padding:.2rem}@font-face{font-family:Roboto;src:url(../fonts/Roboto-Italic.eot);src:url(../fonts/Roboto-Italic.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-Italic.woff) format('woff'),url(../fonts/Roboto-Italic.ttf) format('truetype');font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(../fonts/Roboto-BlackItalic.eot);src:url(../fonts/Roboto-BlackItalic.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-BlackItalic.woff) format('woff'),url(../fonts/Roboto-BlackItalic.ttf) format('truetype');font-weight:900;font-style:italic}@font-face{font-family:Roboto;src:url(../fonts/Roboto-Bold.eot);src:url(../fonts/Roboto-Bold.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-Bold.woff) format('woff'),url(../fonts/Roboto-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(../fonts/Roboto-Thin.eot);src:url(../fonts/Roboto-Thin.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-Thin.woff) format('woff'),url(../fonts/Roboto-Thin.ttf) format('truetype');font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(../fonts/Roboto-Medium.eot);src:url(../fonts/Roboto-Medium.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-Medium.woff) format('woff'),url(../fonts/Roboto-Medium.ttf) format('truetype');font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(../fonts/Roboto-Light.eot);src:url(../fonts/Roboto-Light.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-Light.woff) format('woff'),url(../fonts/Roboto-Light.ttf) format('truetype');font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(../fonts/Roboto-Regular.eot);src:url(../fonts/Roboto-Regular.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-Regular.woff) format('woff'),url(../fonts/Roboto-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(../fonts/Roboto-ThinItalic.eot);src:url(../fonts/Roboto-ThinItalic.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-ThinItalic.woff) format('woff'),url(../fonts/Roboto-ThinItalic.ttf) format('truetype');font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(../fonts/Roboto-BoldItalic.eot);src:url(../fonts/Roboto-BoldItalic.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-BoldItalic.woff) format('woff'),url(../fonts/Roboto-BoldItalic.ttf) format('truetype');font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(../fonts/Roboto-Black.eot);src:url(../fonts/Roboto-Black.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-Black.woff) format('woff'),url(../fonts/Roboto-Black.ttf) format('truetype');font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(../fonts/Roboto-MediumItalic.eot);src:url(../fonts/Roboto-MediumItalic.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-MediumItalic.woff) format('woff'),url(../fonts/Roboto-MediumItalic.ttf) format('truetype');font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(../fonts/Roboto-LightItalic.eot);src:url(../fonts/Roboto-LightItalic.eot?#iefix) format('embedded-opentype'),url(../fonts/Roboto-LightItalic.woff) format('woff'),url(../fonts/Roboto-LightItalic.ttf) format('truetype');font-weight:300;font-style:italic}header,p{margin:0}h1{font-size:1.4rem;margin-bottom:.1rem}a,p#errLabel,p.info,p.intrfo{font-size:.8rem}h3{margin-top:0}a{text-decoration:none;outline:0}#crypt{height:100%;min-height:20rem;width:100%;background-color:#FFF}.crypto{width:8rem;height:auto;bottom:0}p.intrfo{color:#9D9D9D;margin:.4rem}#crypted-container{height:84vh;overflow-y:scroll;overflow-x:hidden}#fileInput{margin-top:6vh;width:100%;height:38vh;display:flex;flex-flow:column}#fileInput p{line-height:38vh;color:#FFF}.panel-container{position:relative}.panel-container>div{position:absolute;text-align:center;transform:translateX(-110%);transition:transform .5s}.panel-container>div>button{margin-top:1rem}.panel-container>div.current{width:100%;height:100vh;overflow:hidden;transform:none;position:relative}.panel-container>div.current~div{transform:translateX(110%)}.panel-container header{margin-top:2rem}div#panel-crypted #finfo{margin:1rem}div#panel-crypted #finfo table{width:100%;font-size:.8rem}div#panel-crypted #finfo table tr{margin-top:.4rem}div#panel-crypted #finfo table tr .bttline{vertical-align:inherit}div#panel-crypted #finfo table tr td,input[type=text]{vertical-align:top}div#panel-crypted #finfo table tr td input[type=text]{width:95%}div#panel-crypted #finfo table tr td a>img{height:1rem;margin-left:.1rem}div#panel-crypted #finfo table tr td:first-child{text-align:left;color:#7e7e7e}div#panel-crypted #finfo table tr td:last-child{text-align:left;padding-left:.2rem}input[type=text]{border:none;border-bottom:1px solid #DDD;outline:0}input[type=text]:focus{animation-name:colorTrans;animation-duration:2s;border-bottom:1px solid #333}p.info{display:block;width:100%;box-sizing:border-box;max-height:0;overflow:hidden;padding:0 .5rem;transition:max-height .3s,padding .3s;background-color:#efefef}img.info{float:right;height:.9rem}img.info:hover+p.info{max-height:10rem;padding-top:.5rem;padding-bottom:.5rem}a.back{float:left}a.back>img{height:1rem;width:auto}div.forgotMP{padding:.2rem .2rem 0 0;text-align:right}footer{display:flex;clear:both;position:absolute;border-top:1px solid #DDD;width:100%;padding-bottom:0;background-color:#FFF;bottom:0;left:0}footer>a{float:right;padding:.2rem}p#errLabel{display:none;display:inline-block;padding:: .2rem;color:#9F3A38} \ No newline at end of file diff --git a/gulp b/gulp deleted file mode 100644 index ab95cfc..0000000 --- a/gulp +++ /dev/null @@ -1,11 +0,0 @@ -Script started on Thu Mar 17 22:21:55 2016 -[?25h[?25h]7;file://R.local/Users/HR/GitHub/Crypter% ]2;Habib@R]1;..ub/Crypter]7;file://R.local/Users/HR/GitHub/Crypter Habib@R:~/GitHub/Crypter|master⚡⇒ script gulpgulp         s  lls -]2;ls -G]1;lsCrypter_Banner.gif gulp package.json src -bower.json gulpfile.js readme.md static -bower_components index.js res test -build license script typescript -debug node_modules spec -% ]2;Habib@R]1;..ub/Crypter]7;file://R.local/Users/HR/GitHub/Crypter Habib@R:~/GitHub/Crypter|master⚡⇒ wwhich node  -]2;which node]1;which/Users/HR/.nvm/versions/node/v5.6.0/bin/node -% ]2;Habib@R]1;..ub/Crypter]7;file://R.local/Users/HR/GitHub/Crypter Habib@R:~/GitHub/Crypter|master⚡⇒ tterm -]2;term]1;term% ]2;Habib@R]1;..ub/Crypter]7;file://R.local/Users/HR/GitHub/Crypter Habib@R:~/GitHub/Crypter|master⚡⇒  \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index f092123..2b2383d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,7 +14,7 @@ const cleancss = new LessPluginCleanCSS({ advanced: true }) gulp.task('default', ['less'], shell.task([ // Run electron // 'ELECTRON_RUN_AS_NODE=true node_modules/.bin/electron node_modules/node-inspector/bin/inspector.js' - 'unset TEST_RUN && node_modules/.bin/electron .' + 'unset TEST_RUN && npm run start' // 'node_modules/.bin/electron --debug-brk=5858 .' ])) diff --git a/package.json b/package.json index 6efba62..3569e1a 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "codeclimate-test-reporter": "^0.3.3", "coveralls": "^2.11.12", "devtron": "^1.3.0", - "electron-builder": "^7.14.2", + "electron-builder": "^7.15.2", "electron-packager": "*", "electron-prebuilt": "1.1.3", "electron-rebuild": "^1.1.5", diff --git a/readme.md b/readme.md index b975314..3afc033 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,7 @@

A simple, convenient and secure crypto app.

- + Download latest release