#!/usr/bin/env python # -*- coding: utf-8 -*-" """ UFONet - DDoS Botnet via Web Abuse - 2013/2014/2015/2016 - by psy (epsylon@riseup.net) You should have received a copy of the GNU General Public License along with UFONet; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ import socket, threading, re, base64, os, time import webbrowser, subprocess, urllib2, json, sys from urlparse import urlparse from main import UFONet import base64, traceback try: import pygeoip except: print "\nError importing: pygeoip lib. \n\n On Debian based systems:\n\n $ 'sudo apt-get install python-geoip' or 'pip install geoip')\n" sys.exit(2) class AjaxMap(object): def __init__(self): self._geoip=None self._geoasn=None self._geoipstatus='nomap' self._err='' ufonet = UFONet() ufonet.create_options() self.zombies = ufonet.extract_zombies() aliens_army = ufonet.extract_aliens() droids_army = ufonet.extract_droids() ucavs_army = ufonet.extract_ucavs() rpcs_army = ufonet.extract_rpcs() self.zombies.extend(aliens_army) self.zombies.extend(droids_army) self.zombies.extend(ucavs_army) self.zombies.extend(rpcs_army) def get_err(self): return self._err # check for geoip data status # basic lock file mechanism to avoid multiple downloads def get_status(self): if os.path.exists('maps.downloading'): if not os.path.exists('maps.downloadmsg'): f=open("maps.downloadmsg","wb") f.write("") f.close() print "[Info] GUI: GeoIP data download started..." print "[Info] GUI: If this message persists: remove 'maps.downloading' and 'maps' folder, then restart ufonet...\n" self._geoipstatus='downloading' elif os.path.isdir('maps'): if self._geoip == None : self._geoip = pygeoip.GeoIP('maps/GeoLiteCity.dat') if self._geoasn == None : self._geoasn = pygeoip.GeoIP('maps/GeoIPASNum.dat') if os.path.exists("maps.downloadmsg") : os.remove("maps.downloadmsg") self._geoipstatus='ok' return self._geoipstatus def retrieve(self,url,name): try: handle = urllib2.urlopen(url) CHUNK = 16384 with open(name,'wb') as fp: while True: chunk = handle.read(CHUNK) if not chunk: break fp.write(chunk) except: traceback.print_exc() def download_maps(self): import subprocess, shlex # generate geolocation values on a map if self.get_status() != 'nomap': return self._geoipstatus == 'ok' if os.path.exists("maps.downloadmsg"): os.remove("maps.downloadmsg") f=open("maps.downloading",'w') f.write("download started' if os.path.exists('/tmp/ufonet.html'): for x in open(r'/tmp/ufonet.html').readlines(): stat = stat + x else: stat="[Info] Waiting for statistics generation..." return stat+"" if self.get_status() != "ok": dljs="" if self.get_status() == "nomap": dljs+="$('#ufomsg').load('/js/ajax.js?fetchgeoip=')\n" if 'doll' in pGet.keys(): dljs+="$('#ufomsg').load('/js/ajax.js?fetchdoll="+pGet['doll']+"')\n" dljs+="doll=new Doll('"+pGet["doll"]+"')\n" return "[Info] GeoIP data download in progress...
see console for errors+" if 'zombie' in pGet.keys(): zn=base64.b64decode(pGet['zombie']) nzn=self.get_next_zombie(zn) if nzn is not None: zombie=self.get_js(nzn) return """ """ else: return "\n" if 'fetchdoll' in pGet.keys(): tn=pGet['fetchdoll'] target = self.geo_ip(tn) if target is None: return "doll waiting for geoip data !" return """ doll up !""" if 'doll' in pGet.keys(): tn=pGet['doll'] return """""" return "\n"