whitelisting sorta works

master
Jordan Orelli 8 years ago
parent bb40a292e3
commit 944cad072d

@ -158,6 +158,94 @@ func (m *messageFactory) BuildEntity(id entityType) (proto.Message, error) {
return fn(), nil
}
type packetWhitelist map[packetType]bool
type entityWhitelist map[entityType]bool
var allPackets = packetWhitelist{
{{- range $id, $spec := .Packets }}
{{$spec.EnumName}}: true,
{{- end }}
}
var allEntities = entityWhitelist{
{{- range $id, $spec := .Entities }}
{{$spec.EnumName}}: true,
{{- end }}
}
var netEntities = entityWhitelist{
{{- range $id, $spec := .Entities }}
{{- if eq $spec.EnumType "NET_Messages" }}
{{$spec.EnumName}}: true,
{{- end }}
{{- end}}
}
var svcEntities = entityWhitelist{
{{- range $id, $spec := .Entities }}
{{- if eq $spec.EnumType "SVC_Messages" }}
{{$spec.EnumName}}: true,
{{- end }}
{{- end}}
}
var baseUserEntities = entityWhitelist{
{{- range $id, $spec := .Entities }}
{{- if eq $spec.EnumType "EBaseUserMessages" }}
{{$spec.EnumName}}: true,
{{- end }}
{{- end}}
}
// ffffffffffffffff kkkkkkkk
// f::::::::::::::::f k::::::k
// f::::::::::::::::::f k::::::k
// f::::::fffffff:::::f k::::::k
// f:::::f ffffffuuuuuu uuuuuu cccccccccccccccc k:::::k kkkkkkk
// f:::::f u::::u u::::u cc:::::::::::::::c k:::::k k:::::k
// f:::::::ffffff u::::u u::::u c:::::::::::::::::c k:::::k k:::::k
// f::::::::::::f u::::u u::::u c:::::::cccccc:::::c k:::::k k:::::k
// f::::::::::::f u::::u u::::u c::::::c ccccccc k::::::k:::::k
// f:::::::ffffff u::::u u::::u c:::::c k:::::::::::k
// f:::::f u::::u u::::u c:::::c k:::::::::::k
// f:::::f u:::::uuuu:::::u c::::::c ccccccc k::::::k:::::k
// f:::::::f u:::::::::::::::uuc:::::::cccccc:::::ck::::::k k:::::k
// f:::::::f u:::::::::::::::u c:::::::::::::::::ck::::::k k:::::k
// f:::::::f uu::::::::uu:::u cc:::::::::::::::ck::::::k k:::::k
// fffffffff uuuuuuuu uuuu cccccccccccccccckkkkkkkk kkkkkkk
var entityEntities = entityWhitelist{
{{- range $id, $spec := .Entities }}
{{- if eq $spec.EnumType "EBaseEntityMessages" }}
{{$spec.EnumName}}: true,
{{- end }}
{{- end}}
}
var gameEntities = entityWhitelist{
{{- range $id, $spec := .Entities }}
{{- if eq $spec.EnumType "EBaseGameEvents" }}
{{$spec.EnumName}}: true,
{{- end }}
{{- end}}
}
var dotaUserEntities = entityWhitelist{
{{- range $id, $spec := .Entities }}
{{- if eq $spec.EnumType "EDotaUserMessages" }}
{{$spec.EnumName}}: true,
{{- end }}
{{- end}}
}
var eteEntities = entityWhitelist{
{{- range $id, $spec := .Entities }}
{{- if eq $spec.EnumType "ETEProtobufIds" }}
{{$spec.EnumName}}: true,
{{- end }}
{{- end}}
}
var messages = messageFactory{
packetFactory{
{{- range $id, $spec := .Packets }}
@ -174,6 +262,7 @@ var messages = messageFactory{
)
type messageSpec struct {
EnumType string
EnumName string
TypeName string
}
@ -252,9 +341,9 @@ func processValueSpec(spec *ast.ValueSpec) {
}
if isEntityType {
entityTypes[n] = messageSpec{EnumName: name.Name}
entityTypes[n] = messageSpec{EnumName: name.Name, EnumType: t.Name}
} else {
packetTypes[n] = messageSpec{EnumName: name.Name}
packetTypes[n] = messageSpec{EnumName: name.Name, EnumType: t.Name}
}
}
}

@ -129,6 +129,7 @@ const (
EBaseUserMessages_UM_CloseCaptionPlaceholder entityType = 142
EBaseUserMessages_UM_CameraTransition entityType = 143
EBaseUserMessages_UM_AudioParameter entityType = 144
EBaseGameEvents_GE_VDebugGameSessionIDEvent entityType = 200
EBaseGameEvents_GE_PlaceDecalEvent entityType = 201
EBaseGameEvents_GE_ClearWorldDecalsEvent entityType = 202
EBaseGameEvents_GE_ClearEntityDecalsEvent entityType = 203
@ -432,6 +433,8 @@ func (t entityType) String() string {
return "EBaseUserMessages_UM_CameraTransition"
case EBaseUserMessages_UM_AudioParameter:
return "EBaseUserMessages_UM_AudioParameter"
case EBaseGameEvents_GE_VDebugGameSessionIDEvent:
return "EBaseGameEvents_GE_VDebugGameSessionIDEvent"
case EBaseGameEvents_GE_PlaceDecalEvent:
return "EBaseGameEvents_GE_PlaceDecalEvent"
case EBaseGameEvents_GE_ClearWorldDecalsEvent:
@ -687,6 +690,434 @@ func (m *messageFactory) BuildEntity(id entityType) (proto.Message, error) {
return fn(), nil
}
type packetWhitelist map[packetType]bool
type entityWhitelist map[entityType]bool
var allPackets = packetWhitelist{
EDemoCommands_DEM_Stop: true,
EDemoCommands_DEM_FileHeader: true,
EDemoCommands_DEM_FileInfo: true,
EDemoCommands_DEM_SyncTick: true,
EDemoCommands_DEM_SendTables: true,
EDemoCommands_DEM_ClassInfo: true,
EDemoCommands_DEM_StringTables: true,
EDemoCommands_DEM_Packet: true,
EDemoCommands_DEM_SignonPacket: true,
EDemoCommands_DEM_ConsoleCmd: true,
EDemoCommands_DEM_CustomData: true,
EDemoCommands_DEM_CustomDataCallbacks: true,
EDemoCommands_DEM_UserCmd: true,
EDemoCommands_DEM_FullPacket: true,
EDemoCommands_DEM_SaveGame: true,
EDemoCommands_DEM_SpawnGroups: true,
}
var allEntities = entityWhitelist{
NET_Messages_net_NOP: true,
NET_Messages_net_Disconnect: true,
NET_Messages_net_SplitScreenUser: true,
NET_Messages_net_Tick: true,
NET_Messages_net_StringCmd: true,
NET_Messages_net_SetConVar: true,
NET_Messages_net_SignonState: true,
NET_Messages_net_SpawnGroup_Load: true,
NET_Messages_net_SpawnGroup_ManifestUpdate: true,
NET_Messages_net_SpawnGroup_SetCreationTick: true,
NET_Messages_net_SpawnGroup_Unload: true,
NET_Messages_net_SpawnGroup_LoadCompleted: true,
SVC_Messages_svc_ServerInfo: true,
SVC_Messages_svc_FlattenedSerializer: true,
SVC_Messages_svc_ClassInfo: true,
SVC_Messages_svc_SetPause: true,
SVC_Messages_svc_CreateStringTable: true,
SVC_Messages_svc_UpdateStringTable: true,
SVC_Messages_svc_VoiceInit: true,
SVC_Messages_svc_VoiceData: true,
SVC_Messages_svc_Print: true,
SVC_Messages_svc_Sounds: true,
SVC_Messages_svc_SetView: true,
SVC_Messages_svc_ClearAllStringTables: true,
SVC_Messages_svc_CmdKeyValues: true,
SVC_Messages_svc_BSPDecal: true,
SVC_Messages_svc_SplitScreen: true,
SVC_Messages_svc_PacketEntities: true,
SVC_Messages_svc_Prefetch: true,
SVC_Messages_svc_Menu: true,
SVC_Messages_svc_GetCvarValue: true,
SVC_Messages_svc_StopSound: true,
SVC_Messages_svc_PeerList: true,
SVC_Messages_svc_PacketReliable: true,
SVC_Messages_svc_HLTVStatus: true,
SVC_Messages_svc_ServerSteamID: true,
SVC_Messages_svc_FullFrameSplit: true,
EBaseUserMessages_UM_AchievementEvent: true,
EBaseUserMessages_UM_CloseCaption: true,
EBaseUserMessages_UM_CloseCaptionDirect: true,
EBaseUserMessages_UM_CurrentTimescale: true,
EBaseUserMessages_UM_DesiredTimescale: true,
EBaseUserMessages_UM_Fade: true,
EBaseUserMessages_UM_GameTitle: true,
EBaseUserMessages_UM_HintText: true,
EBaseUserMessages_UM_HudMsg: true,
EBaseUserMessages_UM_HudText: true,
EBaseUserMessages_UM_KeyHintText: true,
EBaseUserMessages_UM_ColoredText: true,
EBaseUserMessages_UM_RequestState: true,
EBaseUserMessages_UM_ResetHUD: true,
EBaseUserMessages_UM_Rumble: true,
EBaseUserMessages_UM_SayText: true,
EBaseUserMessages_UM_SayText2: true,
EBaseUserMessages_UM_SayTextChannel: true,
EBaseUserMessages_UM_Shake: true,
EBaseUserMessages_UM_ShakeDir: true,
EBaseUserMessages_UM_TextMsg: true,
EBaseUserMessages_UM_ScreenTilt: true,
EBaseUserMessages_UM_Train: true,
EBaseUserMessages_UM_VGUIMenu: true,
EBaseUserMessages_UM_VoiceMask: true,
EBaseUserMessages_UM_VoiceSubtitle: true,
EBaseUserMessages_UM_SendAudio: true,
EBaseUserMessages_UM_ItemPickup: true,
EBaseUserMessages_UM_AmmoDenied: true,
EBaseUserMessages_UM_CrosshairAngle: true,
EBaseUserMessages_UM_ShowMenu: true,
EBaseUserMessages_UM_CreditsMsg: true,
EBaseEntityMessages_EM_PlayJingle: true,
EBaseEntityMessages_EM_ScreenOverlay: true,
EBaseEntityMessages_EM_RemoveAllDecals: true,
EBaseEntityMessages_EM_PropagateForce: true,
EBaseEntityMessages_EM_DoSpark: true,
EBaseEntityMessages_EM_FixAngle: true,
EBaseUserMessages_UM_CloseCaptionPlaceholder: true,
EBaseUserMessages_UM_CameraTransition: true,
EBaseUserMessages_UM_AudioParameter: true,
EBaseGameEvents_GE_VDebugGameSessionIDEvent: true,
EBaseGameEvents_GE_PlaceDecalEvent: true,
EBaseGameEvents_GE_ClearWorldDecalsEvent: true,
EBaseGameEvents_GE_ClearEntityDecalsEvent: true,
EBaseGameEvents_GE_ClearDecalsForSkeletonInstanceEvent: true,
EBaseGameEvents_GE_Source1LegacyGameEventList: true,
EBaseGameEvents_GE_Source1LegacyListenEvents: true,
EBaseGameEvents_GE_Source1LegacyGameEvent: true,
EBaseGameEvents_GE_SosStartSoundEvent: true,
EBaseGameEvents_GE_SosStopSoundEvent: true,
EBaseGameEvents_GE_SosSetSoundEventParams: true,
EBaseGameEvents_GE_SosSetLibraryStackFields: true,
EBaseGameEvents_GE_SosStopSoundEventHash: true,
ETEProtobufIds_TE_EffectDispatchId: true,
EDotaUserMessages_DOTA_UM_AIDebugLine: true,
EDotaUserMessages_DOTA_UM_ChatEvent: true,
EDotaUserMessages_DOTA_UM_CombatHeroPositions: true,
EDotaUserMessages_DOTA_UM_CombatLogShowDeath: true,
EDotaUserMessages_DOTA_UM_CreateLinearProjectile: true,
EDotaUserMessages_DOTA_UM_DestroyLinearProjectile: true,
EDotaUserMessages_DOTA_UM_DodgeTrackingProjectiles: true,
EDotaUserMessages_DOTA_UM_GlobalLightColor: true,
EDotaUserMessages_DOTA_UM_GlobalLightDirection: true,
EDotaUserMessages_DOTA_UM_InvalidCommand: true,
EDotaUserMessages_DOTA_UM_LocationPing: true,
EDotaUserMessages_DOTA_UM_MapLine: true,
EDotaUserMessages_DOTA_UM_MiniKillCamInfo: true,
EDotaUserMessages_DOTA_UM_MinimapDebugPoint: true,
EDotaUserMessages_DOTA_UM_MinimapEvent: true,
EDotaUserMessages_DOTA_UM_NevermoreRequiem: true,
EDotaUserMessages_DOTA_UM_OverheadEvent: true,
EDotaUserMessages_DOTA_UM_SetNextAutobuyItem: true,
EDotaUserMessages_DOTA_UM_SharedCooldown: true,
EDotaUserMessages_DOTA_UM_SpectatorPlayerClick: true,
EDotaUserMessages_DOTA_UM_TutorialTipInfo: true,
EDotaUserMessages_DOTA_UM_UnitEvent: true,
EDotaUserMessages_DOTA_UM_ParticleManager: true,
EDotaUserMessages_DOTA_UM_BotChat: true,
EDotaUserMessages_DOTA_UM_HudError: true,
EDotaUserMessages_DOTA_UM_ItemPurchased: true,
EDotaUserMessages_DOTA_UM_Ping: true,
EDotaUserMessages_DOTA_UM_ItemFound: true,
EDotaUserMessages_DOTA_UM_SwapVerify: true,
EDotaUserMessages_DOTA_UM_WorldLine: true,
EDotaUserMessages_DOTA_UM_TournamentDrop: true,
EDotaUserMessages_DOTA_UM_ItemAlert: true,
EDotaUserMessages_DOTA_UM_HalloweenDrops: true,
EDotaUserMessages_DOTA_UM_ChatWheel: true,
EDotaUserMessages_DOTA_UM_ReceivedXmasGift: true,
EDotaUserMessages_DOTA_UM_UpdateSharedContent: true,
EDotaUserMessages_DOTA_UM_TutorialRequestExp: true,
EDotaUserMessages_DOTA_UM_TutorialPingMinimap: true,
EDotaUserMessages_DOTA_UM_GamerulesStateChanged: true,
EDotaUserMessages_DOTA_UM_ShowSurvey: true,
EDotaUserMessages_DOTA_UM_TutorialFade: true,
EDotaUserMessages_DOTA_UM_AddQuestLogEntry: true,
EDotaUserMessages_DOTA_UM_SendStatPopup: true,
EDotaUserMessages_DOTA_UM_TutorialFinish: true,
EDotaUserMessages_DOTA_UM_SendRoshanPopup: true,
EDotaUserMessages_DOTA_UM_SendGenericToolTip: true,
EDotaUserMessages_DOTA_UM_SendFinalGold: true,
EDotaUserMessages_DOTA_UM_CustomMsg: true,
EDotaUserMessages_DOTA_UM_CoachHUDPing: true,
EDotaUserMessages_DOTA_UM_ClientLoadGridNav: true,
EDotaUserMessages_DOTA_UM_TE_Projectile: true,
EDotaUserMessages_DOTA_UM_TE_ProjectileLoc: true,
EDotaUserMessages_DOTA_UM_TE_DotaBloodImpact: true,
EDotaUserMessages_DOTA_UM_TE_UnitAnimation: true,
EDotaUserMessages_DOTA_UM_TE_UnitAnimationEnd: true,
EDotaUserMessages_DOTA_UM_AbilityPing: true,
EDotaUserMessages_DOTA_UM_ShowGenericPopup: true,
EDotaUserMessages_DOTA_UM_VoteStart: true,
EDotaUserMessages_DOTA_UM_VoteUpdate: true,
EDotaUserMessages_DOTA_UM_VoteEnd: true,
EDotaUserMessages_DOTA_UM_BoosterState: true,
EDotaUserMessages_DOTA_UM_WillPurchaseAlert: true,
EDotaUserMessages_DOTA_UM_TutorialMinimapPosition: true,
EDotaUserMessages_DOTA_UM_PlayerMMR: true,
EDotaUserMessages_DOTA_UM_AbilitySteal: true,
EDotaUserMessages_DOTA_UM_CourierKilledAlert: true,
EDotaUserMessages_DOTA_UM_EnemyItemAlert: true,
EDotaUserMessages_DOTA_UM_StatsMatchDetails: true,
EDotaUserMessages_DOTA_UM_MiniTaunt: true,
EDotaUserMessages_DOTA_UM_BuyBackStateAlert: true,
EDotaUserMessages_DOTA_UM_SpeechBubble: true,
EDotaUserMessages_DOTA_UM_CustomHeaderMessage: true,
EDotaUserMessages_DOTA_UM_QuickBuyAlert: true,
EDotaUserMessages_DOTA_UM_StatsHeroDetails: true,
EDotaUserMessages_DOTA_UM_PredictionResult: true,
EDotaUserMessages_DOTA_UM_ModifierAlert: true,
EDotaUserMessages_DOTA_UM_HPManaAlert: true,
EDotaUserMessages_DOTA_UM_GlyphAlert: true,
EDotaUserMessages_DOTA_UM_BeastChat: true,
EDotaUserMessages_DOTA_UM_SpectatorPlayerUnitOrders: true,
EDotaUserMessages_DOTA_UM_CustomHudElement_Create: true,
EDotaUserMessages_DOTA_UM_CustomHudElement_Modify: true,
EDotaUserMessages_DOTA_UM_CustomHudElement_Destroy: true,
EDotaUserMessages_DOTA_UM_CompendiumState: true,
EDotaUserMessages_DOTA_UM_ProjectionAbility: true,
EDotaUserMessages_DOTA_UM_ProjectionEvent: true,
EDotaUserMessages_DOTA_UM_CombatLogDataHLTV: true,
EDotaUserMessages_DOTA_UM_XPAlert: true,
EDotaUserMessages_DOTA_UM_UpdateQuestProgress: true,
EDotaUserMessages_DOTA_UM_MatchMetadata: true,
EDotaUserMessages_DOTA_UM_QuestStatus: true,
}
var netEntities = entityWhitelist{
NET_Messages_net_NOP: true,
NET_Messages_net_Disconnect: true,
NET_Messages_net_SplitScreenUser: true,
NET_Messages_net_Tick: true,
NET_Messages_net_StringCmd: true,
NET_Messages_net_SetConVar: true,
NET_Messages_net_SignonState: true,
NET_Messages_net_SpawnGroup_Load: true,
NET_Messages_net_SpawnGroup_ManifestUpdate: true,
NET_Messages_net_SpawnGroup_SetCreationTick: true,
NET_Messages_net_SpawnGroup_Unload: true,
NET_Messages_net_SpawnGroup_LoadCompleted: true,
}
var svcEntities = entityWhitelist{
SVC_Messages_svc_ServerInfo: true,
SVC_Messages_svc_FlattenedSerializer: true,
SVC_Messages_svc_ClassInfo: true,
SVC_Messages_svc_SetPause: true,
SVC_Messages_svc_CreateStringTable: true,
SVC_Messages_svc_UpdateStringTable: true,
SVC_Messages_svc_VoiceInit: true,
SVC_Messages_svc_VoiceData: true,
SVC_Messages_svc_Print: true,
SVC_Messages_svc_Sounds: true,
SVC_Messages_svc_SetView: true,
SVC_Messages_svc_ClearAllStringTables: true,
SVC_Messages_svc_CmdKeyValues: true,
SVC_Messages_svc_BSPDecal: true,
SVC_Messages_svc_SplitScreen: true,
SVC_Messages_svc_PacketEntities: true,
SVC_Messages_svc_Prefetch: true,
SVC_Messages_svc_Menu: true,
SVC_Messages_svc_GetCvarValue: true,
SVC_Messages_svc_StopSound: true,
SVC_Messages_svc_PeerList: true,
SVC_Messages_svc_PacketReliable: true,
SVC_Messages_svc_HLTVStatus: true,
SVC_Messages_svc_ServerSteamID: true,
SVC_Messages_svc_FullFrameSplit: true,
}
var baseUserEntities = entityWhitelist{
EBaseUserMessages_UM_AchievementEvent: true,
EBaseUserMessages_UM_CloseCaption: true,
EBaseUserMessages_UM_CloseCaptionDirect: true,
EBaseUserMessages_UM_CurrentTimescale: true,
EBaseUserMessages_UM_DesiredTimescale: true,
EBaseUserMessages_UM_Fade: true,
EBaseUserMessages_UM_GameTitle: true,
EBaseUserMessages_UM_HintText: true,
EBaseUserMessages_UM_HudMsg: true,
EBaseUserMessages_UM_HudText: true,
EBaseUserMessages_UM_KeyHintText: true,
EBaseUserMessages_UM_ColoredText: true,
EBaseUserMessages_UM_RequestState: true,
EBaseUserMessages_UM_ResetHUD: true,
EBaseUserMessages_UM_Rumble: true,
EBaseUserMessages_UM_SayText: true,
EBaseUserMessages_UM_SayText2: true,
EBaseUserMessages_UM_SayTextChannel: true,
EBaseUserMessages_UM_Shake: true,
EBaseUserMessages_UM_ShakeDir: true,
EBaseUserMessages_UM_TextMsg: true,
EBaseUserMessages_UM_ScreenTilt: true,
EBaseUserMessages_UM_Train: true,
EBaseUserMessages_UM_VGUIMenu: true,
EBaseUserMessages_UM_VoiceMask: true,
EBaseUserMessages_UM_VoiceSubtitle: true,
EBaseUserMessages_UM_SendAudio: true,
EBaseUserMessages_UM_ItemPickup: true,
EBaseUserMessages_UM_AmmoDenied: true,
EBaseUserMessages_UM_CrosshairAngle: true,
EBaseUserMessages_UM_ShowMenu: true,
EBaseUserMessages_UM_CreditsMsg: true,
EBaseUserMessages_UM_CloseCaptionPlaceholder: true,
EBaseUserMessages_UM_CameraTransition: true,
EBaseUserMessages_UM_AudioParameter: true,
}
// ffffffffffffffff kkkkkkkk
// f::::::::::::::::f k::::::k
// f::::::::::::::::::f k::::::k
// f::::::fffffff:::::f k::::::k
// f:::::f ffffffuuuuuu uuuuuu cccccccccccccccc k:::::k kkkkkkk
// f:::::f u::::u u::::u cc:::::::::::::::c k:::::k k:::::k
// f:::::::ffffff u::::u u::::u c:::::::::::::::::c k:::::k k:::::k
// f::::::::::::f u::::u u::::u c:::::::cccccc:::::c k:::::k k:::::k
// f::::::::::::f u::::u u::::u c::::::c ccccccc k::::::k:::::k
// f:::::::ffffff u::::u u::::u c:::::c k:::::::::::k
// f:::::f u::::u u::::u c:::::c k:::::::::::k
// f:::::f u:::::uuuu:::::u c::::::c ccccccc k::::::k:::::k
// f:::::::f u:::::::::::::::uuc:::::::cccccc:::::ck::::::k k:::::k
// f:::::::f u:::::::::::::::u c:::::::::::::::::ck::::::k k:::::k
// f:::::::f uu::::::::uu:::u cc:::::::::::::::ck::::::k k:::::k
// fffffffff uuuuuuuu uuuu cccccccccccccccckkkkkkkk kkkkkkk
var entityEntities = entityWhitelist{
EBaseEntityMessages_EM_PlayJingle: true,
EBaseEntityMessages_EM_ScreenOverlay: true,
EBaseEntityMessages_EM_RemoveAllDecals: true,
EBaseEntityMessages_EM_PropagateForce: true,
EBaseEntityMessages_EM_DoSpark: true,
EBaseEntityMessages_EM_FixAngle: true,
}
var gameEntities = entityWhitelist{
EBaseGameEvents_GE_VDebugGameSessionIDEvent: true,
EBaseGameEvents_GE_PlaceDecalEvent: true,
EBaseGameEvents_GE_ClearWorldDecalsEvent: true,
EBaseGameEvents_GE_ClearEntityDecalsEvent: true,
EBaseGameEvents_GE_ClearDecalsForSkeletonInstanceEvent: true,
EBaseGameEvents_GE_Source1LegacyGameEventList: true,
EBaseGameEvents_GE_Source1LegacyListenEvents: true,
EBaseGameEvents_GE_Source1LegacyGameEvent: true,
EBaseGameEvents_GE_SosStartSoundEvent: true,
EBaseGameEvents_GE_SosStopSoundEvent: true,
EBaseGameEvents_GE_SosSetSoundEventParams: true,
EBaseGameEvents_GE_SosSetLibraryStackFields: true,
EBaseGameEvents_GE_SosStopSoundEventHash: true,
}
var dotaUserEntities = entityWhitelist{
EDotaUserMessages_DOTA_UM_AIDebugLine: true,
EDotaUserMessages_DOTA_UM_ChatEvent: true,
EDotaUserMessages_DOTA_UM_CombatHeroPositions: true,
EDotaUserMessages_DOTA_UM_CombatLogShowDeath: true,
EDotaUserMessages_DOTA_UM_CreateLinearProjectile: true,
EDotaUserMessages_DOTA_UM_DestroyLinearProjectile: true,
EDotaUserMessages_DOTA_UM_DodgeTrackingProjectiles: true,
EDotaUserMessages_DOTA_UM_GlobalLightColor: true,
EDotaUserMessages_DOTA_UM_GlobalLightDirection: true,
EDotaUserMessages_DOTA_UM_InvalidCommand: true,
EDotaUserMessages_DOTA_UM_LocationPing: true,
EDotaUserMessages_DOTA_UM_MapLine: true,
EDotaUserMessages_DOTA_UM_MiniKillCamInfo: true,
EDotaUserMessages_DOTA_UM_MinimapDebugPoint: true,
EDotaUserMessages_DOTA_UM_MinimapEvent: true,
EDotaUserMessages_DOTA_UM_NevermoreRequiem: true,
EDotaUserMessages_DOTA_UM_OverheadEvent: true,
EDotaUserMessages_DOTA_UM_SetNextAutobuyItem: true,
EDotaUserMessages_DOTA_UM_SharedCooldown: true,
EDotaUserMessages_DOTA_UM_SpectatorPlayerClick: true,
EDotaUserMessages_DOTA_UM_TutorialTipInfo: true,
EDotaUserMessages_DOTA_UM_UnitEvent: true,
EDotaUserMessages_DOTA_UM_ParticleManager: true,
EDotaUserMessages_DOTA_UM_BotChat: true,
EDotaUserMessages_DOTA_UM_HudError: true,
EDotaUserMessages_DOTA_UM_ItemPurchased: true,
EDotaUserMessages_DOTA_UM_Ping: true,
EDotaUserMessages_DOTA_UM_ItemFound: true,
EDotaUserMessages_DOTA_UM_SwapVerify: true,
EDotaUserMessages_DOTA_UM_WorldLine: true,
EDotaUserMessages_DOTA_UM_TournamentDrop: true,
EDotaUserMessages_DOTA_UM_ItemAlert: true,
EDotaUserMessages_DOTA_UM_HalloweenDrops: true,
EDotaUserMessages_DOTA_UM_ChatWheel: true,
EDotaUserMessages_DOTA_UM_ReceivedXmasGift: true,
EDotaUserMessages_DOTA_UM_UpdateSharedContent: true,
EDotaUserMessages_DOTA_UM_TutorialRequestExp: true,
EDotaUserMessages_DOTA_UM_TutorialPingMinimap: true,
EDotaUserMessages_DOTA_UM_GamerulesStateChanged: true,
EDotaUserMessages_DOTA_UM_ShowSurvey: true,
EDotaUserMessages_DOTA_UM_TutorialFade: true,
EDotaUserMessages_DOTA_UM_AddQuestLogEntry: true,
EDotaUserMessages_DOTA_UM_SendStatPopup: true,
EDotaUserMessages_DOTA_UM_TutorialFinish: true,
EDotaUserMessages_DOTA_UM_SendRoshanPopup: true,
EDotaUserMessages_DOTA_UM_SendGenericToolTip: true,
EDotaUserMessages_DOTA_UM_SendFinalGold: true,
EDotaUserMessages_DOTA_UM_CustomMsg: true,
EDotaUserMessages_DOTA_UM_CoachHUDPing: true,
EDotaUserMessages_DOTA_UM_ClientLoadGridNav: true,
EDotaUserMessages_DOTA_UM_TE_Projectile: true,
EDotaUserMessages_DOTA_UM_TE_ProjectileLoc: true,
EDotaUserMessages_DOTA_UM_TE_DotaBloodImpact: true,
EDotaUserMessages_DOTA_UM_TE_UnitAnimation: true,
EDotaUserMessages_DOTA_UM_TE_UnitAnimationEnd: true,
EDotaUserMessages_DOTA_UM_AbilityPing: true,
EDotaUserMessages_DOTA_UM_ShowGenericPopup: true,
EDotaUserMessages_DOTA_UM_VoteStart: true,
EDotaUserMessages_DOTA_UM_VoteUpdate: true,
EDotaUserMessages_DOTA_UM_VoteEnd: true,
EDotaUserMessages_DOTA_UM_BoosterState: true,
EDotaUserMessages_DOTA_UM_WillPurchaseAlert: true,
EDotaUserMessages_DOTA_UM_TutorialMinimapPosition: true,
EDotaUserMessages_DOTA_UM_PlayerMMR: true,
EDotaUserMessages_DOTA_UM_AbilitySteal: true,
EDotaUserMessages_DOTA_UM_CourierKilledAlert: true,
EDotaUserMessages_DOTA_UM_EnemyItemAlert: true,
EDotaUserMessages_DOTA_UM_StatsMatchDetails: true,
EDotaUserMessages_DOTA_UM_MiniTaunt: true,
EDotaUserMessages_DOTA_UM_BuyBackStateAlert: true,
EDotaUserMessages_DOTA_UM_SpeechBubble: true,
EDotaUserMessages_DOTA_UM_CustomHeaderMessage: true,
EDotaUserMessages_DOTA_UM_QuickBuyAlert: true,
EDotaUserMessages_DOTA_UM_StatsHeroDetails: true,
EDotaUserMessages_DOTA_UM_PredictionResult: true,
EDotaUserMessages_DOTA_UM_ModifierAlert: true,
EDotaUserMessages_DOTA_UM_HPManaAlert: true,
EDotaUserMessages_DOTA_UM_GlyphAlert: true,
EDotaUserMessages_DOTA_UM_BeastChat: true,
EDotaUserMessages_DOTA_UM_SpectatorPlayerUnitOrders: true,
EDotaUserMessages_DOTA_UM_CustomHudElement_Create: true,
EDotaUserMessages_DOTA_UM_CustomHudElement_Modify: true,
EDotaUserMessages_DOTA_UM_CustomHudElement_Destroy: true,
EDotaUserMessages_DOTA_UM_CompendiumState: true,
EDotaUserMessages_DOTA_UM_ProjectionAbility: true,
EDotaUserMessages_DOTA_UM_ProjectionEvent: true,
EDotaUserMessages_DOTA_UM_CombatLogDataHLTV: true,
EDotaUserMessages_DOTA_UM_XPAlert: true,
EDotaUserMessages_DOTA_UM_UpdateQuestProgress: true,
EDotaUserMessages_DOTA_UM_MatchMetadata: true,
EDotaUserMessages_DOTA_UM_QuestStatus: true,
}
var eteEntities = entityWhitelist{
ETEProtobufIds_TE_EffectDispatchId: true,
}
var messages = messageFactory{
packetFactory{
EDemoCommands_DEM_Stop: func() proto.Message { return new(dota.CDemoStop) },
@ -785,6 +1216,7 @@ var messages = messageFactory{
EBaseUserMessages_UM_CloseCaptionPlaceholder: func() proto.Message { return new(dota.CUserMessageCloseCaptionPlaceholder) },
EBaseUserMessages_UM_CameraTransition: func() proto.Message { return new(dota.CUserMessageCameraTransition) },
EBaseUserMessages_UM_AudioParameter: func() proto.Message { return new(dota.CUserMessageAudioParameter) },
EBaseGameEvents_GE_VDebugGameSessionIDEvent: func() proto.Message { return new(dota.CMsgVDebugGameSessionIDEvent) },
EBaseGameEvents_GE_PlaceDecalEvent: func() proto.Message { return new(dota.CMsgPlaceDecalEvent) },
EBaseGameEvents_GE_ClearWorldDecalsEvent: func() proto.Message { return new(dota.CMsgClearWorldDecalsEvent) },
EBaseGameEvents_GE_ClearEntityDecalsEvent: func() proto.Message { return new(dota.CMsgClearEntityDecalsEvent) },

@ -18,6 +18,9 @@ type parser struct {
scratch []byte
pbuf *proto.Buffer
err error
ewl entityWhitelist
pwl packetWhitelist
}
func newParser(r io.Reader) *parser {
@ -25,6 +28,8 @@ func newParser(r io.Reader) *parser {
source: bufio.NewReaderSize(r, 1<<16),
scratch: make([]byte, 1<<17),
pbuf: new(proto.Buffer),
ewl: allEntities,
pwl: allPackets,
}
}
@ -46,6 +51,7 @@ func (p *parser) run(out chan maybe) {
p.err = wrap(err, "read packet error in run loop")
return
}
msg, err := pkt.Open(&messages, p.pbuf)
if err != nil {
p.err = wrap(err, "open packet error in run loop")
@ -68,7 +74,7 @@ func (p *parser) emitChildren(pkt *dota.CDemoPacket, c chan maybe) {
s := br.ReadVarInt()
b := p.scratch[:s]
br.Read(b)
p.pbuf.SetBuf(b)
switch err := br.Err(); err {
case nil:
break
@ -78,6 +84,12 @@ func (p *parser) emitChildren(pkt *dota.CDemoPacket, c chan maybe) {
c <- maybe{error: err}
return
}
if !p.ewl[t] {
continue
}
p.pbuf.SetBuf(b)
e, err := messages.BuildEntity(t)
if err != nil {
c <- maybe{error: wrap(err, "skipping entity of size %d, type %s", len(b), t)}
@ -85,6 +97,7 @@ func (p *parser) emitChildren(pkt *dota.CDemoPacket, c chan maybe) {
}
if err := p.pbuf.Unmarshal(e); err != nil {
c <- maybe{error: wrap(err, "entity unmarshal error")}
continue
}
c <- maybe{Message: e}
}
@ -178,6 +191,16 @@ func (p *parser) readPacket() (*packet, error) {
return nil, wrap(err, "readPacket couldn't read the size value")
}
if !p.pwl[cmd] {
if size > 0 {
_, err := p.source.Discard(int(size))
if err != nil {
return nil, wrap(err, "readPacket couldn't skip packet length %d", size)
}
}
return p.readPacket()
}
if size > 0 {
buf := make([]byte, int(size))
if _, err := io.ReadFull(p.source, buf); err != nil {

Loading…
Cancel
Save