Initial Commit
This commit is contained in:
commit
b014df8543
1
LazyFormFuzz-live.js
Normal file
1
LazyFormFuzz-live.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
javascript:(function(b){var a=document.createElement("script");a.src="//github.timshomepage.net/LazyFormFuzz/LazyFormFuzz.js";a.async=!1;document.getElementsByTagName("head")[0].appendChild(a)})();
|
28
LazyFormFuzz.js
Normal file
28
LazyFormFuzz.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
javascript:(function(w){var b=function(e,h){var c=b.resolve(e,h||"/"),f=b.modules[c];if(!f)throw Error("Failed to resolve module "+e+", tried "+c);return f._cached?f._cached:f()};b.paths=[];b.modules={};b.extensions=[".js",".coffee"];b._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0};b.resolve=function(){return function(e,h){function c(a){if(b.modules[a])return a;for(var g=0;g<b.extensions.length;g++){var n=b.extensions[g];if(b.modules[a+n])return a+n}}function f(a){a=a.replace(/\/+$/,"");var g=a+"/package.json";
|
||||||
|
if(b.modules[g]){var g=b.modules[g](),n=g.browserify;if("object"==typeof n&&n.main){if(g=c(l.resolve(a,n.main)))return g}else if("string"==typeof n){if(g=c(l.resolve(a,n)))return g}else if(g.main&&(g=c(l.resolve(a,g.main))))return g}return c(a+"/index")}h||(h="/");if(b._core[e])return e;var l=b.modules.path(),a=h||".";if(e.match(/^(?:\.\.?\/|\/)/)){var d=c(l.resolve(a,e))||f(l.resolve(a,e));if(d)return d}if(a=function(a,g){var n;"/"===g?n=[""]:n=l.normalize(g).split("/");for(var p=[],q=n.length-1;0<=
|
||||||
|
q;q--)if("node_modules"!==n[q]){var d=n.slice(0,q+1).join("/")+"/node_modules";p.push(d)}for(n=0;n<p.length;n++){q=p[n];if(d=c(q+"/"+a))return d;if(q=f(q+"/"+a))return q}if(d=c(a))return d}(e,a))return a;throw Error("Cannot find module '"+e+"'");}}();b.alias=function(e,h){var c=b.modules.path(),f=null;try{f=b.resolve(e+"/package.json","/")}catch(l){f=b.resolve(e,"/")}for(var c=c.dirname(f),f=(Object.keys||function(a){var g=[],n;for(n in a)g.push(n);return g})(b.modules),a=0;a<f.length;a++){var d=
|
||||||
|
f[a];d.slice(0,c.length+1)===c+"/"?(d=d.slice(c.length),b.modules[h+d]=b.modules[c+d]):d===c&&(b.modules[h]=b.modules[c])}};b.define=function(e,h){var c=b._core[e]?"":b.modules.path().dirname(e),f=function(a){return b(a,c)};f.resolve=function(a){return b.resolve(a,c)};f.modules=b.modules;f.define=b.define;var l={exports:{}};b.modules[e]=function(){return b.modules[e]._cached=l.exports,h.call(l.exports,f,l,l.exports,c,e),b.modules[e]._cached=l.exports,l.exports}};"undefined"==typeof process&&(process=
|
||||||
|
{});process.nextTick||(process.nextTick=function(){var e=[],b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;return b&&window.addEventListener("message",function(c){c.source===window&&"browserify-tick"===c.data&&(c.stopPropagation(),0<e.length&&e.shift()())},!0),function(c){b?(e.push(c),window.postMessage("browserify-tick","*")):setTimeout(c,0)}}());process.title||(process.title="browser");process.binding||(process.binding=function(e){if("evals"===e)return b("vm");throw Error("No such module");
|
||||||
|
});process.cwd||(process.cwd=function(){return"."});b.define("path",function(b,h,c,f,l){function a(a,n){for(var p=[],c=0;c<a.length;c++)n(a[c],c,a)&&p.push(a[c]);return p}function d(a,c){for(var p=0,d=a.length;0<=d;d--){var b=a[d];"."==b?a.splice(d,1):".."===b?(a.splice(d,1),p++):p&&(a.splice(d,1),p--)}if(c)for(;p--;p)a.unshift("..");return a}var s=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;c.resolve=function(){for(var g="",c=!1,p=arguments.length;-1<=p&&!c;p--){var b=0<=p?arguments[p]:process.cwd();
|
||||||
|
"string"==typeof b&&b&&(g=b+"/"+g,c="/"===b.charAt(0))}return g=d(a(g.split("/"),function(a){return!!a}),!c).join("/"),(c?"/":"")+g||"."};c.normalize=function(c){var b="/"===c.charAt(0),p="/"===c.slice(-1);return c=d(a(c.split("/"),function(a){return!!a}),!b).join("/"),!c&&!b&&(c="."),c&&p&&(c+="/"),(b?"/":"")+c};c.join=function(){var d=Array.prototype.slice.call(arguments,0);return c.normalize(a(d,function(a,c){return a&&"string"==typeof a}).join("/"))};c.dirname=function(a){return(a=s.exec(a)[1]||
|
||||||
|
"")?1===a.length?a:a.substring(0,a.length-1):"."};c.basename=function(a,c){var d=s.exec(a)[2]||"";return c&&d.substr(-1*c.length)===c&&(d=d.substr(0,d.length-c.length)),d};c.extname=function(a){return s.exec(a)[3]||""}});b.define("/node_modules/ret/package.json",function(b,h,c,f,l){h.exports={main:"./lib/index.js"}});b.define("/node_modules/ret/lib/index.js",function(b,h,c,f,l){var a=b("./util"),d=b("./types"),s=b("./sets"),g=b("./positions");h.exports=function(c){var b=0,e,m,r={type:d.ROOT,stack:[]},
|
||||||
|
t=r,k=r.stack,B=[],h=function(b){a.error(c,"Nothing to repeat at column "+(b-1))},f=a.strToChars(c);for(e=f.length;b<e;)switch(m=f[b++],m){case "\\":m=f[b++];switch(m){case "b":k.push(g.wordBoundary());break;case "B":k.push(g.nonWordBoundary());break;case "w":k.push(s.words());break;case "W":k.push(s.notWords());break;case "d":k.push(s.ints());break;case "D":k.push(s.notInts());break;case "s":k.push(s.whitespace());break;case "S":k.push(s.notWhitespace());break;default:/\d/.test(m)?k.push({type:d.REFERENCE,
|
||||||
|
value:parseInt(m,10)}):k.push({type:d.CHAR,value:m.charCodeAt(0)})}break;case "^":k.push(g.begin());break;case "$":k.push(g.end());break;case "[":var l;"^"===f[b]?(l=!0,b++):l=!1;m=a.tokenizeClass(f.slice(b),c);b+=m[1];k.push({type:d.SET,set:m[0],not:l});break;case ".":k.push(s.anyChar());break;case "(":var v={type:d.GROUP,stack:[],remember:!0};m=f[b];"?"===m&&(m=f[b+1],b+=2,"="===m?v.followedBy=!0:"!"===m?v.notFollowedBy=!0:":"!==m&&a.error(c,"Invalid character '"+m+"' after '?' at column "+(b-1)),
|
||||||
|
v.remember=!1);k.push(v);B.push(t);t=v;k=v.stack;break;case ")":0===B.length&&a.error(c,"Unmatched ) at column "+(b-1));t=B.pop();k=t.options?t.options[t.options.length-1]:t.stack;break;case "|":t.options||(t.options=[t.stack],delete t.stack);k=[];t.options.push(k);break;case "{":m=/^(\d+)(,(\d+)?)?\}/.exec(f.slice(b));var C,E;null!==m?(C=parseInt(m[1],10),E=m[2]?m[3]?parseInt(m[3],10):Infinity:C,b+=m[0].length,k.push({type:d.REPETITION,min:C,max:E,value:k.pop()})):k.push({type:d.CHAR,value:123});
|
||||||
|
break;case "?":0===k.length&&h(b);k.push({type:d.REPETITION,min:0,max:1,value:k.pop()});break;case "+":0===k.length&&h(b);k.push({type:d.REPETITION,min:1,max:Infinity,value:k.pop()});break;case "*":0===k.length&&h(b);k.push({type:d.REPETITION,min:0,max:Infinity,value:k.pop()});break;default:k.push({type:d.CHAR,value:m.charCodeAt(0)})}return r};h.exports.types=d});b.define("/node_modules/ret/lib/util.js",function(b,h,c,f,l){var a=b("./types"),d=b("./sets"),s={0:0,t:9,n:10,v:11,f:12,r:13},g=h.exports=
|
||||||
|
{strToChars:function(a){return a=a.replace(/(\[\\b\])|\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z\[\\\]\^?])|([0tnvfr]))/g,function(a,b,c,r,d,k,g){a=b?8:c?parseInt(c,16):r?parseInt(r,16):d?parseInt(d,8):k?"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?".indexOf(k):g?s[g]:w;a=String.fromCharCode(a);return/[\[\]{}\^$.|?*+()]/.test(a)&&(a="\\"+a),a}),a},tokenizeClass:function(c,b){for(var e=[],f=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g,r;null!=(r=f.exec(c));)if(r[1])e.push(d.words());
|
||||||
|
else if(r[2])e.push(d.ints());else if(r[3])e.push(d.whitespace());else if(r[4])e.push(d.notWords());else if(r[5])e.push(d.notInts());else if(r[6])e.push(d.notWhitespace());else if(r[7])e.push({type:a.RANGE,from:(r[8]||r[9]).charCodeAt(0),to:r[10].charCodeAt(0)});else{if(!(r=r[12]))return[e,f.lastIndex];e.push({type:a.CHAR,value:r.charCodeAt(0)})}g.error(b,"Missing ']'")},error:function(a,c){throw Error("Invalid regular expression: /"+a+"/: "+c);}}});b.define("/node_modules/ret/lib/types.js",function(b,
|
||||||
|
h,c,f,l){h.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});b.define("/node_modules/ret/lib/sets.js",function(b,h,c,f,l){var a=b("./types"),d=function(){return[{type:a.RANGE,from:48,to:57}]},s=function(){return[{type:a.RANGE,from:97,to:122},{type:a.RANGE,from:65,to:90}].concat(d())},g=function(){return[{type:a.CHAR,value:12},{type:a.CHAR,value:10},{type:a.CHAR,value:13},{type:a.CHAR,value:9},{type:a.CHAR,value:11},{type:a.CHAR,value:160},{type:a.CHAR,value:5760},
|
||||||
|
{type:a.CHAR,value:6158},{type:a.CHAR,value:8192},{type:a.CHAR,value:8193},{type:a.CHAR,value:8194},{type:a.CHAR,value:8195},{type:a.CHAR,value:8196},{type:a.CHAR,value:8197},{type:a.CHAR,value:8198},{type:a.CHAR,value:8199},{type:a.CHAR,value:8200},{type:a.CHAR,value:8201},{type:a.CHAR,value:8202},{type:a.CHAR,value:8232},{type:a.CHAR,value:8233},{type:a.CHAR,value:8239},{type:a.CHAR,value:8287},{type:a.CHAR,value:12288}]};c.words=function(){return{type:a.SET,set:s(),not:!1}};c.notWords=function(){return{type:a.SET,
|
||||||
|
set:s(),not:!0}};c.ints=function(){return{type:a.SET,set:d(),not:!1}};c.notInts=function(){return{type:a.SET,set:d(),not:!0}};c.whitespace=function(){return{type:a.SET,set:g(),not:!1}};c.notWhitespace=function(){return{type:a.SET,set:g(),not:!0}};c.anyChar=function(){return{type:a.SET,set:[{type:a.CHAR,value:10}],not:!0}}});b.define("/node_modules/ret/lib/positions.js",function(b,h,c,f,l){var a=b("./types");c.wordBoundary=function(){return{type:a.POSITION,value:"b"}};c.nonWordBoundary=function(){return{type:a.POSITION,
|
||||||
|
value:"B"}};c.begin=function(){return{type:a.POSITION,value:"^"}};c.end=function(){return{type:a.POSITION,value:"$"}}});b.define("/randexp.js",function(b,h,c,f,l){var a=b("ret"),d=a.types,s=function(a){return a+(97<=a&&122>=a?-32:65<=a&&90>=a?32:0)},g=function(a,b,c,d){return a<=c&&c<=b?{from:c,to:Math.min(b,d)}:a<=d&&d<=b?{from:Math.max(a,c),to:d}:!1},n=function(a,b,c){for(var e,f,h=[],m=!1,l=0,p=a.length;l<p;l++)switch(e=a[l],e.type){case d.CHAR:f=e.value;if(f===b||c&&s(f)===b)return!0;break;case d.RANGE:if(e.from<=
|
||||||
|
b&&b<=e.to||c&&(!1!==(f=g(97,122,e.from,e.to))&&f.from<=b&&b<=f.to||!1!==(f=g(65,90,e.from,e.to))&&f.from<=b&&b<=f.to))return!0;break;case d.SET:var q;if(q=0<h.length)a:{q=h;for(var w=e,D=0,G=q.length;D<G;D++){var x=q[D],u;if(u=x.not!==w.not)b:{x=x.set;u=w.set;var y=void 0,F=void 0,z=void 0,A=void 0;if((F=x.length)!==u.length)u=!1;else{for(y=0;y<F;y++)for(z in A=x[y],A)if(A.hasOwnProperty(z)&&A[z]!==u[y][z]){u=!1;break b}u=!0}}if(u){q=!0;break a}}q=!1}q?m=!0:h.push(e);if(!m&&n(e.set,b,c)!==e.not)return!0}return!1},
|
||||||
|
p=function(a,b,c){var e,f,g,h;switch(a.type){case d.ROOT:case d.GROUP:if(a.notFollowedBy)return"";a.remember&&(e=b.push(!0)-1);f=a.options?a.options[Math.floor(Math.random()*a.options.length)]:a.stack;c="";g=0;for(h=f.length;g<h;g++)c+=p.call(this,f[g],b);return a.remember&&(b[e]=c),c;case d.POSITION:return"";case d.SET:e=!!c!==a.not;if(!e)return p.call(this,a.set[Math.floor(Math.random()*a.set.length)],b,e);for(;;)if(b=this.anyRandChar(),e=b.charCodeAt(0),!n(a.set,e,this.ignoreCase))return b;break;
|
||||||
|
case d.RANGE:return a=a.from+Math.floor(Math.random()*(1+a.to-a.from)),String.fromCharCode(this.ignoreCase&&0.5<Math.random()?s(a):a);case d.REPETITION:e=a.min+Math.floor(Math.random()*(1+(Infinity===a.max?a.min+this.max:a.max)-a.min));c="";for(g=0;g<e;g++)c+=p.call(this,a.value,b);return c;case d.REFERENCE:return b[a.value-1];case d.CHAR:return String.fromCharCode(this.ignoreCase&&0.5<Math.random()?s(a.value):a.value)}},q=h.exports=function(b,c){if(b instanceof RegExp)this.ignoreCase=b.ignoreCase,
|
||||||
|
this.multiline=b.multiline,"number"==typeof b.max&&(this.max=b.max),"function"==typeof b.anyRandChar&&(this.anyRandChar=b.anyRandChar),b=b.source;else{if("string"!=typeof b)throw Error("Expected a regexp or string");this.ignoreCase=c&&-1!==c.indexOf("i");this.multiline=c&&-1!==c.indexOf("m")}this.tokens=a(b)};q.prototype.max=100;q.prototype.anyRandChar=function(){return String.fromCharCode(0+Math.floor(65536*Math.random()))};q.prototype.gen=function(){return p.call(this,this.tokens,[])};var m=q.randexp=
|
||||||
|
function(a,b){var c;return a._randexp===w?(c=new q(a,b),a._randexp=c):(c=a._randexp,"number"==typeof a.max&&(c.max=a.max),"function"==typeof a.anyRandChar&&(c.anyRandChar=a.anyRandChar)),c.gen()};q.sugar=function(){RegExp.prototype.gen=function(){return m(this)}}});!function(b,h){"function"==typeof define&&"object"==typeof define.amd?define(b,function(){return h}):"undefined"!=typeof window&&(window[b]=h)}("RandExp",b("/randexp.js"))})();;(function(m,q){var l={email:/[a-z0-9._+\-]{1,20}@[a-z0-9]{3,15}\.[a-z]{2,4}/i,url:/^(https?:\/\/)([a-z\.\-]+)\.([a-z\.]{2,6})\/?$/,sql:/[a-z0-9"'`\-]{5,17}/,text:/[\x20-\x7E]{10,15}/i,color:/^\#[0-9a-f]{6}$/i,tel:/[0-9+\-]{7,15}/,alphanumeric:/[A-Z][0-9]+/i,week:/(20|1[0-9])[0-9]{2}-W(5[1-2]|[1-4][0-9]|0[1-9])/,month:/(20|1[0-9])[0-9]{2}-(1[0-2]|0[1-9])/,datetime:/(20|1[0-9])[0-9]{2}-(1[0-2]|0[1-9])-(2[0-8]|1[0-9]|0[1-9])T(2[0-3]|[0-1][0-9]):[0-5][0-9]Z/,"datetime-local":/(20|1[0-9])[0-9]{2}-(1[0-2]|0[1-9])-(2[0-8]|1[0-9]|0[1-9])T(2[0-3]|[0-1][0-9]):[0-5][0-9]/,
|
||||||
|
date:/(20|1[0-9])[0-9]{2}-(1[0-2]|0[1-9])-(2[0-8]|1[0-9]|0[1-9])/,time:/(2[0-3]|[0-1][0-9]):[0-5][0-9]/};Array.prototype.forEach||(Array.prototype.forEach=function(d,e){for(var b=0,c=this.length;b<c;++b)b in this&&d.call(e,this[b],b,this)});var r=function(d){var e=[],b=arguments.length,c="",a=1,g="",h={};a:for(c in d)for(a=1;a<b;a++){h=arguments[a];for(g in h)if(h[g]===d[c])continue a;e.push(d[c])}return e},s=function(d,e,b){e=e||1;b=b||0;d=Math.round((d||1E3)/e);return Math.ceil(Math.random()*d)*
|
||||||
|
e-b},n=function(d,e){var b,c,a,g=d.querySelectorAll("input, select, textarea"),h=g.length;b=d.querySelectorAll("option");[].forEach.call(b,function(a){a.selected=!1});b=d.querySelectorAll("[checked]");[].forEach.call(b,function(a){a.checked=!1});for(b=0;b<h;b++)if(a=g[b],!a.hasAttribute("readonly")&&!a.hasAttribute("disabled"))if(a.hasAttribute("checked")&&(a.checked=!1),a.hasAttribute("pattern"))c=a.getAttribute("pattern"),a.value=(new m(c)).gen();else{if(!1===a.hasAttribute("type")&&"INPUT"!==a.nodeName)switch(a.nodeName){case "TEXTAREA":c=
|
||||||
|
(new m(l.text)).gen();a.value=c;continue;case "SELECT":a=a.querySelectorAll("option");a[Math.floor(Math.random()*a.length)].selected=!0;continue;default:continue}c=a.getAttribute("type");var k,f={};switch(c){case "radio":null==f[a.name]&&(c=r(d.querySelectorAll("input[type=radio][name="+a.name+"]"),d.querySelectorAll("[name="+a.name+"][disabled]")),c[Math.floor(Math.random()*c.length)].checked=!0,f[a.name]=!0);continue;case "number":case "range":a.value=s(a.getAttribute("max"),a.getAttribute("step"),
|
||||||
|
a.getAttribute("min"));continue;case "checkbox":c=Math.round(Math.random());a.checked=c;continue;case "search":case "text":k=l.text;break;case "hidden":case "button":case "image":case "file":case "password":case "reset":case "submit":continue;default:null!=l[c]&&(k=l[c])}null!==k&&k!==q&&(f=(new m(k)).gen(),a.value=f,String(a.value).toLowerCase()!=String(f).toLowerCase()&&(console.log(c+" : "+f),console.log(a.value)))}};n(document);var p=document.querySelectorAll("frame, iframe");0<p.length&&[].forEach.call(p,
|
||||||
|
function(d){n(d.contentWindow.document)})})(RandExp);
|
26
create_bookmarklet.php
Normal file
26
create_bookmarklet.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function google_min($new_file)
|
||||||
|
{
|
||||||
|
//Get a much-minified version from Google's closure compiler
|
||||||
|
$ch = curl_init('http://closure-compiler.appspot.com/compile');
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($new_file));
|
||||||
|
$output = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
echo 'Minified code created<hr />';
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
$js_lib = file_get_contents("src/randexp.min.js");
|
||||||
|
$js = file_get_contents("src/LazyFormFuzz-src.js");
|
||||||
|
$lff = google_min($js);
|
||||||
|
|
||||||
|
$new_file = "javascript:{$js_lib};{$lff}";
|
||||||
|
|
||||||
|
file_put_contents("LazyFormFuzz.js", $new_file);
|
||||||
|
|
||||||
|
echo "Bookmarklet created\n";
|
||||||
|
|
243
src/LazyFormFuzz-src.js
Normal file
243
src/LazyFormFuzz-src.js
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
/**
|
||||||
|
* Lazy Form Fuzz
|
||||||
|
*
|
||||||
|
* A tool to take some drudgery out of form testing
|
||||||
|
*
|
||||||
|
* @author Timothy J Warren
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
(function(RandExp, undefined) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Some 'constants'
|
||||||
|
var MONTH = "-(1[0-2]|0[1-9])",
|
||||||
|
YEAR = "(20|1[0-9])[0-9]{2}", // Year 1000 - 2099
|
||||||
|
TIME = "(2[0-3]|[0-1][0-9]):[0-5][0-9]",
|
||||||
|
DATE = YEAR+MONTH+"-(2[0-8]|1[0-9]|0[1-9])";
|
||||||
|
|
||||||
|
// A map of some common regex patterns
|
||||||
|
var patterns = {
|
||||||
|
email: /[a-z0-9._+\-]{1,20}@[a-z0-9]{3,15}\.[a-z]{2,4}/i,
|
||||||
|
url: /^(https?:\/\/)([a-z\.\-]+)\.([a-z\.]{2,6})\/?$/,
|
||||||
|
sql: /[a-z0-9"'`\-]{5,17}/,
|
||||||
|
text: /[\x20-\x7E]{10,15}/, // Visible ASCII character range
|
||||||
|
color: /^\#[0-9a-f]{6}$/i,
|
||||||
|
tel: /[0-9+\-]{7,15}/,
|
||||||
|
alphanumeric: /[A-Z][0-9]+/i,
|
||||||
|
week: new RegExp(YEAR+"-W(5[1-2]|[1-4][0-9]|0[1-9])"),
|
||||||
|
month: new RegExp(YEAR+MONTH),
|
||||||
|
datetime: new RegExp(DATE+"T"+TIME+"Z"),
|
||||||
|
"datetime-local": new RegExp(DATE+"T"+TIME),
|
||||||
|
date: new RegExp(DATE),
|
||||||
|
time: new RegExp(TIME)
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( ! Array.prototype.forEach ) {
|
||||||
|
Array.prototype.forEach = function(fn, scope) {
|
||||||
|
for(var i = 0, len = this.length; i < len; ++i) {
|
||||||
|
if (i in this) {
|
||||||
|
fn.call(scope, this[i], i, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var array_diff = function(arr1)
|
||||||
|
{
|
||||||
|
// http://kevin.vanzonneveld.net
|
||||||
|
// original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
||||||
|
// improved by: Sanjoy Roy
|
||||||
|
// revised by: Brett Zamir (http://brett-zamir.me)
|
||||||
|
// example 1: array_diff(['Kevin', 'van', 'Zonneveld'], ['van', 'Zonneveld']);
|
||||||
|
// returns 1: {0:'Kevin'}
|
||||||
|
var retArr = [],
|
||||||
|
argl = arguments.length,
|
||||||
|
k1 = '',
|
||||||
|
i = 1,
|
||||||
|
k = '',
|
||||||
|
arr = {};
|
||||||
|
|
||||||
|
arr1keys: for (k1 in arr1) {
|
||||||
|
for (i = 1; i < argl; i++) {
|
||||||
|
arr = arguments[i];
|
||||||
|
for (k in arr) {
|
||||||
|
if (arr[k] === arr1[k1]) {
|
||||||
|
// If it reaches here, it was found in at least one array, so try next value
|
||||||
|
continue arr1keys;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
retArr.push(arr1[k1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retArr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a randomly picked number from a maximum, interval, and minimum
|
||||||
|
*
|
||||||
|
* @param int max
|
||||||
|
* @param int step
|
||||||
|
* @param int min
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
var pickRand = function(max, step, min)
|
||||||
|
{
|
||||||
|
max = max || 1000;
|
||||||
|
step = step || 1;
|
||||||
|
min = min || 0;
|
||||||
|
|
||||||
|
var len = Math.round(max / step);
|
||||||
|
return Math.ceil(Math.random() * len) * step - min;
|
||||||
|
};
|
||||||
|
|
||||||
|
var run = function(xdoc, options)
|
||||||
|
{
|
||||||
|
// Get all the form elements
|
||||||
|
var x,
|
||||||
|
attr,
|
||||||
|
itype,
|
||||||
|
self;
|
||||||
|
var elems = xdoc.querySelectorAll("input, select, textarea");
|
||||||
|
var len = elems.length;
|
||||||
|
|
||||||
|
// Remove selections from any option fields
|
||||||
|
var opts = xdoc.querySelectorAll("option");
|
||||||
|
[].forEach.call(opts, function(el) {
|
||||||
|
el.selected = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove checks from radio or checkboxes
|
||||||
|
var chkd = xdoc.querySelectorAll("[checked]");
|
||||||
|
[].forEach.call(chkd, function(el) {
|
||||||
|
el.checked = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
for(x=0; x < len; x++)
|
||||||
|
{
|
||||||
|
self = elems[x];
|
||||||
|
|
||||||
|
// Check for attributes to skip
|
||||||
|
if (self.hasAttribute('readonly') || self.hasAttribute('disabled')) {continue;}
|
||||||
|
|
||||||
|
// Uncheck any elements that fall through
|
||||||
|
if (self.hasAttribute('checked')) { self.checked = false; }
|
||||||
|
|
||||||
|
// Check for pattern attribute
|
||||||
|
if (self.hasAttribute('pattern'))
|
||||||
|
{
|
||||||
|
attr = self.getAttribute('pattern');
|
||||||
|
self.value = new RandExp(attr).gen();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ! Non-input form elements
|
||||||
|
if (self.hasAttribute("type") === false && self.nodeName !== "INPUT")
|
||||||
|
{
|
||||||
|
switch(self.nodeName)
|
||||||
|
{
|
||||||
|
case "TEXTAREA":
|
||||||
|
var txt = new RandExp(patterns.text).gen();
|
||||||
|
self.value = txt;
|
||||||
|
continue;
|
||||||
|
//break;
|
||||||
|
|
||||||
|
case "SELECT":
|
||||||
|
var sel_opts = self.querySelectorAll("option");
|
||||||
|
sel_opts[Math.floor(Math.random() * sel_opts.length)].selected = true;
|
||||||
|
continue;
|
||||||
|
//break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
//break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default pattern for special input types
|
||||||
|
itype = self.getAttribute('type');
|
||||||
|
|
||||||
|
var patt,
|
||||||
|
boxen,
|
||||||
|
boxen_names = {};
|
||||||
|
|
||||||
|
switch(itype)
|
||||||
|
{
|
||||||
|
case "radio":
|
||||||
|
if (boxen_names[self.name] == null)
|
||||||
|
{
|
||||||
|
boxen = array_diff(
|
||||||
|
xdoc.querySelectorAll('input[type=radio][name='+self.name+']'),
|
||||||
|
xdoc.querySelectorAll('[name='+self.name+'][disabled]')
|
||||||
|
);
|
||||||
|
|
||||||
|
boxen[Math.floor(Math.random() * boxen.length)].checked = true;
|
||||||
|
boxen_names[self.name] = true;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
//break;
|
||||||
|
|
||||||
|
case "number":
|
||||||
|
case "range":
|
||||||
|
self.value = pickRand(self.getAttribute('max'), self.getAttribute('step'), self.getAttribute('min'));
|
||||||
|
continue;
|
||||||
|
//break;
|
||||||
|
|
||||||
|
case "checkbox":
|
||||||
|
var chk = Math.round(Math.random());
|
||||||
|
self.checked = chk;
|
||||||
|
continue;
|
||||||
|
//break;
|
||||||
|
|
||||||
|
case "search":
|
||||||
|
case "text":
|
||||||
|
patt = patterns.text;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "hidden":
|
||||||
|
case "button":
|
||||||
|
case "image":
|
||||||
|
case "file":
|
||||||
|
case "password":
|
||||||
|
case "reset":
|
||||||
|
case "submit":
|
||||||
|
continue;
|
||||||
|
//break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (patterns[itype] != null)
|
||||||
|
{
|
||||||
|
patt = patterns[itype];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (patt !== null && patt !== undefined)
|
||||||
|
{
|
||||||
|
var val = new RandExp(patt).gen();
|
||||||
|
self.value = val;
|
||||||
|
if (String(self.value).toLowerCase() != String(val).toLowerCase())
|
||||||
|
{
|
||||||
|
console.log(itype+" : "+val);
|
||||||
|
console.log(self.value);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Run on the main document
|
||||||
|
run(document);
|
||||||
|
|
||||||
|
// Run on frames if they exist
|
||||||
|
var frms = document.querySelectorAll("frame, iframe");
|
||||||
|
var frlen = frms.length;
|
||||||
|
if (frlen > 0)
|
||||||
|
{
|
||||||
|
[].forEach.call(frms, function(frm) {
|
||||||
|
run(frm.contentWindow.document);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}(RandExp));
|
23
src/randexp.min.js
vendored
Normal file
23
src/randexp.min.js
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
(function(w){var b=function(e,h){var c=b.resolve(e,h||"/"),f=b.modules[c];if(!f)throw Error("Failed to resolve module "+e+", tried "+c);return f._cached?f._cached:f()};b.paths=[];b.modules={};b.extensions=[".js",".coffee"];b._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0};b.resolve=function(){return function(e,h){function c(a){if(b.modules[a])return a;for(var g=0;g<b.extensions.length;g++){var n=b.extensions[g];if(b.modules[a+n])return a+n}}function f(a){a=a.replace(/\/+$/,"");var g=a+"/package.json";
|
||||||
|
if(b.modules[g]){var g=b.modules[g](),n=g.browserify;if("object"==typeof n&&n.main){if(g=c(l.resolve(a,n.main)))return g}else if("string"==typeof n){if(g=c(l.resolve(a,n)))return g}else if(g.main&&(g=c(l.resolve(a,g.main))))return g}return c(a+"/index")}h||(h="/");if(b._core[e])return e;var l=b.modules.path(),a=h||".";if(e.match(/^(?:\.\.?\/|\/)/)){var d=c(l.resolve(a,e))||f(l.resolve(a,e));if(d)return d}if(a=function(a,g){var n;"/"===g?n=[""]:n=l.normalize(g).split("/");for(var p=[],q=n.length-1;0<=
|
||||||
|
q;q--)if("node_modules"!==n[q]){var d=n.slice(0,q+1).join("/")+"/node_modules";p.push(d)}for(n=0;n<p.length;n++){q=p[n];if(d=c(q+"/"+a))return d;if(q=f(q+"/"+a))return q}if(d=c(a))return d}(e,a))return a;throw Error("Cannot find module '"+e+"'");}}();b.alias=function(e,h){var c=b.modules.path(),f=null;try{f=b.resolve(e+"/package.json","/")}catch(l){f=b.resolve(e,"/")}for(var c=c.dirname(f),f=(Object.keys||function(a){var g=[],n;for(n in a)g.push(n);return g})(b.modules),a=0;a<f.length;a++){var d=
|
||||||
|
f[a];d.slice(0,c.length+1)===c+"/"?(d=d.slice(c.length),b.modules[h+d]=b.modules[c+d]):d===c&&(b.modules[h]=b.modules[c])}};b.define=function(e,h){var c=b._core[e]?"":b.modules.path().dirname(e),f=function(a){return b(a,c)};f.resolve=function(a){return b.resolve(a,c)};f.modules=b.modules;f.define=b.define;var l={exports:{}};b.modules[e]=function(){return b.modules[e]._cached=l.exports,h.call(l.exports,f,l,l.exports,c,e),b.modules[e]._cached=l.exports,l.exports}};"undefined"==typeof process&&(process=
|
||||||
|
{});process.nextTick||(process.nextTick=function(){var e=[],b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;return b&&window.addEventListener("message",function(c){c.source===window&&"browserify-tick"===c.data&&(c.stopPropagation(),0<e.length&&e.shift()())},!0),function(c){b?(e.push(c),window.postMessage("browserify-tick","*")):setTimeout(c,0)}}());process.title||(process.title="browser");process.binding||(process.binding=function(e){if("evals"===e)return b("vm");throw Error("No such module");
|
||||||
|
});process.cwd||(process.cwd=function(){return"."});b.define("path",function(b,h,c,f,l){function a(a,n){for(var p=[],c=0;c<a.length;c++)n(a[c],c,a)&&p.push(a[c]);return p}function d(a,c){for(var p=0,d=a.length;0<=d;d--){var b=a[d];"."==b?a.splice(d,1):".."===b?(a.splice(d,1),p++):p&&(a.splice(d,1),p--)}if(c)for(;p--;p)a.unshift("..");return a}var s=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;c.resolve=function(){for(var g="",c=!1,p=arguments.length;-1<=p&&!c;p--){var b=0<=p?arguments[p]:process.cwd();
|
||||||
|
"string"==typeof b&&b&&(g=b+"/"+g,c="/"===b.charAt(0))}return g=d(a(g.split("/"),function(a){return!!a}),!c).join("/"),(c?"/":"")+g||"."};c.normalize=function(c){var b="/"===c.charAt(0),p="/"===c.slice(-1);return c=d(a(c.split("/"),function(a){return!!a}),!b).join("/"),!c&&!b&&(c="."),c&&p&&(c+="/"),(b?"/":"")+c};c.join=function(){var d=Array.prototype.slice.call(arguments,0);return c.normalize(a(d,function(a,c){return a&&"string"==typeof a}).join("/"))};c.dirname=function(a){return(a=s.exec(a)[1]||
|
||||||
|
"")?1===a.length?a:a.substring(0,a.length-1):"."};c.basename=function(a,c){var d=s.exec(a)[2]||"";return c&&d.substr(-1*c.length)===c&&(d=d.substr(0,d.length-c.length)),d};c.extname=function(a){return s.exec(a)[3]||""}});b.define("/node_modules/ret/package.json",function(b,h,c,f,l){h.exports={main:"./lib/index.js"}});b.define("/node_modules/ret/lib/index.js",function(b,h,c,f,l){var a=b("./util"),d=b("./types"),s=b("./sets"),g=b("./positions");h.exports=function(c){var b=0,e,m,r={type:d.ROOT,stack:[]},
|
||||||
|
t=r,k=r.stack,B=[],h=function(b){a.error(c,"Nothing to repeat at column "+(b-1))},f=a.strToChars(c);for(e=f.length;b<e;)switch(m=f[b++],m){case "\\":m=f[b++];switch(m){case "b":k.push(g.wordBoundary());break;case "B":k.push(g.nonWordBoundary());break;case "w":k.push(s.words());break;case "W":k.push(s.notWords());break;case "d":k.push(s.ints());break;case "D":k.push(s.notInts());break;case "s":k.push(s.whitespace());break;case "S":k.push(s.notWhitespace());break;default:/\d/.test(m)?k.push({type:d.REFERENCE,
|
||||||
|
value:parseInt(m,10)}):k.push({type:d.CHAR,value:m.charCodeAt(0)})}break;case "^":k.push(g.begin());break;case "$":k.push(g.end());break;case "[":var l;"^"===f[b]?(l=!0,b++):l=!1;m=a.tokenizeClass(f.slice(b),c);b+=m[1];k.push({type:d.SET,set:m[0],not:l});break;case ".":k.push(s.anyChar());break;case "(":var v={type:d.GROUP,stack:[],remember:!0};m=f[b];"?"===m&&(m=f[b+1],b+=2,"="===m?v.followedBy=!0:"!"===m?v.notFollowedBy=!0:":"!==m&&a.error(c,"Invalid character '"+m+"' after '?' at column "+(b-1)),
|
||||||
|
v.remember=!1);k.push(v);B.push(t);t=v;k=v.stack;break;case ")":0===B.length&&a.error(c,"Unmatched ) at column "+(b-1));t=B.pop();k=t.options?t.options[t.options.length-1]:t.stack;break;case "|":t.options||(t.options=[t.stack],delete t.stack);k=[];t.options.push(k);break;case "{":m=/^(\d+)(,(\d+)?)?\}/.exec(f.slice(b));var C,E;null!==m?(C=parseInt(m[1],10),E=m[2]?m[3]?parseInt(m[3],10):Infinity:C,b+=m[0].length,k.push({type:d.REPETITION,min:C,max:E,value:k.pop()})):k.push({type:d.CHAR,value:123});
|
||||||
|
break;case "?":0===k.length&&h(b);k.push({type:d.REPETITION,min:0,max:1,value:k.pop()});break;case "+":0===k.length&&h(b);k.push({type:d.REPETITION,min:1,max:Infinity,value:k.pop()});break;case "*":0===k.length&&h(b);k.push({type:d.REPETITION,min:0,max:Infinity,value:k.pop()});break;default:k.push({type:d.CHAR,value:m.charCodeAt(0)})}return r};h.exports.types=d});b.define("/node_modules/ret/lib/util.js",function(b,h,c,f,l){var a=b("./types"),d=b("./sets"),s={0:0,t:9,n:10,v:11,f:12,r:13},g=h.exports=
|
||||||
|
{strToChars:function(a){return a=a.replace(/(\[\\b\])|\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z\[\\\]\^?])|([0tnvfr]))/g,function(a,b,c,r,d,k,g){a=b?8:c?parseInt(c,16):r?parseInt(r,16):d?parseInt(d,8):k?"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?".indexOf(k):g?s[g]:w;a=String.fromCharCode(a);return/[\[\]{}\^$.|?*+()]/.test(a)&&(a="\\"+a),a}),a},tokenizeClass:function(c,b){for(var e=[],f=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g,r;null!=(r=f.exec(c));)if(r[1])e.push(d.words());
|
||||||
|
else if(r[2])e.push(d.ints());else if(r[3])e.push(d.whitespace());else if(r[4])e.push(d.notWords());else if(r[5])e.push(d.notInts());else if(r[6])e.push(d.notWhitespace());else if(r[7])e.push({type:a.RANGE,from:(r[8]||r[9]).charCodeAt(0),to:r[10].charCodeAt(0)});else{if(!(r=r[12]))return[e,f.lastIndex];e.push({type:a.CHAR,value:r.charCodeAt(0)})}g.error(b,"Missing ']'")},error:function(a,c){throw Error("Invalid regular expression: /"+a+"/: "+c);}}});b.define("/node_modules/ret/lib/types.js",function(b,
|
||||||
|
h,c,f,l){h.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});b.define("/node_modules/ret/lib/sets.js",function(b,h,c,f,l){var a=b("./types"),d=function(){return[{type:a.RANGE,from:48,to:57}]},s=function(){return[{type:a.RANGE,from:97,to:122},{type:a.RANGE,from:65,to:90}].concat(d())},g=function(){return[{type:a.CHAR,value:12},{type:a.CHAR,value:10},{type:a.CHAR,value:13},{type:a.CHAR,value:9},{type:a.CHAR,value:11},{type:a.CHAR,value:160},{type:a.CHAR,value:5760},
|
||||||
|
{type:a.CHAR,value:6158},{type:a.CHAR,value:8192},{type:a.CHAR,value:8193},{type:a.CHAR,value:8194},{type:a.CHAR,value:8195},{type:a.CHAR,value:8196},{type:a.CHAR,value:8197},{type:a.CHAR,value:8198},{type:a.CHAR,value:8199},{type:a.CHAR,value:8200},{type:a.CHAR,value:8201},{type:a.CHAR,value:8202},{type:a.CHAR,value:8232},{type:a.CHAR,value:8233},{type:a.CHAR,value:8239},{type:a.CHAR,value:8287},{type:a.CHAR,value:12288}]};c.words=function(){return{type:a.SET,set:s(),not:!1}};c.notWords=function(){return{type:a.SET,
|
||||||
|
set:s(),not:!0}};c.ints=function(){return{type:a.SET,set:d(),not:!1}};c.notInts=function(){return{type:a.SET,set:d(),not:!0}};c.whitespace=function(){return{type:a.SET,set:g(),not:!1}};c.notWhitespace=function(){return{type:a.SET,set:g(),not:!0}};c.anyChar=function(){return{type:a.SET,set:[{type:a.CHAR,value:10}],not:!0}}});b.define("/node_modules/ret/lib/positions.js",function(b,h,c,f,l){var a=b("./types");c.wordBoundary=function(){return{type:a.POSITION,value:"b"}};c.nonWordBoundary=function(){return{type:a.POSITION,
|
||||||
|
value:"B"}};c.begin=function(){return{type:a.POSITION,value:"^"}};c.end=function(){return{type:a.POSITION,value:"$"}}});b.define("/randexp.js",function(b,h,c,f,l){var a=b("ret"),d=a.types,s=function(a){return a+(97<=a&&122>=a?-32:65<=a&&90>=a?32:0)},g=function(a,b,c,d){return a<=c&&c<=b?{from:c,to:Math.min(b,d)}:a<=d&&d<=b?{from:Math.max(a,c),to:d}:!1},n=function(a,b,c){for(var e,f,h=[],m=!1,l=0,p=a.length;l<p;l++)switch(e=a[l],e.type){case d.CHAR:f=e.value;if(f===b||c&&s(f)===b)return!0;break;case d.RANGE:if(e.from<=
|
||||||
|
b&&b<=e.to||c&&(!1!==(f=g(97,122,e.from,e.to))&&f.from<=b&&b<=f.to||!1!==(f=g(65,90,e.from,e.to))&&f.from<=b&&b<=f.to))return!0;break;case d.SET:var q;if(q=0<h.length)a:{q=h;for(var w=e,D=0,G=q.length;D<G;D++){var x=q[D],u;if(u=x.not!==w.not)b:{x=x.set;u=w.set;var y=void 0,F=void 0,z=void 0,A=void 0;if((F=x.length)!==u.length)u=!1;else{for(y=0;y<F;y++)for(z in A=x[y],A)if(A.hasOwnProperty(z)&&A[z]!==u[y][z]){u=!1;break b}u=!0}}if(u){q=!0;break a}}q=!1}q?m=!0:h.push(e);if(!m&&n(e.set,b,c)!==e.not)return!0}return!1},
|
||||||
|
p=function(a,b,c){var e,f,g,h;switch(a.type){case d.ROOT:case d.GROUP:if(a.notFollowedBy)return"";a.remember&&(e=b.push(!0)-1);f=a.options?a.options[Math.floor(Math.random()*a.options.length)]:a.stack;c="";g=0;for(h=f.length;g<h;g++)c+=p.call(this,f[g],b);return a.remember&&(b[e]=c),c;case d.POSITION:return"";case d.SET:e=!!c!==a.not;if(!e)return p.call(this,a.set[Math.floor(Math.random()*a.set.length)],b,e);for(;;)if(b=this.anyRandChar(),e=b.charCodeAt(0),!n(a.set,e,this.ignoreCase))return b;break;
|
||||||
|
case d.RANGE:return a=a.from+Math.floor(Math.random()*(1+a.to-a.from)),String.fromCharCode(this.ignoreCase&&0.5<Math.random()?s(a):a);case d.REPETITION:e=a.min+Math.floor(Math.random()*(1+(Infinity===a.max?a.min+this.max:a.max)-a.min));c="";for(g=0;g<e;g++)c+=p.call(this,a.value,b);return c;case d.REFERENCE:return b[a.value-1];case d.CHAR:return String.fromCharCode(this.ignoreCase&&0.5<Math.random()?s(a.value):a.value)}},q=h.exports=function(b,c){if(b instanceof RegExp)this.ignoreCase=b.ignoreCase,
|
||||||
|
this.multiline=b.multiline,"number"==typeof b.max&&(this.max=b.max),"function"==typeof b.anyRandChar&&(this.anyRandChar=b.anyRandChar),b=b.source;else{if("string"!=typeof b)throw Error("Expected a regexp or string");this.ignoreCase=c&&-1!==c.indexOf("i");this.multiline=c&&-1!==c.indexOf("m")}this.tokens=a(b)};q.prototype.max=100;q.prototype.anyRandChar=function(){return String.fromCharCode(0+Math.floor(65536*Math.random()))};q.prototype.gen=function(){return p.call(this,this.tokens,[])};var m=q.randexp=
|
||||||
|
function(a,b){var c;return a._randexp===w?(c=new q(a,b),a._randexp=c):(c=a._randexp,"number"==typeof a.max&&(c.max=a.max),"function"==typeof a.anyRandChar&&(c.anyRandChar=a.anyRandChar)),c.gen()};q.sugar=function(){RegExp.prototype.gen=function(){return m(this)}}});!function(b,h){"function"==typeof define&&"object"==typeof define.amd?define(b,function(){return h}):"undefined"!=typeof window&&(window[b]=h)}("RandExp",b("/randexp.js"))})();
|
192
test/index.html
Normal file
192
test/index.html
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test</title>
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset, iframe {
|
||||||
|
display:inline-block;
|
||||||
|
vertical-align:top;
|
||||||
|
text-align:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
width:90%;
|
||||||
|
margin:0 auto;
|
||||||
|
min-height:500px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Form Filler/Fuzzer Test</h1>
|
||||||
|
<iframe src="inner_form.html"></iframe>
|
||||||
|
<form action="test_form.html" method="get" id="html5_form">
|
||||||
|
<fieldset>
|
||||||
|
<legend>HTML5 Miscellaneous Input Types</legend>
|
||||||
|
<dl>
|
||||||
|
<dt><label for="color">Color (Hex Format)</label></dt>
|
||||||
|
<dd><input type="color" name="color" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="email">Email</label></dt>
|
||||||
|
<dd><input type="email" name="email"/></dd>
|
||||||
|
|
||||||
|
<dt><label for="number">Number</label></dt>
|
||||||
|
<dd><input type="number" min="0" max="100" step="5" name="number" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="range">Range</label></dt>
|
||||||
|
<dd><input type="range" min="0" max="250" step="10" name="range" value="30" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="search">Search</label></dt>
|
||||||
|
<dd><input type="search" name="search" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="tel">Tel</label></dt>
|
||||||
|
<dd><input type="tel" name="tel" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="url">URL</label></dt>
|
||||||
|
<dd><input type="url" name="url" /></dd>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>HTML5 Date/Time Input Types</legend>
|
||||||
|
<dl>
|
||||||
|
<dt><label for="date">Date</label></dt>
|
||||||
|
<dd><input type="date" name="date" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="datetime">Date Time</label></dt>
|
||||||
|
<dd><input type="datetime" name="datetime" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="datetime-local">Date Time Local</label></dt>
|
||||||
|
<dd><input type="datetime-local" name="datetime-local" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="month">Month</label></dt>
|
||||||
|
<dd><input type="month" name="month"/></dd>
|
||||||
|
|
||||||
|
<dt><label for="week">Week</label></dt>
|
||||||
|
<dd><input type="week" name="week"/></dd>
|
||||||
|
|
||||||
|
<dt><label for="time">Time</label></dt>
|
||||||
|
<dd><input type="time" name="time"/></dd>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Traditional Form Elements</legend>
|
||||||
|
<dl>
|
||||||
|
<dt><label for="select">Select</label></dt>
|
||||||
|
<dd>
|
||||||
|
<select id="select" name="select">
|
||||||
|
<option value="0">Option 0</option>
|
||||||
|
<option value="1">Option 1</option>
|
||||||
|
<option value="2">Option 2</option>
|
||||||
|
</select>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt><label for="select_opt">Select with optgroup</label></dt>
|
||||||
|
<dd>
|
||||||
|
<select id="select_opt" name="select_opt">
|
||||||
|
<option value="1">Option 1</option>
|
||||||
|
<option value="2">Option 2</option>
|
||||||
|
<optgroup label="foo.foo">
|
||||||
|
<option value="foo1">Foo 1</option>
|
||||||
|
<option value="foo2">Foo 2</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="bar">
|
||||||
|
<option value="3">Option 3</option>
|
||||||
|
<option value="4">Option 4</option>
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt><label for="multiple">Select with Multiple attribute</label></dt>
|
||||||
|
<dd>
|
||||||
|
<select id="multiple" name="multiple" multiple="multiple">
|
||||||
|
<option>Foo</option>
|
||||||
|
<option>Bar</option>
|
||||||
|
<option>Baz</option>
|
||||||
|
</select>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt><label for="textarea">Textarea</label></dt>
|
||||||
|
<dd>
|
||||||
|
<textarea rows="10" cols="40" id="textarea" name="textarea"></textarea>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Traditional Input Types</legend>
|
||||||
|
<dl>
|
||||||
|
<dt><label for="checkbox">Checkbox</label></dt>
|
||||||
|
<dd>
|
||||||
|
<input type="checkbox" name="check" id="checkbox1" value="checked"/>
|
||||||
|
<input type="checkbox" name="check" id="checkbox2" value="checked"/>
|
||||||
|
<input type="checkbox" name="check" id="checkbox3" value="checked"/>
|
||||||
|
<br/>
|
||||||
|
<input type="checkbox" name="check" id="checkbox4" value="checked"/>
|
||||||
|
<input type="checkbox" name="check" id="checkbox5" value="checked"/>
|
||||||
|
<input type="checkbox" name="check" id="checkbox6" value="checked"/>
|
||||||
|
<br />
|
||||||
|
<input type="checkbox" name="check" id="checkbox7" value="checked"/>
|
||||||
|
<input type="checkbox" name="check" id="checkbox8" value="checked"/>
|
||||||
|
<input type="checkbox" name="check" id="checkbox9" value="checked"/>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt><label for="hidden_input">Hidden (not html5 hidden attribute)</label></dt>
|
||||||
|
<dd><input type="hidden" id="hidden_input" name="hidden_input" value="hidden value" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="password">Password</label></dt>
|
||||||
|
<dd><input type="password" name="password" /></dd>
|
||||||
|
|
||||||
|
<dt>Radio</dt>
|
||||||
|
<dd>
|
||||||
|
<label for="radio1">Option 1:</label>
|
||||||
|
<input type="radio" name="rad" id="radio1" value="1" />
|
||||||
|
<br />
|
||||||
|
<label for="radio2">Option 2:</label>
|
||||||
|
<input type="radio" name="rad" id="radio2" value="2" />
|
||||||
|
<br />
|
||||||
|
<label for="radio3">Option 3:</label>
|
||||||
|
<input type="radio" name="rad" id="radio3" value="3" disabled="disabled" />
|
||||||
|
<br />
|
||||||
|
<label for="radio2">Option 4:</label>
|
||||||
|
<input type="radio" name="rad" id="radio2" value="4" />
|
||||||
|
<br />
|
||||||
|
<label for="radio2">Option 5:</label>
|
||||||
|
<input type="radio" name="rad" id="radio2" value="5" readonly="readonly" />
|
||||||
|
<br />
|
||||||
|
<label for="radio2">Option 7:</label>
|
||||||
|
<input type="radio" name="rad" id="radio2" value="7" />
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt><label for="readonly">Readonly</label></dt>
|
||||||
|
<dd><input type="text" readonly="readonly" name="readonly" value="Readonly" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="reset">Reset</label></dt>
|
||||||
|
<dd><input type="reset" value="Reset" name="reset" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="submit">Submit</label></dt>
|
||||||
|
<dd><input type="submit" value="submit" name="submit" form="html5_form" /></dd>
|
||||||
|
|
||||||
|
<dt><label for="text">Text</label></dt>
|
||||||
|
<dd><input type="text" name="text" /></dd>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function DST(src)
|
||||||
|
{
|
||||||
|
var s = document.createElement('script');
|
||||||
|
s.src = src;
|
||||||
|
s.async = false;
|
||||||
|
document.querySelector('body').appendChild(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector('iframe').onload = function() {
|
||||||
|
DST('../src/randexp.min.js');
|
||||||
|
DST('../src/LazyFormFuzz-src.js');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
98
test/inner_form.html
Normal file
98
test/inner_form.html
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test</title>
|
||||||
|
<style type="text/css">
|
||||||
|
body {text-align:center}
|
||||||
|
fieldset {width:auto; display:inline-block; vertical-align:top; text-align:left}
|
||||||
|
label {vertical-align:top}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Form Filler/Fuzzer Frame Test</h1>
|
||||||
|
<form action="inner_form.html" method="get" id="html5_form2">
|
||||||
|
<fieldset>
|
||||||
|
<legend>HTML5 Miscellaneous Input Types</legend>
|
||||||
|
<label>Color (Hex Format) <input type="color" name="color2" /></label><br />
|
||||||
|
<label>Email <input type="email" name="email2"/></label><br />
|
||||||
|
<label>Number <input type="number" min="0" max="100" step="5" name="number2" /></label><br />
|
||||||
|
<label>Range <input type="range" min="0" max="250" step="10" name="range2" value="30" /></label><br />
|
||||||
|
<label>Search <input type="search" name="search2" /></label><br />
|
||||||
|
<label>Tel <input type="tel" name="tel2" /></label><br />
|
||||||
|
<label>URL <input type="url" name="url2" /></label>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>HTML5 Date/Time Input Types</legend>
|
||||||
|
<label>Date <input type="date" name="date2" /></label><br />
|
||||||
|
<label>Date Time <input type="datetime" name="datetime2" /></label><br />
|
||||||
|
<label>Date Time Local <input type="datetime-local" name="datetime-local2" /></label><br />
|
||||||
|
<label>Month <input type="month" name="month2"/></label><br />
|
||||||
|
<label>Week <input type="week" name="week2"/></label><br />
|
||||||
|
<label>Time <input type="time" name="tim2e"/></label>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Traditional Form Elements</legend>
|
||||||
|
<label>Select
|
||||||
|
<select name="select2">
|
||||||
|
<option value="0">Option 0</option>
|
||||||
|
<option value="1">Option 1</option>
|
||||||
|
<option value="2">Option 2</option>
|
||||||
|
</select>
|
||||||
|
</label><br />
|
||||||
|
<label>Select with optgroup
|
||||||
|
<select name="select_op2t">
|
||||||
|
<option value="1">Option 1</option>
|
||||||
|
<option value="2">Option 2</option>
|
||||||
|
<optgroup label="foo.foo">
|
||||||
|
<option value="foo1">Foo 1</option>
|
||||||
|
<option value="foo2">Foo 2</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="bar">
|
||||||
|
<option value="3">Option 3</option>
|
||||||
|
<option value="4">Option 4</option>
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
</label><br />
|
||||||
|
<label>Select with Multiple attribute
|
||||||
|
<select name="multiple2" multiple="multiple">
|
||||||
|
<option>Foo</option>
|
||||||
|
<option>Bar</option>
|
||||||
|
<option>Baz</option>
|
||||||
|
</select>
|
||||||
|
</label><br />
|
||||||
|
<label>Textarea
|
||||||
|
<textarea rows="10" cols="40" name="textarea2"></textarea>
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Traditional Input Types</legend>
|
||||||
|
<label>Checkbox </label><br />
|
||||||
|
<input type="checkbox" name="check2" id="checkbox1" value="checked"/>
|
||||||
|
<input type="checkbox" name="check2" id="checkbox2" value="checked"/>
|
||||||
|
<input type="checkbox" name="check2" id="checkbox3" value="checked"/>
|
||||||
|
<br/>
|
||||||
|
<input type="checkbox" name="check2" id="checkbox4" value="checked"/>
|
||||||
|
<input type="checkbox" name="check2" id="checkbox5" value="checked"/>
|
||||||
|
<input type="checkbox" name="check2" id="checkbox6" value="checked"/>
|
||||||
|
<br />
|
||||||
|
<input type="checkbox" name="check2" id="checkbox7" value="checked"/>
|
||||||
|
<input type="checkbox" name="check2" id="checkbox8" value="checked"/>
|
||||||
|
<input type="checkbox" name="check2" id="checkbox9" value="checked"/>
|
||||||
|
<br />
|
||||||
|
<label>Hidden (not html5 hidden attribute)<input type="hidden" id="hidden_input" name="hidden_input" value="hidden value" /></label><br />
|
||||||
|
<label>Password <input type="password" name="password" /></label><br />
|
||||||
|
<label>Option 1: <input type="radio" name="rad2" id="radio12" value="1" /></label><br />
|
||||||
|
<label>Option 2: <input type="radio" name="rad2" id="radio22" value="2" /></label><br />
|
||||||
|
<label>Option 3: <input type="radio" name="rad2" id="radio32" value="3" disabled="disabled" /></label><br />
|
||||||
|
<label>Option 4: <input type="radio" name="rad2" id="radio42" value="4" /></label><br />
|
||||||
|
<label>Option 5: <input type="radio" name="rad2" id="radio52" value="5" /></label><br />
|
||||||
|
<label>Option 7: <input type="radio" name="rad2" id="radio72" value="7" />
|
||||||
|
</label><br />
|
||||||
|
<label>Readonly <input type="text" readonly="readonly" name="readonly2" value="Readonly" /></label><br />
|
||||||
|
<input type="reset" value="Reset" name="reset2" /><br />
|
||||||
|
<input type="submit" value="submit" name="submit2" form="html5_form" /><br />
|
||||||
|
<label>Text <input type="text" name="text2" /></label><br />
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user