· 6 years ago · Jul 07, 2019, 05:26 AM
1<?php
2
3define("OS", strtolower(PHP_OS));
4header('Content-Type: text/html; charset=utf-8');
5// error_reporting(0);
6
7function getPassword($prompt = "Enter Password: ") {
8 echo $prompt;
9
10 system('stty -echo');
11
12 $password = trim(fgets(STDIN));
13
14 system('stty echo');
15
16 return $password;
17}
18
19function getStr($string,$start,$end){
20 $str = explode($start,$string);
21 $str = explode($end,$str[1]);
22 return $str[0];
23}
24
25function RandStr($randstr){
26 $char = 'qwertyuiopasdfghjklzxcvbnm';
27 $char .= 'QWERTYUIOPASDFGHJKLZXCVBNM';
28 $char .= '0123456789';
29
30 $str = '';
31 for ($i = 0; $i < $randstr; $i++ ) {
32 $pos = rand(0, strlen($char)-1);
33 $str .= $char{$pos};
34 }
35 return $str;
36}
37
38function RandInt($randstr){
39 $char = '0123456789';
40 $str = '';
41 for ($i = 0; $i < $randstr; $i++ ) {
42 $pos = rand(0, strlen($char)-1);
43 $str .= $char{$pos};
44 }
45 return $str;
46}
47
48function curl($url, $data = 0, $header = 0, $cookie = 0) {
49 $ch = curl_init();
50 curl_setopt($ch, CURLOPT_URL, $url);
51 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
52 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
53 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
54 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
55 // curl_setopt($ch, CURLOPT_VERBOSE, 1);
56 curl_setopt($ch, CURLOPT_HEADER, 1);
57 if($header) {
58 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
59 curl_setopt($ch, CURLOPT_ENCODING, "gzip");
60 }
61 if($data) {
62 curl_setopt($ch, CURLOPT_POST, 1);
63 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
64 }
65 if($cookie) {
66 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
67 curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
68 }
69 $x = curl_exec($ch);
70 curl_close($ch);
71 return $x;
72}
73
74function curlNoHeader($url, $data = 0, $header = 0, $cookie = 0) {
75 $ch = curl_init();
76 curl_setopt($ch, CURLOPT_URL, $url);
77 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
78 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
79 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
80 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
81 // curl_setopt($ch, CURLOPT_VERBOSE, 1);
82 curl_setopt($ch, CURLOPT_HEADER, 0);
83 if($header) {
84 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
85 curl_setopt($ch, CURLOPT_ENCODING, "gzip");
86 }
87 if($data) {
88 curl_setopt($ch, CURLOPT_POST, 1);
89 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
90 }
91 if($cookie) {
92 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
93 curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
94 }
95 $x = curl_exec($ch);
96 curl_close($ch);
97 return $x;
98}
99
100function curlPut($url, $data = 0, $header = 0)
101{
102 $ch = curl_init();
103 curl_setopt($ch, CURLOPT_URL, $url);
104 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
105 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
106 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
107 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
108 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
109 curl_setopt($ch, CURLOPT_HEADER, 0);
110 if($header) {
111 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
112 curl_setopt($ch, CURLOPT_ENCODING, "gzip");
113 }
114
115 if($data) {
116 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
117 }
118 $x = curl_exec($ch);
119 curl_close($ch);
120 return $x;
121}
122
123function color() {
124 return [
125 "LW" => (OS == "linux" ? "\e[1;37m" : ""),
126 "WH" => (OS == "linux" ? "\e[0m" : ""),
127 "LR" => (OS == "linux" ? "\e[1;31m" : ""),
128 "LG" => (OS == "linux" ? "\e[1;32m" : ""),
129 "BL" => (OS == "linux" ? "\e[1;34m" : ""),
130 "MG" => (OS == "linux" ? "\e[1;35m" : ""),
131 "LC" => (OS == "linux" ? "\e[1;36m" : ""),
132 "CY" => (OS == "linux" ? "\e[1;33m" : "")
133 ];
134}
135
136function clear(){
137
138 return (OS == "linux" ? system('clear') : "" );
139
140}
141
142function fetchCurlCookies($source) {
143 preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $source, $matches);
144 $cookies = array();
145 foreach($matches[1] as $item) {
146 parse_str($item, $cookie);
147 $cookies = array_merge($cookies, $cookie);
148 }
149 return $cookies;
150}
151
152function generate()
153{
154 $str = file_get_contents("http://namegenerators.org/fake-name-generator-us/");
155 $re = '/<div class="col2">(.*?)<\/div>/s';
156 preg_match_all($re, $str, $matches);
157
158 $data = array();
159
160 $name = str_replace("</span>", "", str_replace('<span class="name">', "",$matches[1][3]));
161 $data['name'] = $name;
162
163 $mail = strtolower($matches[1][10]);
164 $a = explode("@", $mail);
165 $domain = '@gmail.com';
166 $data['email'] = $a[0] . rand(0, 1000) . $domain;
167
168 $namex = str_replace(" ", "", $name);
169 $password = strtolower($namex) . rand(0, 10000);
170 $data['password'] = $password;
171
172 $phonex = $matches[1][9];
173 $phone = str_replace("-", "", $phonex);
174 $data['phone'] = $phone;
175
176 $username = $a[0] . rand(0, 10000); ;
177 $data['username'] = $username;
178
179 return $data;
180}
181
182function regist($phone)
183{
184 $profile = generate();
185
186 $url = 'https://api.gojekapi.com/v5/customers';
187
188 $Phonemodel = RandStr(5);
189 $XUniqueid = RandStr(16);
190
191 $headers = array();
192 $headers[] = 'X-Appversion: 3.24.0';
193 $headers[] = 'X-Uniqueid: '.$XUniqueid.'';
194 $headers[] = 'X-Platform: Android';
195 $headers[] = 'X-Appid: com.gojek.app';
196 $headers[] = 'Accept: application/json';
197 $headers[] = 'X-Session-Id: 626abb77-81ae-4e3c-afa6-9c7302640fe5';
198 $headers[] = 'D1: DD:78:69:F0:F4:43:D9:2F:2A:9A:F8:C6:63:36:8F:E4:8F:29:45:EC:A1:7D:DE:C0:05:96:58:91:F6:32:43:1B';
199 $headers[] = 'X-Phonemodel: Android,SM-'.$Phonemodel.'';
200 $headers[] = 'X-Pushtokentype: FCM';
201 $headers[] = 'X-Deviceos: Android,5.1.1';
202 $headers[] = 'User-Uuid: ';
203 $headers[] = 'X-Devicetoken: ';
204 $headers[] = 'Authorization: Bearer';
205 $headers[] = 'Accept-Language: en-ID';
206 $headers[] = 'X-User-Locale: en_ID';
207 $headers[] = 'X-Location: 33.985805,-118.2541117';
208 $headers[] = 'X-Location-Accuracy: 3.0';
209 $headers[] = 'Content-Type: application/json; charset=UTF-8';
210 $headers[] = 'Host: api.gojekapi.com';
211 $headers[] = 'User-Agent: okhttp/3.10.0';
212
213 $body = array(
214 'name' => $profile['name'],
215 'email' => $profile['email'],
216 'phone' => '+'.$phone,
217 'signed_up_country' => 'ID'
218 );
219
220 $post = curlNoHeader($url, json_encode($body), $headers);
221 $result = json_decode($post);
222 if ($result->success == 0) {
223
224 $data = array(
225 'status' => 'failed',
226 'message' => $result->errors[0]->message,
227 );
228
229 }elseif ($result->success == 1) {
230
231 $data = array(
232 'status' => 'success',
233 'message' => $result->data->message,
234 'profile' => $body,
235 'otp_token' => $result->data->otp_token,
236 );
237
238 }else{
239
240 $data = array(
241 'status' => 'failed',
242 'message' => 'Unexpected Error',
243 );
244 }
245
246
247 return $data;
248
249}
250
251function postOtp($otp, $token)
252{
253 $url = 'https://api.gojekapi.com/v5/customers/phone/verify';
254
255 $Phonemodel = RandStr(5);
256 $XUniqueid = RandStr(16);
257
258 $headers = array();
259 $headers[] = 'X-Appversion: 3.24.0';
260 $headers[] = 'X-Uniqueid: '.$XUniqueid.'';
261 $headers[] = 'X-Platform: Android';
262 $headers[] = 'X-Appid: com.gojek.app';
263 $headers[] = 'Accept: application/json';
264 $headers[] = 'X-Session-Id: 626abb77-81ae-4e3c-afa6-9c7302640fe5';
265 $headers[] = 'D1: DD:78:69:F0:F4:43:D9:2F:2A:9A:F8:C6:63:36:8F:E4:8F:29:45:EC:A1:7D:DE:C0:05:96:58:91:F6:32:43:1B';
266 $headers[] = 'X-Phonemodel: Android,SM-'.$Phonemodel.'';
267 $headers[] = 'X-Pushtokentype: FCM';
268 $headers[] = 'X-Deviceos: Android,5.1.1';
269 $headers[] = 'User-Uuid: ';
270 $headers[] = 'X-Devicetoken: ';
271 $headers[] = 'Authorization: Bearer';
272 $headers[] = 'Accept-Language: en-ID';
273 $headers[] = 'X-User-Locale: en_ID';
274 $headers[] = 'X-Location: 33.985805,-118.2541117';
275 $headers[] = 'X-Location-Accuracy: 3.0';
276 $headers[] = 'Content-Type: application/json; charset=UTF-8';
277 $headers[] = 'Host: api.gojekapi.com';
278 $headers[] = 'User-Agent: okhttp/3.10.0';
279
280 $body = array(
281 'client_name' => 'gojek:cons:android',
282 'data' => array(
283 'otp' => $otp,
284 'otp_token' => $token,
285 ),
286 'client_secret' => '83415d06-ec4e-11e6-a41b-6c40088ab51e',
287 );
288
289 $post = curlNoHeader($url, json_encode($body), $headers);
290 $result = json_decode($post);
291
292 if ($result->success) {
293
294 $data = array(
295 'status' => 'success',
296 'access_token' => $result->data->access_token,
297 'refresh_token' => $result->data->refresh_token,
298 'cutomer_id' => $result->data->customer->id,
299 );
300 }else{
301
302 $data = array(
303 'status' => 'failed',
304 'message' => $result->errors[0]->message,
305 );
306 }
307
308 return $data;
309}
310
311function login($token)
312{
313 $url = 'https://api.gojekapi.com/v4/customers/device';
314
315 $push_token = RandStr(11).':APA91bE9VM_oE6YN9Yzrt5gzkiWF4Xfm8vMA4Myg8_U7vjSsVszE663wBVFiY4vAojMYU_yPgBh-eaKHk0agKVVDlXhpmyzOuHh6CwlaoBKgiouYrBO12RVD16bevUhMNNMJ_oWgNgBu';
316 $device_id = RandStr(16);
317 $Phonemodel = RandStr(5);
318 $XUniqueid = RandStr(16);
319
320 $headers = array();
321 $headers[] = 'X-Appversion: 3.24.0';
322 $headers[] = 'X-Uniqueid: '.$XUniqueid.'';
323 $headers[] = 'X-Platform: Android';
324 $headers[] = 'X-Appid: com.gojek.app';
325 $headers[] = 'Accept: application/json';
326 $headers[] = 'X-Session-Id: 626abb77-81ae-4e3c-afa6-9c7302640fe5';
327 $headers[] = 'D1: DD:78:69:F0:F4:43:D9:2F:2A:9A:F8:C6:63:36:8F:E4:8F:29:45:EC:A1:7D:DE:C0:05:96:58:91:F6:32:43:1B';
328 $headers[] = 'X-Phonemodel: Android,SM-'.$Phonemodel.'';
329 $headers[] = 'X-Pushtokentype: FCM';
330 $headers[] = 'X-Deviceos: Android,5.1.1';
331 $headers[] = 'User-Uuid: 627548103';
332 $headers[] = 'X-Devicetoken: ';
333 $headers[] = 'Authorization: Bearer '.$token.'';
334 $headers[] = 'Accept-Language: en-ID';
335 $headers[] = 'X-User-Locale: en_ID';
336 $headers[] = 'X-Location: 33.985805,-118.2541117';
337 $headers[] = 'X-Location-Accuracy: 3.0';
338 $headers[] = 'Content-Type: application/json; charset=UTF-8';
339 $headers[] = 'Host: api.gojekapi.com';
340 $headers[] = 'User-Agent: okhttp/3.10.0';
341
342 $body = '{"push_token_type":"FCM","application_id":"com.gojek.app","push_token":"'.$push_token.'","device_id":"'.$device_id.'"}';
343
344 $post = curlPut($url, $body, $headers);
345 $result = json_decode($post);
346
347 if ($result->success) {
348
349 $data = array(
350 'status' => 'success',
351 'message' => $result->data->message,
352 );
353
354 }else{
355
356 $data = array(
357 'status' => 'failed',
358 'message' => $result->errors[0]->message,
359 );
360
361 }
362
363 return $data;
364
365}
366
367function postPromo($token, $kode_promo)
368{
369 $url = 'https://api.gojekapi.com/go-promotions/v1/promotions/enrollments';
370
371 $push_token = RandStr(11).':APA91bE9VM_oE6YN9Yzrt5gzkiWF4Xfm8vMA4Myg8_U7vjSsVszE663wBVFiY4vAojMYU_yPgBh-eaKHk0agKVVDlXhpmyzOuHh6CwlaoBKgiouYrBO12RVD16bevUhMNNMJ_oWgNgBu';
372 $device_id = RandStr(16);
373 $Phonemodel = RandStr(5);
374 $XUniqueid = RandStr(16);
375
376 $headers = array();
377 $headers[] = 'X-Appversion: 3.24.0';
378 $headers[] = 'X-Uniqueid: '.$XUniqueid.'';
379 $headers[] = 'X-Platform: Android';
380 $headers[] = 'X-Appid: com.gojek.app';
381 $headers[] = 'Accept: application/json';
382 $headers[] = 'X-Session-Id: 626abb77-81ae-4e3c-afa6-9c7302640fe5';
383 $headers[] = 'D1: DD:78:69:F0:F4:43:D9:2F:2A:9A:F8:C6:63:36:8F:E4:8F:29:45:EC:A1:7D:DE:C0:05:96:58:91:F6:32:43:1B';
384 $headers[] = 'X-Phonemodel: Android,SM-'.$Phonemodel.'';
385 $headers[] = 'X-Pushtokentype: FCM';
386 $headers[] = 'X-Deviceos: Android,5.1.1';
387 $headers[] = 'User-Uuid: 627548103';
388 $headers[] = 'X-Devicetoken: '.$push_token.'';
389 $headers[] = 'Authorization: Bearer '.$token.'';
390 $headers[] = 'Accept-Language: en-ID';
391 $headers[] = 'X-User-Locale: en_ID';
392 $headers[] = 'X-Location: 33.985805,-118.2541117';
393 $headers[] = 'X-Location-Accuracy: 3.0';
394 $headers[] = 'Content-Type: application/json; charset=UTF-8';
395 $headers[] = 'Host: api.gojekapi.com';
396 $headers[] = 'User-Agent: okhttp/3.10.0';
397
398 $body = array(
399 'promo_code' => $kode_promo,
400 );
401
402 $post = curlNoHeader($url, json_encode($body), $headers);
403 $result = json_decode($post);
404
405 if ($result->success) {
406
407 $data = array(
408 'status' => 'success',
409 'message' => $result->data->message,
410 );
411
412 }else{
413
414 $data = array(
415 'status' => 'failed',
416 'message' => $result->errors[0]->message,
417 );
418 }
419
420 return $data;
421
422}
423
424echo 'Enter your Phone Number with country code here: ';
425$phone = trim(fgets(STDIN));
426$regist = regist($phone);
427$kode = 'GOFOODHEMAT1';
428if ($regist['status'] == 'success') {
429
430 echo 'Name: '.$regist['profile']['name'].' | Email: '.$regist['profile']['email'].' | Phone: '.$regist['profile']['phone']. PHP_EOL;
431 $otp_token = $regist['otp_token'];
432 echo 'Enter your OTP Code Here: ';
433 $otp = trim(fgets(STDIN));
434 $postotp = postOtp($otp, $otp_token);
435 if ($postotp['status'] == 'success') {
436
437 echo 'OTP Success!'.PHP_EOL;
438 $access_token = $postotp['access_token'];
439 echo 'Access Token: '.$access_token.PHP_EOL;
440 $login = login($access_token);
441 if ($login['status'] == 'success') {
442
443 $promo = postPromo($access_token, $kode);
444 echo 'Code: '.$kode.' | '.$promo['message'] . PHP_EOL;
445
446 }
447 }
448}