Skip to content

Commit

Permalink
rip
Browse files Browse the repository at this point in the history
Signed-off-by: Bluscream <admin@timo.de.vc>
  • Loading branch information
Bluscream committed Dec 16, 2018
1 parent 178cfb4 commit ad84208
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/shittyExploits/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Custom Disconnect pyTSon script
97 changes: 97 additions & 0 deletions scripts/shittyExploits/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import ts3lib, ts3defines
from ts3plugin import ts3plugin, PluginHost
from pytson import getCurrentApiVersion
from bluscream import timestamp, getScriptPath, getChannelPassword

def loadCfg(path):
result = {}
with open(path) as fp:
for line in fp:
line = line.split('=', 1)
result[line[0].strip()] = line[1].strip()
return result

def saveCfg(path, cfg:dict):
lines = []
for k,v in cfg.items():
lines.append("%s=%s"%(k,v))
if len(lines) < 1: return
outF = open(path, "w")
outF.writelines(map(lambda s: s + '\n', lines))
outF.close()

# noinspection PyArgumentList
class shittyExploits(ts3plugin):
path = getScriptPath(__name__)
name = "Shitty Exploits"
try: apiVersion = getCurrentApiVersion()
except: apiVersion = 21
requestAutoload = True
version = "1.0"
author = "Bluscream"
description = ""
offersConfigure = False
commandKeyword = ""
infoTitle = "[b]Shitty Exploits[/b]:"
hotkeys = []
menuItems = [
(ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL, 0, "Reconnect here", "scripts/%s/refresh.svg"%__name__),
(ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL, 1, "Reconnect with TP", "scripts/%s/refresh.svg"%__name__),
(ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL, 2, "Reconnect with Commander", "scripts/%s/refresh.svg"%__name__),
(ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL, 3, "Reconnect with Recording", "scripts/%s/refresh.svg"%__name__),
(ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL, 4, "Reconnect with All", "scripts/%s/refresh.svg"%__name__),
]
ini = ""
cfg = {}

def __init__(self):
self.ini = "%s/shittyExploits/config.ini"%ts3lib.getPluginPath()
self.cfg = loadCfg(self.ini)
if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(), self.name, self.author))

def onMenuItemEvent(self, schid, atype, mID, selectedItemID):
self.cfg["client_is_talker"] = 1 if mID in [1,4] else 0
self.cfg["client_is_channel_commander"] = 1 if mID in [2,4] else 0
self.cfg["client_is_recording"] = 1 if mID in [3,4] else 0
saveCfg(self.ini, self.cfg)
print(self.cfg)
self.reconnect(schid, selectedItemID)

def infoData(self, schid, id, atype):
if atype != ts3defines.PluginItemType.PLUGIN_CHANNEL:
return None
with open(self.ini, encoding="utf-8") as f:
return [line.rstrip('\n') for line in f.readlines()]

def reconnect(self, schid=0, cid=0):
if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
err, host, port, pw = ts3lib.getServerConnectInfo(schid)
address = host if not "." in host else "{}:{}".format(host,port)
# ts3lib.stopConnection(schid, "")
err, nickname = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
err, nickname_phonetic = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC)
cpw = ""
if not cid:
err, cid = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL)
err, cpw = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL_PASSWORD)
else:
(err, cid, cpw) = ts3lib.getChannelConnectInfo(schid, cid)
err, default_token = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_DEFAULT_TOKEN)
args = [
ts3defines.PluginConnectTab.PLUGIN_CONNECT_TAB_CURRENT, # connectTab: int,
address, # serverLabel: Union[str, unicode],
address, # serverAddress: Union[str, unicode],
pw, # serverPassword: Union[str, unicode],
nickname, # nickname: Union[str, unicode],
cid, # channel: Union[str, unicode],
cpw if cpw else "123", # channelPassword: Union[str, unicode]
"", # captureProfile: Union[str, unicode],
"", # playbackProfile: Union[str, unicode]
"", # hotkeyProfile: Union[str, unicode],
"", # userIdentity: Union[str, unicode],
default_token, # oneTimeKey: Union[str, unicode],
nickname_phonetic, # phoneticName: Union[str, unicode]
"", # No idea
]
print("ts3lib.guiConnect({})".format("\", \"".join(str(x) for x in args)))
ts3lib.guiConnect(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12], args[13])
1 change: 1 addition & 0 deletions scripts/shittyExploits/refresh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ad84208

Please sign in to comment.