Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d33a26526f | ||
|
|
e5cef9f768 | ||
|
|
02dc70d435 | ||
|
|
5354db236d | ||
|
|
ff2ce99a19 |
No files matched your search
+23
-3
@@ -16,6 +16,11 @@ module.exports = function (grunt) {
|
|||||||
|
|
||||||
browserify: {
|
browserify: {
|
||||||
default: {
|
default: {
|
||||||
|
options: {
|
||||||
|
browserifyOptions: {
|
||||||
|
debug: true
|
||||||
|
}
|
||||||
|
},
|
||||||
src: ['<%= pkg.grunt.src.path %>/debug.js', '<%= pkg.grunt.src.path %>/<%= pkg.grunt.src.script %>'],
|
src: ['<%= pkg.grunt.src.path %>/debug.js', '<%= pkg.grunt.src.path %>/<%= pkg.grunt.src.script %>'],
|
||||||
dest: '<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.script %>.js'
|
dest: '<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.script %>.js'
|
||||||
},
|
},
|
||||||
@@ -25,6 +30,20 @@ module.exports = function (grunt) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
exorcise: {
|
||||||
|
default: {
|
||||||
|
options: {
|
||||||
|
url: "http://localhost:63344/lint-neo-yt/src/app.map",
|
||||||
|
root: "../",
|
||||||
|
base: "../",
|
||||||
|
strict: true
|
||||||
|
},
|
||||||
|
files: {
|
||||||
|
'src/app.map': ['src/app.js']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
uglify: {
|
uglify: {
|
||||||
options: {
|
options: {
|
||||||
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
|
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
|
||||||
@@ -68,14 +87,15 @@ module.exports = function (grunt) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Load the plugins.
|
// Load the plugins.
|
||||||
grunt.loadNpmTasks('grunt-browserify');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||||
|
grunt.loadNpmTasks('grunt-browserify');
|
||||||
|
grunt.loadNpmTasks('grunt-exorcise');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||||
grunt.loadNpmTasks('grunt-cache-breaker');
|
grunt.loadNpmTasks('grunt-cache-breaker');
|
||||||
|
|
||||||
// Default task(s).
|
// Default task(s).
|
||||||
grunt.registerTask('default', ['clean', 'browserify:default', 'copy', 'cachebreaker']);
|
grunt.registerTask('default', ['clean', 'browserify:default', 'exorcise:default', 'copy', 'cachebreaker']);
|
||||||
grunt.registerTask('build', ['clean', 'browserify:build', 'uglify:build', 'copy', 'cachebreaker']);
|
grunt.registerTask('build', ['clean', 'browserify:build', 'uglify:build', 'copy', 'cachebreaker']);
|
||||||
|
|
||||||
};
|
};
|
||||||
+5
-2
@@ -14,13 +14,13 @@
|
|||||||
"repository": "https://github.com/Neo-Desktop/lint-neo-yt",
|
"repository": "https://github.com/Neo-Desktop/lint-neo-yt",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"bootstrap": "^3.3.7",
|
"bootstrap.native": "^2.0.8",
|
||||||
"bootswatch": "^3.3.7",
|
"bootswatch": "^3.3.7",
|
||||||
"browserify": "^14.1.0",
|
"browserify": "^14.1.0",
|
||||||
"browserify-css": "^0.10.0",
|
"browserify-css": "^0.10.0",
|
||||||
"browserify-shim": "^3.8.13",
|
"browserify-shim": "^3.8.13",
|
||||||
"bulkify": "^1.4.2",
|
"bulkify": "^1.4.2",
|
||||||
"crypto-js": "^3.1.9-1",
|
"gencryption": "^3.5.0",
|
||||||
"grunt": "^1.0.1",
|
"grunt": "^1.0.1",
|
||||||
"grunt-browserify": "^5.0.0",
|
"grunt-browserify": "^5.0.0",
|
||||||
"grunt-cache-breaker": "^2.0.1",
|
"grunt-cache-breaker": "^2.0.1",
|
||||||
@@ -28,14 +28,17 @@
|
|||||||
"grunt-contrib-clean": "^1.0.0",
|
"grunt-contrib-clean": "^1.0.0",
|
||||||
"grunt-contrib-copy": "^1.0.0",
|
"grunt-contrib-copy": "^1.0.0",
|
||||||
"grunt-contrib-uglify": "^2.2.0",
|
"grunt-contrib-uglify": "^2.2.0",
|
||||||
|
"grunt-exorcise": "^2.1.1",
|
||||||
"hasher": "^1.2.0",
|
"hasher": "^1.2.0",
|
||||||
"highlight.js": "^9.9.0",
|
"highlight.js": "^9.9.0",
|
||||||
"html": "^1.0.0",
|
"html": "^1.0.0",
|
||||||
"htmllint": "^0.6.0",
|
"htmllint": "^0.6.0",
|
||||||
"jquery": "^3.1.1",
|
"jquery": "^3.1.1",
|
||||||
"js-beautify": "^1.6.11",
|
"js-beautify": "^1.6.11",
|
||||||
|
"node-forge": "^0.7.0",
|
||||||
"sql-formatter": "^1.2.0",
|
"sql-formatter": "^1.2.0",
|
||||||
"uglifyify": "^3.0.4",
|
"uglifyify": "^3.0.4",
|
||||||
|
"whirlpool": "0.0.4",
|
||||||
"xml-beautifier": "^0.3.0"
|
"xml-beautifier": "^0.3.0"
|
||||||
},
|
},
|
||||||
"grunt": {
|
"grunt": {
|
||||||
|
|||||||
+1099
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
CSS Boilerplate
|
CSS Boilerplate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@import url('../node_modules/bootstrap/dist/css/bootstrap.min.css');
|
@import url('../node_modules/bootstrap.native/assets/css/bootstrap.min.css');
|
||||||
@import url('../node_modules/bootswatch/darkly/bootstrap.min.css');
|
@import url('../node_modules/bootswatch/darkly/bootstrap.min.css');
|
||||||
@import url('../node_modules/highlight.js/styles/default.css');
|
@import url('../node_modules/highlight.js/styles/default.css');
|
||||||
@import url('../node_modules/highlight.js/styles/monokai-sublime.css');
|
@import url('../node_modules/highlight.js/styles/monokai-sublime.css');
|
||||||
|
|||||||
+32
-36
@@ -9,7 +9,8 @@
|
|||||||
<nav class="navbar navbar-fixed-top navbar-default">
|
<nav class="navbar navbar-fixed-top navbar-default">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
|
||||||
|
aria-expanded="false" aria-controls="navbar">
|
||||||
<span class="sr-only">Toggle navigation</span>
|
<span class="sr-only">Toggle navigation</span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
@@ -18,56 +19,51 @@
|
|||||||
<a class="navbar-brand" href="#">Linter</a>
|
<a class="navbar-brand" href="#">Linter</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="navbar" class="collapse navbar-collapse">
|
<div id="navbar" class="collapse navbar-collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav"></ul>
|
||||||
<li id="html_tab" data-name="HTML Linter" class="active"><a href="#">HTML</a></li>
|
|
||||||
<li id="json_tab" data-name="JSON Linter"><a href="#">JSON</a></li>
|
|
||||||
<li id="xml_tab" data-name="XML Linter"><a href="#">XML</a></li>
|
|
||||||
<li id="js_tab" data-name="JavaScript Linter"><a href="#">JavaScript</a></li>
|
|
||||||
<li id="css_tab" data-name="CSS Linter"><a href="#">CSS</a></li>
|
|
||||||
<li id="sql_tab" data-name="SQL Linter"><a href="#">SQL</a></li>
|
|
||||||
<li id="encode_decode_tab" class="dropdown">
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true">Encode/Decode <span class="caret"></span></a>
|
|
||||||
<ul class="dropdown-menu" role="menu">
|
|
||||||
<li id="urlencode_tab" data-extra-highlight="encode_decode_tab" data-name="URL Encoder"><a href="#">URLEncode</a></li>
|
|
||||||
<li id="urldecode_tab" data-extra-highlight="encode_decode_tab" data-name="URL Decoder"><a href="#">URLDecode</a></li>
|
|
||||||
<li id="base64encode_tab" data-extra-highlight="encode_decode_tab" data-name="Base64 Encoder"><a href="#">Base64Encode</a></li>
|
|
||||||
<li id="base64decode_tab" data-extra-highlight="encode_decode_tab" data-name="Base64 Decoder"><a href="#">Base64Decode</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li id="hash_tools_tab" class="dropdown">
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true">Hash Tools <span class="caret"></span></a>
|
|
||||||
<ul class="dropdown-menu" role="menu">
|
|
||||||
<li id="md5_hash_tab" data-extra-highlight="hash_tools_tab" data-name="MD5 Hasher"><a href="#">MD5</a></li>
|
|
||||||
<li id="sha1_hash_tab" data-extra-highlight="hash_tools_tab" data-name="SHA1 Hasher"><a href="#">SHA1</a></li>
|
|
||||||
<li id="sha256_hash_tab" data-extra-highlight="hash_tools_tab" data-name="SHA256 Hasher"><a href="#">SHA256</a></li>
|
|
||||||
<li id="sha224_hash_tab" data-extra-highlight="hash_tools_tab" data-name="SHA224 Hasher"><a href="#">SHA224</a></li>
|
|
||||||
<li id="sha512_hash_tab" data-extra-highlight="hash_tools_tab" data-name="SHA512 Hasher"><a href="#">SHA512</a></li>
|
|
||||||
<li id="sha384_hash_tab" data-extra-highlight="hash_tools_tab" data-name="SHA384 Hasher"><a href="#">SHA384</a></li>
|
|
||||||
<li id="sha3_hash_tab" data-extra-highlight="hash_tools_tab" data-name="SHA3 Hasher"><a href="#">SHA3</a></li>
|
|
||||||
<li id="ripemd160_hash_tab" data-extra-highlight="hash_tools_tab" data-name="RIPEMD160 Hasher"><a href="#">RIPEMD160</a></li>
|
|
||||||
<li id="bcrypt_hash_tab" data-extra-highlight="hash_tools_tab" data-name="BCrypt Hasher"><a href="#">BCrypt</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div><!-- /.nav-collapse -->
|
</div><!-- /.nav-collapse -->
|
||||||
</div><!-- /.container -->
|
</div><!-- /.container -->
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-9">
|
<div class="col">
|
||||||
<h1 id="header">HTML Lint</h1>
|
<h1 id="header">HTML Lint</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-9">
|
</div>
|
||||||
<p>
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<textarea id="input"></textarea>
|
<textarea id="input"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="select" class="control-label">Dropdown</label>
|
||||||
|
<select class="form-control" id="select">
|
||||||
|
<option>1</option>
|
||||||
|
<option>2</option>
|
||||||
|
<option>3</option>
|
||||||
|
<option>4</option>
|
||||||
|
<option>5</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
<hr>
|
<hr>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
<div class="output">
|
<div class="output">
|
||||||
<pre><code id="output" class="hljs" contenteditable="true"></code></pre>
|
<pre><code id="output" class="hljs" contenteditable="true"></code></pre>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+375
-92
@@ -26,7 +26,7 @@ window.$ = window.jQuery = require('jquery');
|
|||||||
|
|
||||||
// include bootstrap css and javascript
|
// include bootstrap css and javascript
|
||||||
require('./index.css');
|
require('./index.css');
|
||||||
require('bootstrap');
|
var bsn = require('bootstrap.native');
|
||||||
|
|
||||||
// use hasher for application page management
|
// use hasher for application page management
|
||||||
var hasher = require('hasher');
|
var hasher = require('hasher');
|
||||||
@@ -53,39 +53,126 @@ var beautify_xml = require('xml-beautifier');
|
|||||||
// sql-formatter library
|
// sql-formatter library
|
||||||
var beautify_sql = require('sql-formatter');
|
var beautify_sql = require('sql-formatter');
|
||||||
|
|
||||||
// crypto-js library
|
|
||||||
var CryptoJS = require('crypto-js');
|
|
||||||
|
|
||||||
// bcrypt-js library
|
// bcrypt-js library
|
||||||
var bcrypt = require('bcryptjs');
|
var bcrypt = require('bcryptjs');
|
||||||
|
|
||||||
var crypto = {
|
// forge library
|
||||||
MD5: function() {
|
var forge = require('node-forge');
|
||||||
return CryptoJS.MD5.apply(this, arguments).toString(CryptoJS.enc.Hex);
|
|
||||||
|
// gencryption
|
||||||
|
var gencryption = require("gencryption");
|
||||||
|
|
||||||
|
// whirlpool
|
||||||
|
var whirlpool = require("whirlpool");
|
||||||
|
|
||||||
|
var cryptoShim = {
|
||||||
|
shim: {
|
||||||
|
out: function (md) {
|
||||||
|
return md.digest().toHex();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
SHA1: function() {
|
/**
|
||||||
return CryptoJS.SHA1.apply(this, arguments).toString(CryptoJS.enc.Hex);
|
* MD(4|5) support
|
||||||
|
* @param type
|
||||||
|
* @param textIn
|
||||||
|
* @return {*}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
MD: function (type, textIn) {
|
||||||
|
switch (type) {
|
||||||
|
case 4:
|
||||||
|
type = "md4";
|
||||||
|
return gencryption.md4.getHashOfTextSync.apply(this, [textIn]);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
type = "md5";
|
||||||
|
return gencryption.md5.getHashOfTextSync.apply(this, [textIn]);
|
||||||
|
default:
|
||||||
|
throw new Error("Unable to parse MD " + type);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
SHA256: function() {
|
/**
|
||||||
return CryptoJS.SHA256.apply(this, arguments).toString(CryptoJS.enc.Hex);
|
* SHA(1|2|3|KE) support
|
||||||
|
* @param type
|
||||||
|
* @param bits
|
||||||
|
* @param textIn
|
||||||
|
* @param outputBitLength
|
||||||
|
* @return {*}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
SHA: function (type, bits, textIn, outputBitLength) {
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
return gencryption.sha1.getHashOfTextSync.apply(this, [textIn]);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return gencryption.sha2.getHashOfTextSync.apply(this, [bits, textIn]);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return gencryption.sha3.getHashOfTextSync.apply(this, [bits, textIn]);
|
||||||
|
break;
|
||||||
|
case "ke":
|
||||||
|
return gencryption.shake.getHashOfTextSync.apply(this, [bits, outputBitLength, textIn]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error("Unable to parse SHA " + type);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
SHA224: function() {
|
/**
|
||||||
return CryptoJS.SHA224.apply(this, arguments).toString(CryptoJS.enc.Hex);
|
* Keccak support
|
||||||
|
* @param bitSize [224, 256, 384, 512]
|
||||||
|
* @param stringIn
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
keccak: function (bitSize, stringIn) {
|
||||||
|
return gencryption.keccak.getHashOfTextSync.apply(this, [bitSize, stringIn]);
|
||||||
},
|
},
|
||||||
SHA512: function() {
|
/**
|
||||||
return CryptoJS.SHA512.apply(this, arguments).toString(CryptoJS.enc.Hex);
|
* Whirlpool support
|
||||||
|
* @param stringIn
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
whirlpool: function (stringIn) {
|
||||||
|
return whirlpool.apply(this, [stringIn]);
|
||||||
},
|
},
|
||||||
SHA384: function() {
|
/**
|
||||||
return CryptoJS.SHA384.apply(this, arguments).toString(CryptoJS.enc.Hex);
|
* RIPEMD[160] support
|
||||||
|
* @param length
|
||||||
|
* @param stringIn
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
RIPEMD: function (length, stringIn) {
|
||||||
|
if (length === 160) {
|
||||||
|
return gencryption.ripemd160.getHashOfTextSync.apply(this, [stringIn]);
|
||||||
|
} else {
|
||||||
|
return gencryption.ripemd.getHashOfTextSync.apply(this, [stringIn]);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
SHA3: function() {
|
/**
|
||||||
return CryptoJS.SHA3.apply(this, arguments).toString(CryptoJS.enc.Hex);
|
* DSS1 support
|
||||||
|
* @param stringIn
|
||||||
|
* @return {*}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
DSS1: function (stringIn) {
|
||||||
|
return gencryption.dss1.getHashOfTextSync.apply(this, [stringIn])
|
||||||
},
|
},
|
||||||
RIPEMD160: function() {
|
/**
|
||||||
return CryptoJS.RIPEMD160.apply(this, arguments).toString(CryptoJS.enc.Hex);
|
* MDC2 support
|
||||||
|
* @param stringIn
|
||||||
|
* @return {*}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
MDC2: function (stringIn) {
|
||||||
|
return gencryption.mdc2.getHashOfTextSync.apply(this, [stringIn]);
|
||||||
},
|
},
|
||||||
bcrypt: function(stringIn) {
|
/**
|
||||||
return bcrypt.hashSync(stringIn, 10);
|
* BCrypt support
|
||||||
|
* @param stringIn
|
||||||
|
* @return {string|?string}
|
||||||
|
*/
|
||||||
|
bcrypt: function (stringIn) {
|
||||||
|
return bcrypt.hashSync.apply(this, [stringIn, 10]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -139,13 +226,13 @@ var hashShim = {
|
|||||||
* Calls hasher.setHash()
|
* Calls hasher.setHash()
|
||||||
*/
|
*/
|
||||||
setHash: function (path) {
|
setHash: function (path) {
|
||||||
debug.type("setHash() in", arguments);
|
debug.type("setHash() in", JSON.stringify(arguments));
|
||||||
|
|
||||||
// arguments[0]; // = type
|
// arguments[0]; // = type
|
||||||
arguments[1] = btoa(arguments[1]); // = code
|
arguments[1] = btoa(arguments[1]); // = code
|
||||||
arguments[2] = typeof arguments[2] !== 'undefined' ? btoa(arguments[2]) : arguments[2]; // hash
|
arguments[2] = typeof arguments[2] !== 'undefined' ? btoa(arguments[2]) : arguments[2]; // hash
|
||||||
|
|
||||||
debug.type("setHash() out", arguments);
|
debug.type("setHash() out", JSON.stringify(arguments));
|
||||||
|
|
||||||
hasher.setHash.apply(this, arguments);
|
hasher.setHash.apply(this, arguments);
|
||||||
},
|
},
|
||||||
@@ -154,24 +241,216 @@ var hashShim = {
|
|||||||
* Calls hasher.replaceHash()
|
* Calls hasher.replaceHash()
|
||||||
*/
|
*/
|
||||||
replaceHash: function (path) {
|
replaceHash: function (path) {
|
||||||
debug.type("replaceHash() in", arguments);
|
debug.type("replaceHash() in", JSON.stringify(arguments));
|
||||||
|
|
||||||
// arguments[0]; // = type
|
// arguments[0]; // = type
|
||||||
arguments[1] = btoa(arguments[1]); // = code
|
arguments[1] = btoa(arguments[1]); // = code
|
||||||
arguments[2] = typeof arguments[2] !== 'undefined' ? btoa(arguments[2]) : arguments[2]; // hash
|
arguments[2] = typeof arguments[2] !== 'undefined' ? btoa(arguments[2]) : arguments[2]; // hash
|
||||||
|
|
||||||
debug.type("replaceHash() out", arguments);
|
debug.type("replaceHash() out", JSON.stringify(arguments));
|
||||||
|
|
||||||
hasher.replaceHash.apply(this, arguments);
|
hasher.replaceHash.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
_valid_tabs: [],
|
||||||
|
html: {
|
||||||
|
name: "HTML Linter",
|
||||||
|
text: "HTML"
|
||||||
|
},
|
||||||
|
json: {
|
||||||
|
name: "JSON Linter",
|
||||||
|
text: "JSON"
|
||||||
|
},
|
||||||
|
xml: {
|
||||||
|
name: "XML Linter",
|
||||||
|
text: "XML"
|
||||||
|
},
|
||||||
|
css: {
|
||||||
|
name: "CSS Linter",
|
||||||
|
text: "CSS"
|
||||||
|
},
|
||||||
|
js: {
|
||||||
|
name: "JS Linter",
|
||||||
|
text: "JS"
|
||||||
|
},
|
||||||
|
sql: {
|
||||||
|
name: "SQL Linter",
|
||||||
|
text: "SQL"
|
||||||
|
},
|
||||||
|
encode_decode: {
|
||||||
|
name: "Encode/Decode",
|
||||||
|
text: "Encode/Decode",
|
||||||
|
tabs: {
|
||||||
|
urlencode: {
|
||||||
|
name: "URL Encoder",
|
||||||
|
text: "URLEncode"
|
||||||
|
},
|
||||||
|
urldecode: {
|
||||||
|
name: "URL Decoder",
|
||||||
|
text: "URLDecode"
|
||||||
|
},
|
||||||
|
base64encode: {
|
||||||
|
name: "Base64 Encoder",
|
||||||
|
text: "Base64Encode"
|
||||||
|
},
|
||||||
|
base64decode: {
|
||||||
|
name: "Base64 Decoder",
|
||||||
|
text: "Base64Decode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hash_tools: {
|
||||||
|
name: "Hash Tools",
|
||||||
|
text: "Hash Tools",
|
||||||
|
tabs: {
|
||||||
|
md_hash: {
|
||||||
|
name: "MD Hasher",
|
||||||
|
text: "MD"
|
||||||
|
},
|
||||||
|
sha_hash: {
|
||||||
|
name: "SHA Hasher",
|
||||||
|
text: "SHA"
|
||||||
|
},
|
||||||
|
ripemd_hash: {
|
||||||
|
name: "RIPEMD Hasher",
|
||||||
|
text: "RIPEMD"
|
||||||
|
},
|
||||||
|
bcrypt_hash: {
|
||||||
|
name: "BCrypt Hasher",
|
||||||
|
text: "BCrypt"
|
||||||
|
},
|
||||||
|
keccak_hash: {
|
||||||
|
name: "Keccak Hasher",
|
||||||
|
text: "Keccak"
|
||||||
|
},
|
||||||
|
whirlpool_hash: {
|
||||||
|
name: "Whirlpool Hasher",
|
||||||
|
text: "Whirlpool"
|
||||||
|
},
|
||||||
|
dss1_hash: {
|
||||||
|
name: "DSS1 Hasher",
|
||||||
|
text: "DSS1"
|
||||||
|
},
|
||||||
|
mdc2_hash: {
|
||||||
|
name: "MDC2 Hasher",
|
||||||
|
text: "MDC2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
encryption_tools: {
|
||||||
|
name: "Encryption Tools",
|
||||||
|
text: "Encryption",
|
||||||
|
tabs: {
|
||||||
|
aes_enc: {
|
||||||
|
name: "AES Encryption",
|
||||||
|
text: "AES"
|
||||||
|
},
|
||||||
|
"3des_enc": {
|
||||||
|
name: "Triple DES Encryption",
|
||||||
|
text: "3-DES"
|
||||||
|
},
|
||||||
|
rc4_enc: {
|
||||||
|
name: "RC-4 Encryption",
|
||||||
|
text: "RC4"
|
||||||
|
},
|
||||||
|
rabbit_enc: {
|
||||||
|
name: "Rabbit Encryption",
|
||||||
|
text: "Rabbit"
|
||||||
|
},
|
||||||
|
evpkdf_enc: {
|
||||||
|
name: "Evpkdf Encryption",
|
||||||
|
text: "Evpkdf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var shim = {
|
||||||
|
/**
|
||||||
|
* Shim for d.gEBI();
|
||||||
|
* @param id
|
||||||
|
* @return {Element}
|
||||||
|
*/
|
||||||
|
element: function(id) {
|
||||||
|
if (id.substring(0, 1) === '#') {
|
||||||
|
id = id.substring(1);
|
||||||
|
}
|
||||||
|
return document.getElementById(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$('window').ready(function () {
|
$('window').ready(function () {
|
||||||
|
|
||||||
// main I/O
|
// main I/O
|
||||||
var input = $('#input');
|
var input = $('#input');
|
||||||
var output = $('#output');
|
var output = $('#output');
|
||||||
|
var navbar = $('#navbar').find('.nav');
|
||||||
|
|
||||||
|
Object.keys(config).forEach(function (key) {
|
||||||
|
if (key[0] === '_') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var listItemID = key + '_tab';
|
||||||
|
var linkID = key + '_link';
|
||||||
|
|
||||||
|
var listItem = $('<li />')
|
||||||
|
.attr('id', listItemID)
|
||||||
|
.attr('data-name', config[key].name)
|
||||||
|
.attr('data-function', key);
|
||||||
|
|
||||||
|
var link = $('<a />')
|
||||||
|
.attr('id', linkID)
|
||||||
|
.attr('href', '#')
|
||||||
|
.html(config[key].text)
|
||||||
|
.appendTo(listItem);
|
||||||
|
|
||||||
|
navbar.append(listItem);
|
||||||
|
|
||||||
|
if (config[key].hasOwnProperty('tabs')) {
|
||||||
|
|
||||||
|
var tabs = config[key].tabs;
|
||||||
|
|
||||||
|
listItem.addClass('dropdown');
|
||||||
|
|
||||||
|
link.addClass('dropdown-toggle')
|
||||||
|
.attr('role', 'button')
|
||||||
|
.attr('aria-expanded', 'false')
|
||||||
|
.attr('data-toggle', 'dropdown');
|
||||||
|
|
||||||
|
$('<span />')
|
||||||
|
.addClass('caret')
|
||||||
|
.appendTo(link);
|
||||||
|
|
||||||
|
var ul = $('<ul />')
|
||||||
|
.addClass('dropdown-menu')
|
||||||
|
.attr('role', 'menu');
|
||||||
|
|
||||||
|
Object.keys(tabs).forEach(function (k2) {
|
||||||
|
var id2 = k2 + '_tab';
|
||||||
|
|
||||||
|
var li = $('<li />')
|
||||||
|
.attr('id', id2)
|
||||||
|
.attr('data-extra-highlight', listItemID)
|
||||||
|
.attr('data-name', tabs[k2].name)
|
||||||
|
.attr('data-function', k2)
|
||||||
|
.appendTo(ul);
|
||||||
|
|
||||||
|
$('<a />')
|
||||||
|
.attr('href', '#')
|
||||||
|
.html(tabs[k2].text)
|
||||||
|
.appendTo(li);
|
||||||
|
|
||||||
|
});
|
||||||
|
listItem.append(ul);
|
||||||
|
|
||||||
|
new bsn.Dropdown(shim.element(linkID), {persist: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hasher page changer function
|
* hasher page changer function
|
||||||
@@ -180,55 +459,53 @@ $('window').ready(function () {
|
|||||||
*/
|
*/
|
||||||
var changeType = function (type, setHash) {
|
var changeType = function (type, setHash) {
|
||||||
setHash = typeof setHash !== 'boolean' ? true : setHash;
|
setHash = typeof setHash !== 'boolean' ? true : setHash;
|
||||||
debug.type('changeType()', 'setHash: ' + (setHash ? 'true' : 'false'));
|
debug.type('changeType()', 'Start: ' + type + ' | setHash: ' + (setHash ? 'true' : 'false'));
|
||||||
|
|
||||||
var hash = hashShim.getHash();
|
var hash = hashShim.getHash();
|
||||||
|
|
||||||
switch (type) {
|
var exists = false;
|
||||||
case 'html':
|
|
||||||
case 'xml':
|
|
||||||
case 'json':
|
|
||||||
case 'js':
|
|
||||||
case 'css':
|
|
||||||
case 'sql':
|
|
||||||
case 'urlencode':
|
|
||||||
case 'urldecode':
|
|
||||||
case 'base64encode':
|
|
||||||
case 'base64decode':
|
|
||||||
case 'md5_hash':
|
|
||||||
case 'sha1_hash':
|
|
||||||
case 'sha256_hash':
|
|
||||||
case 'sha224_hash':
|
|
||||||
case 'sha512_hash':
|
|
||||||
case 'sha384_hash':
|
|
||||||
case 'sha3_hash':
|
|
||||||
case 'ripemd160_hash':
|
|
||||||
case 'bcrypt_hash':
|
|
||||||
debug.type('changeType()', 'type: ' + type);
|
|
||||||
|
|
||||||
$('#navbar').find('.active').removeClass('active');
|
for (var key in config) {
|
||||||
var tab = $('#' + type + '_tab');
|
if (config.hasOwnProperty(type)) {
|
||||||
tab.addClass('active');
|
exists = true;
|
||||||
|
|
||||||
if (tab.data('extra-highlight') !== '') {
|
|
||||||
$('#' + tab.data('extra-highlight')).addClass('active');
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#header').text(tab.data('name'));
|
|
||||||
|
|
||||||
if (setHash) {
|
|
||||||
debug.type('changeType()', 'Calling hasher.sethash with {' + type + '} : {' + hash.code + '}');
|
|
||||||
hashShim.setHash(type, hash.code);
|
|
||||||
} else {
|
|
||||||
debug.type('changeType()', 'Not calling hasher.sethash');
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
else if (config[key].hasOwnProperty('tabs') && config[key].tabs.hasOwnProperty(type)) {
|
||||||
debug.type('changeType()', 'Default Case: Calling hasher.sethash with {html} : {' + hash.code + '}');
|
exists = true;
|
||||||
hashShim.setHash('html', hash.code);
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!exists) {
|
||||||
|
debug.type('changeType()', 'Default Case: Calling hasher.sethash with {html} : {' + hash.code + '}');
|
||||||
|
hashShim.setHash('html', hash.code);
|
||||||
|
debug.type('changeType()', '----------End----------');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug.type('changeType()', 'type: ' + type);
|
||||||
|
|
||||||
|
// de-highlight currently highlighted tab
|
||||||
|
navbar.find('.active').removeClass('active');
|
||||||
|
|
||||||
|
// add highlighting to active tab
|
||||||
|
var tab = $('#' + type + '_tab');
|
||||||
|
tab.addClass('active');
|
||||||
|
|
||||||
|
// if it's a sub tab this will be populated
|
||||||
|
if (tab.data('extra-highlight') !== '') {
|
||||||
|
$('#' + tab.data('extra-highlight')).addClass('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#header').text(tab.data('name'));
|
||||||
|
|
||||||
|
if (setHash) {
|
||||||
|
debug.type('changeType()', 'Calling hasher.sethash with {' + type + '} : {' + hash.code + '}');
|
||||||
|
hashShim.setHash(type, hash.code);
|
||||||
|
} else {
|
||||||
|
debug.type('changeType()', 'Not calling hasher.sethash');
|
||||||
|
}
|
||||||
|
|
||||||
|
debug.type('changeType()', '----------End----------');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -266,6 +543,7 @@ $('window').ready(function () {
|
|||||||
case 'sql':
|
case 'sql':
|
||||||
stringOut = hljs.highlight('sql', beautify_sql.format(code), true).value;
|
stringOut = hljs.highlight('sql', beautify_sql.format(code), true).value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'urlencode':
|
case 'urlencode':
|
||||||
stringOut = hljs.highlight('yaml', encodeURIComponent(code), true).value;
|
stringOut = hljs.highlight('yaml', encodeURIComponent(code), true).value;
|
||||||
break;
|
break;
|
||||||
@@ -278,32 +556,30 @@ $('window').ready(function () {
|
|||||||
case 'base64decode':
|
case 'base64decode':
|
||||||
stringOut = hljs.highlight('yaml', atob(code), true).value;
|
stringOut = hljs.highlight('yaml', atob(code), true).value;
|
||||||
break;
|
break;
|
||||||
case 'md5_hash':
|
|
||||||
stringOut = hljs.highlight('yaml', crypto.MD5(code), true).value;
|
case 'md_hash':
|
||||||
|
stringOut = hljs.highlight('yaml', cryptoShim.MD(5, code), true).value;
|
||||||
break;
|
break;
|
||||||
case 'sha1_hash':
|
case 'sha_hash':
|
||||||
stringOut = hljs.highlight('yaml', crypto.SHA1(code), true).value;
|
stringOut = hljs.highlight('yaml', cryptoShim.SHA(1, null, code, null), true).value;
|
||||||
break;
|
break;
|
||||||
case 'sha256_hash':
|
case 'ripemd_hash':
|
||||||
stringOut = hljs.highlight('yaml', crypto.SHA256(code), true).value;
|
stringOut = hljs.highlight('yaml', cryptoShim.RIPEMD(160, code), true).value;
|
||||||
break;
|
break;
|
||||||
case 'sha224_hash':
|
case 'keccak_hash':
|
||||||
stringOut = hljs.highlight('yaml', crypto.SHA224(code), true).value;
|
stringOut = hljs.highlight('yaml', cryptoShim.keccak(512, code), true).value;
|
||||||
break;
|
break;
|
||||||
case 'sha512_hash':
|
case 'whirlpool_hash':
|
||||||
stringOut = hljs.highlight('yaml', crypto.SHA512(code), true).value;
|
stringOut = hljs.highlight('yaml', cryptoShim.whirlpool(code), true).value;
|
||||||
break;
|
break;
|
||||||
case 'sha384_hash':
|
case 'dss1_hash':
|
||||||
stringOut = hljs.highlight('yaml', crypto.SHA384(code), true).value;
|
stringOut = hljs.highlight('yaml', cryptoShim.DSS1(code), true).value;
|
||||||
break;
|
break;
|
||||||
case 'sha3_hash':
|
case 'mdc2_hash':
|
||||||
stringOut = hljs.highlight('yaml', crypto.SHA3(code), true).value;
|
stringOut = hljs.highlight('yaml', cryptoShim.MDC2(code), true).value;
|
||||||
break;
|
|
||||||
case 'ripemd160_hash':
|
|
||||||
stringOut = hljs.highlight('yaml', crypto.RIPEMD160(code), true).value;
|
|
||||||
break;
|
break;
|
||||||
case 'bcrypt_hash':
|
case 'bcrypt_hash':
|
||||||
stringOut = hljs.highlight('yaml', crypto.bcrypt(code), true).value;
|
stringOut = hljs.highlight('yaml', cryptoShim.bcrypt(code), true).value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -342,14 +618,21 @@ $('window').ready(function () {
|
|||||||
hasher.init();
|
hasher.init();
|
||||||
|
|
||||||
// hook into the navbar tabs and use hasher for them
|
// hook into the navbar tabs and use hasher for them
|
||||||
var navbar = $('#navbar');
|
navbar.find('li:not(.dropdown)').click(function (e) {
|
||||||
navbar.find('>ul>li:not(.dropdown)').click(function (e) {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
changeType(this.id.replace('_tab', ''));
|
var t = $(this);
|
||||||
|
var func = t.data('function');
|
||||||
|
var dbinfo = {
|
||||||
|
id: t.attr('id'),
|
||||||
|
func: t.data('function')
|
||||||
|
};
|
||||||
|
debug.type('navbar.find()', 'fired! ' + JSON.stringify(dbinfo));
|
||||||
|
changeType(func);
|
||||||
});
|
});
|
||||||
navbar.find('.dropdown>ul>li').click(function (e) {
|
|
||||||
|
$(".navbar-brand").click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
changeType(this.id.replace('_tab', ''));
|
changeType('html');
|
||||||
});
|
});
|
||||||
|
|
||||||
// function main ()
|
// function main ()
|
||||||
|
|||||||
Reference in new issue
Block a user