update.py 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. """
  4. UFONet - Denial of Service Toolkit - 2013/2014/2015/2016/2017/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://github.com/epsylon/ufonet"
  18. rootDir = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', ''))
  19. if not os.path.exists(os.path.join(rootDir, ".git")):
  20. print "Not any .git repository found!\n"
  21. print "="*30
  22. print "\nTo have working this feature, you should clone UFONet with:\n"
  23. print "$ git clone %s" % GIT_REPOSITORY
  24. else:
  25. checkout = execute("git checkout . && git pull", shell=True, stdout=PIPE, stderr=PIPE).communicate()[0]
  26. print checkout
  27. if not "Already up-to-date" in checkout:
  28. print "Congratulations!! UFONet has been updated... ;-)\n"
  29. else:
  30. print "Your UFONet doesn't need to be updated... ;-)\n"