From 8625bb1c48f1ab742b97cc8c4d6f466ca2157711 Mon Sep 17 00:00:00 2001 From: altNightHawk <84723615+altNightHawk@users.noreply.github.com> Date: Sun, 15 Feb 2026 17:38:57 +0000 Subject: [PATCH] Add Exfil's API with a fallback to Source protocol --- discordgsm/games.csv | 648 +++++++++++++++---------------- discordgsm/protocols/__init__.py | 89 ++--- discordgsm/protocols/exfil.py | 157 ++++++++ 3 files changed, 526 insertions(+), 368 deletions(-) mode change 100644 => 100755 discordgsm/games.csv mode change 100644 => 100755 discordgsm/protocols/__init__.py create mode 100755 discordgsm/protocols/exfil.py diff --git a/discordgsm/games.csv b/discordgsm/games.csv old mode 100644 new mode 100755 index f949578..ba3e322 --- a/discordgsm/games.csv +++ b/discordgsm/games.csv @@ -1,324 +1,324 @@ -Id,Name,Protocol,Options - -7d2d,7 Days to Die (2013),source,port=26900;port_query_offset=1 - -abioticf,Abiotic Factor(2023),source,port_query=27015 -ageofchivalry,Age of Chivalry (2007),source,port=27015 -alienarena,Alien Arena (2004),quake2,port_query=27910 -alienswarm,Alien Swarm (2010),source,port=27015 -americasarmy,America's Army (2002),gamespy2,port=1716;port_query_offset=1 -americasarmy2,America's Army 2 (2003),gamespy2,port=1716;port_query_offset=1 -americasarmy3,America's Army 3 (2009),source,port=8777;port_query=27020 -americasarmypg,America's Army: Proving Grounds (2015),source,port=8777;port_query=27020 -aoe2,Age of Empires 2 (1999),ase,port_query=27224 -arkse,Ark: Survival Evolved (2017),source,port=7777;port_query=27015 -arma,ARMA: Armed Assault (2007),gamespy2,port=2302 -arma2,ARMA 2 (2009),source,port=2302;port_query_offset=1 -arma2oa,ARMA 2: Operation Arrowhead (2010),source,port=2302;port_query_offset=1 -arma3,ARMA 3 (2013),source,port=2302;port_query_offset=1 -armacwa,ARMA: Cold War Assault (2011),gamespy1,port=2302;port_query_offset=1 -armar,ARMA: Resistance (2011),gamespy1,port=2302;port_query_offset=1 -armareforger,Arma Reforger (2022),source,port=2001;port_query=17777 -asa,Ark: Survival Ascended (2023),asa,port=7777 -assettocorsa,Assetto Corsa (2014),assettocorsa,port=9610 -astrocolony,Astro Colony (2022),source,port_query=27015 -atlas,Atlas (2018),source,port=5761;port_query_offset=51800 -avorion,Avorion (2017),source,port=40017;port_query_offset=2 -avp2,Aliens versus Predator 2 (2001),gamespy1,port=27888 -avp2010,Aliens vs. Predator (2010),source,port=27015 - -baldursgate,Baldur's Gate (1998),gamespy1,port=6073;port_query=1470 -barotrauma,Barotrauma (2019),source,port=27015;port_query_offset=1 -bat1944,Battalion 1944 (2018),source,port=7777;port_query_offset=3 -beammp,BeamMP (2021),beammp,port=30814 -beyondthewire,Beyond the Wire (2022),source,port=7887;port_query=27165 -bf1942,Battlefield 1942 (2002),gamespy1,port=14567;port_query=23000 -bf2,Battlefield 2 (2005),gamespy3,port=16567;port_query=29900 -bf2142,Battlefield 2142 (2006),gamespy3,port=16567;port_query=29900 -bf3,Battlefield 3 (2011),battlefield,port=25200;port_query_offset=22000 -bf4,Battlefield 4 (2013),battlefield,port=25200;port_query_offset=22000 -bfbc2,Battlefield: Bad Company 2 (2010),battlefield,port=19567;port_query=48888 -bfh,Battlefield Hardline (2015),battlefield,port=25200;port_query_offset=22000 -bfv,Battlefield Vietnam (2004),gamespy2,port=15567;port_query=23000 -bm,Black Mesa (2015),source,port=27015 -breach,Breach (2011),source,port=27016 -breed,Breed (2004),gamespy2,port=7649 -brink,Brink (2011),source,port_query_offset=1 - -cacrenegade,Command and Conquer: Renegade (2002),gamespy1,port=4848;port_query=25300 -callofjuarez,Call of Juarez (2006),ase,port_query=26000 -chaser,Chaser (2003),ase,port=3000;port_query_offset=123 -chrome,Chrome (2003),ase,port=27015;port_query_offset=123 -cod,Call of Duty (2003),quake3,port=28960 -cod2,Call of Duty 2 (2005),quake3,port=28960 -cod3,Call of Duty 3 (2006),quake3,port=28960 -cod4,Call of Duty 4: Modern Warfare (2007),quake3,port=28960 -codenameeagle,Codename Eagle (2000),gamespy1,port_query=4711 -codmw2,Call of Duty: Modern Warfare 2 (2009),quake3,port=28960 -codmw3,Call of Duty: Modern Warfare 3 (2011),source,port_query_offset=2 -coduo,Call of Duty: United Offensive (2004),quake3,port=28960 -codwaw,Call of Duty: World at War (2008),quake3,port=28960 -commandos3,Commandos 3: Destination Berlin (2003),gamespy1,port_query=6500 -conanexiles,Conan Exiles (2018),source,port=7777;port_query=27015 -contactjack,Contract J.A.C.K. (2003),gamespy1,port_query=27888 -contagion,Contagion (2011),source,port=27015 -crossracing,Cross Racing Championship Extreme 2005 (2005),ase,port=12321;port_query_offset=123 -crysis,Crysis (2007),gamespy3,port=64087 -crysis2,Crysis 2 (2011),gamespy3,port=64000 -crysiswars,Crysis Wars (2008),gamespy3,port=64100 -cs15,Counter-Strike 1.5 (2002),won,port=27015 -cs16,Counter-Strike 1.6 (2003),source,port=27015 -cs2,Counter-Strike 2 (2023),source,port=27015 -cscz,Counter-Strike: Condition Zero (2004),source,port=27015 -csgo,Counter-Strike: Global Offensive (2012),source,port=27015 -css,Counter-Strike: Source (2004),source,port=27015 - -daikatana,Daikatana (2000),quake2,port=27982;port_query_offset=10 -darkesthour,Darkest Hour: Europe '44-'45 (2008),unreal2,port=7757;port_query_offset=1 -dayofdragons,Day of Dragons (2019),source,port_query=27016 -daysofwar,Days of War (2017),source,port=27015 -dayz,DayZ (2018),source,port=2302;port_query_offset=24714 -dayzmod,DayZ Mod (2013),source,port=2302;port_query_offset=1 -deadlydozenpt,Deadly Dozen: Pacific Theater (2002),gamespy1,port_query=25300 -descent3,Descent 3 (1999),gamespy1,port=2092;port_query=20142 -deusex,Deus Ex (2000),gamespy2,port=7791;port_query_offset=1 -devastation,Devastation (2003),unreal2,port=7777;port_query_offset=1 -dh2005,Deer Hunter 2005 (2004),gamespy2,port=23459;port_query=34567 -dinodday,Dino D-Day (2011),source,port=27015 -dirttrackracing2,Dirt Track Racing 2 (2002),gamespy1,port=32240;port_query_offset=-100 -discord,Discord,discord, -dmomam,Dark Messiah of Might and Magic (2006),source,port=27015 -dnl,Dark and Light (2017),source,port=7777;port_query=27015 -dod,Day of Defeat (2003),source,port=27015 -dods,Day of Defeat: Source (2005),source,port=27015 -doi,Day of Infamy (2017),source,port=27015 -doom3,Doom 3 (2004),doom3,port=27666 -dota2,Dota 2 (2013),source,port=27015 -drakan,Drakan: Order of the Flame (1999),gamespy1,port=27045;port_query_offset=1 - -eco,ECO (2018),eco,port=3001 -empyrion,Empyrion - Galactic Survival (2015),source,port=30000;port_query_offset=1 -enshrouded,Enshrouded (2024),source,port=27015;port_query_offset=1 -esf,Half Life: Earths Special Forces(2013),source,port=27015 -etqw,Enemy Territory: Quake Wars (2007),doom3,port=3074;port_query=27733 -ets2,Euro Truck Simulator 2,source,port_query=27016 -exfil,EXFIL (2024),source,port_query=27015 - -f12002,Formula One 2002 (2002),gamespy1,port_query=3297 -f1c9902,F1 Challenge '99-'02 (2002),gamespy1,port_query=34397 -factorio,Factorio (2016),factorio,port=34197 -farcry,Far Cry (2004),ase,port=49001;port_query_offset=123 -farcry2,Far Cry 2 (2008),ase,port_query=14001 -fear,F.E.A.R. (2005),gamespy2,port_query=27888 -fivem,Grand Theft Auto V - FiveM (2013),fivem,port=30120 -flashpoint,Operation Flashpoint: Cold War Crisis (2001),gamespy1,port=2302;port_query_offset=1 -flashpointresistance,Operation Flashpoint: Resistance (2002),gamespy1,port=2302;port_query_offset=1 -forest,The Forest (2014),source,port=27015;port_query_offset=1 -fortressforever,Fortress Forever (2007),source,port=27015 -front,The Front (2023),front,port=27015 -fs22,Farming Simulator 22 (2021),source,port=27015 - -garrysmod,Garry's Mod (2004),source,port=27015 -ges,GoldenEye: Source (2010),source,port=27015 -giantscitizenkabuto,Giants: Citizen Kabuto (2000),gamespy1,port_query=8911 -globaloperations,Global Operations (2002),gamespy1,port_query=28672 -gore,Gore: Ultimate Soldier (2002),gamespy1,port=27777;port_query_offset=1 -gportal,GPORTAL,gportal, -graw,Tom Clancy's Ghost Recon Advanced Warfighter (2006),gamespy2,port_query=15250 -graw2,Tom Clancy's Ghost Recon Advanced Warfighter 2 (2007),gamespy2,port_query=16250 -groundbranch,Ground Branch (2018),source,port=27015 -gunmanchronicles,Gunman Chronicles (2000),source,port=27015 - -had2,Hidden & Dangerous 2 (2003),gamespy1,port=11001;port_query_offset=3 -halo,Halo (2003),gamespy2,port=2302 -halo2,Halo 2 (2007),gamespy2,port=2302 -heretic2,Heretic II (1998),gamespy1,port=27900;port_query_offset=1 -hexen2,Hexen II (1997),hexen2,port=26900;port_query_offset=50 -hfnaw,Holdfast: Nations at War (2020),source,port=27000 -hidden,The Hidden (2005),source,port=27015 -hl2dm,Half-Life 2: Deathmatch (2004),source,port=27015 -hldm,Half-Life Deathmatch (1998),source,port=27015 -hldms,Half-Life Deathmatch: Source (2005),source,port=27015 -hll,Hell Let Loose (2021),source,port=27015 -homefront,Homefront (2011),source,port=27015 -homeworld2,Homeworld 2 (2003),gamespy1,port_query=6500 -humanitz,HumanitZ (2023),source,port_query=27015 -hurtworld,Hurtworld (2015),source,port=12871;port_query=12881 - -icarus,ICARUS (2023),source,port_query=17015 -igi2,I.G.I.-2: Covert Strike (2003),gamespy1,port_query=26001 -il2,IL-2 Sturmovik (2001),gamespy1,port_query=21000 -insurgency,Insurgency (2014),source,port=27015 -insurgencysandstorm,Insurgency: Sandstorm (2018),source,port=27015;port_query_offset=1 -iosoccer,IOSoccer (2018),source,port=27015 -ironstorm,Iron Storm (2002),gamespy1,port_query=3505 - -jamesbondnightfire,James Bond 007: Nightfire (2002),gamespy1,port_query=6550 -jbep3,Jabroni Brawl: Episode 3 (2022),source,port=27015 -jc3mp,Just Cause 3 - Multiplayer (2017),source,port=4200;port_query_offset=1 - -killingfloor,Killing Floor (2009),unreal2,port=7707;port_query_offset=1 -killingfloor2,Killing Floor 2 (2016),source,port=7777;port_query=27015 -kingpin,Kingpin: Life of Crime (1999),gamespy1,port=31510;port_query_offset=-10 -kisspc,Kiss: Psycho Circus: The Nightmare Child (2000),gamespy1,port=7777;port_query_offset=1 -kzmod,Kreedz Climbing (2017),source,port=27015 - -leadandgold,Lead and Gold: Gangs of the Wild West (2010),source,port=27015;port_query_offset=1 -left4dead,Left 4 Dead (2008),source,port=27015 -left4dead2,Left 4 Dead 2 (2009),source,port=27015 - -medievalengineers,Medieval Engineers (2015),source,port=27015 -minecraft,Minecraft (2009),minecraft,port=25565 -minecraftpe,Minecraft: Bedrock Edition (2011),raknet,port=19132 -mnc,Monday Night Combat (2011),source,port=7777;port_query=27016 -moe,Myth of Empires(2021),source,port=11888;port_query_offset=1000 -moh2010,Medal of Honor (2010),battlefield,port=7673;port_query=48888 -mohaa,Medal of Honor: Allied Assault (2002),gamespy1,port=12203;port_query_offset=97 -mohab,Medal of Honor: Airborne (2007),gamespy1,port=12203;port_query_offset=97 -mohbt,Medal of Honor: Allied Assault Breakthrough (2003),gamespy1,port=12203;port_query_offset=97 -mohpa,Medal of Honor: Pacific Assault (2004),gamespy1,port=13203;port_query_offset=97 -mohsh,Medal of Honor: Allied Assault Spearhead (2002),gamespy1,port=12203;port_query_offset=97 -mohwf,Medal of Honor: Warfighter (2012),battlefield,port=25200;port_query_offset=22000 -mordhau,Mordhau (2019),source,port=7777;port_query=27015 -mtasa,Grand Theft Auto: San Andreas - Multi Theft Auto (2004),ase,port=22003;port_query_offset=123 -mtavc,Grand Theft Auto: Vice City - Multi Theft Auto (2002),ase,port=22003;port_query_offset=123 - -nab,Nerf Arena Blast (1999),gamespy1,port=4444;port_query_offset=1 -nascarthunder2004,NASCAR Thunder 2004 (2003),gamespy2,port_query=13333 -netpanzer,netPanzer (2002),gamespy1,port=3030 -nexuiz,Nexuiz (2005),quake3,port_query=26000 -nfshp2,Need for Speed: Hot Pursuit 2 (2002),gamespy1,port_query=61220 -nitrofamily,Nitro Family (2004),gamespy1,port_query=25601 -nmrih,No More Room in Hell (2011),source,port=27015 -nolf,The Operative: No One Lives Forever (2000),gamespy1,port_query=27888 -nolf2,No One Lives Forever 2: A Spy in H.A.R.M.'s Way (2002),gamespy1,port_query=27890 -nos,No One Survived (2023),source,port_query=48203 -notd,Night of the Dead(2020),source,port_query=22815 -ns,Natural Selection (2002),source,port=27015 -ns2,Natural Selection 2 (2012),source,port_query_offset=1 -nucleardawn,Nuclear Dawn (2011),source,port=27015 -nwn,Neverwinter Nights (2002),nwn1,port=5121 -nwn2,Neverwinter Nights 2 (2006),nwn2,port=5121 - -openarena,OpenArena (2005),quake3,port_query=27960 -operationharsh,Operation: Harsh Doorstop (2023),source,port_query=27005 - -painkiller,Painkiller (2004),ase,port=3455;port_query_offset=123 -palworld,Palworld (2024),palworld,port=8211 -pixark,PixARK (2018),source,port=7777;port_query=27015 -postal2,Postal 2 (2003),gamespy1,port=7777;port_query_offset=1 -prbf2,Project Reality: Battlefield 2 (2005),gamespy3,port=16567;port_query=29900 -prey,Prey (2017),doom3,port=27719 -primalcarnage,Primal Carnage: Extinction (2015),source,port=7777;port_query=27015 -przomboid,Project Zomboid (2013),source,port=16261 -ps,Post Scriptum (2018),source,port=10027;port_query=10037 - -quake1,Quake 1: QuakeWorld (1996),quake1,port=27500 -quake2,Quake 2 (1997),quake2,port=27910 -quake3,Quake 3: Arena (1999),quake3,port=27960 -quake4,Quake 4 (2005),doom3,port=28004 -quakelive,Quake Live (2010),source,port=27960 - -r6,Rainbow Six (1998),gamespy1,port_query=2348 -r6ravenshield,Rainbow Six 3: Raven Shield (2003),gamespy1,port=7777;port_query_offset=1000 -r6roguespear,Rainbow Six 2: Rogue Spear (1999),gamespy1,port_query=2346 -ragdollkungfu,Rag Doll Kung Fu (2005),source,port=27015 -rallisportchallenge,RalliSport Challenge (2002),gamespy1,port_query=17500 -rallymasters,Rally Masters (2000),gamespy1,port_query=16666 -redline,Redline (1999),gamespy1,port_query=25252 -redm,Red Dead Redemption 2 - RedM (2016),fivem,port=30120 -redorchestra,Red Orchestra (2011),unreal2,port=7758;port_query_offset=1 -redorchestra2,Red Orchestra 2 (2011),source,port=7777;port_query=27015 -redorchestraost,Red Orchestra: Ostfront 41-45 (2006),gamespy1,port=7757;port_query_offset=10 -renegadex_lan,RenegadeX (LAN Mode),renegadex_lan,port=7777;port_query=45542 -ricochet,Ricochet (2000),source,port=27015 -riseofnations,Rise of Nations (2003),gamespy1,port_query=6501 -rs2,Rising Storm 2: Vietnam (2017),source,port=27015 -rtcw,Return to Castle Wolfenstein (2001),quake3,port_query=27960 -rune,Rune (2000),gamespy1,port=7777;port_query_offset=1 -rust,Rust (2018),source,port=28015 - -samp,San Andreas Multiplayer (2006),samp,port=7777 -satisfactory,Satisfactory (2019),satisfactory,port_query=7777 -scpsl,SCP: Secret Laboratory (2017),scpsl, -scum,SCUM (2018),scum,port=27015 -shatteredhorizon,Shattered Horizon (2009),source,port=27015 -ship,The Ship (2006),source,port=27015 -shogo,Shogo (1998),gamespy1,port_query=27888 -silica,Silica (2023),source,port=27015 -sin,SiN,gamespy1,port_query=22450 -sinep,SiN Episodes,source,port=27015 -sniperelite4,Sniper Elite 4 (2017),source,port_query=27050 -sof,Soldier of Fortune,quake1,port_query=28910 -sof2,Soldier of Fortune 2,quake3,port_query=20100 -soldat,Soldat,ase,port=13073;port_query_offset=123 -sonsforest,Sons Of The Forest (2023),source,port=27015;port_query_offset=1 -soulmask,SoulMask (2024),source,port_query=25025 -spaceengineers,Space Engineers,source,port=27015 -squad,Squad,source,port=7787;port_query=27165 -ss,Serious Sam,gamespy1,port=25600;port_query_offset=1 -ss2,Serious Sam 2,gamespy2,port=25600 -stalker,S.T.A.L.K.E.R.,gamespy3,port=5445;port_query_offset=2 -starbound,Starbound,source,port=21025 -stbc,Star Trek: Bridge Commander,gamespy1,port_query=22101 -stvef,Star Trek: Voyager - Elite Force,quake3,port_query=27960 -stvef2,Star Trek: Voyager - Elite Force 2,quake3,port_query=29253 -suicidesurvival,Suicide Survival,source,port=27015 -svencoop,Sven Coop,source,port=27015 -swat4,SWAT 4,gamespy2,port=10480;port_query_offset=2 -swbf,Star Wars: Battlefront,gamespy2,port_query=3658 -swbf2,Star Wars: Battlefront 2,gamespy2,port_query=3658 -swjk,Star Wars Jedi Knight: Jedi Academy (2003),quake3,port_query=29070 -swjk2,Star Wars Jedi Knight II: Jedi Outcast (2002),quake3,port_query=28070 -swrc,Star Wars: Republic Commando,gamespy2,port=7777;port_query=11138 -synergy,Synergy,source,port=27015 - -tacticalops,Tactical Ops,gamespy1,port=7777;port_query_offset=1 -takeonhelicopters,Take On Helicopters (2011),gamespy1,port=2302;port_query_offset=1 -teamfactor,Team Factor,gamespy1,port_query=57778 -teamspeak3,Teamspeak 3,teamspeak3,port=10011 -terminus,Terminus,gamespy1,port_query=12286 -terraria,Terraria - TShock (2011),terraria,port=7777;port_query_offset=101 -tf2,Team Fortress 2,source,port=27015 -tfc,Team Fortress Classic,source,port=27015 -theisle,The Isle (2015),source,port_query=7778 -theisleevrima,The Isle - EVRIMA (2020),theisleevrima,port_query=7778 -thespecialists,The Specialists (2002),source,port=27015 -thps3,Tony Hawk's Pro Skater 3,gamespy1,port_query=6500 -thps4,Tony Hawk's Pro Skater 4,gamespy1,port_query=6500 -thu2,Tony Hawk's Underground 2,gamespy1,port_query=5153 -tmnf,Trackmania Nations Forever,nadeo,port=5000 -towerunite,Tower Unite,source,port=27015 -toxikk_lan,Toxikk (LAN_Mode),toxikk_lan,port=7777;port_query_offset=6224 -tremulous,Tremulous,quake3,port_query=30720 -tribesvengeance,Tribes: Vengeance,gamespy2,port=7777;port_query_offset=1 -tron20,Tron 2.0,gamespy2,port_query=27888 -turok2,Turok 2,gamespy1,port_query=12880 - -universalcombat,Universal Combat,ase,port=1135;port_query_offset=123 -unreal,Unreal,gamespy1,port=7777;port_query_offset=1 -unturned,Unturned,source,port=27015;port_query_offset=1 -urbanterror,Urban Terror,quake3,port_query=27960 -ut,Unreal Tournament,gamespy1,port=7777;port_query_offset=1 -ut2003,Unreal Tournament 2003,unreal2,port=7757;port_query_offset=1 -ut2004,Unreal Tournament 2004,unreal2,port=7777;port_query_offset=1 -ut3,Unreal Tournament 3,ut3,port=7777;port_query_offset=-1277 -ut3_lan,Unreal Tournament 3 (LAN Mode),ut3_lan,port=7777;port_query_offset=6224 - -v8supercar,V8 Supercar Challenge,gamespy1,port_query=16700 -valheim,Valheim (2021),source,port=2456;port_query_offset=1 -vcmp,Vice City Multiplayer,vcmp,port=8192 -vietcong,Vietcong,gamespy1,port=5425;port_query=15425 -vietcong2,Vietcong 2,gamespy2,port=5001;port_query=19967 -vrising,V Rising,source,port=9876;port_query=9877 - -warsow,Warsow,quake3,port=44400 -wheeloftime,Wheel of Time,gamespy1,port=7777;port_query_offset=1 -wolfenstein2009,Wolfenstein 2009,doom3,port=27666 -wolfensteinet,Wolfenstein: Enemy Territory,quake3,port_query=27960 - -xonotic,Xonotic,quake3,port=26000;port_query=26000 -xpandrally,Xpand Rally,ase,port=28015;port_query_offset=123 - -zombiemaster,Zombie Master,source,port=27015 -zps,Zombie Panic: Source,source,port=27015 +Id,Name,Protocol,Options + +7d2d,7 Days to Die (2013),source,port=26900;port_query_offset=1 + +abioticf,Abiotic Factor(2023),source,port_query=27015 +ageofchivalry,Age of Chivalry (2007),source,port=27015 +alienarena,Alien Arena (2004),quake2,port_query=27910 +alienswarm,Alien Swarm (2010),source,port=27015 +americasarmy,America's Army (2002),gamespy2,port=1716;port_query_offset=1 +americasarmy2,America's Army 2 (2003),gamespy2,port=1716;port_query_offset=1 +americasarmy3,America's Army 3 (2009),source,port=8777;port_query=27020 +americasarmypg,America's Army: Proving Grounds (2015),source,port=8777;port_query=27020 +aoe2,Age of Empires 2 (1999),ase,port_query=27224 +arkse,Ark: Survival Evolved (2017),source,port=7777;port_query=27015 +arma,ARMA: Armed Assault (2007),gamespy2,port=2302 +arma2,ARMA 2 (2009),source,port=2302;port_query_offset=1 +arma2oa,ARMA 2: Operation Arrowhead (2010),source,port=2302;port_query_offset=1 +arma3,ARMA 3 (2013),source,port=2302;port_query_offset=1 +armacwa,ARMA: Cold War Assault (2011),gamespy1,port=2302;port_query_offset=1 +armar,ARMA: Resistance (2011),gamespy1,port=2302;port_query_offset=1 +armareforger,Arma Reforger (2022),source,port=2001;port_query=17777 +asa,Ark: Survival Ascended (2023),asa,port=7777 +assettocorsa,Assetto Corsa (2014),assettocorsa,port=9610 +astrocolony,Astro Colony (2022),source,port_query=27015 +atlas,Atlas (2018),source,port=5761;port_query_offset=51800 +avorion,Avorion (2017),source,port=40017;port_query_offset=2 +avp2,Aliens versus Predator 2 (2001),gamespy1,port=27888 +avp2010,Aliens vs. Predator (2010),source,port=27015 + +baldursgate,Baldur's Gate (1998),gamespy1,port=6073;port_query=1470 +barotrauma,Barotrauma (2019),source,port=27015;port_query_offset=1 +bat1944,Battalion 1944 (2018),source,port=7777;port_query_offset=3 +beammp,BeamMP (2021),beammp,port=30814 +beyondthewire,Beyond the Wire (2022),source,port=7887;port_query=27165 +bf1942,Battlefield 1942 (2002),gamespy1,port=14567;port_query=23000 +bf2,Battlefield 2 (2005),gamespy3,port=16567;port_query=29900 +bf2142,Battlefield 2142 (2006),gamespy3,port=16567;port_query=29900 +bf3,Battlefield 3 (2011),battlefield,port=25200;port_query_offset=22000 +bf4,Battlefield 4 (2013),battlefield,port=25200;port_query_offset=22000 +bfbc2,Battlefield: Bad Company 2 (2010),battlefield,port=19567;port_query=48888 +bfh,Battlefield Hardline (2015),battlefield,port=25200;port_query_offset=22000 +bfv,Battlefield Vietnam (2004),gamespy2,port=15567;port_query=23000 +bm,Black Mesa (2015),source,port=27015 +breach,Breach (2011),source,port=27016 +breed,Breed (2004),gamespy2,port=7649 +brink,Brink (2011),source,port_query_offset=1 + +cacrenegade,Command and Conquer: Renegade (2002),gamespy1,port=4848;port_query=25300 +callofjuarez,Call of Juarez (2006),ase,port_query=26000 +chaser,Chaser (2003),ase,port=3000;port_query_offset=123 +chrome,Chrome (2003),ase,port=27015;port_query_offset=123 +cod,Call of Duty (2003),quake3,port=28960 +cod2,Call of Duty 2 (2005),quake3,port=28960 +cod3,Call of Duty 3 (2006),quake3,port=28960 +cod4,Call of Duty 4: Modern Warfare (2007),quake3,port=28960 +codenameeagle,Codename Eagle (2000),gamespy1,port_query=4711 +codmw2,Call of Duty: Modern Warfare 2 (2009),quake3,port=28960 +codmw3,Call of Duty: Modern Warfare 3 (2011),source,port_query_offset=2 +coduo,Call of Duty: United Offensive (2004),quake3,port=28960 +codwaw,Call of Duty: World at War (2008),quake3,port=28960 +commandos3,Commandos 3: Destination Berlin (2003),gamespy1,port_query=6500 +conanexiles,Conan Exiles (2018),source,port=7777;port_query=27015 +contactjack,Contract J.A.C.K. (2003),gamespy1,port_query=27888 +contagion,Contagion (2011),source,port=27015 +crossracing,Cross Racing Championship Extreme 2005 (2005),ase,port=12321;port_query_offset=123 +crysis,Crysis (2007),gamespy3,port=64087 +crysis2,Crysis 2 (2011),gamespy3,port=64000 +crysiswars,Crysis Wars (2008),gamespy3,port=64100 +cs15,Counter-Strike 1.5 (2002),won,port=27015 +cs16,Counter-Strike 1.6 (2003),source,port=27015 +cs2,Counter-Strike 2 (2023),source,port=27015 +cscz,Counter-Strike: Condition Zero (2004),source,port=27015 +csgo,Counter-Strike: Global Offensive (2012),source,port=27015 +css,Counter-Strike: Source (2004),source,port=27015 + +daikatana,Daikatana (2000),quake2,port=27982;port_query_offset=10 +darkesthour,Darkest Hour: Europe '44-'45 (2008),unreal2,port=7757;port_query_offset=1 +dayofdragons,Day of Dragons (2019),source,port_query=27016 +daysofwar,Days of War (2017),source,port=27015 +dayz,DayZ (2018),source,port=2302;port_query_offset=24714 +dayzmod,DayZ Mod (2013),source,port=2302;port_query_offset=1 +deadlydozenpt,Deadly Dozen: Pacific Theater (2002),gamespy1,port_query=25300 +descent3,Descent 3 (1999),gamespy1,port=2092;port_query=20142 +deusex,Deus Ex (2000),gamespy2,port=7791;port_query_offset=1 +devastation,Devastation (2003),unreal2,port=7777;port_query_offset=1 +dh2005,Deer Hunter 2005 (2004),gamespy2,port=23459;port_query=34567 +dinodday,Dino D-Day (2011),source,port=27015 +dirttrackracing2,Dirt Track Racing 2 (2002),gamespy1,port=32240;port_query_offset=-100 +discord,Discord,discord, +dmomam,Dark Messiah of Might and Magic (2006),source,port=27015 +dnl,Dark and Light (2017),source,port=7777;port_query=27015 +dod,Day of Defeat (2003),source,port=27015 +dods,Day of Defeat: Source (2005),source,port=27015 +doi,Day of Infamy (2017),source,port=27015 +doom3,Doom 3 (2004),doom3,port=27666 +dota2,Dota 2 (2013),source,port=27015 +drakan,Drakan: Order of the Flame (1999),gamespy1,port=27045;port_query_offset=1 + +eco,ECO (2018),eco,port=3001 +empyrion,Empyrion - Galactic Survival (2015),source,port=30000;port_query_offset=1 +enshrouded,Enshrouded (2024),source,port=27015;port_query_offset=1 +esf,Half Life: Earths Special Forces(2013),source,port=27015 +etqw,Enemy Territory: Quake Wars (2007),doom3,port=3074;port_query=27733 +ets2,Euro Truck Simulator 2,source,port_query=27016 +exfil,EXFIL (2024),exfil,port_query=27015 + +f12002,Formula One 2002 (2002),gamespy1,port_query=3297 +f1c9902,F1 Challenge '99-'02 (2002),gamespy1,port_query=34397 +factorio,Factorio (2016),factorio,port=34197 +farcry,Far Cry (2004),ase,port=49001;port_query_offset=123 +farcry2,Far Cry 2 (2008),ase,port_query=14001 +fear,F.E.A.R. (2005),gamespy2,port_query=27888 +fivem,Grand Theft Auto V - FiveM (2013),fivem,port=30120 +flashpoint,Operation Flashpoint: Cold War Crisis (2001),gamespy1,port=2302;port_query_offset=1 +flashpointresistance,Operation Flashpoint: Resistance (2002),gamespy1,port=2302;port_query_offset=1 +forest,The Forest (2014),source,port=27015;port_query_offset=1 +fortressforever,Fortress Forever (2007),source,port=27015 +front,The Front (2023),front,port=27015 +fs22,Farming Simulator 22 (2021),source,port=27015 + +garrysmod,Garry's Mod (2004),source,port=27015 +ges,GoldenEye: Source (2010),source,port=27015 +giantscitizenkabuto,Giants: Citizen Kabuto (2000),gamespy1,port_query=8911 +globaloperations,Global Operations (2002),gamespy1,port_query=28672 +gore,Gore: Ultimate Soldier (2002),gamespy1,port=27777;port_query_offset=1 +gportal,GPORTAL,gportal, +graw,Tom Clancy's Ghost Recon Advanced Warfighter (2006),gamespy2,port_query=15250 +graw2,Tom Clancy's Ghost Recon Advanced Warfighter 2 (2007),gamespy2,port_query=16250 +groundbranch,Ground Branch (2018),source,port=27015 +gunmanchronicles,Gunman Chronicles (2000),source,port=27015 + +had2,Hidden & Dangerous 2 (2003),gamespy1,port=11001;port_query_offset=3 +halo,Halo (2003),gamespy2,port=2302 +halo2,Halo 2 (2007),gamespy2,port=2302 +heretic2,Heretic II (1998),gamespy1,port=27900;port_query_offset=1 +hexen2,Hexen II (1997),hexen2,port=26900;port_query_offset=50 +hfnaw,Holdfast: Nations at War (2020),source,port=27000 +hidden,The Hidden (2005),source,port=27015 +hl2dm,Half-Life 2: Deathmatch (2004),source,port=27015 +hldm,Half-Life Deathmatch (1998),source,port=27015 +hldms,Half-Life Deathmatch: Source (2005),source,port=27015 +hll,Hell Let Loose (2021),source,port=27015 +homefront,Homefront (2011),source,port=27015 +homeworld2,Homeworld 2 (2003),gamespy1,port_query=6500 +humanitz,HumanitZ (2023),source,port_query=27015 +hurtworld,Hurtworld (2015),source,port=12871;port_query=12881 + +icarus,ICARUS (2023),source,port_query=17015 +igi2,I.G.I.-2: Covert Strike (2003),gamespy1,port_query=26001 +il2,IL-2 Sturmovik (2001),gamespy1,port_query=21000 +insurgency,Insurgency (2014),source,port=27015 +insurgencysandstorm,Insurgency: Sandstorm (2018),source,port=27015;port_query_offset=1 +iosoccer,IOSoccer (2018),source,port=27015 +ironstorm,Iron Storm (2002),gamespy1,port_query=3505 + +jamesbondnightfire,James Bond 007: Nightfire (2002),gamespy1,port_query=6550 +jbep3,Jabroni Brawl: Episode 3 (2022),source,port=27015 +jc3mp,Just Cause 3 - Multiplayer (2017),source,port=4200;port_query_offset=1 + +killingfloor,Killing Floor (2009),unreal2,port=7707;port_query_offset=1 +killingfloor2,Killing Floor 2 (2016),source,port=7777;port_query=27015 +kingpin,Kingpin: Life of Crime (1999),gamespy1,port=31510;port_query_offset=-10 +kisspc,Kiss: Psycho Circus: The Nightmare Child (2000),gamespy1,port=7777;port_query_offset=1 +kzmod,Kreedz Climbing (2017),source,port=27015 + +leadandgold,Lead and Gold: Gangs of the Wild West (2010),source,port=27015;port_query_offset=1 +left4dead,Left 4 Dead (2008),source,port=27015 +left4dead2,Left 4 Dead 2 (2009),source,port=27015 + +medievalengineers,Medieval Engineers (2015),source,port=27015 +minecraft,Minecraft (2009),minecraft,port=25565 +minecraftpe,Minecraft: Bedrock Edition (2011),raknet,port=19132 +mnc,Monday Night Combat (2011),source,port=7777;port_query=27016 +moe,Myth of Empires(2021),source,port=11888;port_query_offset=1000 +moh2010,Medal of Honor (2010),battlefield,port=7673;port_query=48888 +mohaa,Medal of Honor: Allied Assault (2002),gamespy1,port=12203;port_query_offset=97 +mohab,Medal of Honor: Airborne (2007),gamespy1,port=12203;port_query_offset=97 +mohbt,Medal of Honor: Allied Assault Breakthrough (2003),gamespy1,port=12203;port_query_offset=97 +mohpa,Medal of Honor: Pacific Assault (2004),gamespy1,port=13203;port_query_offset=97 +mohsh,Medal of Honor: Allied Assault Spearhead (2002),gamespy1,port=12203;port_query_offset=97 +mohwf,Medal of Honor: Warfighter (2012),battlefield,port=25200;port_query_offset=22000 +mordhau,Mordhau (2019),source,port=7777;port_query=27015 +mtasa,Grand Theft Auto: San Andreas - Multi Theft Auto (2004),ase,port=22003;port_query_offset=123 +mtavc,Grand Theft Auto: Vice City - Multi Theft Auto (2002),ase,port=22003;port_query_offset=123 + +nab,Nerf Arena Blast (1999),gamespy1,port=4444;port_query_offset=1 +nascarthunder2004,NASCAR Thunder 2004 (2003),gamespy2,port_query=13333 +netpanzer,netPanzer (2002),gamespy1,port=3030 +nexuiz,Nexuiz (2005),quake3,port_query=26000 +nfshp2,Need for Speed: Hot Pursuit 2 (2002),gamespy1,port_query=61220 +nitrofamily,Nitro Family (2004),gamespy1,port_query=25601 +nmrih,No More Room in Hell (2011),source,port=27015 +nolf,The Operative: No One Lives Forever (2000),gamespy1,port_query=27888 +nolf2,No One Lives Forever 2: A Spy in H.A.R.M.'s Way (2002),gamespy1,port_query=27890 +nos,No One Survived (2023),source,port_query=48203 +notd,Night of the Dead(2020),source,port_query=22815 +ns,Natural Selection (2002),source,port=27015 +ns2,Natural Selection 2 (2012),source,port_query_offset=1 +nucleardawn,Nuclear Dawn (2011),source,port=27015 +nwn,Neverwinter Nights (2002),nwn1,port=5121 +nwn2,Neverwinter Nights 2 (2006),nwn2,port=5121 + +openarena,OpenArena (2005),quake3,port_query=27960 +operationharsh,Operation: Harsh Doorstop (2023),source,port_query=27005 + +painkiller,Painkiller (2004),ase,port=3455;port_query_offset=123 +palworld,Palworld (2024),palworld,port=8211 +pixark,PixARK (2018),source,port=7777;port_query=27015 +postal2,Postal 2 (2003),gamespy1,port=7777;port_query_offset=1 +prbf2,Project Reality: Battlefield 2 (2005),gamespy3,port=16567;port_query=29900 +prey,Prey (2017),doom3,port=27719 +primalcarnage,Primal Carnage: Extinction (2015),source,port=7777;port_query=27015 +przomboid,Project Zomboid (2013),source,port=16261 +ps,Post Scriptum (2018),source,port=10027;port_query=10037 + +quake1,Quake 1: QuakeWorld (1996),quake1,port=27500 +quake2,Quake 2 (1997),quake2,port=27910 +quake3,Quake 3: Arena (1999),quake3,port=27960 +quake4,Quake 4 (2005),doom3,port=28004 +quakelive,Quake Live (2010),source,port=27960 + +r6,Rainbow Six (1998),gamespy1,port_query=2348 +r6ravenshield,Rainbow Six 3: Raven Shield (2003),gamespy1,port=7777;port_query_offset=1000 +r6roguespear,Rainbow Six 2: Rogue Spear (1999),gamespy1,port_query=2346 +ragdollkungfu,Rag Doll Kung Fu (2005),source,port=27015 +rallisportchallenge,RalliSport Challenge (2002),gamespy1,port_query=17500 +rallymasters,Rally Masters (2000),gamespy1,port_query=16666 +redline,Redline (1999),gamespy1,port_query=25252 +redm,Red Dead Redemption 2 - RedM (2016),fivem,port=30120 +redorchestra,Red Orchestra (2011),unreal2,port=7758;port_query_offset=1 +redorchestra2,Red Orchestra 2 (2011),source,port=7777;port_query=27015 +redorchestraost,Red Orchestra: Ostfront 41-45 (2006),gamespy1,port=7757;port_query_offset=10 +renegadex_lan,RenegadeX (LAN Mode),renegadex_lan,port=7777;port_query=45542 +ricochet,Ricochet (2000),source,port=27015 +riseofnations,Rise of Nations (2003),gamespy1,port_query=6501 +rs2,Rising Storm 2: Vietnam (2017),source,port=27015 +rtcw,Return to Castle Wolfenstein (2001),quake3,port_query=27960 +rune,Rune (2000),gamespy1,port=7777;port_query_offset=1 +rust,Rust (2018),source,port=28015 + +samp,San Andreas Multiplayer (2006),samp,port=7777 +satisfactory,Satisfactory (2019),satisfactory,port_query=7777 +scpsl,SCP: Secret Laboratory (2017),scpsl, +scum,SCUM (2018),scum,port=27015 +shatteredhorizon,Shattered Horizon (2009),source,port=27015 +ship,The Ship (2006),source,port=27015 +shogo,Shogo (1998),gamespy1,port_query=27888 +silica,Silica (2023),source,port=27015 +sin,SiN,gamespy1,port_query=22450 +sinep,SiN Episodes,source,port=27015 +sniperelite4,Sniper Elite 4 (2017),source,port_query=27050 +sof,Soldier of Fortune,quake1,port_query=28910 +sof2,Soldier of Fortune 2,quake3,port_query=20100 +soldat,Soldat,ase,port=13073;port_query_offset=123 +sonsforest,Sons Of The Forest (2023),source,port=27015;port_query_offset=1 +soulmask,SoulMask (2024),source,port_query=25025 +spaceengineers,Space Engineers,source,port=27015 +squad,Squad,source,port=7787;port_query=27165 +ss,Serious Sam,gamespy1,port=25600;port_query_offset=1 +ss2,Serious Sam 2,gamespy2,port=25600 +stalker,S.T.A.L.K.E.R.,gamespy3,port=5445;port_query_offset=2 +starbound,Starbound,source,port=21025 +stbc,Star Trek: Bridge Commander,gamespy1,port_query=22101 +stvef,Star Trek: Voyager - Elite Force,quake3,port_query=27960 +stvef2,Star Trek: Voyager - Elite Force 2,quake3,port_query=29253 +suicidesurvival,Suicide Survival,source,port=27015 +svencoop,Sven Coop,source,port=27015 +swat4,SWAT 4,gamespy2,port=10480;port_query_offset=2 +swbf,Star Wars: Battlefront,gamespy2,port_query=3658 +swbf2,Star Wars: Battlefront 2,gamespy2,port_query=3658 +swjk,Star Wars Jedi Knight: Jedi Academy (2003),quake3,port_query=29070 +swjk2,Star Wars Jedi Knight II: Jedi Outcast (2002),quake3,port_query=28070 +swrc,Star Wars: Republic Commando,gamespy2,port=7777;port_query=11138 +synergy,Synergy,source,port=27015 + +tacticalops,Tactical Ops,gamespy1,port=7777;port_query_offset=1 +takeonhelicopters,Take On Helicopters (2011),gamespy1,port=2302;port_query_offset=1 +teamfactor,Team Factor,gamespy1,port_query=57778 +teamspeak3,Teamspeak 3,teamspeak3,port=10011 +terminus,Terminus,gamespy1,port_query=12286 +terraria,Terraria - TShock (2011),terraria,port=7777;port_query_offset=101 +tf2,Team Fortress 2,source,port=27015 +tfc,Team Fortress Classic,source,port=27015 +theisle,The Isle (2015),source,port_query=7778 +theisleevrima,The Isle - EVRIMA (2020),theisleevrima,port_query=7778 +thespecialists,The Specialists (2002),source,port=27015 +thps3,Tony Hawk's Pro Skater 3,gamespy1,port_query=6500 +thps4,Tony Hawk's Pro Skater 4,gamespy1,port_query=6500 +thu2,Tony Hawk's Underground 2,gamespy1,port_query=5153 +tmnf,Trackmania Nations Forever,nadeo,port=5000 +towerunite,Tower Unite,source,port=27015 +toxikk_lan,Toxikk (LAN_Mode),toxikk_lan,port=7777;port_query_offset=6224 +tremulous,Tremulous,quake3,port_query=30720 +tribesvengeance,Tribes: Vengeance,gamespy2,port=7777;port_query_offset=1 +tron20,Tron 2.0,gamespy2,port_query=27888 +turok2,Turok 2,gamespy1,port_query=12880 + +universalcombat,Universal Combat,ase,port=1135;port_query_offset=123 +unreal,Unreal,gamespy1,port=7777;port_query_offset=1 +unturned,Unturned,source,port=27015;port_query_offset=1 +urbanterror,Urban Terror,quake3,port_query=27960 +ut,Unreal Tournament,gamespy1,port=7777;port_query_offset=1 +ut2003,Unreal Tournament 2003,unreal2,port=7757;port_query_offset=1 +ut2004,Unreal Tournament 2004,unreal2,port=7777;port_query_offset=1 +ut3,Unreal Tournament 3,ut3,port=7777;port_query_offset=-1277 +ut3_lan,Unreal Tournament 3 (LAN Mode),ut3_lan,port=7777;port_query_offset=6224 + +v8supercar,V8 Supercar Challenge,gamespy1,port_query=16700 +valheim,Valheim (2021),source,port=2456;port_query_offset=1 +vcmp,Vice City Multiplayer,vcmp,port=8192 +vietcong,Vietcong,gamespy1,port=5425;port_query=15425 +vietcong2,Vietcong 2,gamespy2,port=5001;port_query=19967 +vrising,V Rising,source,port=9876;port_query=9877 + +warsow,Warsow,quake3,port=44400 +wheeloftime,Wheel of Time,gamespy1,port=7777;port_query_offset=1 +wolfenstein2009,Wolfenstein 2009,doom3,port=27666 +wolfensteinet,Wolfenstein: Enemy Territory,quake3,port_query=27960 + +xonotic,Xonotic,quake3,port=26000;port_query=26000 +xpandrally,Xpand Rally,ase,port=28015;port_query_offset=123 + +zombiemaster,Zombie Master,source,port=27015 +zps,Zombie Panic: Source,source,port=27015 diff --git a/discordgsm/protocols/__init__.py b/discordgsm/protocols/__init__.py old mode 100644 new mode 100755 index 1b978a1..6f6cddf --- a/discordgsm/protocols/__init__.py +++ b/discordgsm/protocols/__init__.py @@ -1,44 +1,45 @@ -# flake8: noqa -from .asa import ASA -from .ase import ASE -from .assettocorsa import AssettoCorsa -from .battlefield import Battlefield -from .beammp import BeamMP -from .discord import Discord -from .doom3 import Doom3 -from .eco import Eco -from .factorio import Factorio -from .fivem import FiveM -from .front import Front -from .gamespy1 import GameSpy1 -from .gamespy2 import GameSpy2 -from .gamespy3 import GameSpy3 -from .gportal import GPortal -from .hexen2 import Hexen2 -from .minecraft import Minecraft -from .nadeo import Nadeo -from .nwn1 import NWN1 -from .nwn2 import NWN2 -from .palworld import Palworld -from .protocol import Protocol -from .quake1 import Quake1 -from .quake2 import Quake2 -from .quake3 import Quake3 -from .raknet import Raknet -from .renegadex_lan import RenegadeX -from .samp import Samp -from .satisfactory import Satisfactory -from .scpsl import SCPSL -from .scum import Scum -from .source import Source -from .teamspeak3 import Teamspeak3 -from .terraria import Terraria -from .theisleevrima import TheIsleEvrima -from .toxikk_lan import Toxikk_LAN -from .unreal2 import Unreal2 -from .ut3 import UT3 -from .ut3_lan import UT3_LAN -from .vcmp import Vcmp -from .won import WON - -protocols = {str(protocol.name): protocol for protocol in Protocol.__subclasses__()} +# flake8: noqa +from .asa import ASA +from .ase import ASE +from .assettocorsa import AssettoCorsa +from .battlefield import Battlefield +from .beammp import BeamMP +from .discord import Discord +from .doom3 import Doom3 +from .eco import Eco +from .exfil import Exfil +from .factorio import Factorio +from .fivem import FiveM +from .front import Front +from .gamespy1 import GameSpy1 +from .gamespy2 import GameSpy2 +from .gamespy3 import GameSpy3 +from .gportal import GPortal +from .hexen2 import Hexen2 +from .minecraft import Minecraft +from .nadeo import Nadeo +from .nwn1 import NWN1 +from .nwn2 import NWN2 +from .palworld import Palworld +from .protocol import Protocol +from .quake1 import Quake1 +from .quake2 import Quake2 +from .quake3 import Quake3 +from .raknet import Raknet +from .renegadex_lan import RenegadeX +from .samp import Samp +from .satisfactory import Satisfactory +from .scpsl import SCPSL +from .scum import Scum +from .source import Source +from .teamspeak3 import Teamspeak3 +from .terraria import Terraria +from .theisleevrima import TheIsleEvrima +from .toxikk_lan import Toxikk_LAN +from .unreal2 import Unreal2 +from .ut3 import UT3 +from .ut3_lan import UT3_LAN +from .vcmp import Vcmp +from .won import WON + +protocols = {str(protocol.name): protocol for protocol in Protocol.__subclasses__()} diff --git a/discordgsm/protocols/exfil.py b/discordgsm/protocols/exfil.py new file mode 100755 index 0000000..5691ba5 --- /dev/null +++ b/discordgsm/protocols/exfil.py @@ -0,0 +1,157 @@ +import asyncio +import time +import logging +from typing import TYPE_CHECKING + +import aiohttp +import opengsq +from opengsq.responses.source import SourceInfo, GoldSourceInfo, Visibility + +from discordgsm.protocols.protocol import Protocol + +if TYPE_CHECKING: + from discordgsm.gamedig import GamedigResult + +logger = logging.getLogger(__name__) + + +class Exfil(Protocol): + name = "exfil" + + async def query(self): + host, port = str(self.kv["host"]), int(str(self.kv["port"])) + start = time.time() + + # Stage 1: Try HTTP API first + try: + async with aiohttp.ClientSession() as session: + api_url = f"http://{host}:{port}/status" + async with session.get(api_url, timeout=aiohttp.ClientTimeout(total=3)) as response: + if response.status == 200: + data = await response.json() + if isinstance(data, dict): + # Successfully got API response + logger.debug(f"Exfil HTTP API success for {host}:{port}") + result = await self._build_result_from_api(data, host, port, start, time.time()) + return result + else: + logger.debug(f"Exfil HTTP API failed with status {response.status} for {host}:{port}") + except asyncio.TimeoutError: + logger.debug(f"Exfil HTTP API timeout for {host}:{port}") + except Exception as e: + logger.debug(f"Exfil HTTP API exception for {host}:{port}: {type(e).__name__}: {e}") + + # Stage 2: Fallback to Source protocol (A2S query) + try: + logger.debug(f"Exfil falling back to Source protocol for {host}:{port}") + source = opengsq.Source(host, port, self.timeout) + + async def get_players(): + try: + return await source.get_players() + except Exception: + return [] + + # Query info and players from Source protocol + info, players = await asyncio.gather(source.get_info(), get_players()) + + if isinstance(info, SourceInfo): + info: SourceInfo = info + connect = f"{host}:{info.port}" + elif isinstance(info, GoldSourceInfo): + info: GoldSourceInfo = info + connect = info.address + else: + raise Exception("Unknown SourceInfo type") + + ping = int((time.time() - start) * 1000) + players.sort(key=lambda x: x.duration, reverse=True) + players, bots = players[info.bots :], players[: info.bots] + + result: GamedigResult = { + "name": info.name, + "map": info.map, + "password": info.visibility == Visibility.Private, + "numplayers": info.players, + "numbots": info.bots, + "maxplayers": info.max_players, + "players": [ + { + "name": player.name, + "raw": {"score": player.score, "time": player.duration}, + } + for player in players + ], + "bots": [ + {"name": bot.name, "raw": {"score": bot.score, "time": bot.duration}} + for bot in bots + ], + "connect": connect, + "ping": ping, + "raw": info.__dict__, + } + logger.debug(f"Exfil Source protocol success for {host}:{port}") + return result + + except Exception as e: + logger.error(f"Exfil protocol failed for {host}:{port}: {type(e).__name__}: {e}") + raise Exception(f"Both HTTP API and Source protocol failed for {host}:{port}: {str(e)}") + + async def _build_result_from_api(self, api_data: dict, host: str, port: int, start_time: float, end_time: float) -> "GamedigResult": + """ + Build standardized GamedigResult from HTTP API response. + Maps API fields to match expected format. + Handles both Exfil API format and Steam A2S format. + """ + ping = int((end_time - start_time) * 1000) + + # Extract and map fields from API response + # Try multiple possible field names for server name + name = (api_data.get("serverName") or + api_data.get("name") or + api_data.get("SteamServerName_s") or + "Unknown") + map_name = api_data.get("map", "Unknown") + password = api_data.get("password", False) + + # Parse player count - handle both formats: + # Format 1: Players_s = "X/Y" (Steam A2S format) + # Format 2: players = X, maxPlayers = Y (Exfil API format) + numplayers = 0 + maxplayers = 0 + if "Players_s" in api_data: + players_str = str(api_data["Players_s"]) + if "/" in players_str: + try: + numplayers, maxplayers = map(int, players_str.split("/")) + except (ValueError, IndexError): + numplayers = 0 + maxplayers = 0 + else: + # Use direct integer fields (Exfil API format) + numplayers = int(api_data.get("players", api_data.get("current", 0))) + maxplayers = int(api_data.get("maxPlayers", api_data.get("max", 0))) + + # Extract player list if available + player_list = [] + if isinstance(api_data.get("playerList"), list): + player_list = [ + {"name": player if isinstance(player, str) else player.get("name", "Unknown"), "raw": {}} + for player in api_data["playerList"] + ] + + result: GamedigResult = { + "name": name, + "map": map_name, + "password": bool(password), + "numplayers": numplayers, + "numbots": 0, + "maxplayers": maxplayers, + "players": player_list if player_list else None, + "bots": None, + "connect": f"{host}:{port}", + "ping": ping, + "raw": api_data, + } + + return result