-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgrabber.py
283 lines (192 loc) · 7.64 KB
/
grabber.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# Use with python3
# Version 2.0
import random
import socket
import os
try:
import socks
except ModuleNotFoundError:
os.system("pip install PySocks")
os.system("pip install socks")
try:
import ipapi
except ModuleNotFoundError:
os.system("pip install ipapi")
import time
try:
from colorama import Fore
except ModuleNotFoundError:
os.system("pip install colorama")
from platform import platform
import sys
try:
import requests
except ModuleNotFoundError:
os.system("pip install requests")
import json
try:
from stem import SocketError
except ModuleNotFoundError:
os.system("pip install stem")
from setup.banner import banner , banner2
W = Fore.LIGHTWHITE_EX
R = Fore.RED
G = Fore.GREEN
C = Fore.CYAN
Y = Fore.YELLOW
yes = ['y' , 'yes']
no = ['n' , 'no']
def clr():
os.system('cls') if "Windows" in platform() else os.system("clear")
clr()
def cprint(str):
print(f"{W}[{C}>{W}]{C} {str}")
def error(str):
print(f"\n{W}[{R}!{W}] {str}\n")
def connection_check():
s = requests.get("https://www.google.com")
if s.status_code == 200:
error("Connection found...")
time.sleep(2)
clr()
else:
error("Internet not found")
sys.exit(0)
connection_check()
clr()
def main():
banner()
print(f"{W}\n\t\tSelect option\n")
ip_Dict = {1 : "United States" , 2 : "Netherlands"
, 3 : "China" , 4 : "India" , 5 : "Taiwan" , 6 : "Australia"
, 7 : "United Kingdom" , 8 : "Pakistan" , 9 : "Nepal" , 10 : "Indonesia"
, 11 : "Korea" , 12 : "Germany" , 13 : "Colombia" , 14 : "Turkey" , 15 : "South Africa"
, 16 : "Singapore" , 17 : "Ethiopia" , 18 : "Romania" , 19 : "Japan" , 20 : "Brazil" , 21 : "Saudi Arabia"
, 22 : "Mauritius" , 23 : "France" , 24 : "Italy" , 25 : "Zambia" , 26 : "Iran" , 27 : "Ireland"
, 28 : "Portugal" , 29 : "Panama" , 30 : "Russia" , 31 : "Poland" , 32 : "Venezuela" , 33 : "Belgium"
, 34 : "Finland" , 35 : "Czechia" , 36 : "Kazakhstan" , 37 : "Canada" , 38 : "Austria" , 39 : "Egypt"
, 40 : "Vietnam" , 41 : "Morocco" , 42 : "Argentina" , 43 : "Tunisia" , 44 : "Thailand" , 45 : "Mexico"
, 46 : "Spain" , 47 : "Malaysia" , 48 : "Palestine" , 49 : "Switzerland" , 50 : "Greece" , 51 : "Togo"
, 52 : "Norway" , 53 : "Hong Kong" , 54 : "Denmark" , 55 : "Nigeria" , 56 : "About me"
}
ip_info_code = {"US":"United States" , "NL":"Netherlands" , "CN":"China" , "IN":"India" , "TW":"Taiwan"
, "AU":"Australia" , "GB":"United Kingdom" , "PK":"Pakistan" , "NP":"Nepal" , "ID":"Indonesia" , "KR":"Korea"
, "DE":"Germany" , "CO":"Colombia" , "TR":"Turkey" , "ZA":"South Africa" , "SG":"Singapore"
, "ET":"Ethiopia" , "RO":"Romania" , "JP":"Japan" , "BR":"Brazil" , "SA":"Saudi Arabia" , "MU":"Mauritius"
, "FR":"France" , "IT":"Italy" , "ZM":"Zambia" , "IR":"Iran" , "IE":"Ireland" , "PT":"Portugal" , "PA":"Panama"
, "RU":"Russia" , "PL":"Poland" , "VE":"Venezuela" , "BE":"Belgium" , "FI":"Finland" , "CZ" : "Czechia"
, "KZ":"Kazakhstan" , "CA":"Canada" , "AT":"Austria" , "EG":"Egypt" , "VN":"Vietnam" , "MA":"Morocco"
, "AR":"Argentina" , "TN":"Tunisia" , "TH":"Thailand" , "MX":"Mexico" , "ES":"Spain" , "MY":"Malaysia"
, "PS":"Palestine" , "CH":"Switzerland" , "GR":"Greece" , "TG":"Togo" , "NO":"Norway" , "HK":"Hong Kong"
, "DK":"Denmark" , "NG":"Nigeria"
}
even = ""
odd = ""
for k , v in ip_Dict.items():
if k%2 == 1:
odd = f'{W}[{G}{str(k)}{W}] {C}{v}'
elif k%2 == 0:
even = f"{W}[{G}{str(k)}{W}] {C}{v}"
print(odd + "\t" + even)
try:
choice = int(input(f"{W}\nEnter:~ "))
except ValueError:
error("BullShit!!")
sys.exit()
if choice == 56:
banner2()
exit()
if choice in ip_Dict.keys():
ip_country = ip_Dict.get(choice)
filename = ip_country + '.txt'
print(f"{W}Country selected: {G}{ip_country}\n")
if os.path.exists(filename):
del_file = input(f"{C}\nDo you want to delete previous {W}{filename}{R}(y/n): ").lower()
if del_file in yes:
os.remove(filename)
else:
error("File can't be deleted")
else:
error("Invalid option")
sys.exit()
ip_gen = []
ip_range = int(input(C +"\nHow many ip's do you want: "))
value = []
while len(value) != ip_range:
ip1 = random.randint(1 , 255)
ip2 = random.randint(1 , 255)
ip3 = random.randint(1 , 255)
ip4 = random.randint(1 , 255)
ip = str(ip1)+'.'+str(ip2) + '.' + str(ip3) + '.' +str(ip4)
print(f"\n{C}Ip generated : {W}{ip}")
ip_gen.append(ip)
cprint(f"Trying to find country...{W}{ip}")
try:
ip_cont = ipapi.location(ip)
if ip_cont['country_name'] == ip_country:
print(f"{Y}IP {ip} is of {W}{ip_country}\n")
value.append(ip)
with open(filename , "a+") as file:
file.write(ip + "\n")
else:
print(f"{R}{ip} is not valid :{W} {ip_cont['country_name']}\n")
with open("AllCountriesIP.txt" , "a+") as ipp:
ipp.write(ip)
except KeyError:
print(R + "Not valid ip")
except KeyboardInterrupt:
cprint("Exiting...")
sys.exit()
except Exception:
error("\nSwitching ip scanner...\n")
try:
ipinfosec = "https://www.ipinfo.io/"
ip_resp = requests.get(ipinfosec+ip+'/json')
for key , val in ip_info_code.items():
if val == ip_country:
new_country_code = key
else:
pass
ip_resp = json.loads(ip_resp.text)
if ip_resp['country'] == new_country_code:
print(f"{Y}IP {ip} is of {W}{ip_country}\n")
filename = ip_country + '.txt'
value.append(ip)
with open(filename , "a+") as file:
file.write(ip + "\n")
else:
print(f"{R}{ip} is not valid : {W}{ip_cont['country_name']}\n")
except KeyError:
error(R + "Not valid ip")
except KeyboardInterrupt:
cprint("Good Bye")
sys.exit()
except Exception as e:
error(e)
print("Ip's generated and saved in " + filename)
tr = True
px = 0
# Using proxy
while tr == True:
port = random.randint(1000,9999)
port = str(port)
try:
print(f"{W}\nChanging proxy:{C} {value[px]}:{port}")
socket.socket = socks.socksocket
socks.set_default_proxy(socks.SOCKS5,value[px],port)
time.sleep(300)
px = px +1
except SocketError:
error("Something went wrong!")
except KeyboardInterrupt:
error("Exitiing.....")
tr = False
except KeyError:
cprint(f"{R}Fixing error....")
if len(value) == px:
clr()
cprint(f"{C}\nEstablishing connection again...")
px = 0
else:
pass
main()