mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Initial pages commit
This commit is contained in:
parent
b1d73a725d
commit
56dbb3fa40
376 changed files with 252899 additions and 88317 deletions
540
docs/operations_OS.js.html
Executable file
540
docs/operations_OS.js.html
Executable file
|
@ -0,0 +1,540 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>CyberChef Source: operations/OS.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: operations/OS.js</h1>
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre
|
||||
class="sunlight-highlight-javascript linenums">/**
|
||||
* Operating system operations.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2016
|
||||
* @license Apache-2.0
|
||||
*
|
||||
* @namespace
|
||||
*/
|
||||
var OS = {
|
||||
|
||||
/**
|
||||
* Parse UNIX file permissions operation.
|
||||
*
|
||||
* @param {string} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
run_parse_unix_perms: function(input, args) {
|
||||
var perms = {
|
||||
d : false, // directory
|
||||
sl : false, // symbolic link
|
||||
np : false, // named pipe
|
||||
s : false, // socket
|
||||
cd : false, // character device
|
||||
bd : false, // block device
|
||||
dr : false, // door
|
||||
sb : false, // sticky bit
|
||||
su : false, // setuid
|
||||
sg : false, // setgid
|
||||
ru : false, // read user
|
||||
wu : false, // write user
|
||||
eu : false, // execute user
|
||||
rg : false, // read group
|
||||
wg : false, // write group
|
||||
eg : false, // execute group
|
||||
ro : false, // read other
|
||||
wo : false, // write other
|
||||
eo : false // execute other
|
||||
},
|
||||
d = 0,
|
||||
u = 0,
|
||||
g = 0,
|
||||
o = 0,
|
||||
output = "",
|
||||
octal = null,
|
||||
textual = null;
|
||||
|
||||
if (input.search(/\s*[0-7]{1,4}\s*/i) === 0) {
|
||||
// Input is octal
|
||||
octal = input.match(/\s*([0-7]{1,4})\s*/i)[1];
|
||||
|
||||
if (octal.length == 4) {
|
||||
d = parseInt(octal[0], 8);
|
||||
u = parseInt(octal[1], 8);
|
||||
g = parseInt(octal[2], 8);
|
||||
o = parseInt(octal[3], 8);
|
||||
} else {
|
||||
if (octal.length > 0) u = parseInt(octal[0], 8);
|
||||
if (octal.length > 1) g = parseInt(octal[1], 8);
|
||||
if (octal.length > 2) o = parseInt(octal[2], 8);
|
||||
}
|
||||
|
||||
perms.su = d >> 2 & 0x1;
|
||||
perms.sg = d >> 1 & 0x1;
|
||||
perms.sb = d & 0x1;
|
||||
|
||||
perms.ru = u >> 2 & 0x1;
|
||||
perms.wu = u >> 1 & 0x1;
|
||||
perms.eu = u & 0x1;
|
||||
|
||||
perms.rg = g >> 2 & 0x1;
|
||||
perms.wg = g >> 1 & 0x1;
|
||||
perms.eg = g & 0x1;
|
||||
|
||||
perms.ro = o >> 2 & 0x1;
|
||||
perms.wo = o >> 1 & 0x1;
|
||||
perms.eo = o & 0x1;
|
||||
} else if (input.search(/\s*[dlpcbDrwxsStT-]{1,10}\s*/) === 0) {
|
||||
// Input is textual
|
||||
textual = input.match(/\s*([dlpcbDrwxsStT-]{1,10})\s*/)[1];
|
||||
|
||||
switch (textual[0]) {
|
||||
case "d":
|
||||
perms.d = true;
|
||||
break;
|
||||
case "l":
|
||||
perms.sl = true;
|
||||
break;
|
||||
case "p":
|
||||
perms.np = true;
|
||||
break;
|
||||
case "s":
|
||||
perms.s = true;
|
||||
break;
|
||||
case "c":
|
||||
perms.cd = true;
|
||||
break;
|
||||
case "b":
|
||||
perms.bd = true;
|
||||
break;
|
||||
case "D":
|
||||
perms.dr = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (textual.length > 1) perms.ru = textual[1] == "r";
|
||||
if (textual.length > 2) perms.wu = textual[2] == "w";
|
||||
if (textual.length > 3) {
|
||||
switch (textual[3]) {
|
||||
case "x":
|
||||
perms.eu = true;
|
||||
break;
|
||||
case "s":
|
||||
perms.eu = true;
|
||||
perms.su = true;
|
||||
break;
|
||||
case "S":
|
||||
perms.su = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (textual.length > 4) perms.rg = textual[4] == "r";
|
||||
if (textual.length > 5) perms.wg = textual[5] == "w";
|
||||
if (textual.length > 6) {
|
||||
switch (textual[6]) {
|
||||
case "x":
|
||||
perms.eg = true;
|
||||
break;
|
||||
case "s":
|
||||
perms.eg = true;
|
||||
perms.sg = true;
|
||||
break;
|
||||
case "S":
|
||||
perms.sg = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (textual.length > 7) perms.ro = textual[7] == "r";
|
||||
if (textual.length > 8) perms.wo = textual[8] == "w";
|
||||
if (textual.length > 9) {
|
||||
switch (textual[9]) {
|
||||
case "x":
|
||||
perms.eo = true;
|
||||
break;
|
||||
case "t":
|
||||
perms.eo = true;
|
||||
perms.sb = true;
|
||||
break;
|
||||
case "T":
|
||||
perms.sb = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return "Invalid input format.\nPlease enter the permissions in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format.";
|
||||
}
|
||||
|
||||
output += "Textual representation: " + OS._perms_to_str(perms);
|
||||
output += "\nOctal representation: " + OS._perms_to_octal(perms);
|
||||
|
||||
// File type
|
||||
if (textual) {
|
||||
output += "\nFile type: " + OS._ft_from_perms(perms);
|
||||
}
|
||||
|
||||
// setuid, setgid
|
||||
if (perms.su) {
|
||||
output += "\nThe setuid flag is set";
|
||||
}
|
||||
if (perms.sg) {
|
||||
output += "\nThe setgid flag is set";
|
||||
}
|
||||
|
||||
// sticky bit
|
||||
if (perms.sb) {
|
||||
output += "\nThe sticky bit is set";
|
||||
}
|
||||
|
||||
// Permission matrix
|
||||
output += "\n\n +---------+-------+-------+-------+\n" +
|
||||
" | | User | Group | Other |\n" +
|
||||
" +---------+-------+-------+-------+\n" +
|
||||
" | Read | " + (perms.ru ? "X" : " ") + " | " + (perms.rg ? "X" : " ") + " | " + (perms.ro ? "X" : " ") + " |\n" +
|
||||
" +---------+-------+-------+-------+\n" +
|
||||
" | Write | " + (perms.wu ? "X" : " ") + " | " + (perms.wg ? "X" : " ") + " | " + (perms.wo ? "X" : " ") + " |\n" +
|
||||
" +---------+-------+-------+-------+\n" +
|
||||
" | Execute | " + (perms.eu ? "X" : " ") + " | " + (perms.eg ? "X" : " ") + " | " + (perms.eo ? "X" : " ") + " |\n" +
|
||||
" +---------+-------+-------+-------+\n";
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Given a permissions object dictionary, generates a textual permissions string.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} perms
|
||||
* @returns {string}
|
||||
*/
|
||||
_perms_to_str: function(perms) {
|
||||
var str = "",
|
||||
type = "-";
|
||||
|
||||
if (perms.d) type = "d";
|
||||
if (perms.sl) type = "l";
|
||||
if (perms.np) type = "p";
|
||||
if (perms.s) type = "s";
|
||||
if (perms.cd) type = "c";
|
||||
if (perms.bd) type = "b";
|
||||
if (perms.dr) type = "D";
|
||||
|
||||
str = type;
|
||||
|
||||
str += perms.ru ? "r" : "-";
|
||||
str += perms.wu ? "w" : "-";
|
||||
if (perms.eu && perms.su) {
|
||||
str += "s";
|
||||
} else if (perms.su) {
|
||||
str += "S";
|
||||
} else if (perms.eu) {
|
||||
str += "x";
|
||||
} else {
|
||||
str += "-";
|
||||
}
|
||||
|
||||
str += perms.rg ? "r" : "-";
|
||||
str += perms.wg ? "w" : "-";
|
||||
if (perms.eg && perms.sg) {
|
||||
str += "s";
|
||||
} else if (perms.sg) {
|
||||
str += "S";
|
||||
} else if (perms.eg) {
|
||||
str += "x";
|
||||
} else {
|
||||
str += "-";
|
||||
}
|
||||
|
||||
str += perms.ro ? "r" : "-";
|
||||
str += perms.wo ? "w" : "-";
|
||||
if (perms.eo && perms.sb) {
|
||||
str += "t";
|
||||
} else if (perms.sb) {
|
||||
str += "T";
|
||||
} else if (perms.eo) {
|
||||
str += "x";
|
||||
} else {
|
||||
str += "-";
|
||||
}
|
||||
|
||||
return str;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Given a permissions object dictionary, generates an octal permissions string.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} perms
|
||||
* @returns {string}
|
||||
*/
|
||||
_perms_to_octal: function(perms) {
|
||||
var d = 0,
|
||||
u = 0,
|
||||
g = 0,
|
||||
o = 0;
|
||||
|
||||
if (perms.su) d += 4;
|
||||
if (perms.sg) d += 2;
|
||||
if (perms.sb) d += 1;
|
||||
|
||||
if (perms.ru) u += 4;
|
||||
if (perms.wu) u += 2;
|
||||
if (perms.eu) u += 1;
|
||||
|
||||
if (perms.rg) g += 4;
|
||||
if (perms.wg) g += 2;
|
||||
if (perms.eg) g += 1;
|
||||
|
||||
if (perms.ro) o += 4;
|
||||
if (perms.wo) o += 2;
|
||||
if (perms.eo) o += 1;
|
||||
|
||||
return d.toString() + u.toString() + g.toString() + o.toString();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Given a permissions object dictionary, returns the file type.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} perms
|
||||
* @returns {string}
|
||||
*/
|
||||
_ft_from_perms: function(perms) {
|
||||
if (perms.d) return "Directory";
|
||||
if (perms.sl) return "Symbolic link";
|
||||
if (perms.np) return "Named pipe";
|
||||
if (perms.s) return "Socket";
|
||||
if (perms.cd) return "Character device";
|
||||
if (perms.bd) return "Block device";
|
||||
if (perms.dr) return "Door";
|
||||
return "Regular file";
|
||||
},
|
||||
|
||||
};
|
||||
</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">×</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">
|
||||
© 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>
|
Loading…
Add table
Add a link
Reference in a new issue