#ApiDebug = #True
#ApiDebugName = "CSS HACK"
;- NAME STEALER CONSTANTS
#STEALER_START_TOOGLE_VK = #VK_NUMPAD5 ;// This a toogle press 1 = start ,press again = stop
#CHANGE_DELAY = 1000 ;miliseconds (1000) = 1sec
#STEAL_BOTS_NAME = #True
#NAME_BYPASS = Chr(32) + Chr(31)
;-
#MAX_PLAYER_NAME_LENGTH = 32
#SIGNED_GUID_LEN = 32 ;// Hashed CD Key (32 hex alphabetic chars + 0 terminator )
;// a client can have up To 4 customization files (logo, sounds, models, txt).
#MAX_CUSTOM_FILES = 4 ;// max 4 files
#MAX_CUSTOM_FILE_SIZE = 131072
Macro thiscall(object)
MOV ecx, object
EndMacro
#fnClient = "client.dll"
#fnEngine = "engine.dll"
#fnVPhysics = "vphysics.dll"
#fnVStd = "vstdlib.dll"
#fnFileSystem = "FileSystem_Steam.dll"
#fnMatSystem = "MaterialSystem.dll"
#fnVgui = "vgui2.dll"
Structure player_info_t
;// scoreboard information
name.c[#MAX_PLAYER_NAME_LENGTH]
;// local server user ID, unique while server is running
userID.i
;// global unique player identifer
guid.c[#SIGNED_GUID_LEN + 1]
;// friends identification number
friendsID.i
;// friends name
friendsName.c[#MAX_PLAYER_NAME_LENGTH]
;// true, if player is a bot controlled by game.dll
fakeplayer.b
;// true if player is the HLTV proxy
ishltv.b
;// custom files CRC for this player
customFiles.l[#MAX_CUSTOM_FILES]
;// this counter increases each time the server downloaded a new file
filesDownloaded.c
EndStructure
Interface IVEngineClient ;// VEngineClient013
GetIntersectingSurfaces()
GetLightForPoint()
TraceLineMaterialAndLighting()
ParseFile()
CopyFile()
GetScreenSize()
ServerCmd()
ClientCmd(*szCmdString)
GetPlayerInfo(ent_num, *pinfo)
GetPlayerForUserID()
TextMessageGet()
Con_IsVisible()
GetLocalPlayer()
LoadModel()
Time()
GetLastTimeStamp()
GetSentence()
GetSentenceLength()
IsStreaming()
GetViewAngles()
SetViewAngles()
GetMaxClients()
Key_LookupBinding()
Key_BindingForKey()
StartKeyTrapMode()
CheckDoneKeyTrapping()
IsInGame()
IsConnected()
IsDrawingLoadingImage()
Con_NPrintf()
Con_NXPrintf()
IsBoxVisible()
IsBoxInViewCluster()
CullBox()
Sound_ExtraUpdate()
GetGameDirectory()
WorldToScreenMatrix()
WorldToViewMatrix()
GameLumpVersion()
GameLumpSize()
LoadGameLump()
LevelLeafCount()
GetBSPTreeQuery()
LinearToGamma()
LightStyleValue()
ComputeDynamicLighting()
GetAmbientLightColor()
GetDXSupportLevel()
SupportsHDR()
Mat_Stub()
GetChapterName()
GetLevelName()
GetVoiceTweakAPI()
EngineStats_BeginFrame()
EngineStats_EndFrame()
FireEvents()
GetLeavesArea()
DoesBoxTouchAreaFrustum()
SetAudioState()
SentenceGroupPick()
SentenceGroupPickSequential()
SentenceIndexFromName()
SentenceNameFromIndex()
SentenceGroupIndexFromName()
SentenceGroupNameFromIndex()
SentenceLength()
ComputeLighting()
ActivateOccluder()
IsOccluded()
SaveAllocMemory()
SaveFreeMemory()
GetNetChannelInfo()
DebugDrawPhysCollide()
CheckPoint()
DrawPortals()
IsPlayingDemo()
IsRecordingDemo()
IsPlayingTimeDemo()
GetDemoRecordingTick()
GetDemoPlaybackTick()
GetDemoPlaybackStartTick()
GetDemoPlaybackTimeScale()
GetDemoPlaybackTotalTicks()
IsPaused()
IsTakingScreenshot()
IsHLTV()
IsReplay()
DownloadReplay()
IsReplayEnabled()
IsReplayRecording()
GetReplayRecordingTick()
IsLevelMainMenuBackground()
GetMainMenuBackgroundName()
GetVideoModes()
SetOcclusionParameters()
GetUILanguage()
IsSkyboxVisibleFromPoint()
GetMapEntitiesString()
IsInEditMode()
GetScreenAspectRatio()
REMOVED_SteamRefreshLogin()
REMOVED_SteamProcessCall()
GetEngineBuildNumber()
GetProductVersionString()
GrabPreColorCorrectedFrame()
IsHammerRunning()
ExecuteClientCmd(*szCmdString)
MapHasHDRLighting()
GetAppID()
GetLightForPointFast()
ClientCmd_Unrestricted(*szCmdString)
SetRestrictServerCommands()
SetRestrictClientCommands()
SetOverlayBindProxy()
CopyFrameBufferToMaterial()
ChangeTeam()
ReadConfiguration()
SetAchievementMgr()
GetAchievementMgr()
MapLoadFailed()
SetMapLoadFailed()
IsLowViolence()
GetMostRecentSaveGame()
SetMostRecentSaveGame()
StartXboxExitingProcess()
IsSaveInProgress()
OnStorageDeviceAttached()
OnStorageDeviceDetached()
ResetDemoInterpolation()
SetGamestatsData()
GetGamestatsData()
LoadFilmmaker()
UnloadFilmmaker()
GetMouseDelta()
ServerCcceyValues()
IsInCommentaryMode()
EndInterface
;- STEAM INTERFACES
Interface ISteamClient011
CreateSteamPipe()
BReleaseSteamPipe(hSteamPipe)
ConnectToGlobalUser(hSteamPipe)
CreateLocalUser(*phSteamPipe, eAccountType)
ReleaseUser(hSteamPipe, hUser)
GetISteamUser(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamGameServer(hSteamUser, hSteamPipe, pchVersion.s)
SetLocalIPBinding(unIP, usPort)
GetISteamFriends(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamUtils(hSteamPipe, pchVersion.s)
GetISteamMatchmaking(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamMasterServerUpdater(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamMatchmakingServers(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamGenericInterface(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamUserStats(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamGameServerStats(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamApps(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamNetworking(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamRemoteStorage(hSteamUser, hSteamPipe, pchVersion.s)
GetISteamScreenshots(hSteamUser, hSteamPipe, pchVersion.s)
RunFrame()
GetIPCCallCount()
SetWarningMessageHook(pFunction)
BShutdownIfAllPipesClosed()
GetISteamHTTP(hSteamUser, hSteamPipe, pchVersion.s)
EndInterface
Interface ISteamFriends009
GetPersonaName()
SetPersonaName(*pchPersonaName)
GetPersonaState()
GetFriendCount(iFriendFlags)
GetFriendByIndex(iFriend, iFriendFlags)
GetFriendRelationship(steamIDFriend)
GetFriendPersonaState(steamIDFriend)
GetFriendPersonaName(steamIDFriend)
GetFriendGamePlayed(steamIDFriend, *pFriendGameInfo)
GetFriendPersonaNameHistory(steamIDFriend, iPersonaName)
HasFriend(steamIDFriend, iFriendFlags)
GetClanCount()
GetClanByIndex(iClan)
GetClanName(steamIDClan)
GetClanTag(steamIDClan)
GetFriendCountFromSource(steamIDSource)
GetFriendFromSourceByIndex(steamIDSource, iFriend)
IsUserInSource(steamIDUser, steamIDSource)
SetInGameVoiceSpeaking(steamIDUser, bSpeaking.b)
ActivateGameOverlay(*pchDialog)
ActivateGameOverlayToUser(*pchDialog, steamID)
ActivateGameOverlayToWebPage(*pchURL)
ActivateGameOverlayToStore(nAppID)
SetPlayedWith(steamIDUserPlayedWith)
ActivateGameOverlayInviteDialog(steamIDLobby)
GetSmallFriendAvatar(steamIDFriend)
GetMediumFriendAvatar(steamIDFriend)
GetLargeFriendAvatar(steamIDFriend)
RequestUserInformation(steamIDUser, bRequireNameOnly.b)
RequestClanOfficerList(steamIDClan)
GetClanOwner(steamIDClan)
GetClanOfficerCount(steamIDClan)
GetClanOfficerByIndex(steamIDClan, iOfficer)
GetUserRestrictions()
SetRichPresence(*pchKey, *pchValue)
ClearRichPresence()
GetFriendRichPresence(steamIDFriend, *pchKey)
GetFriendRichPresenceKeyCount(steamIDFriend)
GetFriendRichPresenceKeyByIndex(steamIDFriend, iKey)
InviteUserToGame(steamIDFriend, *pchConnectString)
GetCoplayFriendCount()
GetCoplayFriend(iCoplayFriend)
GetFriendCoplayTime(steamIDFriend)
GetFriendCoplayGame(steamIDFriend)
EndInterface
Global steamclient.ISteamClient011
Global steamfriends.ISteamFriends009
;- STEAM PROTOTYPES
PrototypeC PROTO_STEAM_CreateInterface(pName.s, *pReturnCode)
Prototype PROTO_STEAM_SetPersonaName(*pchPersonaName)
Global STEAM_CreateInterface.PROTO_STEAM_CreateInterface
Global STEAM_SetPersonaName.PROTO_STEAM_SetPersonaName
;- H2L PROTOTYPES
PrototypeC PROTO_H2L_CreateInterface(pszInterfaceName.s, *pReturnCode)
Prototype PROTO_GetMaxClients()
Prototype PROTO_GetPlayerInfo(ent_num.i, *pinfo)
Prototype PROTO_GetLocalPlayer()
;- H2L PROTOTYPES
Global H2L_CreateInterface.PROTO_H2L_CreateInterface
Global GetMaxClients.PROTO_GetMaxClients
Global GetPlayerInfo.PROTO_GetPlayerInfo
Global GetLocalPlayer.PROTO_GetLocalPlayer
Global Engine.IVEngineClient
Global playerInfo.player_info_t
Global bStealName.b = #False
Global NameStealer_ThreadID.i
Global KeyCheck_ThreadID.i
Procedure DebugString(debug_text.s)
If #ApiDebug = #True
OutputDebugString_(#ApiDebugName + ": " + debug_text)
EndIf
EndProcedure
Procedure Get_H2L_Interface(_Interface.s, InterfaceName.s)
resu = 0
hBase = GetModuleHandle_(_Interface)
If hBase
H2L_CreateInterface = GetProcAddress_(hBase, "CreateInterface")
If H2L_CreateInterface
resu = H2L_CreateInterface(InterfaceName, #Null)
Else
DebugString("Invalid H2L_CreateInterface : " + Str(H2L_CreateInterface))
EndIf
Else
DebugString("Invalid hBase : " + Str(hBase))
EndIf
ProcedureReturn resu
EndProcedure
Procedure KeyCheck_Thread(param)
While(1)
If GetAsyncKeyState_(#STEALER_START_TOOGLE_VK)&$8000
If bStealName = #False
bStealName = #True
ElseIf bStealName = #True
bStealName = #False
EndIf
EndIf
Delay(100)
Wend
EndProcedure
Procedure NameStealer_Thread(param)
Protected newName.s
KeyCheck_ThreadID = CreateThread(@KeyCheck_Thread(), 0)
While(1)
If bStealName
For iIndex.l = 0 To GetMaxClients() - 1
If GetPlayerInfo(iIndex, @playerInfo)
If iIndex = GetLocalPlayer()
Continue
EndIf
If #STEAL_BOTS_NAME = #False
If playerInfo\fakeplayer
Continue
EndIf
EndIf
If playerInfo\name
newName = PeekS(@playerInfo\name) + #NAME_BYPASS
thiscall(steamfriends)
STEAM_SetPersonaName(@newName)
Delay(#CHANGE_DELAY)
EndIf
If Not bStealName : Break : EndIf
EndIf
Next iIndex
EndIf
Delay(100)
Wend
EndProcedure
Procedure.b InitSteam_Stuff()
hMod = GetModuleHandle_("steamclient.dll")
If hMod
STEAM_CreateInterface = GetProcAddress_(hMod, "CreateInterface")
If STEAM_CreateInterface
steamclient = STEAM_CreateInterface("SteamClient011", #Null)
If steamclient
thiscall(steamclient)
pipe = CallFunctionFast(@steamclient\CreateSteamPipe())
If pipe
thiscall(steamclient)
user = CallFunctionFast(@steamclient\ConnectToGlobalUser(), pipe)
If user
thiscall(steamclient)
steamfriends = CallFunctionFast(@steamclient\GetISteamFriends(), user, pipe, @"SteamFriends009")
If steamfriends
ProcedureReturn #True
Else
DebugString("Invalid steamfriends : " + Str(steamfriends))
EndIf
Else
DebugString("Invalid user : " + Str(user))
EndIf
Else
DebugString("Invalid pipe : " + Str(pipe))
EndIf
Else
DebugString("Invalid steamclient : " + Str(steamclient))
EndIf
Else
DebugString("Invalid STEAM_CreateInterface : " + Str(STEAM_CreateInterface))
EndIf
Else
DebugString("Invalid hMod : " + Str(hMod))
EndIf
ProcedureReturn #False
EndProcedure
Procedure InitStuff(param)
;wait a bit let the process load
Delay(1000)
;- wait until the module load...
If Not GetModuleHandle_("steamclient.dll")
While Not GetModuleHandle_("steamclient.dll")
Delay(100)
Wend
EndIf
If Not GetModuleHandle_(#fnEngine)
While Not GetModuleHandle_(#fnEngine)
Delay(100)
Wend
EndIf
If Not GetModuleHandle_(#fnClient)
While Not GetModuleHandle_(#fnClient)
Delay(100)
Wend
EndIf
If InitSteam_Stuff()
DebugString("Steam Stuff Inited")
STEAM_SetPersonaName = Val(Str(@steamfriends\SetPersonaName())) ; <- Fail PureBasic bug...
Engine = Get_H2L_Interface(#fnEngine, "VEngineClient013")
;- Prototypes Faster then > CallFunctionFast
GetMaxClients = Val(Str(@Engine\GetMaxClients())) ; <- Fail PureBasic bug...
GetPlayerInfo = Val(Str(@Engine\GetPlayerInfo()))
GetLocalPlayer = Val(Str(@Engine\GetLocalPlayer()))
NameStealer_ThreadID = CreateThread(@NameStealer_Thread(), 0)
Else
MessageRequester("Error", "Failed to Init Steam Stuff!", #MB_ICONERROR)
ExitProcess_(0)
EndIf
EndProcedure
Procedure ProcessUnload()
If IsThread(KeyCheck_ThreadID)
KillThread(KeyCheck_ThreadID)
Delay(100)
EndIf
If IsThread(NameStealer_ThreadID)
KillThread(NameStealer_ThreadID)
Delay(100)
EndIf
EndProcedure
;- DLL MAIN
ProcedureDLL AttachProcess(Instance)
CreateThread(@InitStuff(), 0)
EndProcedure
; Called when the program release (free) the DLL
ProcedureDLL DetachProcess(Instance)
ProcessUnload()
EndProcedure
; Both are called when a thread in a program call or release (free) the DLL
ProcedureDLL AttachThread(Instance)
EndProcedure
ProcedureDLL DetachThread(Instance)
EndProcedure
; IDE Options = PureBasic 4.51 (Windows - x86)
; ExecutableFormat = Shared Dll
; CursorPosition = 8
; Folding = Bs04-49
; EnableAsm
; EnableXP
; Executable = CSS NameStealer.dll