Advertisement
pidzero

flash_ubiquiti_with_aredn/do.py

Oct 25th, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.96 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import os
  4. from sys import stdout
  5. from time import sleep
  6.  
  7. print ("""
  8. \033[2J\033[0;35;1m--------------------------------------------------------\033[0m
  9. This program will flash a Ubiquiti radio with the AREDN
  10. firmare.
  11.  
  12. \033[31;1mWARNING!\033[0m  Your Ubiquiti radio must be one of these:
  13. AirGrid M2 (XM)
  14. AirGrid M5 (XM)
  15. Bullet M2
  16. Bullet M5
  17. Bullet M2 Titanium
  18. Bullet M5 Titanium
  19. NanoBridge M2G18
  20. NanoBridge M3
  21. NanoBridge M5G22
  22. NanoBridge M5G25
  23. NanoBridge M9
  24. NanoStation Loco M2
  25. NanoStation Loco M5 (XM)
  26. NanoStation Loco M9
  27. PicoStation M2
  28.  
  29. Please make sure the interface through which you will be
  30. programming has an IP on the 192.168.1.0/24 subnet, such
  31. as 192.168.1.10 (but NOT 192.168.1.1 or 192.168.1.20,
  32. because the radio will use these IPs).
  33.  
  34. Put the radio in flash mode:
  35.  While holding RESET, power the radio and wait for the
  36.  LEDs to be alternate between:
  37.  \033[0;1;32m◼ \033[32m◼ \033[31m◼ \033[30m◻ \033[32m◼ \033[30m◻ \033[0m and \033[0;1;32m◼ \033[32m◼ \033[30m◻ \033[33m◼ \033[30m◻ \033[32m◼ \033[0m
  38. """)
  39. result = input("Type '\033[32;1mYES\033[0m' to proceed, or anything else to abort \033[36;1m> \033[33m")
  40. print ("\033[0;35;1m--------------------------------------------------------\033[0m")
  41.  
  42. if result.upper() == "YES":
  43.     print ("Ok, proceeding...")
  44.     print ("")
  45.     print ("Uploading firmware...")
  46.     os.system("printf 'connect 192.168.1.20\nmode binary\nput aredn-3.19.3.0-ubnt-bullet-m-factory.bin' | tftp")
  47.  
  48.     print ("""
  49. Now we wait for the the LEDs to be: \033[0;1;32m◼ \033[32m◼ \033[30m◻ \033[30m◻ \033[30m◻ \033[32m◼ \033[0m
  50. """)
  51.     for timer in range(150):
  52.         print ("\rWaiting "+str(150-timer)+" seconds...", end='')
  53.         stdout.flush()
  54.         sleep(1)
  55.     print ("""
  56. Okay, done!  Now configure the AREDN firmware at:
  57. http://root:hsmm@192.168.1.1/cgi-bin/setup
  58. \033[0;35;1m--------------------------------------------------------\033[0m
  59. """)
  60.  
  61. else:
  62.     print ("Ok, aborting procedure.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement