File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 < label for ="result " class ="form-label "> Password</ label >
2121 </ div >
2222 </ form >
23+ < script src ="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js "> </ script >
24+ < script type ="text/javascript " src ="/assets/js/cigpassword.js "> </ script >
2325 < script >
2426 var cigPassword = document . getElementById ( 'cig-password' ) ;
2527 cigPassword . addEventListener ( 'submit' , ( event ) => {
2628 event . preventDefault ( ) ;
2729 if ( ! cigPassword . checkValidity ( ) ) {
2830 event . preventDefault ( ) ;
2931 } else {
30- const data = new URLSearchParams ( new FormData ( cigPassword ) ) ;
31- var url = new URL ( "https://cigpassword.hack-gpon.org/" ) ;
32- url . search = data . toString ( ) ;
33- fetch ( url , { mode : 'cors' } ) . then ( response => response . json ( ) ) . then ( json => document . getElementById ( 'result' ) . value = json . password ) . catch ( ( error ) => {
34- document . getElementById ( 'result' ) . value = "Error!"
35- } ) ;
32+ const data = new FormData ( cigPassword ) ;
33+ document . getElementById ( 'result' ) . value = cigpassword_gpon ( data . get ( "serial" ) , data . get ( "username" ) ) ;
3634 }
3735 [ ...cigPassword . elements ] . map ( e => e . parentNode ) . forEach ( e => e . classList . toggle ( 'was-validated' , true ) ) ;
3836 } ) ;
Original file line number Diff line number Diff line change 1+ function hexToBytes ( hex ) {
2+ let bytes = new Uint8Array ( hex . length / 2 ) ;
3+ for ( let i = 0 ; i < hex . length ; i += 2 ) {
4+ bytes [ i / 2 ] = parseInt ( hex . substr ( i , 2 ) , 16 ) ;
5+ }
6+ return bytes ;
7+ }
8+
9+ function cigpassword_gpon ( ont_serial , ont_user ) {
10+ const hardcoded_key = '01030a1013051764c8061419b49d0500' ;
11+ const hardcoded_seed = '2345679abcdefghijkmnpqrstuvwxyzACDEFGHJKLMNPQRSTUVWXYZ' ;
12+
13+ let ont_vendor = ont_serial . substring ( 0 , 4 ) . toUpperCase ( ) ;
14+ let ont_id = ont_serial . substring ( 4 ) . toLowerCase ( ) ;
15+ let formatted_serial = `${ ont_vendor } ${ ont_id } ` ;
16+
17+ let key_bytes = CryptoJS . enc . Hex . parse ( hardcoded_key ) ;
18+ let hmac = CryptoJS . HmacMD5 ( `${ formatted_serial } -${ ont_user } ` , key_bytes ) ;
19+ let pw_md5_hmac = hexToBytes ( hmac . toString ( CryptoJS . enc . Hex ) ) ;
20+
21+ let output = Array ( pw_md5_hmac . length ) ;
22+
23+ for ( let i = 0 ; i < pw_md5_hmac . length ; i ++ ) {
24+ output [ i ] = hardcoded_seed [ pw_md5_hmac [ i ] % 0x36 ] ;
25+ }
26+
27+ return output . join ( '' ) ;
28+ }
You can’t perform that action at this time.
0 commit comments