setup.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. """
  4. This file is part of the UFONet project, https://ufonet.03c8.net
  5. Copyright (c) 2013/2024 | psy <epsylon@riseup.net>
  6. You should have received a copy of the GNU General Public License along
  7. with UFONet; if not, write to the Free Software Foundation, Inc., 51
  8. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  9. """
  10. import sys, time
  11. if sys.version_info[0] != 3:
  12. sys.exit("Sorry, UFONet requires Python >= 3")
  13. libs = ("GeoIP", "python-geoip", "pygeoip", "requests", "whois", "scapy", "pycryptodomex", "duckduckgo-search")
  14. import subprocess, os
  15. def speech():
  16. print("[MASTER] Connecting UFONET [AI] system, remotely...\n")
  17. time.sleep(5)
  18. print("\n[AI] Hello Master!... ;-)\n")
  19. print("\n[AI] Launching self-deployment protocols...\n")
  20. time.sleep(2)
  21. print(r" _______")
  22. print(r" |.-----.|")
  23. print(r" ||x . x||")
  24. print(r" ||_.-._||")
  25. print(r" `--)-(--`")
  26. print(r" __[=== o]___")
  27. print(r" |:::::::::::|")
  28. def checkeuid():
  29. try:
  30. euid = os.geteuid()
  31. except:
  32. sys.exit(2) # return
  33. return euid
  34. def install(package):
  35. subprocess.run(["python3", "-m", "pip", "install", "--upgrade", "pip", "--no-warn-script-location", "--root-user-action=ignore"])
  36. subprocess.run(["python3", "-m", "pip", "install", "pycurl", "--upgrade", "--no-warn-script-location", "--root-user-action=ignore"])
  37. for lib in libs:
  38. subprocess.run(["python3", "-m", "pip", "install", lib, "--no-warn-script-location", "--ignore-installed", "--root-user-action=ignore"])
  39. if __name__ == '__main__':
  40. euid = checkeuid()
  41. if euid != 0:
  42. try:
  43. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  44. os.execlpe('sudo', *args)
  45. except:
  46. sys.exit()
  47. sys.exit()
  48. speech()
  49. os.system("sudo apt-get install -y --no-install-recommends libpython3.11-dev python3-pycurl python3-geoip python3-whois python3-requests libgeoip1 libgeoip-dev")
  50. install(libs)
  51. print("\n[UFONET] Setup has been completed!. You can now try to run: ./ufonet\n")