-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgatekeeper.js
57 lines (48 loc) · 1.68 KB
/
gatekeeper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
Run this script :
$> frida -U -l bypass-throttle.js gatekeeperd
Explainations :
Frida enumeration :
$> frida-trace -U gatekeeperd -i "*timeout*"
19088 ms _ZN10gatekeeper10GateKeeper19ComputeRetryTimeoutEPKNS_16failure_record_tE()
19089 ms _ZN10gatekeeper10GateKeeper19ComputeRetryTimeoutEPKNS_16failure_record_tE()
Code :
/*
* Calculates the timeout in milliseconds as a function of the failure
* counter 'x' as follows:
*
* [0, 4] -> 0
* 5 -> 30
* [6, 10] -> 0
* [11, 29] -> 30
* [30, 139] -> 30 * (2^((x - 30)/10))
* [140, inf) -> 1 day
*
*
uint32_t GateKeeper::ComputeRetryTimeout(const failure_record_t *record) {
static const int failure_timeout_ms = 30000;
if (record->failure_counter == 0) return 0;
if (record->failure_counter > 0 && record->failure_counter <= 10) {
if (record->failure_counter % 5 == 0) {
return failure_timeout_ms;
} else {
return 0;
}
} else if (record->failure_counter < 30) {
return failure_timeout_ms;
} else if (record->failure_counter < 140) {
return failure_timeout_ms << ((record->failure_counter - 30) / 10);
}
return DAY_IN_MS;
}
*/
Interceptor.attach(Module.getExportByName(null,"_ZN10gatekeeper10GateKeeper19ComputeRetryTimeoutEPKNS_16failure_record_tE"), {
onEnter: function(args){
console.log("Called ComputeRetryTimeout");
},
onLeave: function(return_){
console.log("ComputeRetryTimeout return Throttle : " + return_);
return_.replace(0);
console.log("Replaced with 0")
}
})