
Security News
NIST Under Federal Audit for NVD Processing Backlog and Delays
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
teamspeak-query
Advanced tools
A small, promise-based library for talking to your Teamspeak-Server via the Teamspeak Server Query. See for yourself:
const TeamspeakQuery = require('teamspeak-query');
const query = new TeamspeakQuery.Raw();
query.send('login', 'serveradmin', 'changeme')
.then(() => query.send('use', 1))
.then(() => query.send('servernotifyregister', { 'event': 'server' }))
.then(() => console.log('Done! Everything went fine'))
.catch(err => console.error('An error occured:', err));
// After teamspeak has processed 'servernotifyregister',
// we will get notified about any connections
query.on('cliententerview', data =>
console.log(data.client_nickname, 'connected') );
$ npm install teamspeak-query
Upgrading: If you are upgrading to a newer version of teamspeak-query
, take a look at the changelog to find out what needs to be done on your side. I will try to keep this process as simple as possible with future releases.
The constructor takes a single object with some options.
Name | Default | Description |
---|---|---|
options | {} | Passed to net.Socket.connect |
options.host | 127.0.0.1 | The ip of the server |
options.port | 10011 | The query port of the server |
The underlying TCP socket can be accessed via the sock
property.
When using SSH you won't need to authenticate via the login
-command, because, unlike with TeamspeakQuery.Raw
,
this is done when establishing the connection.
Name | Default | Description |
---|---|---|
options | {} | Passed to ssh2.Client.connect |
options.host | 127.0.0.1 | The ip of the server |
options.port | 10011 | The query port of the server |
options.username | none | The username |
options.password | none | The password |
The underlying ssh2.Client instance can be accessed via the client
property.
The first Example, but via SSH:
const query = new TeamspeakQuery.SSH({ username: 'serveradmin', password: 'changeme' });
// We can omit the login command
query.send('use', 1)
.then(() => query.send('servernotifyregister', { 'event': 'server' }))
.then(() => console.log('Done! Everything went fine'))
.catch(err => console.error('An error occured:', err))
query.on('cliententerview', data =>
console.log(data.client_nickname, 'connected') );
Sends a command to the server and returns a Promise that resolves the response or rejects if something went wrong.
There are 2 ways, which can also be mixed, to specify parameters for the command:
{ 'parameter': 'value', 'x': 42 }
.query.send('login', 'username', 'password')
.
You can also use it to set flags, e.g. query.send('clientlist', '-uid', '-ip')
.If you want your response to be an array, e.g. for commands like clientlist
, take a look at Issue #3.
Once you are done with everything you should call the disconnect method to release any resources that are required for keeping the connection open. This includes things like the keepalive loop.
Example:
query.send('login', 'serveradmin', 'changeme')
.then(() => query.send('use', 1))
.then(() => query.send('clientlist'))
.then(() => query.disconnect())
.catch(console.error);
A keep-alive mechanism is implemented to prevent the server from closing the connection after inactivity. It basically just sends a version
command every few minutes (This doesn't require authentication and has a very small overhead).
If you want to tune its parameters, you can access the keepalive
property of your TeamspeakQuery
instance:
query.keepalive.enable()
query.keepalive.disable()
x
seconds: query.keepalive.setDuration(x)
Commands are being throttled by default to prevent a ban for flooding (see Whitelisting and Blacklisting on page 6 in the specs).
The instance of lib/throttle.js can be accessed via query.throttle
.
If you want to disable throttling, you can do it like this: query.throttle.set('enable', false)
.
For interacting with files in Teamspeak channels, you can use the teamspeak-filesystem package
.
FAQs
Teamspeak-ServerQuery library
The npm package teamspeak-query receives a total of 10 weekly downloads. As such, teamspeak-query popularity was classified as not popular.
We found that teamspeak-query demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.