-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
71 lines (59 loc) · 1.78 KB
/
Copy pathrun.py
File metadata and controls
71 lines (59 loc) · 1.78 KB
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
#!/usr/bin/env python3
from termcolor import colored
import json
import datetime
import random
import pprint
import re
import sys
import tldextract
import requests
sys.path.insert(0, '/Users/yui/Dropbox')
import config
def get_dom():
"""Get Domain List and parse into an array"""
res = []
with open('list.txt') as f:
lines = f.readlines()
for line in lines:
url = "".join(
re.findall(
'https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+',
line))
domain = tldextract.extract(url).domain
res.append("".join(domain))
return res
def dom_check(names):
"""Check Availibility of the array"""
for name in names:
company = name + ".app"
response = requests.get(
"https://domainr.p.mashape.com/v2/status?mashape-key=&domain=" +
company,
headers={
"X-Mashape-Key": config.mashape_key,
"Accept": "application/json"})
temp_dict = json.loads(response.text)
status = temp_dict["status"][0]["status"]
if status.endswith('inactive'):
symbol = '✓'
output(company, symbol)
else:
symbol = 'x'
output(company, symbol)
def output(name, status):
with open('richlist.txt', 'a') as f:
f.write(name + ' ' + status + ' ' + '\n')
# url = 'http://maps.googleapis.com/maps/api/directions/json'
def sort():
with open('richlist.txt', 'r') as f:
lines = f.readlines()
for line in lines:
if "✓" in line:
with open('rich.txt', 'a') as f:
f.write(line[:-5] + '\n')
if __name__ == '__main__':
# print(dom_check())
# name = get_dom()
# dom_check(name)
sort()