update.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. """
  4. UFONet - Denial of Service Toolkit - 2013/2018 - by psy (epsylon@riseup.net)
  5. You should have received a copy of the GNU General Public License along
  6. with UFONet; if not, write to the Free Software Foundation, Inc., 51
  7. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  8. """
  9. import os
  10. from subprocess import PIPE
  11. from subprocess import Popen as execute
  12. class Updater(object):
  13. """
  14. Update UFONet automatically from a .git repository
  15. """
  16. def __init__(self):
  17. GIT_REPOSITORY = "https://code.03c8.net/epsylon/ufonet"
  18. GIT_REPOSITORY2 = "https://github.com/epsylon/ufonet"
  19. rootDir = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', ''))
  20. if not os.path.exists(os.path.join(rootDir, ".git")):
  21. print "Not any .git repository found!\n"
  22. print "="*30
  23. print "\nTo have working this feature, you should clone UFONet with:\n"
  24. print "$ git clone %s" % GIT_REPOSITORY
  25. print "\nAlso you can try this other mirror:\n"
  26. print "$ git clone %s" % GIT_REPOSITORY2 + "\n"
  27. else:
  28. checkout = execute("git checkout . && git pull", shell=True, stdout=PIPE, stderr=PIPE).communicate()[0]
  29. print checkout
  30. if not "Already up-to-date" in checkout:
  31. print "Congratulations!! UFONet has been updated... ;-)\n"
  32. else:
  33. print "Your UFONet doesn't need to be updated... ;-)\n"