randomip.py 769 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. """
  4. UFONet - DDoS Botnet via Web Abuse - 2013/2014/2015/2016 - 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. from random import randrange
  10. class RandomIP(object):
  11. """
  12. Class to generate random valid IP's
  13. """
  14. def _generateip(self, string):
  15. notvalid = [10, 127, 169, 172, 192]
  16. first = randrange(1, 256)
  17. while first is notvalid:
  18. first = randrange(1, 256)
  19. _ip = ".".join([str(first), str(randrange(1, 256)),
  20. str(randrange(1, 256)), str(randrange(1, 256))])
  21. return _ip