Created
August 26, 2017 03:51
Simple tool to use WhatRuns API to get technologies used on a page. Doesn't submit the page if it's not in the database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
import datetime | |
import json | |
import sys | |
import requests | |
import urllib | |
from tabulate import tabulate | |
url = "https://www.whatruns.com/api/v1/get_site_apps" | |
data = {"data": {"hostname": sys.argv[1], "url": sys.argv[1], | |
"rawhostname": sys.argv[1]}} | |
data = urllib.urlencode({k: json.dumps(v) for k, v in data.iteritems()}) | |
data = data.replace('+', '') | |
headers = {'Content-Type': 'application/x-www-form-urlencoded'} | |
response = requests.post(url, data=data, headers=headers) | |
loaded = json.loads(response.content) | |
apps = ast.literal_eval(loaded['apps']) | |
nuance = apps.keys().pop() | |
entries = list() | |
for app_type, values in apps[nuance].iteritems(): | |
for item in values: | |
dt = datetime.datetime.fromtimestamp((item['detectedTime']/1000)) | |
ldt = datetime.datetime.fromtimestamp((item['latestDetectedTime']/1000)) | |
entries.append({'Type': app_type, 'Name': item['name'], | |
'Detected': dt, 'Last_Detected': ldt}) | |
print tabulate(entries, headers='keys') |
Hello,
Would you know how to port this to JS ?
I tried :
await axios.post(
'https://www.whatruns.com/api/v1/get_site_apps',
new URLSearchParams({
'hostname': url,
'url': url,
'rawhostname': url
})
);
And got :
{ exception: 'SyntaxError: Unexpected token u in JSON at position 0' }
as response body.
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks