如何使用包含新行和回车的正则表达式选择子串

时间:2014-02-12 06:27:34

标签: regex python-2.7

我有以下字符串,我想使用正则表达式选择子字符串。

在名为 challenge 的字符串中定义了函数,我想使用正则表达式选择整个函数。我试过以下正则表达式:
功能挑战(。*)

此正则表达式选择在正则表达式中提到的文本之后和 var c = 1229462601 行之前开始的字符串。原因是有一个新行(\ n)字符以及回车符(\ t)和不会选择换行符和回车符。

我已经尝试了功能挑战([。 \ s ] *),但这也不行。请我修复正则表达式。
P.S我正在使用Python和正则表达式应该在Python中工作。

由于

<html><head><meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="-1"/>
<meta http-equiv="CacheControl" content="no-cache"/>
<script language="JavaScript">
<!-- 
_efoxy_ = { 
    enabled : 1,
    func    : "challenge()",
    name    : "TS0140436f_76",
    value   : "00013488b557364dd69c0052f8952a00001c2079723852d9a44bf0d8225069cf065e200fcaeffa",
    storage : {
        local  : { enabled : 1 },
        wname  : { enabled : 1 },
        cookie : { enabled : 1 },
        websql : { enabled : 1 }
    }
}; 
//-->
</script>
<script language="JavaScript">
<!--
if(typeof _efoxy_=="undefined"){_efoxy_={}}(function(p,c){var efoxy={enabled:true,debug:false,storages:[],storage:{local:{enabled:true},wname:{enabled:true},cookie:{enabled:true},websql:{enabled:true,result:{}}}};efoxy.log=function(string){if(efoxy.debug){if(typeof console!="undefined"){console.log(string)}else{alert(string)}}};efoxy.evaluateUserFunction=function(){if(p.func&&typeof p.func!=="undefined"){try{eval(p.func)}catch(e){}}};efoxy.init=function(){var i=0;if(!_efoxy_.enabled){efoxy.enabled=false;return false}if(!efoxy.enabled){return false}efoxy.storages[i++]=efoxy.storage.local;efoxy.storages[i++]=efoxy.storage.wname;efoxy.storages[i++]=efoxy.storage.cookie;efoxy.storage.init();efoxy.log("localStorage: "+efoxy.storage.local.enabled);efoxy.log("window.name: "+efoxy.storage.wname.enabled);efoxy.log("cookie: "+efoxy.storage.cookie.enabled);efoxy.log("webSQL: "+efoxy.storage.websql.enabled);if(!efoxy.storage.enabled()){efoxy.enabled=false;return false}return true};efoxy.servertime=function(){var name=_efoxy_.name;var value=_efoxy_.value;var obj=efoxy.deserialize(value);var servertime=obj.timestamp;return servertime};efoxy.get_random=function(flag,length){var random_number=0;var random_value="";for(var i=0;i<length;i++){random_number=Math.floor((Math.random()*10));if((random_number%2)!=flag){random_number++;random_number=(random_number%10)}random_value+=(""+random_number)}return random_value};efoxy.storage.local.init=function(){if(!localStorage){efoxy.storage.local.enabled=false}if(!(p.storage.local.enabled)){efoxy.storage.local.enabled=false}};efoxy.storage.local.get=function(name){if(!efoxy.storage.local.enabled){return false}if(!localStorage[name]){return false}return localStorage.getItem(name)};efoxy.storage.local.set=function(name,value){if(!efoxy.storage.local.enabled){return false}if(localStorage[name]){localStorage.removeItem(name)}localStorage.setItem(name,value);if(localStorage[name]!=value){efoxy.storage.local.enabled=false;return false}return true};efoxy.storage.wname.init=function(){if(window.name==="undefined"){efoxy.storage.wname.enabled=false}if(!(p.storage.wname.enabled)){efoxy.storage.wname.enabled=false}if(window.name!=""){if(window.name.indexOf(p.name)==-1){efoxy.storage.wname.enabled=false}}};efoxy.storage.wname.get=function(name){if(!efoxy.storage.wname.enabled){return false}if(!window.name){return false}var a=window.name.split("#");for(var i=0;i<a.length;i++){var n=a[i].split("=");if(n[0]==name){return n[1]}}return false};efoxy.storage.wname.set=function(name,value){if(!efoxy.storage.wname.enabled){return false}if(name.indexOf("#")!=-1){return false}var a=window.name.split("#");for(var i=0;i<a.length;i++){var n=a[i].split("=");if(n[0]==name){a[i]=name+"="+value;break}}if(i==a.length){a[i]=name+"="+value}window.name=a.join("#");if(efoxy.storage.wname.get(name)!=value){efoxy.storage.wname.enabled=false;return false}return true};efoxy.storage.cookie.init=function(){if(efoxy.setcookie("test","test")){efoxy.storage.cookie.enabled=true}else{efoxy.storage.cookie.enabled=false}if(!(p.storage.cookie.enabled)){efoxy.storage.cookie.enabled=false}efoxy.setcookie("test","test",-1)};efoxy.storage.cookie.get=function(name){var server_value=p.value;if(!efoxy.storage.cookie.enabled){return false}var value=efoxy.getcookie(name);if(!value){return false}value=value.substring(0,server_value.length);return value};efoxy.storage.cookie.set=function(name,value){var server_value=p.value;var created_value=server_value;if(!efoxy.storage.cookie.enabled){return false}var cookie_value=efoxy.getcookie(name);if(cookie_value){created_value=cookie_value.substring(server_value.length*2)}var obj=efoxy.deserialize(server_value);efoxy.setcookie(name,value+server_value+created_value,obj.validtime);return true};efoxy.storage.websql.init=function(){if(!window.openDatabase){efoxy.storage.websql.enabled=false;return}if(!(p.storage.websql.enabled)){efoxy.storage.websql.enabled=false;return}try{efoxy.storage.websql.db=openDatabase("efoxy_db","1.0","efoxy database",1024);efoxy.storage.websql.db.transaction(function(t){t.executeSql("CREATE TABLE IF NOT EXISTS efoxy (name unique, value)")})}catch(e){efoxy.storage.websql.enabled=false}};efoxy.storage.websql.get=function(name){if(!efoxy.storage.websql.enabled){return false}if(!efoxy.storage.websql.db){efoxy.storage.websql.enabled=false;return false}try{var sqlQuery="SELECT name, value FROM efoxy WHERE name = ?";efoxy.storage.websql.db.transaction(function(t){t.executeSql(sqlQuery,[name],efoxy.storage.websql.result.get,efoxy.storage.websql.result.error)})}catch(e){efoxy.storage.websql.enabled=false;return false}return true};efoxy.storage.websql.set=function(name,value){if(!efoxy.storage.websql.enabled){return false}if(!efoxy.storage.websql.db){efoxy.storage.websql.enabled=false;return false}try{var sqlQuery="REPLACE INTO efoxy (name, value) VALUES (?, ?)";efoxy.storage.websql.db.transaction(function(t){t.executeSql(sqlQuery,[name,value],efoxy.storage.websql.result.set,efoxy.storage.websql.result.error)})}catch(e){efoxy.storage.websql.enabled=false;return false}return true};efoxy.storage.websql.result.get=function(tx,result){var name=_efoxy_.name;var value=_efoxy_.value;if(result.rows.length>0){var values=[];values[0]=efoxy.storage.value;values[1]=result.rows.item(0).value;var id=efoxy.storage.scan(values);if((id>=0)&&(values[id])){value=values[id];efoxy.storage.value=value;name=result.rows.item(0).name}}efoxy.storage.clone(name,value)};efoxy.storage.websql.result.set=function(tx,result){efoxy.evaluateUserFunction()};efoxy.storage.websql.result.error=function(tx,err){efoxy.log("efoxy.storage.websql.result.error: "+err.message);efoxy.storage.websql.enabled=false;efoxy.evaluateUserFunction()};efoxy.storage.init=function(){for(var i=0;i<efoxy.storages.length;i++){efoxy.storages[i].init()}efoxy.storage.websql.init();efoxy.storage.inconsistency=0};efoxy.storage.get=function(name){var values=[];for(var i=0;i<efoxy.storages.length;i++){var s=efoxy.storages[i];if(s.enabled){values[i]=s.get(name)}}if(values.length==0){return false}return values};efoxy.storage.set=function(name,value){for(var i=0;i<efoxy.storages.length;i++){efoxy.storages[i].set(name,value)}};efoxy.storage.enabled=function(){var enabled=false;for(var i=0;i<efoxy.storages.length;i++){if(efoxy.storages[i].enabled){return true}}if(efoxy.storage.websql.enabled){return true}};efoxy.storage.scan=function(values){var sid=0,inconsistency=0;var lifetime=0,servertime=0;var id=-1,t=0;if(!values){return id}for(var i=0;i<values.length;i++){if(!values[i]){continue}if(efoxy.checksum(values[i])==false){efoxy.storage.inconsistency=1;continue}obj=efoxy.deserialize(values[i]);lifetime=efoxy.servertime()-obj.timestamp;if(lifetime<=obj.validtime){if(obj.timestamp>t){t=obj.timestamp;id=i}if(sid&&sid!=obj.sid){efoxy.storage.inconsistency=1}sid=obj.sid}}return id};efoxy.storage.clone=function(name,value){var server_value=p.value;efoxy.log("server_value: "+server_value);efoxy.log("clone: "+name+"="+value);if(efoxy.checksum(value)==false){value=server_value;efoxy.storage.inconsistency=1}var param_value=efoxy.get_random(efoxy.storage.inconsistency,4)+value+server_value;var f=document.forms[0];if(f){for(var i=0;i<f.elements.length;i++){if(f.elements[i].name==name){f.elements[i].value=param_value;break}}if(i==f.elements.length){var e=document.createElement("input");e.type="hidden";e.name=name;e.value=param_value;f.appendChild(e)}}efoxy.storage.set(name,value);if(efoxy.storage.websql.enabled){efoxy.storage.websql.set(name,value)}else{efoxy.evaluateUserFunction()}};efoxy.crc=function(string){var table="00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";var crc=0;crc=crc^(-1);for(var i=0;i<string.length;i++){crc=(crc>>8)^("0x"+table.substr(((crc^string.charCodeAt(i))&255)*9,8))}crc=crc^(-1);crc=Math.abs(crc);return crc};efoxy.checksum=function(value){var server_value=p.value;if(value.length!=server_value.length){return false}obj=efoxy.deserialize(value);return(obj.checksum==efoxy.crc(value.substring(0,value.length-8)))};efoxy.deserialize=function(value){var obj={version:0,sid:0,has_session:0,timestamp:0,validtime:0,signature:0,checksum:0};var size=[4,16,2,8,8,32,8];var off=0,i=0;if(!value){return obj}obj.version=parseInt(value.substring(off,off+size[i]),16);off+=size[i];i++;obj.sid=parseInt(value.substring(off,off+size[i]),16);off+=size[i];i++;obj.has_session=parseInt(value.substring(off,off+size[i]),16);off+=size[i];i++;obj.timestamp=parseInt(value.substring(off,off+size[i]),16);off+=size[i];i++;obj.validtime=parseInt(value.substring(off,off+size[i]),16);off+=size[i];i++;obj.signature=parseInt(value.substring(off,off+size[i]),16);off+=size[i];i++;obj.checksum=parseInt(value.substring(off,off+size[i]),16);off+=size[i];return obj};efoxy.getcookie=function(name){var n,v,cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){n=cookies[i].substr(0,cookies[i].indexOf("="));v=cookies[i].substr(cookies[i].indexOf("=")+1);n=n.replace(/^\s+|\s+$/g,"");if(n==name){return unescape(v)}}return false};efoxy.setcookie=function(name,value,expire){var expire_string="";if(expire){var d=new Date();d.setTime(d.getTime()+(expire*1000));expire_string+="; expires="+d.toUTCString()}document.cookie=name+"="+value+expire_string;return efoxy.getcookie(name)};var run=function(){if(!efoxy.init()){efoxy.evaluateUserFunction();return}var name=p.name;var value=p.value;var values=efoxy.storage.get(name);var id=efoxy.storage.scan(values);if((values)&&(id>=0)&&(values[id])){value=values[id];efoxy.storage.value=value;efoxy.storage.clone(name,value);return}if(efoxy.storage.websql.enabled){if(!efoxy.storage.websql.get(name)){efoxy.storage.clone(name,value)}return}efoxy.storage.clone(name,value)};if(p.name!=undefined){if(!!window.addEventListener){window.addEventListener("load",run,false)}else{if(!!window.attachEvent){window.attachEvent("onload",run)}else{window.onload=run}}}})(_efoxy_);
//-->
</script>
<script type="text/javascript">
function decode_string(in_str) { return decodeURIComponent(in_str); }
function decode_action() {var f = document.forms[0];if (f.attributes['action'] != undefined) {f.attributes['action'].value = decode_string(f.attributes['action'].value);} else { f.action = decode_string(f.action);}}function submit_form() {var e = document.forms[0].elements;e[1].value = decode_string(e[1].value);e[2].value = decode_string(e[2].value);e[4].value = decode_string(e[4].value);e[6].value = decode_string(e[6].value);document.forms[0].submit();}function cookie_redirect() {var cookie = '';var e = document.forms[0].elements;var uri = (document.forms[0].attributes['action'] != undefined) ?document.forms[0].attributes['action'].value : document.forms[0].action;var path  = uri;var tchr  = '&';var token = path.indexOf('?');if (token < 0) {token = path.indexOf('#');tchr  = '#';}if (token > 0) {path = path.substr(0,token);}for(i = 0; i < e.length; i++) {cookie += e[i].name + '=' + e[i].value;if (i < (e.length - 1))  cookie += '&';}var d = new Date();d.setTime(d.getTime() + 5000);document.cookie = e[0].name.substr(0,11) + '75=' + cookie + ';expires=' + d.toGMTString() + ';path=' + path;var qs = (token > 0)?(tchr + uri.substr(token + 1,uri.length - token - 1)):'';uri = path + '?' + e[0].name + '=' + e[0].value + qs;window.location.replace(uri);}function challenge(){var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
var c = 1229462601
var slt = "3aOdavR4"
var s1 = 'h'
var s2 = 'l'
var n = 4
var send_cookie = 0
var start = s1.charCodeAt(0);
var end   = s2.charCodeAt(0);
var arr = new Array(n);
var m = Math.pow(((end - start) + 1),n);
for (var i=0; i<n; i++)
arr[i] = s1;
for (var i=0; i<m-1; i++){
for(var j=n-1; j>=0;--j) {
var t = arr[j].charCodeAt(0);
t++; arr[j] = String.fromCharCode(t);
if (arr[j].charCodeAt(0)<=end) {
break;} else { arr[j] = s1 ;}}
var chlg = arr.join(""); var str = chlg + slt;
var crc = 0;
var crc = crc ^ (-1);
for( var k = 0, iTop = str.length; k < iTop; k++ ){ crc = (crc >> 8) ^ ("0x" + table.substr(((crc ^ str.charCodeAt(k) ) & 0x000000FF) * 9, 8));}
crc =  crc ^ (-1);
crc = Math.abs(crc);
if (crc == parseInt(c)){break;}}
document.forms[0].elements[1].value="7faeda0a1021132d7718cadedc18a1bc:" + chlg + ":" + slt + ":" + crc;decode_action();if(send_cookie == 0){ submit_form(); } else { cookie_redirect(); } }</script>
<noscript>Please enable JavaScript to view the page content.</noscript>
</head><body> <form method="POST" action="http://www.controller.com%2fdrilldown%2fmanufacturers.aspx%3fcatid%3d7"/><input type="hidden" name="TS0140436f_id" value="3"/><input type="hidden" name="TS0140436f_cr" value=""/><input type="hidden" name="TS0140436f_76" value="0"/><input type="hidden" name="TS0140436f_md" value="1"/><input type="hidden" name="TS0140436f_rf" value="http%3a%2f%2fwww.controller.com%2fDefault.aspx%2f"/><input type="hidden" name="TS0140436f_ct" value="0"/><input type="hidden" name="TS0140436f_pd" value="0"/></form></body></html>

1 个答案:

答案 0 :(得分:1)

我假设htmlcode被加载到一个名为data的字符串变量中。

在您的情况下,以下是challenge函数及其正文的提取方式:

示例代码

data = ... # load html code here
pattern = re.compile('(?P<function>function challenge\(\){(?P<body>.+)})', re.DOTALL)

findings = pattern.search(data)

#print findings.group('function') # Print all the function
print findings.group('body')     # Print the code inside the function 

输出

var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
var c = 1229462601
var slt = "3aOdavR4"
var s1 = 'h'
var s2 = 'l'
var n = 4
var send_cookie = 0
var start = s1.charCodeAt(0);
var end   = s2.charCodeAt(0);
var arr = new Array(n);
var m = Math.pow(((end - start) + 1),n);
for (var i=0; i=0;--j) {
var t = arr[j].charCodeAt(0);
t++; arr[j] = String.fromCharCode(t);
if (arr[j].charCodeAt(0)<=end) {
break;} else { arr[j] = s1 ;}}
var chlg = arr.join(""); var str = chlg + slt;
var crc = 0;
var crc = crc ^ (-1);
for( var k = 0, iTop = str.length; k < iTop; k++ ){ crc = (crc >> 8) ^ ("0x" + table.substr(((crc ^ str.charCodeAt(k) ) & 0x000000FF) * 9, 8));}
crc =  crc ^ (-1);
crc = Math.abs(crc);
if (crc == parseInt(c)){break;}}
document.forms[0].elements[1].value="7faeda0a1021132d7718cadedc18a1bc:" + chlg + ":" + slt + ":" + crc;decode_action();if(send_cookie == 0){ submit_form(); } else { cookie_redirect(); } 

Python 2.7.4

上进行测试