Initial Commit

This commit is contained in:
Neill Cox 2024-08-10 14:13:07 +10:00
commit 05c2e5e81f
17 changed files with 1197 additions and 0 deletions

63
ah_tools/listvs.py Normal file
View file

@ -0,0 +1,63 @@
from pprint import pprint as pp
import subprocess
import requests
# cmd = "ssh ah-platypus2 ls -l"
# result = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
#
# print(result)
#
# auth = requests.auth.HTTPBasicAuth('root', '}~7R%t]Ru3qW')
# url = "https://platypus-2.ace-hosting.com.au:10000/virtual-server/remote.cgi?program=list-domains&multiline&json=1"
#
# r = requests.get(url, auth=auth)
#
# print(r.text)
read_api_test_token="dop_v1_c34e7364effc04a6cc031f28722e479d64867ef68ad1925e38cdf0982dce0117"
r = requests.get('https://api.digitalocean.com/v2/droplets', headers={'Authorization': f'Bearer {read_api_test_token}'})
servers = r.json()
# pp(servers)
for s in servers['droplets']:
print(s['name'])
linode_token = "0eb5b7c46ae094dbf2a70b12024b6a5160e85ee841eb0bffc4262740b45d0aed"
url = "https://api.linode.com/v4/linode/instances?page=1&page_size=100"
headers = {"accept": "application/json", "Authorization": f"Bearer {linode_token}"}
response = requests.get(url, headers=headers)
servers = response.json()
for s in servers['data']:
print(s['label'])
bl_token ="8ozeaEDL96p44WptTPXZNknTfrpDmntYzLfh8gU1zFNYKBLRHnc537qGH4wvicDb"
api_uri = "https://api.binarylane.com.au/v2/servers"
headers = {"accept": "application/json", "Authorization": f"Bearer {bl_token}"}
r = requests.get(api_uri, headers=headers)
servers = r.json()
for s in servers['servers']:
print(s['name'])
"""
Servers
Digital Ocean
Linode
Rimu Hosting N/A
BinaryLane
S3 Buckets
AMAZON
BackBlaze
Digital Ocean
"""