Skip to content

Instantly share code, notes, and snippets.

@mottaquikarim
Last active December 14, 2017 20:31
Show Gist options
  • Select an option

  • Save mottaquikarim/a270729358edb78b4a34e2b06a903be2 to your computer and use it in GitHub Desktop.

Select an option

Save mottaquikarim/a270729358edb78b4a34e2b06a903be2 to your computer and use it in GitHub Desktop.
GET all scripts from webscript.io

Dump WebScript Scripts

  1. Download the py file above, save as dump_webscript.py
  2. Go to https://www.webscript.io/settings and copy APIKEY
  3. Replace user (line 10) with your Webscript login email
  4. Replace api_key (line 11) with APIKEY
  5. Activate venv: virtualenv .venv && source .venv/bin/activate
  6. pip install requests
  7. python dump_webscript.py

...OR...

Go to Python Anywhere, make account and run this script.

import os
from requests import get
from requests.auth import HTTPBasicAuth
host = 'https://www.webscript.io'
LIST_RECORDS = '/api/0.1/subdomains'
LIST_RECORD = '/api/0.1/script/{}/{}'
user = 'XXXXXX'
api_key = 'XXXXXXX'
if __name__ == '__main__':
r = get(host+LIST_RECORDS, auth=HTTPBasicAuth(user, api_key))
subd = r.json()
scr = 0
for key in subd.keys():
curr = subd.get(key)
scripts = curr.get('scripts')
print('##########################')
print('SUBDOMAIN: ', key)
print('##########################')
if not os.path.exists('subd_'+key):
os.makedirs('subd_'+key)
for script in scripts:
print('##########################')
print('SCRIPT: ', script)
print('##########################')
if script.startswith("/"):
script = script[1:]
r = get(host+LIST_RECORD.format(key, script), auth=HTTPBasicAuth(user, api_key))
code = r.text
if script == '':
script = 'index'
if '/' in script:
script = script.replace('/', "-")
f = open('subd_'+key + '/' + script+'.lua', "w")
f.write(code)
f.close()
scr = scr + 1
print('##########################')
print('DONE SCRIPT: ', script)
print('##########################')
print(scr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment