Initial pages commit

This commit is contained in:
n1474335 2016-11-28 11:01:54 +00:00
parent b1d73a725d
commit 56dbb3fa40
376 changed files with 252899 additions and 88317 deletions

446
docs/core_Recipe.js.html Executable file
View file

@ -0,0 +1,446 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>CyberChef Source: core/Recipe.js</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top navbar-inverse">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html"><img class="branding-logo" src="../build/prod/images/cyberchef-32x32.png"
alt="logo"/>CyberChef</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a>
<ul class="dropdown-menu inline">
<li><a href="FlowControl.html">FlowControl</a></li><li><a href="Utils.html">Utils</a></li><li><a href="Base.html">Base</a></li><li><a href="Base64.html">Base64</a></li><li><a href="BitwiseOp.html">BitwiseOp</a></li><li><a href="ByteRepr.html">ByteRepr</a></li><li><a href="CharEnc.html">CharEnc</a></li><li><a href="Checksum.html">Checksum</a></li><li><a href="Cipher.html">Cipher</a></li><li><a href="Code.html">Code</a></li><li><a href="Compress.html">Compress</a></li><li><a href="Convert.html">Convert</a></li><li><a href="DateTime.html">DateTime</a></li><li><a href="Endian.html">Endian</a></li><li><a href="Entropy.html">Entropy</a></li><li><a href="Extract.html">Extract</a></li><li><a href="FileType.html">FileType</a></li><li><a href="HTML.html">HTML</a></li><li><a href="HTTP.html">HTTP</a></li><li><a href="Hash.html">Hash</a></li><li><a href="Hexdump.html">Hexdump</a></li><li><a href="IP.html">IP</a></li><li><a href="JS.html">JS</a></li><li><a href="MAC.html">MAC</a></li><li><a href="Numberwang.html">Numberwang</a></li><li><a href="OS.html">OS</a></li><li><a href="PublicKey.html">PublicKey</a></li><li><a href="Punycode.html">Punycode</a></li><li><a href="QuotedPrintable.html">QuotedPrintable</a></li><li><a href="Rotate.html">Rotate</a></li><li><a href="SeqUtils.html">SeqUtils</a></li><li><a href="StrUtils.html">StrUtils</a></li><li><a href="Tidy.html">Tidy</a></li><li><a href="URL_.html">URL_</a></li><li><a href="UUID.html">UUID</a></li><li><a href="Unicode.html">Unicode</a></li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
<ul class="dropdown-menu inline">
<li><a href="Chef.html">Chef</a></li><li><a href="Dish.html">Dish</a></li><li><a href="Ingredient.html">Ingredient</a></li><li><a href="Operation.html">Operation</a></li><li><a href="Recipe.html">Recipe</a></li><li><a href="ControlsWaiter.html">ControlsWaiter</a></li><li><a href="HTMLApp.html">HTMLApp</a></li><li><a href="HTMLCategory.html">HTMLCategory</a></li><li><a href="HTMLIngredient.html">HTMLIngredient</a></li><li><a href="HTMLOperation.html">HTMLOperation</a></li><li><a href="HighlighterWaiter.html">HighlighterWaiter</a></li><li><a href="InputWaiter.html">InputWaiter</a></li><li><a href="Manager.html">Manager</a></li><li><a href="OperationsWaiter.html">OperationsWaiter</a></li><li><a href="OptionsWaiter.html">OptionsWaiter</a></li><li><a href="OutputWaiter.html">OutputWaiter</a></li><li><a href="RecipeWaiter.html">RecipeWaiter</a></li><li><a href="SeasonalWaiter.html">SeasonalWaiter</a></li><li><a href="WindowWaiter.html">WindowWaiter</a></li>
</ul>
</li>
<li class="dropdown">
<a href="events.list.html" class="dropdown-toggle" data-toggle="dropdown">Events<b class="caret"></b></a>
<ul class="dropdown-menu inline">
<li><a href="Manager.html#event:appstart">Manager#event:appstart</a></li><li><a href="Manager.html#event:operationadd">Manager#event:operationadd</a></li><li><a href="Manager.html#event:operationremove">Manager#event:operationremove</a></li><li><a href="Manager.html#event:oplistcreate">Manager#event:oplistcreate</a></li><li><a href="Manager.html#event:statechange">Manager#event:statechange</a></li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu inline">
<li><a href="global.html#Categories">Categories</a></li><li><a href="global.html#OperationConfig">OperationConfig</a></li><li><a href="global.html#main">main</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content">
<div class="row">
<div class="col-md-12">
<div id="main">
<h1 class="page-title">Source: core/Recipe.js</h1>
<section>
<article>
<pre
class="sunlight-highlight-javascript linenums">/**
* The Recipe controls a list of Operations and the Dish they operate on.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*
* @class
* @param {Object} recipe_config
*/
var Recipe = function(recipe_config) {
this.op_list = [];
if (recipe_config) {
this._parse_config(recipe_config);
}
};
/**
* Reads and parses the given config.
*
* @private
* @param {Object} recipe_config
*/
Recipe.prototype._parse_config = function(recipe_config) {
for (var c = 0; c &lt; recipe_config.length; c++) {
var operation_name = recipe_config[c].op;
var operation_config = OperationConfig[operation_name];
var operation = new Operation(operation_name, operation_config);
operation.set_ing_values(recipe_config[c].args);
operation.set_breakpoint(recipe_config[c].breakpoint);
operation.set_disabled(recipe_config[c].disabled);
this.add_operation(operation);
}
};
/**
* Returns the value of the Recipe as it should be displayed in a recipe config.
*
* @returns {*}
*/
Recipe.prototype.get_config = function() {
var recipe_config = [];
for (var o = 0; o &lt; this.op_list.length; o++) {
recipe_config.push(this.op_list[o].get_config());
}
return recipe_config;
};
/**
* Adds a new Operation to this Recipe.
*
* @param {Operation} operation
*/
Recipe.prototype.add_operation = function(operation) {
this.op_list.push(operation);
};
/**
* Adds a list of Operations to this Recipe.
*
* @param {Operation[]} operations
*/
Recipe.prototype.add_operations = function(operations) {
this.op_list = this.op_list.concat(operations);
};
/**
* Set a breakpoint on a specified Operation.
*
* @param {number} position - The index of the Operation
* @param {boolean} value
*/
Recipe.prototype.set_breakpoint = function(position, value) {
try {
this.op_list[position].set_breakpoint(value);
} catch (err) {
// Ignore index error
}
};
/**
* Remove breakpoints on all Operations in the Recipe up to the specified position. Used by Flow
* Control Fork operation.
*
* @param {number} pos
*/
Recipe.prototype.remove_breaks_up_to = function(pos) {
for (var i = 0; i &lt; pos; i++) {
this.op_list[i].set_breakpoint(false);
}
};
/**
* Returns true if there is an Flow Control Operation in this Recipe.
*
* @returns {boolean}
*/
Recipe.prototype.contains_flow_control = function() {
for (var i = 0; i &lt; this.op_list.length; i++) {
if (this.op_list[i].is_flow_control()) return true;
}
return false;
};
/**
* Returns the index of the last Operation index that will be executed, taking into account disabled
* Operations and breakpoints.
*
* @param {number} [start_index=0] - The index to start searching from
* @returns (number}
*/
Recipe.prototype.last_op_index = function(start_index) {
var i = start_index + 1 || 0,
op;
for (; i &lt; this.op_list.length; i++) {
op = this.op_list[i];
if (op.is_disabled()) return i-1;
if (op.is_breakpoint()) return i-1;
}
return i-1;
};
/**
* Executes each operation in the recipe over the given Dish.
*
* @param {Dish} dish
* @param {number} [start_from=0] - The index of the Operation to start executing from
* @returns {number} - The final progress through the recipe
*/
Recipe.prototype.execute = function(dish, start_from) {
start_from = start_from || 0;
var op, input, output, num_jumps = 0;
for (var i = start_from; i &lt; this.op_list.length; i++) {
op = this.op_list[i];
if (op.is_disabled()) {
continue;
}
if (op.is_breakpoint()) {
return i;
}
try {
input = dish.get(op.input_type);
if (op.is_flow_control()) {
// Package up the current state
var state = {
"progress" : i,
"dish" : dish,
"op_list" : this.op_list,
"num_jumps" : num_jumps
};
state = op.run(state);
i = state.progress;
num_jumps = state.num_jumps;
} else {
output = op.run(input, op.get_ing_values());
dish.set(output, op.output_type);
}
} catch (err) {
var e = typeof err == "string" ? { message: err } : err;
e.progress = i;
e.display_str = op.name + " - ";
if (e.fileName) {
e.display_str += e.name + " in " + e.fileName +
" on line " + e.lineNumber +
".&lt;br>&lt;br>Message: " + e.message;
} else {
e.display_str += e.message;
}
throw e;
}
}
return this.op_list.length;
};
/**
* Returns the recipe configuration in string format.
*
* @returns {string}
*/
Recipe.prototype.to_string = function() {
return JSON.stringify(this.get_config());
};
/**
* Creates a Recipe from a given configuration string.
*
* @param {string} recipe_str
*/
Recipe.prototype.from_string = function(recipe_str) {
var recipe_config = JSON.parse(recipe_str);
this._parse_config(recipe_config);
};
</pre>
</article>
</section>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="modal fade" id="searchResults">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Search results</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<footer>
<span class="copyright">
&copy; Crown Copyright 2016
</span>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>
on Mon Nov 28th 2016
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
</footer>
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/toc.js"></script>
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
lang = langClassMatch ? langClassMatch[1] : "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
$.catchAnchorLinks( {
navbarOffset: 10
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
showAndHide : false,
smoothScrolling: true
} );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
$( "table" ).each( function () {
var $this = $( this );
$this.addClass('table');
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
<script type="text/javascript">
$(document).ready(function() {
SearcherDisplay.init();
});
</script>
</body>
</html>