From 452350820f0efe611c65731b839b5701127ab02e Mon Sep 17 00:00:00 2001 From: Daniel Zulla Date: Fri, 8 Feb 2013 09:58:40 -0500 Subject: [PATCH] added taint functions, need to add vm.js support --- src/modules/variable/is_tainted.js | 17 +++++++++++++++++ src/modules/variable/taint.js | 20 ++++++++++++++++++++ src/modules/variable/untaint.js | 20 ++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 src/modules/variable/is_tainted.js create mode 100644 src/modules/variable/taint.js create mode 100644 src/modules/variable/untaint.js diff --git a/src/modules/variable/is_tainted.js b/src/modules/variable/is_tainted.js new file mode 100644 index 0000000..bce2745 --- /dev/null +++ b/src/modules/variable/is_tainted.js @@ -0,0 +1,17 @@ +/* +* @author Daniel Zulla +* @created 08.2.2013 +* @website https://www.zulla.org + */ + + +PHP.Modules.prototype.is_tainted = function( variable ) { + + var COMPILER = PHP.Compiler.prototype, + VARIABLE = PHP.VM.Variable.prototype; + + if ( variable[ VARIABLE.TYPE ] === VARIABLE.STRING ) { + return new PHP.VM.Variable(variable[ VARIABLE.TAINT_MARK ] === 0x6A8FCE84); + } + +}; diff --git a/src/modules/variable/taint.js b/src/modules/variable/taint.js new file mode 100644 index 0000000..3e18b34 --- /dev/null +++ b/src/modules/variable/taint.js @@ -0,0 +1,20 @@ +/* +* @author Daniel Zulla +* @created 08.2.2013 +* @website https://www.zulla.org + */ + + +PHP.Modules.prototype.taint = function( variable ) { + + var COMPILER = PHP.Compiler.prototype, + VARIABLE = PHP.VM.Variable.prototype; + + if ( variable[ VARIABLE.TYPE ] === VARIABLE.STRING + && ( variable[ VARIABLE.TAINT_MARK ] == 0x2C5E7F2D + || variable[ VARIABLE.TAINT_MARK ] == 0x00000000 ) ) + { + return variable[ VARIABLE.TAINT_MARK] = 0x6A8FCE84; + } + +}; diff --git a/src/modules/variable/untaint.js b/src/modules/variable/untaint.js new file mode 100644 index 0000000..cefec89 --- /dev/null +++ b/src/modules/variable/untaint.js @@ -0,0 +1,20 @@ +/* +* @author Daniel Zulla +* @created 08.2.2013 +* @website https://www.zulla.org + */ + + +PHP.Modules.prototype.untaint = function( variable ) { + + var COMPILER = PHP.Compiler.prototype, + VARIABLE = PHP.VM.Variable.prototype; + + if ( variable[ VARIABLE.TYPE ] === VARIABLE.STRING + && ( variable[ VARIABLE.TAINT_MARK ] == 0x6A8FCE84 + || variable[ VARIABLE.TAINT_MARK ] == 0x00000000 ) ) + { + return variable[ VARIABLE.TAINT_MARK] = 0x2C5E7F2D; + } + +};