1const wb_challenge = new function(){ 2 this.debug = false; 3 4 this.init = () => { 5 // Solve challenge 6 this.solve_challenge(); 7 }; 8 9 this.solve_challenge = () => { 10 if( this.debug ) console.log('Attempting browser challenge'); 11 const formWrappers = document.querySelectorAll('.gform_wrapper'); 12 formWrappers.forEach( formWrapper => { 13 const form = formWrapper.querySelector('form'); 14 const form_id = form.dataset.formid; 15 const challengeField = formWrapper.querySelector('input[name="input_'+challenge_opts.field+'"]'); 16 if( this.debug ) console.log('Browser challenge field: ', challengeField); 17 if( !challengeField ){ 18 return; 19 } 20 this.solve_challenge_field( challengeField ); 21 } ); 22 }; 23 24 this.solve_challenge_field = async ( challengeField ) => { 25 const challengeValue = challengeField.value; 26 if( this.debug ) console.log('Browser challenge value: ', challengeValue); 27 28 if( typeof TextEncoder == "undefined" || typeof crypto == "undefined" || typeof crypto.subtle == "undefined" ){ 29 alert('Your web browser is outdated and unsupported. Registration cannot be completed. Please upgrade to a modern web browser such as Microsoft Edge or Google Chrome.'); 30 return; 31 } 32 33 const encoder = new TextEncoder(); 34 const data = encoder.encode(challengeValue); 35 if( this.debug ) console.log('Browser challenge data: ', data); 36 const hash = await crypto.subtle.digest('SHA-1', data); 37 if( this.debug ) console.log('Browser challenge hash: ', hash); 38 const hashArray = Array.from(new Uint8Array(hash)); 39 const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join(''); 40 if( this.debug ) console.log('Browser challenge hex: ', hashHex); 41 42 challengeField.value = hashHex; 43 if( this.debug ) console.log('Browser challenge field final value: ', challengeField.value); 44 }; 45 46 // see if DOM is already available 47 if (document.readyState === "complete" || document.readyState === "interactive") { 48 // call on next available tick 49 setTimeout(this.init, 1); 50 } else { 51 document.addEventListener("DOMContentLoaded", this.init); 52 } 53};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.