@@ -7,13 +7,76 @@ export default class LootLink extends BypassDefinition {
7
7
}
8
8
9
9
execute ( ) {
10
- if ( / [ ? & ] r = / . test ( window . location . href . toString ( ) ) ) {
10
+ if ( / [ ? & ] r = / . test ( window . location . href . toString ( ) ) ) { // https://loot-link.com/s?fJjn&r=
11
11
const urlParams = new URLSearchParams ( window . location . search )
12
12
const r = urlParams . get ( 'r' )
13
- const finalURL = decodeURIComponent ( escape ( atob ( r ) ) ) ;
13
+ const finalURL = decodeURIComponent ( escape ( atob ( r ) ) )
14
14
this . helpers . safelyNavigate ( finalURL )
15
+ } else { // https://loot-link.com/s?fJjn
16
+ const originalFetch = window . fetch
17
+ window . fetch = ( url , config ) => this . customFetch ( url , config , originalFetch )
15
18
}
16
19
}
20
+
21
+ customFetch ( url , config , originalFetch ) {
22
+ if ( url . includes ( `${ INCENTIVE_SYNCER_DOMAIN } /tc` ) ) {
23
+ return originalFetch ( url , config ) . then ( response => {
24
+ if ( ! response . ok ) return response . json ( )
25
+ return this . handleResponse ( response )
26
+ } ) ;
27
+ }
28
+ return originalFetch ( url , config )
29
+ }
30
+
31
+ handleResponse ( response ) {
32
+ return response . clone ( ) . json ( ) . then ( data => {
33
+ let urid = ""
34
+ let action_pixel_url = ""
35
+ data . forEach ( item => {
36
+ urid = item . urid
37
+ action_pixel_url = item . action_pixel_url
38
+ } ) ;
39
+
40
+ const task_id = 54 ; // magic number
41
+
42
+ this . setupWebSocket ( urid , task_id )
43
+ navigator . sendBeacon ( `https://${ urid . substr ( - 5 ) % 3 } .${ INCENTIVE_SERVER_DOMAIN } /st?uid=${ urid } &cat=${ task_id } ` )
44
+ fetch ( `https://${ INCENTIVE_SYNCER_DOMAIN } /td?ac=1&urid=${ urid } &&cat=${ task_id } &tid=${ TID } ` )
45
+ fetch ( action_pixel_url )
46
+
47
+ return new Response ( JSON . stringify ( data ) , {
48
+ status : response . status ,
49
+ statusText : response . statusText ,
50
+ headers : response . headers
51
+ } )
52
+ } )
53
+ }
54
+
55
+ setupWebSocket ( urid , task_id ) {
56
+ const ws = new WebSocket ( `wss://${ urid . substr ( - 5 ) % 3 } .${ INCENTIVE_SERVER_DOMAIN } /c?uid=${ urid } &cat=${ task_id } &key=${ KEY } ` )
57
+
58
+ ws . onopen = ( ) => setInterval ( ( ) => ws . send ( '0' ) , 1000 )
59
+ ws . onmessage = event => {
60
+ if ( event . data . includes ( 'r:' ) ) {
61
+ this . helpers . safelyNavigate ( this . decryptData ( event . data . replace ( 'r:' , '' ) ) )
62
+ }
63
+ }
64
+ }
65
+
66
+ decryptData ( encodedData ) {
67
+ let final = ""
68
+ let combinationLink = atob ( encodedData )
69
+ let key = combinationLink . substring ( 0 , 5 )
70
+ let enc_link = combinationLink . substring ( 5 )
71
+ for ( let i = 0 ; i < enc_link . length ; i ++ ) {
72
+ let enc_char = enc_link . charCodeAt ( i )
73
+ let keyAtOffset = key . charCodeAt ( i % key . length )
74
+ let charcode = enc_char ^ keyAtOffset
75
+ final += String . fromCharCode ( charcode )
76
+ }
77
+
78
+ return final
79
+ }
17
80
}
18
81
19
82
export const matches = [ 'lootlinks.co' , 'loot-links.com' , 'loot-link.com' ]
0 commit comments