Created
May 31, 2015 17:07
-
-
Save Bluscream/cbd781157dbbd5d4babe to your computer and use it in GitHub Desktop.
Teamspeak TS 3 LUA Script - Client Dump - Dumps online clients to a text file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("ts3defs") | |
require("ts3errors") | |
local SCRIPT = "TS3 Dump Script" | |
local SCRIPTSHORT = "TS3DS" | |
local VERSION = "0.2" | |
local AUTHOR = "B1uscr34m" | |
local EMAIL = "[email protected]" | |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
-- Installation Instructions: | |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
-- %ts3dir%: "c:\program files (x68)\teamspeak 3 client" OR "c:\program files\teamspeak 3 client" OR "C:\Users\YOUR USERNAME\AppData\Roaming\TS3Client" | |
-- a) If you want to use the full plugin: | |
-- a1) Download the plugin here: | |
-- a2) Install the plugin | |
-- a3) Goto step c) | |
-- b) If you want to run this script seperatly: | |
-- b1) Save this script as "masscontrolmodule.lua" in your "%ts3dir%\plugins\lua_plugin" folder. | |
-- b2) In teamspeak, any window, where chat would be enter: "/lua load masscontrolmodule.lua" -- Response will be: "Lua script loaded" | |
-- b3) Now go to step c) | |
-- c) In Teamspeak press [CTRL]+[SHIFT]+[P] or go to 'Settings -> Plugins' and check the 'Lua Plugin' Checkbox. | |
-- c1) Click on Reload all then mark 'Lua Plugin' and click on Settings. | |
-- c2) Uncheck 'testmodule' and restart Teamspeak 3 Client or click on 'Reload all' | |
-- d) Call everything in here named "function TEXTHERE" from the TeamSpeak 3 chat via: /lua run <function> | |
-- Note that the serverConnectionHandlerID of the current server is always passed. | |
-- | |
-- Settings | |
-- local TS3DS_DEBUG = true | |
-- local ts3dsCol = { 'Green', 'Yellow', 'Red', 'Blue' } | |
-- local RANDCOL = ( ts3dsCol[ math.random( #ts3dsCol ) ] ) | |
-- local ts3dsPrefix = "[color="Blue"]([/color][color="Green"]EMC[/color][color="Blue"])[/color] " | |
function dumpClientsTXT(serverConnectionHandlerID,Func) | |
ts3.requestServerVariables(serverConnectionHandlerID) | |
local clients, error = ts3.getClientList(serverConnectionHandlerID) | |
local myClientID, error = ts3.getClientID(serverConnectionHandlerID) | |
local chanID, error = ts3.getChannelOfClient(serverConnectionHandlerID,myClientID) | |
local serverUID, error = ts3.getServerVariableAsString(serverConnectionHandlerID, ts3defs.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER) | |
local serverNAME, error = ts3.getServerVariableAsString(serverConnectionHandlerID, ts3defs.VirtualServerProperties.VIRTUALSERVER_NAME) | |
local serverCLIENTS, error = ts3.getServerVariableAsInt(serverConnectionHandlerID, ts3defs.VirtualServerProperties.VIRTUALSERVER_CLIENTS_ONLINE) | |
local serverMAXCLIENTS, error = ts3.getServerVariableAsString(serverConnectionHandlerID, ts3defs.VirtualServerProperties.VIRTUALSERVER_MAXCLIENTS) | |
local serverCHANNELS, error = ts3.getServerVariableAsInt(serverConnectionHandlerID, ts3defs.VirtualServerProperties.VIRTUALSERVER_CHANNELS_ONLINE) | |
local serverVERSION, error = ts3.getServerVariableAsString(serverConnectionHandlerID, ts3defs.VirtualServerProperties.VIRTUALSERVER_VERSION) | |
local serverPLATFORM, error = ts3.getServerVariableAsString(serverConnectionHandlerID, ts3defs.VirtualServerProperties.VIRTUALSERVER_PLATFORM) | |
local date = os.date() | |
local time = os.time() | |
if Func == "All" and Func ~= "Room" then | |
--file = io.open("C:/Users/Timo/AppData/Roaming/TS3Client/dumps/serverclientdump_" .. serverUID .. ".txt", "w") | |
file = io.open("C:/Users/Timo/AppData/Roaming/TS3Client/dumps/" .. serverNAME .. ".txt", "w") | |
ts3.printMessageToCurrentTab("Server Clients Dump of Server: " .. serverNAME .. " at " .. date .. "\n") | |
file:write("Server Clients Dump of Server: " .. serverNAME .. " at " .. date .. "\n") | |
ts3.printMessageToCurrentTab("ServerID: " .. serverConnectionHandlerID .. " ServerUID: " .. serverUID .. "\n") | |
file:write("ServerID: " .. serverConnectionHandlerID .. " ServerUID: " .. serverUID .. "\n") | |
ts3.printMessageToCurrentTab("Online Clients: " .. serverCLIENTS .. "/" .. serverMAXCLIENTS .." Channels: " .. serverCHANNELS .. "\n") | |
file:write("Online Clients: " .. serverCLIENTS .. "/" .. serverMAXCLIENTS .." Channels: " .. serverCHANNELS .. "\n") | |
ts3.printMessageToCurrentTab("Running " .. serverVERSION .. " on " .. serverPLATFORM .. "\n") | |
file:write("Running " .. serverVERSION .. " on " .. serverPLATFORM .. "\n") | |
end | |
if chanID == clientsChanID and Func ~= "All" and Func == "Room" then | |
file = io.open("C:/Users/Timo/AppData/Roaming/TS3Client/dumps/channelclientdump_" .. serverUID .. "_" .. chanID .. ".txt", "w") | |
file:write("Channel Clients Dump of Server: " .. serverNAME .. " in " .. chanID .. " at " .. date .. "\nServerID: " .. serverConnectionHandlerID .. " ServerUID: " .. serverUID .. "\n") | |
end | |
for i=1, #clients do | |
local clientsChanID, error = ts3.getChannelOfClient(serverConnectionHandlerID,clients[i]) | |
if Func == "All" and Func ~= "Room" then | |
local tclientID = clients[i] | |
ts3.requestClientVariables(serverConnectionHandlerID, tclientID) | |
local AllMyRoomClientsDB, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_DATABASE_ID) | |
local AllMyRoomClientName, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_NICKNAME) | |
local AllMyRoomClientUID, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) | |
local AllMyRoomClientVERSION, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_VERSION) | |
local AllMyRoomClientPLATFORM, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_PLATFORM) | |
-- local AllMyRoomClientCOUNTRY, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_COUNTRY) | |
local AllMyRoomClientTYPE, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_TYPE) | |
if AllMyRoomClientTYPE == "1" then | |
AllMyRoomClientTYPE = "QUERY" | |
elseif AllMyRoomClientTYPE == "0" then | |
AllMyRoomClientTYPE = "CLIENT" | |
else | |
AllMyRoomClientTYPE = "UNKOWN" | |
end | |
ts3.printMessageToCurrentTab(AllMyRoomClientTYPE .. " > " .. clientsChanID .. " > ClientName: "..AllMyRoomClientName.." | ClientDB: "..AllMyRoomClientsDB.." | ClientID: "..clients[i]) | |
file:write(AllMyRoomClientTYPE..": "..AllMyRoomClientName.." | Channel: "..clientsChanID.." | DBID: "..AllMyRoomClientsDB.." | CID: "..clients[i].." | VER: "..AllMyRoomClientVERSION.." | OS: "..AllMyRoomClientPLATFORM.." | UID: "..AllMyRoomClientUID.."\n") | |
--file:write("\n") | |
end | |
if chanID == clientsChanID and Func ~= "All" and Func == "Room" then | |
local AllMyRoomClientsDB, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_DATABASE_ID) | |
local AllMyRoomClientName, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_NICKNAME) | |
ts3.printMessageToCurrentTab("ClientName: "..AllMyRoomClientName.." | ClientDB: "..AllMyRoomClientsDB.." | ClientID: "..clients[i]..".") | |
-- file:write("ClientName: "..AllMyRoomClientName.." | ClientDB: "..AllMyRoomClientsDB.." | ClientID: "..clients[i]..".") | |
-- file:write("\n") | |
end | |
end | |
if Func ~= "All" and Func ~= "Room" then | |
ts3.printMessageToCurrentTab("[ERROR]: DO Command: /lua run info [All/Room]") | |
end | |
if Func == "All" and Func ~= "Room" then | |
file:close() | |
end | |
end | |
function dumpClientsCSV(serverConnectionHandlerID,Func) | |
ts3.requestServerVariables(serverConnectionHandlerID) | |
local clients, error = ts3.getClientList(serverConnectionHandlerID) | |
local myClientID, error = ts3.getClientID(serverConnectionHandlerID) | |
local chanID, error = ts3.getChannelOfClient(serverConnectionHandlerID,myClientID) | |
local serverNAME, error = ts3.getServerVariableAsString(serverConnectionHandlerID, ts3defs.VirtualServerProperties.VIRTUALSERVER_NAME) | |
local date = os.date() | |
local time = os.time() | |
if Func == "All" and Func ~= "Room" then | |
file = io.open("C:/Users/Timo/AppData/Roaming/TS3Client/dumps/" .. serverNAME .. ".csv", "w") | |
ts3.printMessageToCurrentTab("Server Clients Dump of Server: " .. serverNAME .. " at " .. date .. "\n") | |
file:write("TYPE,Nickname,Channel ID,DBID,CID,VERSION,PLATFORM,UID\n") | |
end | |
if chanID == clientsChanID and Func ~= "All" and Func == "Room" then | |
file = io.open("C:/Users/Timo/AppData/Roaming/TS3Client/dumps/channelclientdump_" .. serverUID .. "_" .. chanID .. ".csv", "w") | |
end | |
for i=1, #clients do | |
local clientsChanID, error = ts3.getChannelOfClient(serverConnectionHandlerID,clients[i]) | |
if Func == "All" and Func ~= "Room" then | |
local tclientID = clients[i] | |
ts3.requestClientVariables(serverConnectionHandlerID, tclientID) | |
local AllMyRoomClientsDB, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_DATABASE_ID) | |
local AllMyRoomClientName, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_NICKNAME) | |
local AllMyRoomClientUID, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) | |
local AllMyRoomClientVERSION, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_VERSION) | |
local AllMyRoomClientPLATFORM, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_PLATFORM) | |
-- local AllMyRoomClientCOUNTRY, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_COUNTRY) | |
local AllMyRoomClientTYPE, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_TYPE) | |
if AllMyRoomClientTYPE == "1" then | |
AllMyRoomClientTYPE = "QUERY" | |
elseif AllMyRoomClientTYPE == "0" then | |
AllMyRoomClientTYPE = "CLIENT" | |
else | |
AllMyRoomClientTYPE = "UNKOWN" | |
end | |
file:write(AllMyRoomClientTYPE..","..AllMyRoomClientName..","..clientsChanID..","..AllMyRoomClientsDB..","..clients[i]..","..AllMyRoomClientVERSION..","..AllMyRoomClientPLATFORM..","..AllMyRoomClientUID.."\n") | |
--file:write("\n") | |
end | |
if chanID == clientsChanID and Func ~= "All" and Func == "Room" then | |
local AllMyRoomClientsDB, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_DATABASE_ID) | |
local AllMyRoomClientName, error = ts3.getClientVariableAsString(serverConnectionHandlerID,clients[i],ts3defs.ClientProperties.CLIENT_NICKNAME) | |
ts3.printMessageToCurrentTab("ClientName: "..AllMyRoomClientName.." | ClientDB: "..AllMyRoomClientsDB.." | ClientID: "..clients[i]..".") | |
-- file:write("ClientName: "..AllMyRoomClientName.." | ClientDB: "..AllMyRoomClientsDB.." | ClientID: "..clients[i]..".") | |
-- file:write("\n") | |
end | |
end | |
if Func ~= "All" and Func ~= "Room" then | |
ts3.printMessageToCurrentTab("[ERROR]: DO Command: /lua run info [All/Room]") | |
end | |
if Func == "All" and Func ~= "Room" then | |
file:close() | |
end | |
end |
i don't use teamspeak anymore, sorry
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, How can I contact you?
I have some questions about server dumping with LUA.
Hope you get the message and answer :)
T