initial commit
This commit is contained in:
commit
366072673c
187
accessData.html
Normal file
187
accessData.html
Normal file
@ -0,0 +1,187 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>jsCrypt Analytics</title>
|
||||
<script src="https://d26b395fwzu5fz.cloudfront.net/3.4.1/keen.min.js" type="text/javascript"></script>
|
||||
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
|
||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-aNUYGqSUL9wG/vP7+cWZ5QOM4gsQou3sBfWRr/8S3R1Lv0rysEmnwsRKMbhiQX/O" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<center><h1>jsCrypt Analytics</h1></center>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-9" id="c1">Loading...</div>
|
||||
<div class="col-md-3" id="c2"></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-3" id="c3"></div>
|
||||
<div class="col-md-3" id="c4"></div>
|
||||
<div class="col-md-3" id="c5"></div>
|
||||
<div class="col-md-3" id="c6"></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-2" id="c7"></div>
|
||||
<div class="col-md-2" id="c11"></div>
|
||||
<div class="col-md-8" id="c8"></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="c9"></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-6" id="c10"></div>
|
||||
<div class="col-md-2" id="c12"></div>
|
||||
<div class="col-md-2" id="c13"></div>
|
||||
<div class="col-md-2" id="c14"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var x = new Keen({
|
||||
projectId: "572defc807271937a30dfa34",
|
||||
writeKey: "519d6a7e6b8a069a4103b318bfa8635cb0ec6cef0f0726ba1b44856d8d6ebabe93d99b825c319e53e24f18c4f3f1f78ba5e0d5bf74400ad4713a3c686da80848b78c1ff53d1080c5ddb6d9225ccd211228adbf9e82c6b8ab9a2dc3c1557e776f",
|
||||
readKey: "c9d13a44462aac096546d82e70ddbae6e033078e72acc8088704efcdff0a54a46f2efb6a0b7adc1c855d0d2589c89697650e1c9bc75aacfad5e9723748e0a5ce3f49a2b8b75bd74ef392cd4012836e730270382d46ffb94ae55b918b10dc5b83"
|
||||
});
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
interval: "hourly",
|
||||
timeframe: "this_12_hours"
|
||||
});
|
||||
x.run(data, function(err, res){
|
||||
if (err) {
|
||||
alert(err);
|
||||
} else {
|
||||
console.log("connection successfull");
|
||||
}
|
||||
});
|
||||
x.draw(data, document.getElementById("c1"), {
|
||||
chartType: "areachart",
|
||||
title: "runs in last 12 hours"
|
||||
});
|
||||
//----------
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
//interval: "hourly",
|
||||
timeframe: "this_12_hours"
|
||||
});
|
||||
x.draw(data, document.getElementById("c2"), {
|
||||
//chartType: "areachart",
|
||||
title: "runs in last 12 hours Total"
|
||||
});
|
||||
//----------
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
//interval: "hourly",
|
||||
timeframe: "this_24_hours"
|
||||
});
|
||||
x.draw(data, document.getElementById("c3"), {
|
||||
//chartType: "areachart",
|
||||
title: "runs in last 24 hours Total"
|
||||
});
|
||||
//----------
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
//interval: "hourly",
|
||||
timeframe: "this_1_hours"
|
||||
});
|
||||
x.draw(data, document.getElementById("c4"), {
|
||||
//chartType: "areachart",
|
||||
title: "runs in last 1 hours Total"
|
||||
});
|
||||
//----------
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
//interval: "hourly",
|
||||
timeframe: "this_10_minutes"
|
||||
});
|
||||
x.draw(data, document.getElementById("c5"), {
|
||||
//chartType: "areachart",
|
||||
title: "runs in last 10 minutes Total"
|
||||
});
|
||||
//----------
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
//interval: "hourly",
|
||||
timeframe: "this_1_minutes"
|
||||
});
|
||||
x.draw(data, document.getElementById("c6"), {
|
||||
//chartType: "areachart",
|
||||
title: "runs in last 1 minutes Total"
|
||||
});
|
||||
//----------
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
//interval: "hourly",
|
||||
timeframe: "this_1_years"
|
||||
});
|
||||
x.draw(data, document.getElementById("c7"), {
|
||||
//chartType: "areachart",
|
||||
title: "runs in this year Total"
|
||||
});
|
||||
//----------
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
interval: "monthly",
|
||||
timeframe: "this_1_years"
|
||||
});
|
||||
x.draw(data, document.getElementById("c8"), {
|
||||
chartType: "areachart",
|
||||
title: "runs in this year"
|
||||
});
|
||||
//----------
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
groupBy: "url",
|
||||
timeframe: "this_1_years"
|
||||
});
|
||||
x.draw(data, document.getElementById("c9"), {
|
||||
title: "different URLs (1 year)",
|
||||
chartType: "columnchart",
|
||||
chartOptions: {
|
||||
isStacked: true
|
||||
}
|
||||
});
|
||||
//---
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
groupBy: "user_agent",
|
||||
timeframe: "this_1_years"
|
||||
});
|
||||
x.draw(data, document.getElementById("c10"), {
|
||||
title: "different IPs (1 year)",
|
||||
});
|
||||
//---
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
timeframe: "this_1_month"
|
||||
});
|
||||
x.draw(data, document.getElementById("c12"), {
|
||||
title: "runs in this month Total",
|
||||
});
|
||||
//---
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
timeframe: "last_1_month"
|
||||
});
|
||||
x.draw(data, document.getElementById("c13"), {
|
||||
title: "runs in last month Total",
|
||||
});
|
||||
//---
|
||||
var data = new Keen.Query("count", {
|
||||
event_collection: "jsRun",
|
||||
groupBy: "ip_address",
|
||||
timeframe: "this_1_year"
|
||||
});
|
||||
x.draw(data, document.getElementById("c14"), {
|
||||
title: "User Agent (1 year)",
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
29
css/style.css
Normal file
29
css/style.css
Normal file
@ -0,0 +1,29 @@
|
||||
#settings {
|
||||
border: 5px;
|
||||
border-color: black;
|
||||
}
|
||||
img {
|
||||
position: relatve;
|
||||
}
|
||||
header {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
#hTitle {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
top: 0rem;
|
||||
|
||||
color: white;
|
||||
font-size: 7rem;
|
||||
}
|
||||
#settingsP {
|
||||
font-size: 1em;
|
||||
}
|
||||
#resizeH5 {
|
||||
text-align: right;
|
||||
padding-right: 2rem;
|
||||
}
|
||||
.right {
|
||||
padding-right: 0px;
|
||||
}
|
BIN
header.jpg
Normal file
BIN
header.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 166 KiB |
201
index.html
Normal file
201
index.html
Normal file
@ -0,0 +1,201 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>jsCrypt</title>
|
||||
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
|
||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-aNUYGqSUL9wG/vP7+cWZ5QOM4gsQou3sBfWRr/8S3R1Lv0rysEmnwsRKMbhiQX/O" crossorigin="anonymous">
|
||||
<link href="css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<img src="header.jpg" width="100%">
|
||||
<div id="divTitle"><h1 id="hTitle">JS-Cryptifier</h1></div>
|
||||
</header>
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
|
||||
<span>Done</span>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<h3 id="title" name="code"><i class="fa fa-code" aria-hidden="true"></i> | Enter Source:</h3>
|
||||
<div class="jumbotron">
|
||||
<center>
|
||||
<textarea id="code" rows="6" cols="30"></textarea>
|
||||
</center>
|
||||
<h5 id="resizeH5"><i class="fa fa-arrows" aria-hidden="true"></i> | Rezise me!</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div id="controlls">
|
||||
<h3><i class="fa fa-play" aria-hidden="true"></i> Controlls:</h3>
|
||||
<div class="jumbotron">
|
||||
<div class="btn-group-vertical" role="group" id="cryptBtns">
|
||||
<button class="btn btn-success btn-lg" id="run"onclick="run();"><i class="fa fa-lock" aria-hidden="true"></i> Cryptify</button>
|
||||
<button class="btn btn-primary btn-lg" id="run"onclick="runPassCrypt();"><i class="fa fa-key" aria-hidden="true"></i> PasswordCrypt</button>
|
||||
<button class="btn btn-lg" id="run" href="#code" onclick="document.getElementById('code').value = packify(document.getElementById('code').value); window.scrollTo(0,0);"><i class="fa fa-compress" aria-hidden="true"></i> Minimize [WIP]</button>
|
||||
<button class="btn btn-danger btn-lg" id="run" href="#code" onclick="jsUnCrypt(); window.scrollTo(0,0);"><i class="fa fa-unlock" aria-hidden="true"></i> unCryptify</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="divOut"></p>
|
||||
<ul class="nav nav-tabs">
|
||||
<hr>
|
||||
<li role="presentation" id="navInfo" class="active"><a onclick="$('#info').slideDown(500);$('#calcSize').slideUp(500);$('#settings').slideUp(500);document.getElementById('navCalc').className='';document.getElementById('navSettings').className='';document.getElementById('navInfo').className='active';"</li><h4><i class="fa fa-info" aria-hidden="true"></i> | Info</h4></a></li>
|
||||
<li role="presentation" id="navCalc"><a onclick="$('#info').slideUp(500);$('#calcSize').slideUp(500);$('#settings').slideDown(500);document.getElementById('navCalc').className='active';document.getElementById('navSettings').className='';document.getElementById('navInfo').className='';"><h4><i class="fa fa-cogs" aria-hidden="true"></i> | Settings</h4></a></li>
|
||||
<li role="presentation" id="navSettings"><a onclick="$('#info').slideUp(500);$('#calcSize').slideDown(500);$('#settings').slideUp(500);document.getElementById('navSettings').className='active';document.getElementById('navCalc').className='';document.getElementById('navInfo').className='';"><h4><i class="fa fa-calculator" aria-hidden="true"></i> | Estimated File-Size</h4></a></li>
|
||||
</ul>
|
||||
<div id="info">
|
||||
<div class="jumbotron">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item"><span class="label label-success">Cryptify</span> | Obfuscates, Packes, Encodes, Encrypts and Uglyficates the js-Code with advanced anti-reverse-engineering functions, self hashing algorithms, emulation prevention and DOM-persistance.</li>
|
||||
<li class="list-group-item"><span class="label label-primary">PasswordCrypt</span> | Encrypts js-Code with external Password. Password gets requested at run of code. Usefull for permission management.</li>
|
||||
<li class="list-group-item"><span class="label label-info">Minimize</span> | Creates self decompressing packed and minified Code with zip-like compression algorythms.</li>
|
||||
<li class="list-group-item"><span class="label label-warning">UnCryptify</span> | Deobfuscates and decryptifies obfuscated JS-Code. Works for many free obfuscators (not for this one...)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="settings">
|
||||
<div class="jumbotron">
|
||||
|
||||
<h4>All Settings only affect the 'Cryptify'-Funktion!</h4>
|
||||
<hr>
|
||||
<label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
<input type="checkbox" id="unreadable">
|
||||
</span>
|
||||
<p class="form-control" id="settingsP">CryptonIon-Engine</p>
|
||||
<span class="input-group-addon">
|
||||
Size: +1,190,000 chars
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
<label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
CryptonIon-Engine
|
||||
</span>
|
||||
<span class="form-control">
|
||||
No normal Chars in Output. Output look similar to JSFuck Output.
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
<hr>
|
||||
|
||||
<label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
<input type="checkbox" id="buffer">
|
||||
</span>
|
||||
<p class="form-control" id="settingsP">Front-End Buffer</p>
|
||||
<span class="input-group-addon">
|
||||
Size: +56,000 chars
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
<label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
Front-End Buffer
|
||||
</span>
|
||||
<span class="form-control">
|
||||
Hiddes Internal Funktions/Vars. Best together with CryptoIon-Engine.
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
<hr>
|
||||
|
||||
<label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
<input type="checkbox" id="emulatePrev">
|
||||
</span>
|
||||
<p class="form-control" id="settingsP">EmulationPrev</p>
|
||||
<span class="input-group-addon">
|
||||
Size: +1750 chars
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
<label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
EmulationPrev
|
||||
</span>
|
||||
<span class="form-control">
|
||||
If enabled Code cannot run on localhost, only on registred domain!
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
<hr>
|
||||
|
||||
<label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
<input type="checkbox" id="hackerMsg">
|
||||
</span>
|
||||
<p class="form-control" id="settingsP">Msg to Hacker</p>
|
||||
<span class="input-group-addon" id="hackerMsgChars">
|
||||
Size: +46 chars
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
<label>
|
||||
<div class="input-group">
|
||||
<p class="input-group-addon" id="settingsP">Edit the Msg to Hacker:</p>
|
||||
<input type="text" class="form-control" id="hackerMsgTxt" value="Uncaught ReferenceError: noiqndq is not defined(...)">
|
||||
<p class="input-group-addon" id="settingsP">Please edit the Text.</p>
|
||||
</div>
|
||||
</label>
|
||||
<label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
Msg To Hacker
|
||||
</span>
|
||||
<span class="form-control">
|
||||
Output if Hacker tries to pipe input to eval into console.log(). Default is good. Trust me.
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="calcSize">
|
||||
<div class="jumbotron">
|
||||
<p>Cryptifying can take a long time.<br>Thats why you can calc the estimated Size after Crypting here:</p>
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Char-Count of Input: </td>
|
||||
<td id="cCharsBefore"></td>
|
||||
<td id="xCharsBefore"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Chars after minimizing: </td>
|
||||
<td id="cCharsPackify"></td>
|
||||
<td id="xCharsPackify"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Chars after Crypting with current Settings: </td>
|
||||
<td id="cCharsCurSettings"></td>
|
||||
<td id="xCharsCurSettings"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button class="btn btn-d" id="btnCalc" onclick="calc()"><i class="fa fa-calculator" aria-hidden="true"></i> Calculate!</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
</div>
|
||||
<h4 id="endH4">While cryptifying site may become inoperatable and look like it has crashed, but if the Browser does not tell you that this Site is crashed, she isn't!</h4>
|
||||
</body>
|
||||
<script src="js/jsCrypt.js"></script>
|
||||
<div id="key" class="12345"></div>
|
||||
</div>
|
||||
</html>
|
839
js/jsCrypt.js
Normal file
839
js/jsCrypt.js
Normal file
File diff suppressed because one or more lines are too long
259
js/jsCryptNode.js
Normal file
259
js/jsCryptNode.js
Normal file
File diff suppressed because one or more lines are too long
162
js/jsUnCrypt.js
Normal file
162
js/jsUnCrypt.js
Normal file
@ -0,0 +1,162 @@
|
||||
function packify( input ) {
|
||||
var script = input,
|
||||
len,
|
||||
i,
|
||||
chunk,
|
||||
chunk_size,
|
||||
re,
|
||||
matches,
|
||||
savings,
|
||||
|
||||
potential,
|
||||
potentials = {},
|
||||
potentials_arr = [],
|
||||
|
||||
map = '',
|
||||
char_code,
|
||||
char,
|
||||
output;
|
||||
|
||||
// Single quotes need to be escaped, so use double-quotes in your input
|
||||
// source whenever possible.
|
||||
script = script.replace( /'/g, "\\'" );
|
||||
|
||||
// Replace any non-space whitespace with spaces (shouldn't be necessary).
|
||||
script = script.replace( /\s+/g, ' ' );
|
||||
|
||||
// Return number of chars saved by replacing `count` occurences of `string`.
|
||||
function get_savings( string, count ) {
|
||||
return ( string.length - 1 ) * ( count - 1 ) - 2;
|
||||
};
|
||||
|
||||
// Just trying to keep things DRY here... Let's match some patterns!
|
||||
function get_re_match( pattern, text ) {
|
||||
var re = RegExp( pattern.replace( /(\W)/g, '\\$1' ), 'g' );
|
||||
return [
|
||||
text.match( re ) || [],
|
||||
re
|
||||
];
|
||||
};
|
||||
|
||||
// Look for recurring patterns between 2 and 20 characters in length (could
|
||||
// have been between 2 and len / 2, but that gets REALLY slow).
|
||||
for ( chunk_size = 2, len = script.length; chunk_size <= 20; chunk_size++ ) {
|
||||
|
||||
// Start at the beginning of the input string, go to the end.
|
||||
for ( i = 0; i < len - chunk_size; i++ ) {
|
||||
|
||||
// Grab the "chunk" at the current position.
|
||||
chunk = script.substr( i, chunk_size );
|
||||
|
||||
if ( !potentials[ chunk ] ) {
|
||||
// Find the number of chunk matches in the input script.
|
||||
matches = get_re_match( chunk, script )[0];
|
||||
|
||||
// If any matches, save this chunk as a potential pattern. By using an
|
||||
// object instead of an array, we don't have to worry about uniquing
|
||||
// the array as new potentials will just overwrite previous potentials.
|
||||
if ( get_savings( chunk, matches.length ) >= 0 ) {
|
||||
potentials[ chunk ] = matches.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Since we'll need to sort the potentials, create an array from the object.
|
||||
for ( i in potentials ) {
|
||||
potentials.hasOwnProperty( i )
|
||||
&& potentials_arr.push({ pattern: i, count: potentials[ i ] });
|
||||
}
|
||||
|
||||
// Potentials get sorted first by byte savings, then by # of occurrences
|
||||
// (favoring smaller count, longer patterns), then lexicographically.
|
||||
function sort_potentials( a, b ) {
|
||||
return get_savings( b.pattern, b.count ) - get_savings( a.pattern, a.count )
|
||||
|| a.count - b.count
|
||||
|| ( a.pattern < b.pattern ? -1 : a.pattern > b.pattern ? 1 : 0 );
|
||||
};
|
||||
|
||||
// Loop over all the potential patterns, unless we run out of replacement
|
||||
// chars first. Dealing with 7-bit ASCII, valid replacement chars are 1-31
|
||||
// & 127 (excluding ASCII 10 & 13).
|
||||
for ( char_code = 0; potentials_arr.length && char_code < 127; ) {
|
||||
|
||||
// Re-calculate match counts.
|
||||
for ( i = 0, len = potentials_arr.length; i < len; i++ ) {
|
||||
potential = potentials_arr[i];
|
||||
matches = get_re_match( potential.pattern, script )[0];
|
||||
potential.count = matches.length;
|
||||
}
|
||||
|
||||
// Sort the array of potentials such that replacements that will yield the
|
||||
// highest byte savings come first.
|
||||
potentials_arr.sort( sort_potentials );
|
||||
|
||||
// Get the current best potential replacement.
|
||||
potential = potentials_arr.shift();
|
||||
|
||||
// Find all chunk matches in the input string.
|
||||
chunk = potential.pattern;
|
||||
matches = get_re_match( chunk, script );
|
||||
re = matches[1];
|
||||
matches = matches[0];
|
||||
|
||||
// Ensure that replacing this potential pattern still actually saves bytes.
|
||||
savings = get_savings( chunk, matches.length );
|
||||
if ( savings >= 0 ) {
|
||||
|
||||
// Increment the current replacement character.
|
||||
char_code = ++char_code == 10 ? 11
|
||||
: char_code == 13 ? 14
|
||||
: char_code == 32 ? 127
|
||||
: char_code;
|
||||
|
||||
// Get the replacement char.
|
||||
char = String.fromCharCode( char_code );
|
||||
|
||||
//console.log( char_code, char, matches.length, chunk, savings );
|
||||
|
||||
// Replace the pattern with the replacement character.
|
||||
script = script.replace( re, char );
|
||||
|
||||
// Add the char + pattern combo into the map of replacements.
|
||||
map += char + chunk;
|
||||
}
|
||||
}
|
||||
|
||||
// For each group of 1 low ASCII char / 1+ regular ASCII chars combo in the
|
||||
// map string, replace the low ASCII char in the script string with the
|
||||
// remaining regular ASCII chars, then eval the script string. Using with in
|
||||
// this manner ensures that the temporary _ var won't be leaked.
|
||||
output = ""
|
||||
+ "with({_:'" + script + "'})"
|
||||
+ "'" + map + "'.replace(/.([ -~]+)/g,function(x,y){"
|
||||
+ "_=_.replace(RegExp(x[0],'g'),y)"
|
||||
+ "}),"
|
||||
+ "eval(_)";
|
||||
|
||||
if ( eval( output.replace( 'eval(_)', '_' ) ) === input ) {
|
||||
// If the output *actually* evals to the input string, packing was
|
||||
// successful. Log some useful stats and return the output.
|
||||
|
||||
return output;
|
||||
|
||||
} else {
|
||||
// Otherwise, exit with an error.
|
||||
console.log( 'Error!' );
|
||||
return input;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function jsUnCrypt(code) {
|
||||
while(code.search("eval")||code.search("document.write")) {
|
||||
if (code.search("eval") {
|
||||
code = code.replace("eval","code=");
|
||||
} else if (code.search("document.write")) {
|
||||
code = code.replace("eval","code=");
|
||||
}
|
||||
code = eval("code");
|
||||
}
|
||||
alert("code");
|
||||
}
|
38
js/test.js
Normal file
38
js/test.js
Normal file
@ -0,0 +1,38 @@
|
||||
<!--
|
||||
test.js
|
||||
|
||||
Copyright 2016 Dodox <Dodox@LAPTOP-QTGU1A3S>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
|
||||
|
||||
-->
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<title>unbenannt</title>
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="Geany 1.27" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
13
test.html
Normal file
13
test.html
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test</title>
|
||||
<script src="test.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='key' class='19426583'></div>
|
||||
<img src="https://api.keen.io/3.0/projects/572de881383144319424c1d8/events/email_opened?api_key=e4a738703a7aa6ffd6b374cca4a785b5aa9d84b13c208ee97c324544d6420af8b2beda6284fd6e94f4bddd4ab58e86a0369474a45a3258ebfad35ffff4e37f1bc5c4dc33d52454f654adb3b8b29f3a94e84053bf0b291e45d90e77e08a7ea838&data=eyJpcF9hZGRyZXNzIjoiJHtrZWVuLmlwfSIsInVzZXJfYWdlbnQiOiIke2tlZW4udXNlcl9hZ2VudH0ifQ=="></img>
|
||||
<button onclick="run()">Run!</button>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user