Skip to content

Instantly share code, notes, and snippets.

@dustyfresh
Last active October 20, 2019 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustyfresh/28f8b380d41910c51b67870a3e2acc70 to your computer and use it in GitHub Desktop.
Save dustyfresh/28f8b380d41910c51b67870a3e2acc70 to your computer and use it in GitHub Desktop.
script to grab each pwnagotchi unit's fingerprint. You can redirect this output to a list and loop through each fingerprint to broadcast messages to ALL pwnagotchi units OwO
#!/usr/bin/env python
'''
$ ./pwnagotchi_ids.py | while read fingerprint; do pwngrid -send $fingerprint -message "( ͡° ͜ʖ ͡°)"; done
'''
import json
import requests
def main():
blacklist = open('./blacklist.txt', 'r').read().splitlines()
page = 0
print('grabbing page count...')
units = json.loads(requests.get('https://api.pwnagotchi.ai/api/v1/units').content)
print('discovered {} pages and {} units'.format(units['pages'], units['records']))
print('sending message to the first page...')
page += 1
while page != int(units['pages']):
records = json.loads(requests.get('https://api.pwnagotchi.ai/api/v1/units?p={}'.format(page)).content)['units']
for unit in records:
if unit['fingerprint'] not in blacklist:
print(unit['fingerprint'])
page += 1
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment