Skip to content

Instantly share code, notes, and snippets.

@9b
Created December 13, 2011 16:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 9b/1472896 to your computer and use it in GitHub Desktop.
Save 9b/1472896 to your computer and use it in GitHub Desktop.
Hook JS calls for easier analysis
//preserve originals
var ori = function() {
var self = this;
this.unescape = unescape;
this.alert = alert;
this.eval = eval;
this.fromCharCode = String.fromCharCode;
this.call_unescape = function(e) {
document.write("<br>original unescape was passed data");
return this.unescape(e);
}, this.call_alert = function(e) {
document.write("<br>original alert was passed data");
return this.alert(e);
}, this.call_eval = function(e) {
document.write("<br>original eval was passed data");
//return this.eval(e);
}, this.call_fromCharCode = function(e) {
document.write("<br>original String.fromCharCode was passed data");
return this.fromCharCode(e);
}
}
var ori = new ori();
var VERSION = 8.0;
var PLATFORM = "WIN";
var GETPAGENUMWORDS = 2;
var GETPAGENTHWORD = "DEFINE";
var PAGENUM = 2;
//define the hookers!
var app = {
alert: function(data) {
document.write("<br>Alert was passed: " + data);
},
doc: {
Collab: {
getIcon: function(e) {
document.write("<br>getIcon was called");
}
}
},
platform: PLATFORM,
viewerVersion: VERSION,
}
var Collab = {
collectEmailInfo: function() {
document.write("<br>collectEmailInfo was called");
},
getIcon: function(e) {
document.write("<br>getIcon was called");
}
}
var media = {
newPlayer: function() {
document.write("<br>newPlayer was called");
}
}
var util = {
printf: function() {
document.write("<br>printf was called");
},
printd: function() {
document.write("<br>printd was called");
},
byteToChar: function(e) {
document.write("<br>byteToChar was called with: " + e);
}
}
var getPageNumWords = GETPAGENUMWORDS;
var getPageNthWord = GETPAGENTHWORD;
var pageNum = PAGENUM;
var unescape = function(d) {
document.write("<br>unescape was called with: " + d);
return ori.call_unescape(d);
}
var alert = function(d) {
document.write("<br>alert was called");
return ori.call_alert(d);
}
var eval = function(d) {
document.write("<br>eval was called with " + d);
return ori.call_eval(d);
}
var String = {
fromCharCode: function(d) {
document.write("<br>String.fromCharCode was called with " + d);
return ori.call_fromCharCode(d);
}
}
var info = {
author: "hooker"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment