Skip to content

Instantly share code, notes, and snippets.

@galehrizky
Created February 3, 2020 12:56
Show Gist options
  • Save galehrizky/fd9b7dd6106a43283633c410d6d9d339 to your computer and use it in GitHub Desktop.
Save galehrizky/fd9b7dd6106a43283633c410d6d9d339 to your computer and use it in GitHub Desktop.
Alexa Rank Mass Check
# Iseng Project c0delabs.com
# Visit c0delabs.com
# Mass Alexa Rank
# usage alexa.py list.txt
import requests as reqs
import json
import sys
import re
import time
from termcolor import colored
def endpoint():
return "https://c0delabs.com/lush/api/seo/"
def read():
try:
if len(sys.argv) > 1:
ser = sys.argv[1]
else:
print("Masukan nama List dengan benar")
sys.exit()
return open(ser, "r").readlines()
except IOError:
print("File Not valid")
sys.exit()
def clean_url(url):
uri = re.compile(r"https?://(www\.)?")
site = uri.sub('', url).strip().strip('/')
return site
def sendRequest(url):
sendreq = reqs.get(endpoint()+url).content
return sendreq
def json_to_array(jsonnya):
x = json.loads(jsonnya)
return x
def green(str):
return colored(str, "green")
def blue(str):
return colored(str, "blue")
def main():
try:
list_sites = read()
for x in list_sites:
response = sendRequest(clean_url(x)).decode('utf-8')
result = json_to_array(response)
print("[+]"+green("Domain :"+result['data']['domain']))
print("[+]"+green("Alexa Rank :"+result['data']['rank']['alexa_rank']))
print("[+]"+blue("Selesai ~"))
except KeyboardInterrupt as e:
sys.exit()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment