├── logo.png
├── README.md
├── test1.html
├── test2.html
├── fuzzer.js
├── PMHook.js
├── replay.html
└── logger.html
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yehgdotnet/postmessagehook/HEAD/logo.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # postmessagehook
2 | by Gary O'Leary-Steele | cloned from https://sentinel.appcheck-ng.com/static/pm/logger.html
3 |
--------------------------------------------------------------------------------
/test1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/test2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/fuzzer.js:
--------------------------------------------------------------------------------
1 | function fuzz_json(data, fuzz_func){
2 | /*
3 | Unpacks a JSON object and applies the callback to
4 | each property.
5 |
6 | The callback is passed the current value and should return the new
7 | value.
8 |
9 | Args:
10 | data: Object to fuzz
11 | fuzz_func: fuzzed function to apply to data
12 |
13 | */
14 | //console.log("Fuzzing json");
15 | var fuzzed_objects = [];
16 | for(var key in data) {
17 |
18 | // Ensure we only deal with fuzzable props not builtins
19 | if(data.hasOwnProperty(key)) {
20 | // If its not an object send to simple fuzzer to apply callback
21 | if(typeof data[key] != "object"){
22 |
23 | // Obtain an array of fuzzed objects
24 | fuzzed = simple_fuzz(data[key],fuzz_func);
25 |
26 | // copy the object and insert fuzzed values.
27 | for(c=0;c < fuzzed.length; c++){
28 | // Make copy
29 | var copy = JSON.parse(JSON.stringify(data));
30 | // apply fuzzed value
31 | copy[key] = fuzzed[c];
32 | fuzzed_objects.push(copy);
33 | }
34 |
35 | }else{
36 | // Make a copy of the original so that the
37 | // nested elements we pass in dont get changed in the original
38 | //var copy = JSON.parse(JSON.stringify(data));
39 | //var unpacked_nested_object = fuzz_json(copy[key],fuzz_func);
40 |
41 | // Here we use recursion to unpack to the point we can apply the fuzzer.
42 | // then we unpack these and add them to the return value
43 | var unpacked_nested_object = fuzz_json(data[key],fuzz_func)
44 | //console.log(unpacked_nested_object);
45 | for(var u=0,l=unpacked_nested_object.length; u 1 && data.split("{").length == data.split("{").length){
139 |
140 | // assuming that the part after the first { is JSON
141 |
142 | // Only deals with 1 JSON struct!! should improve this to get them all
143 | var start_json = data.indexOf("{")
144 | var end_json = data.lastIndexOf("}")
145 |
146 | var prefix = data.slice(0, start_json)
147 | var json_part = data.slice(start_json, end_json + 1)
148 | var suffix = data.slice(end_json + 1)
149 | //console.log(prefix)
150 | //console.log(json_part)
151 | //console.log(suffix)
152 |
153 | json_part_fuzzed= do_simple_fuzz(JSON.parse(json_part), fuzz_func)
154 | for(var i=0,l=json_part_fuzzed.length; i= 0) ? (indexOf + (startpos || 0)) : indexOf;
189 | }
190 |
191 | String.prototype.regexLastIndexOf = function(regex, startpos) {
192 | regex = (regex.global) ? regex : new RegExp(regex.source, "g" + (regex.ignoreCase ? "i" : "") + (regex.multiLine ? "m" : ""));
193 | if(typeof (startpos) == "undefined") {
194 | startpos = this.length;
195 | } else if(startpos < 0) {
196 | startpos = 0;
197 | }
198 | var stringToWorkWith = this.substring(0, startpos + 1);
199 | var lastIndexOf = -1;
200 | var nextStop = 0;
201 | while((result = regex.exec(stringToWorkWith)) != null) {
202 | lastIndexOf = result.index;
203 | regex.lastIndex = ++nextStop;
204 | }
205 | return lastIndexOf;
206 | }
207 |
208 | function dedupe_array(a) {
209 | var seen = {};
210 | var out = [];
211 | var len = a.length;
212 | var j = 0;
213 | for(var i = 0; i < len; i++) {
214 | var item = a[i];
215 | if(seen[item] !== 1) {
216 | seen[item] = 1;
217 | out[j++] = item;
218 | }
219 | }
220 | return out;
221 | }
222 |
223 |
224 | var fuzz_count = 0
225 | function default_fuzz_callback(data){
226 |
227 | // test to see if the value looks like a URL.
228 |
229 | //var tag_payload = "