intermediary commit

This commit is contained in:
brent s 2018-02-13 00:09:36 -05:00
parent caca1d1e84
commit a8b9ecc7a0
12 changed files with 6637 additions and 29 deletions

4
TODO
View File

@ -22,4 +22,6 @@ probably need to package https://packages.debian.org/source/stretch/freebsd-buil

-net, add ipxe - write flask app that determines path based on MAC addr

-net, add shorewall templater
-net, add shorewall templater

-port in sslchk

223
arch/buildup/pkgchk.py Executable file
View File

@ -0,0 +1,223 @@
#!/usr/bin/env python3

import argparse
import configparser
import hashlib
import os
import re
import shlex
import subprocess
import tarfile # for verifying built PKGBUILDs. We just need to grab <tar>/.PKGINFO, and check: pkgver = <version>
import tempfile
from collections import OrderedDict
from urllib.request import urlopen

class color(object):
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'


vcstypes = ('bzr', 'git', 'hg', 'svn')

class pkgChk(object):
def __init__(self, pkg):
# pkg should be a string of a PKGBUILD,
# not the path to a file.
self.pkg = pkg
# The below holds parsed data from the PKGBUILD.
self.pkgdata = {'pkgver': self.getLex('pkgver', 'var'),
'_pkgver': self.getLex('_pkgver', 'var'),
'pkgname': self.getLex('pkgname', 'var'),
'sources': self.getLex('source', 'array')}

def getLex(self, attrib, attrtype):
# Parse the PKGBUILD and return actual values from it.
# attrtype should be "var" or "array".
# var returns a string and array returns a list.
# If the given attrib isn't in the pkgbuild, None is returned.
# The sources array is special, though - it returns a tuple of:
# (hashtype, dict) where dict is a mapping of:
# filename: hash
# filename2: hash2
# etc.
if attrtype not in ('var', 'array'):
raise ValueError('{0} is not a valid attribute type.'.format(attrib))
_sums = ('sha512', 'sha384', 'sha256', 'sha1', 'md5') # in order of preference
_attrmap = {'var': 'echo ${{{0}}}'.format(attrib),
'array': 'echo ${{{}[@]}}'.format(attrib)}
_tempfile = tempfile.mkstemp(text = True)
with open(_tempfile[1], 'w') as f:
f.write(self.pkg)
_cmd = ['/bin/bash',
'--restricted', '--noprofile',
'--init-file', _tempfile[1],
'-i', '-c', _attrmap[attrtype]]
with open(os.devnull, 'wb') as devnull:
_out = subprocess.run(_cmd, env = {'PATH': ''},
stdout = subprocess.PIPE,
stderr = devnull).stdout.decode('utf-8').strip()
if _out == '':
os.remove(_tempfile[1])
return(None)
if attrtype == 'var':
os.remove(_tempfile[1])
return(_out)
else: # it's an array
if attrib == 'source':
_sources = {}
_source = shlex.split(_out)
_sumarr = [None] * len(_source)
for h in _sums:
_cmd[-1] = 'echo ${{{0}[@]}}'.format(h + 'sums')
with open(os.devnull, 'wb') as devnull:
_out = subprocess.run(_cmd, env = {'PATH': ''},
stdout = subprocess.PIPE,
stderr = devnull).stdout.decode('utf-8').strip()
if _out != '':
os.remove(_tempfile[1])
return(h, OrderedDict(zip(_source, shlex.split(_out))))
else:
continue
# No match for checksums.
os.remove(_tempfile[1])
return(None, OrderedDict(zip(_source, shlex.split(_out))))
else:
os.remove(_tempfile[1])
return(shlex.split(_out))
return()
def getURL(self, url):
with urlopen(url) as http:
code = http.getcode()
return(code)
def chkVer(self):
_separators = []
# TODO: this is to explicitly prevent parsing
# VCS packages, so might need some re-tooling in the future.
if self.pkgdata['pkgname'].split('-')[-1] in vcstypes:
return(None)
# transform the current version into a list of various components.
if not self.pkgdata['pkgver']:
return(None)
if self.pkgdata['_pkgver']:
_cur_ver = self.pkgdata['_pkgver']
else:
_cur_ver = self.pkgdata['pkgver']
# This will catch like 90% of the software versions out there.
# Unfortunately, it won't catch all of them. I dunno how to
# handle that quite yet. TODO.
_split_ver = _cur_ver.split('.')
_idx = len(_split_ver) - 1
while _idx >= 0:
_url = re.sub('^[A-Za-z0-9]+::',
'',
list(self.pkgdata['sources'].keys())[0])
_code = self.getURL(_url)
_idx -= 1

def parseArgs():
_ini = '~/.config/optools/buildup.ini'
_defini = os.path.abspath(os.path.expanduser(_ini))
args = argparse.ArgumentParser()
args.add_argument('-c', '--config',
default = _defini,
dest = 'config',
help = ('The path to the config file. ' +
'Default: {0}{1}{2}').format(color.BOLD,
_defini,
color.END))
args.add_argument('-R', '--no-recurse',
action = 'store_false',
dest = 'recurse',
help = ('If specified, and the path provided is a directory, ' +
'do NOT recurse into subdirectories.'))
args.add_argument('-p', '--path',
metavar = 'path/to/dir/or/PKGBUILD',
default = None,
dest = 'pkgpath',
help = ('The path to either a directory containing PKGBUILDs (recursion ' +
'enabled - see {0}-R/--no-recurse{1}) ' +
'or a single PKGBUILD. Use to override ' +
'the config\'s PKG:paths.').format(color.BOLD, color.END))
return(args)

def parsePkg(pkgbuildstr):
p = pkgChk(pkgbuildstr)
p.chkVer()
return()

def iterDir(pkgpath, recursion = True):
filepaths = []
if os.path.isfile(pkgpath):
return([pkgpath])
if recursion:
for root, subdirs, files in os.walk(pkgpath):
for vcs in vcstypes:
if '.{0}'.format(vcs) in subdirs:
subdirs.remove('.{0}'.format(vcs))
for f in files:
if 'PKGBUILD' in f:
filepaths.append(os.path.join(root, f))
else:
for f in os.listdir(pkgpath):
if 'PKGBUILD' in f:
filepaths.append(f)
filepaths.sort()
return(filepaths)

def parseCfg(cfgfile):
def getPath(p):
return(os.path.abspath(os.path.expanduser(p)))
_defcfg = '[PKG]\npaths = \ntestbuild = no\n[VCS]\n'
for vcs in vcstypes:
_defcfg += '{0} = no\n'.format(vcs)
_cfg = configparser.ConfigParser()
_cfg._interpolation = configparser.ExtendedInterpolation()
_cfg.read((_defcfg, cfgfile))
# We convert to a dict so we can do things like list comprehension.
cfg = {s:dict(_cfg.items(s)) for s in _cfg.sections()}
if 'paths' not in cfg['PKG'].keys():
raise ValueError('You must provide a valid configuration ' +
'file with the PKG:paths setting specified and valid.')
cfg['PKG']['paths'] = sorted([getPath(p.strip()) for p in cfg['PKG']['paths'].split(',')],
reverse = True)
for p in cfg['PKG']['paths'][:]:
if not os.path.exists(p):
print('WARNING: {0} does not exist; skipping...'.format(p))
cfg['PKG']['paths'].remove(p)
# We also want to convert these to pythonic True/False
cfg['PKG']['testbuild'] = _cfg['PKG'].getboolean('testbuild')
for k in vcstypes:
cfg['VCS'][k] = _cfg['VCS'].getboolean(k)
return(cfg)

if __name__ == '__main__':
args = vars(parseArgs().parse_args())
if not os.path.isfile(args['config']):
raise FileNotFoundError('{0} does not exist.'.format(cfg))
cfg = parseCfg(args['config'])
if args['pkgpath']:
args['pkgpath'] = os.path.abspath(os.path.expanduser(args['pkgpath']))
if os.path.isdir(args['pkgpath']):
iterDir(args['pkgpath'], recursion = args['recurse'])
elif os.path.isfile(args['pkgpath']):
parsePkg(args['pkgpath'])
else:
raise FileNotFoundError('{0} does not exist.'.format(args['pkgpath']))
else:
files = []
for p in cfg['PKG']['paths']:
files.extend(iterDir(p))
files.sort()
for p in files:
with open(p, 'r') as f:
parsePkg(f.read())

View File

@ -0,0 +1,39 @@
## This configuration file will allow you to perform more
## fine-grained control of BuildUp.
## It supports the syntax shortcuts found here:
## https://docs.python.org/3/library/configparser.html#configparser.ExtendedInterpolation

[PKG]
# The path(s) to your PKGBUILD(s), or a directory/directories containing them.
# If you have more than one, separate with a comma.
paths = path/to/pkgbuilds,another/path/to/pkgbuilds

# If 'yes', try building the package with the new version.
# If 'no' (the default), don't try to build with the new version.
# This can be a good way to test that you don't need to modify the PKGBUILD,
# but can be error-prone (missing makedeps, etc.).
testbuild = no

[VCS]
# Here you can enable or disable which VCS platforms you want to support.
# Note that it will increase the time of your check, as it will
# actually perform a checkout/clone/etc. of the source and check against
# the version function inside the PKGBUILD.
# It's also generally meaningless, as VCS PKGBUILDs are intended
# to be dynamic. Nonetheless, the options are there.
# Use 'yes' to enable, or 'no' to disable (the default).
# Currently only the given types are supported (i.e. no CVS).

# THESE ARE CURRENTLY NOT SUPPORTED.

# Check revisions for -git PKGBUILDs
git = no

# Check revisions for -svn PKGBUILDs
svn = no

# Check revisions for -hg PKGBUILDs
hg = no

# Check revisions for -bzr PKGBUILDs
bzr = no

View File

@ -8,7 +8,11 @@ import pprint
import subprocess
import sys

cfgfile = os.path.join(os.environ['HOME'], '.arch.repoclone.ini')
cfgfile = os.path.join(os.environ['HOME'],
'.config',
'optools',
'repoclone',
'arch.ini')

# Rsync options
opts = [
@ -108,6 +112,8 @@ def parseArgs():
help = ('The upstream mirror to sync from, must be an rsync URI '+
'(Default: {0}').format(liveopts['mirror']))
# TODO: can we do this?
# We can; we need to .format() a repo in, probably, on the src and dest.
# Problem is the last updated/last synced files.
# args.add_argument('-r',
# '--repos',
# dest = 'repos',

563
mumble/Mumble.proto Normal file
View File

@ -0,0 +1,563 @@
// Copyright 2005-2017 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

syntax = "proto2";

package MumbleProto;

option optimize_for = SPEED;

message Version {
// 2-byte Major, 1-byte Minor and 1-byte Patch version number.
optional uint32 version = 1;
// Client release name.
optional string release = 2;
// Client OS name.
optional string os = 3;
// Client OS version.
optional string os_version = 4;
}

// Not used. Not even for tunneling UDP through TCP.
message UDPTunnel {
// Not used.
required bytes packet = 1;
}

// Used by the client to send the authentication credentials to the server.
message Authenticate {
// UTF-8 encoded username.
optional string username = 1;
// Server or user password.
optional string password = 2;
// Additional access tokens for server ACL groups.
repeated string tokens = 3;
// A list of CELT bitstream version constants supported by the client.
repeated int32 celt_versions = 4;
optional bool opus = 5 [default = false];
}

// Sent by the client to notify the server that the client is still alive.
// Server must reply to the packet with the same timestamp and its own
// good/late/lost/resync numbers. None of the fields is strictly required.
message Ping {
// Client timestamp. Server should not attempt to decode.
optional uint64 timestamp = 1;
// The amount of good packets received.
optional uint32 good = 2;
// The amount of late packets received.
optional uint32 late = 3;
// The amount of packets never received.
optional uint32 lost = 4;
// The amount of nonce resyncs.
optional uint32 resync = 5;
// The total amount of UDP packets received.
optional uint32 udp_packets = 6;
// The total amount of TCP packets received.
optional uint32 tcp_packets = 7;
// UDP ping average.
optional float udp_ping_avg = 8;
// UDP ping variance.
optional float udp_ping_var = 9;
// TCP ping average.
optional float tcp_ping_avg = 10;
// TCP ping variance.
optional float tcp_ping_var = 11;
}

// Sent by the server when it rejects the user connection.
message Reject {
enum RejectType {
// The rejection reason is unknown (details should be available
// in Reject.reason).
None = 0;
// The client attempted to connect with an incompatible version.
WrongVersion = 1;
// The user name supplied by the client was invalid.
InvalidUsername = 2;
// The client attempted to authenticate as a user with a password but it
// was wrong.
WrongUserPW = 3;
// The client attempted to connect to a passworded server but the password
// was wrong.
WrongServerPW = 4;
// Supplied username is already in use.
UsernameInUse = 5;
// Server is currently full and cannot accept more users.
ServerFull = 6;
// The user did not provide a certificate but one is required.
NoCertificate = 7;
AuthenticatorFail = 8;
}
// Rejection type.
optional RejectType type = 1;
// Human readable rejection reason.
optional string reason = 2;
}

// ServerSync message is sent by the server when it has authenticated the user
// and finished synchronizing the server state.
message ServerSync {
// The session of the current user.
optional uint32 session = 1;
// Maximum bandwidth that the user should use.
optional uint32 max_bandwidth = 2;
// Server welcome text.
optional string welcome_text = 3;
// Current user permissions in the root channel.
optional uint64 permissions = 4;
}

// Sent by the client when it wants a channel removed. Sent by the server when
// a channel has been removed and clients should be notified.
message ChannelRemove {
required uint32 channel_id = 1;
}

// Used to communicate channel properties between the client and the server.
// Sent by the server during the login process or when channel properties are
// updated. Client may use this message to update said channel properties.
message ChannelState {
// Unique ID for the channel within the server.
optional uint32 channel_id = 1;
// channel_id of the parent channel.
optional uint32 parent = 2;
// UTF-8 encoded channel name.
optional string name = 3;
// A collection of channel id values of the linked channels. Absent during
// the first channel listing.
repeated uint32 links = 4;
// UTF-8 encoded channel description. Only if the description is less than
// 128 bytes
optional string description = 5;
// A collection of channel_id values that should be added to links.
repeated uint32 links_add = 6;
// A collection of channel_id values that should be removed from links.
repeated uint32 links_remove = 7;
// True if the channel is temporary.
optional bool temporary = 8 [default = false];
// Position weight to tweak the channel position in the channel list.
optional int32 position = 9 [default = 0];
// SHA1 hash of the description if the description is 128 bytes or more.
optional bytes description_hash = 10;
// Maximum number of users allowed in the channel. If this value is zero,
// the maximum number of users allowed in the channel is given by the
// server's "usersperchannel" setting.
optional uint32 max_users = 11;
}

// Used to communicate user leaving or being kicked. May be sent by the client
// when it attempts to kick a user. Sent by the server when it informs the
// clients that a user is not present anymore.
message UserRemove {
// The user who is being kicked, identified by their session, not present
// when no one is being kicked.
required uint32 session = 1;
// The user who initiated the removal. Either the user who performs the kick
// or the user who is currently leaving.
optional uint32 actor = 2;
// Reason for the kick, stored as the ban reason if the user is banned.
optional string reason = 3;
// True if the kick should result in a ban.
optional bool ban = 4;
}

// Sent by the server when it communicates new and changed users to client.
// First seen during login procedure. May be sent by the client when it wishes
// to alter its state.
message UserState {
// Unique user session ID of the user whose state this is, may change on
// reconnect.
optional uint32 session = 1;
// The session of the user who is updating this user.
optional uint32 actor = 2;
// User name, UTF-8 encoded.
optional string name = 3;
// Registered user ID if the user is registered.
optional uint32 user_id = 4;
// Channel on which the user is.
optional uint32 channel_id = 5;
// True if the user is muted by admin.
optional bool mute = 6;
// True if the user is deafened by admin.
optional bool deaf = 7;
// True if the user has been suppressed from talking by a reason other than
// being muted.
optional bool suppress = 8;
// True if the user has muted self.
optional bool self_mute = 9;
// True if the user has deafened self.
optional bool self_deaf = 10;
// User image if it is less than 128 bytes.
optional bytes texture = 11;
// The positional audio plugin identifier.
// Positional audio information is only sent to users who share
// identical plugin contexts.
//
// This value is not trasmitted to clients.
optional bytes plugin_context = 12;
// The user's plugin-specific identity.
// This value is not transmitted to clients.
optional string plugin_identity = 13;
// User comment if it is less than 128 bytes.
optional string comment = 14;
// The hash of the user certificate.
optional string hash = 15;
// SHA1 hash of the user comment if it 128 bytes or more.
optional bytes comment_hash = 16;
// SHA1 hash of the user picture if it 128 bytes or more.
optional bytes texture_hash = 17;
// True if the user is a priority speaker.
optional bool priority_speaker = 18;
// True if the user is currently recording.
optional bool recording = 19;
}

// Relays information on the bans. The client may send the BanList message to
// either modify the list of bans or query them from the server. The server
// sends this list only after a client queries for it.
message BanList {
message BanEntry {
// Banned IP address.
required bytes address = 1;
// The length of the subnet mask for the ban.
required uint32 mask = 2;
// User name for identification purposes (does not affect the ban).
optional string name = 3;
// The certificate hash of the banned user.
optional string hash = 4;
// Reason for the ban (does not affect the ban).
optional string reason = 5;
// Ban start time.
optional string start = 6;
// Ban duration in seconds.
optional uint32 duration = 7;
}
// List of ban entries currently in place.
repeated BanEntry bans = 1;
// True if the server should return the list, false if it should replace old
// ban list with the one provided.
optional bool query = 2 [default = false];
}

// Used to send and broadcast text messages.
message TextMessage {
// The message sender, identified by its session.
optional uint32 actor = 1;
// Target users for the message, identified by their session.
repeated uint32 session = 2;
// The channels to which the message is sent, identified by their
// channel_ids.
repeated uint32 channel_id = 3;
// The root channels when sending message recursively to several channels,
// identified by their channel_ids.
repeated uint32 tree_id = 4;
// The UTF-8 encoded message. May be HTML if the server allows.
required string message = 5;
}

message PermissionDenied {
enum DenyType {
// Operation denied for other reason, see reason field.
Text = 0;
// Permissions were denied.
Permission = 1;
// Cannot modify SuperUser.
SuperUser = 2;
// Invalid channel name.
ChannelName = 3;
// Text message too long.
TextTooLong = 4;
// The flux capacitor was spelled wrong.
H9K = 5;
// Operation not permitted in temporary channel.
TemporaryChannel = 6;
// Operation requires certificate.
MissingCertificate = 7;
// Invalid username.
UserName = 8;
// Channel is full.
ChannelFull = 9;
NestingLimit = 10;
}
// The denied permission when type is Permission.
optional uint32 permission = 1;
// channel_id for the channel where the permission was denied when type is
// Permission.
optional uint32 channel_id = 2;
// The user who was denied permissions, identified by session.
optional uint32 session = 3;
// Textual reason for the denial.
optional string reason = 4;
// Type of the denial.
optional DenyType type = 5;
// The name that is invalid when type is UserName.
optional string name = 6;
}

message ACL {
message ChanGroup {
// Name of the channel group, UTF-8 encoded.
required string name = 1;
// True if the group has been inherited from the parent (Read only).
optional bool inherited = 2 [default = true];
// True if the group members are inherited.
optional bool inherit = 3 [default = true];
// True if the group can be inherited by sub channels.
optional bool inheritable = 4 [default = true];
// Users explicitly included in this group, identified by user_id.
repeated uint32 add = 5;
// Users explicitly removed from this group in this channel if the group
// has been inherited, identified by user_id.
repeated uint32 remove = 6;
// Users inherited, identified by user_id.
repeated uint32 inherited_members = 7;
}
message ChanACL {
// True if this ACL applies to the current channel.
optional bool apply_here = 1 [default = true];
// True if this ACL applies to the sub channels.
optional bool apply_subs = 2 [default = true];
// True if the ACL has been inherited from the parent.
optional bool inherited = 3 [default = true];
// ID of the user that is affected by this ACL.
optional uint32 user_id = 4;
// ID of the group that is affected by this ACL.
optional string group = 5;
// Bit flag field of the permissions granted by this ACL.
optional uint32 grant = 6;
// Bit flag field of the permissions denied by this ACL.
optional uint32 deny = 7;
}
// Channel ID of the channel this message affects.
required uint32 channel_id = 1;
// True if the channel inherits its parent's ACLs.
optional bool inherit_acls = 2 [default = true];
// User group specifications.
repeated ChanGroup groups = 3;
// ACL specifications.
repeated ChanACL acls = 4;
// True if the message is a query for ACLs instead of setting them.
optional bool query = 5 [default = false];
}

// Client may use this message to refresh its registered user information. The
// client should fill the IDs or Names of the users it wants to refresh. The
// server fills the missing parts and sends the message back.
message QueryUsers {
// user_ids.
repeated uint32 ids = 1;
// User names in the same order as ids.
repeated string names = 2;
}

// Used to initialize and resync the UDP encryption. Either side may request a
// resync by sending the message without any values filled. The resync is
// performed by sending the message with only the client or server nonce
// filled.
message CryptSetup {
// Encryption key.
optional bytes key = 1;
// Client nonce.
optional bytes client_nonce = 2;
// Server nonce.
optional bytes server_nonce = 3;
}

message ContextActionModify {
enum Context {
// Action is applicable to the server.
Server = 0x01;
// Action can target a Channel.
Channel = 0x02;
// Action can target a User.
User = 0x04;
}
enum Operation {
Add = 0;
Remove = 1;
}
// The action name.
required string action = 1;
// The display name of the action.
optional string text = 2;
// Context bit flags defining where the action should be displayed.
optional uint32 context = 3;
optional Operation operation = 4;
}

// Sent by the client when it wants to initiate a Context action.
message ContextAction {
// The target User for the action, identified by session.
optional uint32 session = 1;
// The target Channel for the action, identified by channel_id.
optional uint32 channel_id = 2;
// The action that should be executed.
required string action = 3;
}

// Lists the registered users.
message UserList {
message User {
// Registered user ID.
required uint32 user_id = 1;
// Registered user name.
optional string name = 2;
optional string last_seen = 3;
optional uint32 last_channel = 4;
}
// A list of registered users.
repeated User users = 1;
}

// Sent by the client when it wants to register or clear whisper targets.
//
// Note: The first available target ID is 1 as 0 is reserved for normal
// talking. Maximum target ID is 30.
message VoiceTarget {
message Target {
// Users that are included as targets.
repeated uint32 session = 1;
// Channel that is included as a target.
optional uint32 channel_id = 2;
// ACL group that is included as a target.
optional string group = 3;
// True if the voice should follow links from the specified channel.
optional bool links = 4 [default = false];
// True if the voice should also be sent to children of the specific
// channel.
optional bool children = 5 [default = false];
}
// Voice target ID.
optional uint32 id = 1;
// The receivers that this voice target includes.
repeated Target targets = 2;
}

// Sent by the client when it wants permissions for a certain channel. Sent by
// the server when it replies to the query or wants the user to resync all
// channel permissions.
message PermissionQuery {
// channel_id of the channel for which the permissions are queried.
optional uint32 channel_id = 1;
// Channel permissions.
optional uint32 permissions = 2;
// True if the client should drop its current permission information for all
// channels.
optional bool flush = 3 [default = false];
}

// Sent by the server to notify the users of the version of the CELT codec they
// should use. This may change during the connection when new users join.
message CodecVersion {
// The version of the CELT Alpha codec.
required int32 alpha = 1;
// The version of the CELT Beta codec.
required int32 beta = 2;
// True if the user should prefer Alpha over Beta.
required bool prefer_alpha = 3 [default = true];
optional bool opus = 4 [default = false];
}

// Used to communicate user stats between the server and clients.
message UserStats {
message Stats {
// The amount of good packets received.
optional uint32 good = 1;
// The amount of late packets received.
optional uint32 late = 2;
// The amount of packets never received.
optional uint32 lost = 3;
// The amount of nonce resyncs.
optional uint32 resync = 4;
}

// User whose stats these are.
optional uint32 session = 1;
// True if the message contains only mutable stats (packets, ping).
optional bool stats_only = 2 [default = false];
// Full user certificate chain of the user certificate in DER format.
repeated bytes certificates = 3;
// Packet statistics for packets received from the client.
optional Stats from_client = 4;
// Packet statistics for packets sent by the server.
optional Stats from_server = 5;

// Amount of UDP packets sent.
optional uint32 udp_packets = 6;
// Amount of TCP packets sent.
optional uint32 tcp_packets = 7;
// UDP ping average.
optional float udp_ping_avg = 8;
// UDP ping variance.
optional float udp_ping_var = 9;
// TCP ping average.
optional float tcp_ping_avg = 10;
// TCP ping variance.
optional float tcp_ping_var = 11;

// Client version.
optional Version version = 12;
// A list of CELT bitstream version constants supported by the client of this
// user.
repeated int32 celt_versions = 13;
// Client IP address.
optional bytes address = 14;
// Bandwith used by this client.
optional uint32 bandwidth = 15;
// Connection duration.
optional uint32 onlinesecs = 16;
// Duration since last activity.
optional uint32 idlesecs = 17;
// True if the user has a strong certificate.
optional bool strong_certificate = 18 [default = false];
optional bool opus = 19 [default = false];
}

// Used by the client to request binary data from the server. By default large
// comments or textures are not sent within standard messages but instead the
// hash is. If the client does not recognize the hash it may request the
// resource when it needs it. The client does so by sending a RequestBlob
// message with the correct fields filled with the user sessions or channel_ids
// it wants to receive. The server replies to this by sending a new
// UserState/ChannelState message with the resources filled even if they would
// normally be transmitted as hashes.
message RequestBlob {
// sessions of the requested UserState textures.
repeated uint32 session_texture = 1;
// sessions of the requested UserState comments.
repeated uint32 session_comment = 2;
// channel_ids of the requested ChannelState descriptions.
repeated uint32 channel_description = 3;
}

// Sent by the server when it informs the clients on server configuration
// details.
message ServerConfig {
// The maximum bandwidth the clients should use.
optional uint32 max_bandwidth = 1;
// Server welcome text.
optional string welcome_text = 2;
// True if the server allows HTML.
optional bool allow_html = 3;
// Maximum text message length.
optional uint32 message_length = 4;
// Maximum image message length.
optional uint32 image_message_length = 5;
// The maximum number of users allowed on the server.
optional uint32 max_users = 6;
}

// Sent by the server to inform the clients of suggested client configuration
// specified by the server administrator.
message SuggestConfig {
// Suggested client version.
optional uint32 version = 1;
// True if the administrator suggests positional audio to be used on this
// server.
optional bool positional = 2;
// True if the administrator suggests push to talk to be used on this server.
optional bool push_to_talk = 3;
}

823
mumble/MurmurRPC.proto Normal file
View File

@ -0,0 +1,823 @@
// Copyright 2005-2017 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

syntax = "proto2";

package MurmurRPC;

// Note about embedded messages:
//
// To help save bandwidth, the protocol does not always send complete embedded
// messages (i.e. an embeddded message with all of the fields filled in). These
// incomplete messages only contain enough identifying information to get more
// information from the message's corresponding "Get" method. For example:
//
// User.server only ever contains the server ID. Calling ServerGet(User.server)
// will return a Server message with the server's status and uptime.

message Void {
}

message Version {
// 2-byte Major, 1-byte Minor and 1-byte Patch version number.
optional uint32 version = 1;
// Client release name.
optional string release = 2;
// Client OS name.
optional string os = 3;
// Client OS version.
optional string os_version = 4;
}

message Uptime {
// The number of seconds from the starting time.
optional uint64 secs = 1;
}

message Server {
// The unique server ID.
required uint32 id = 1;
// Is the server currently running?
optional bool running = 2;
// The update of the server.
optional Uptime uptime = 3;

message Event {
enum Type {
UserConnected = 0;
UserDisconnected = 1;
UserStateChanged = 2;
UserTextMessage = 3;
ChannelCreated = 4;
ChannelRemoved = 5;
ChannelStateChanged = 6;
};
// The server on which the event happened.
optional Server server = 1;
// The type of event that happened.
optional Type type = 2;
// The user tied to the event (if applicable).
optional User user = 3;
// The text message tied to the event (if applicable).
optional TextMessage message = 4;
// The channel tied to the event (if applicable).
optional Channel channel = 5;
}

message Query {
}

message List {
// The servers.
repeated Server servers = 1;
}
}

message Event {
enum Type {
ServerStopped = 0;
ServerStarted = 1;
};
// The server for which the event happened.
optional Server server = 1;
// The type of event that happened.
optional Type type = 2;
}

message ContextAction {
enum Context {
Server = 0x01;
Channel = 0x02;
User = 0x04;
};
// The server on which the action is.
optional Server server = 1;
// The context in which the action is.
optional uint32 context = 2;
// The action name.
optional string action = 3;
// The user-visible descriptive name of the action.
optional string text = 4;
// The user that triggered the ContextAction.
optional User actor = 5;
// The user on which the ContextAction was triggered.
optional User user = 6;
// The channel on which the ContextAction was triggered.
optional Channel channel = 7;
}

message TextMessage {
// The server on which the TextMessage originates.
optional Server server = 1;
// The user who sent the message.
optional User actor = 2;
// The users to whom the message is sent.
repeated User users = 3;
// The channels to which the message is sent.
repeated Channel channels = 4;
// The channels to which the message is sent, including the channels'
// ancestors.
repeated Channel trees = 5;
// The message body that is sent.
optional string text = 6;

message Filter {
enum Action {
// Accept the message.
Accept = 0;
// Reject the message with a permission error.
Reject = 1;
// Silently drop the message.
Drop = 2;
}
// The server on which the message originated.
optional Server server = 1;
// The action to perform for the message.
optional Action action = 2;
// The text message.
optional TextMessage message = 3;
}
}

message Log {
// The server on which the log message was generated.
optional Server server = 1;
// The unix timestamp of when the message was generated.
optional int64 timestamp = 2;
// The log message.
optional string text = 3;

message Query {
// The server whose logs will be queried.
optional Server server = 1;
// The minimum log index to receive.
optional uint32 min = 2;
// The maximum log index to receive.
optional uint32 max = 3;
}

message List {
// The server where the log entries are from.
optional Server server = 1;
// The total number of logs entries on the server.
optional uint32 total = 2;
// The minimum log index that was sent.
optional uint32 min = 3;
// The maximum log index that was sent.
optional uint32 max = 4;
// The log entries.
repeated Log entries = 5;
}
}

message Config {
// The server for which the configuration is for.
optional Server server = 1;
// The configuration keys and values.
map<string, string> fields = 2;

message Field {
// The server for which the configuration field is for.
optional Server server = 1;
// The field key.
optional string key = 2;
// The field value.
optional string value = 3;
}
}

message Channel {
// The server on which the channel exists.
optional Server server = 1;
// The unique channel identifier.
optional uint32 id = 2;
// The channel name.
optional string name = 3;
// The channel's parent.
optional Channel parent = 4;
// Linked channels.
repeated Channel links = 5;
// The channel's description.
optional string description = 6;
// Is the channel temporary?
optional bool temporary = 7;
// The position in which the channel should appear in a sorted list.
optional int32 position = 8;

message Query {
// The server on which the channels are.
optional Server server = 1;
}

message List {
// The server on which the channels are.
optional Server server = 1;
// The channels.
repeated Channel channels = 2;
}
}

message User {
// The server to which the user is connected.
optional Server server = 1;
// The user's session ID.
optional uint32 session = 2;
// The user's registered ID.
optional uint32 id = 3;
// The user's name.
optional string name = 4;
// Is the user muted?
optional bool mute = 5;
// Is the user deafened?
optional bool deaf = 6;
// Is the user suppressed?
optional bool suppress = 7;
// Is the user a priority speaker?
optional bool priority_speaker = 8;
// Has the user muted him/herself?
optional bool self_mute = 9;
// Has the user muted him/herself?
optional bool self_deaf = 10;
// Is the user recording?
optional bool recording = 11;
// The channel the user is in.
optional Channel channel = 12;
// How long the user has been connected to the server.
optional uint32 online_secs = 13;
// How long the user has been idle on the server.
optional uint32 idle_secs = 14;
// How many bytes per second is the user transmitting to the server.
optional uint32 bytes_per_sec = 15;
// The user's client version.
optional Version version = 16;
// The user's plugin context.
optional bytes plugin_context = 17;
// The user's plugin identity.
optional string plugin_identity = 18;
// The user's comment.
optional string comment = 19;
// The user's texture.
optional bytes texture = 20;
// The user's IP address.
optional bytes address = 21;
// Is the user in TCP-only mode?
optional bool tcp_only = 22;
// The user's UDP ping in milliseconds.
optional float udp_ping_msecs = 23;
// The user's TCP ping in milliseconds.
optional float tcp_ping_msecs = 24;

message Query {
// The server whose users will be queried.
optional Server server = 1;
}

message List {
// The server to which the users are connected.
optional Server server = 1;
// The users.
repeated User users = 2;
}

message Kick {
// The server to which the user is connected.
optional Server server = 1;
// The user to kick.
optional User user = 2;
// The user who performed the kick.
optional User actor = 3;
// The reason for why the user is being kicked.
optional string reason = 4;
}
}

message Tree {
// The server which the tree represents.
optional Server server = 1;
// The current channel.
optional Channel channel = 2;
// Channels below the current channel.
repeated Tree children = 3;
// The users in the current channel.
repeated User users = 4;

message Query {
// The server to query.
optional Server server = 1;
}
}

message Ban {
// The server on which the ban is applied.
optional Server server = 1;
// The banned IP address.
optional bytes address = 2;
// The number of leading bits in the address to which the ban applies.
optional uint32 bits = 3;
// The name of the banned user.
optional string name = 4;
// The certificate hash of the banned user.
optional string hash = 5;
// The reason for the ban.
optional string reason = 6;
// The ban start time (in epoch form).
optional int64 start = 7;
// The ban duration.
optional int64 duration_secs = 8;

message Query {
// The server whose bans to query.
optional Server server = 1;
}

message List {
// The server for which the bans apply.
optional Server server = 1;
// The bans.
repeated Ban bans = 2;
}
}

message ACL {
enum Permission {
None = 0x00;
Write = 0x01;
Traverse = 0x02;
Enter = 0x04;
Speak = 0x08;
Whisper = 0x100;
MuteDeafen = 0x10;
Move = 0x20;
MakeChannel = 0x40;
MakeTemporaryChannel = 0x400;
LinkChannel = 0x80;
TextMessage = 0x200;

Kick = 0x10000;
Ban = 0x20000;
Register = 0x40000;
RegisterSelf = 0x80000;
}

message Group {
// The ACL group name.
optional string name = 1;
// Is the group inherited?
optional bool inherited = 2;
// Does the group inherit members?
optional bool inherit = 3;
// Can this group be inherited by its children?
optional bool inheritable = 4;

// The users explicitly added by this group.
repeated DatabaseUser users_add = 5;
// The users explicitly removed by this group.
repeated DatabaseUser users_remove = 6;
// All of the users who are part of this group.
repeated DatabaseUser users = 7;
}

// Does the ACL apply to the current channel?
optional bool apply_here = 3;
// Does the ACL apply to the current channel's sub-channels?
optional bool apply_subs = 4;
// Was the ACL inherited?
optional bool inherited = 5;

// The user to whom the ACL applies.
optional DatabaseUser user = 6;
// The group to whom the ACL applies.
optional ACL.Group group = 7;

// The permissions granted by the ACL (bitmask of ACL.Permission).
optional uint32 allow = 8;
// The permissions denied by the ACL (bitmask of ACL.Permission).
optional uint32 deny = 9;

message Query {
// The server where the user and channel exist.
optional Server server = 1;
// The user to query.
optional User user = 2;
// The channel to query.
optional Channel channel = 3;
}

message List {
// The server on which the ACLs exist.
optional Server server = 1;
// The channel to which the ACL refers.
optional Channel channel = 2;
// The ACLs part of the given channel.
repeated ACL acls = 3;
// The groups part of the given channel.
repeated ACL.Group groups = 4;
// Should ACLs be inherited from the parent channel.
optional bool inherit = 5;
}

message TemporaryGroup {
// The server where the temporary group exists.
optional Server server = 1;
// The channel to which the temporary user group is added.
optional Channel channel = 2;
// The user who is added to the group.
optional User user = 3;
// The name of the temporary group.
optional string name = 4;
}
}

message Authenticator {
message Request {
// An authentication request for a connecting user.
message Authenticate {
// The user's name.
optional string name = 1;
// The user's password.
optional string password = 2;
// The user's certificate chain in DER format.
repeated bytes certificates = 3;
// The hexadecimal hash of the user's certificate.
optional string certificate_hash = 4;
// If the user is connecting with a strong certificate.
optional bool strong_certificate = 5;
}

// A request for information about a user, given by either the user's ID
// or name.
message Find {
// The user's ID used for lookup.
optional uint32 id = 1;
// The user's name used for lookup.
optional string name = 2;
}

// A query of all the registered users, optionally filtered by the given
// filter string.
message Query {
// A user name filter (% is often used as a wildcard)
optional string filter = 1;
}

// A request for a new user registration.
message Register {
// The database user to register.
optional DatabaseUser user = 1;
}

// A request for deregistering a registered user.
message Deregister {
// The database user to deregister.
optional DatabaseUser user = 1;
}

// A request to update a registered user's information. The information
// provided should be merged with existing data.
message Update {
// The database user to update.
optional DatabaseUser user = 1;
}

optional Authenticate authenticate = 1;
optional Find find = 2;
optional Query query = 3;
optional Register register = 4;
optional Deregister deregister = 5;
optional Update update = 6;
}

message Response {
// The initialization for the authenticator stream. This message must be
// sent before authentication requests will start streaming.
message Initialize {
optional Server server = 1;
}

enum Status {
// The request should fallthrough to murmur's default action.
Fallthrough = 0;
// The request was successful.
Success = 1;
// The request failed; there was some error.
Failure = 2;
// A temporary failure prevented the request from succeeding (e.g. a
// database was unavailable).
TemporaryFailure = 3;
}

message Authenticate {
// The status of the request.
optional Status status = 1;
// The user's registered ID.
optional uint32 id = 2;
// The corrected user's name;
optional string name = 3;
// Additional ACL groups that the user belongs too.
repeated ACL.Group groups = 4;
}

message Find {
// The database user (if found).
optional DatabaseUser user = 1;
}

message Query {
// The matched database users.
repeated DatabaseUser users = 1;
}

message Register {
// The status of the request.
optional Status status = 1;
// The registered database user (must contain the registered user's ID).
optional DatabaseUser user = 2;
}

message Deregister {
// The status of the request.
optional Status status = 1;
}

message Update {
// The status of the request.
optional Status status = 1;
}

optional Initialize initialize = 1;
optional Authenticate authenticate = 2;
optional Find find = 3;
optional Query query = 4;
optional Register register = 5;
optional Deregister deregister = 6;
optional Update update = 7;
}
}

message DatabaseUser {
// The server on which the user is registered.
optional Server server = 1;
// The unique user ID.
optional uint32 id = 2;
// The user's name.
optional string name = 3;
// The user's email address.
optional string email = 4;
// The user's comment.
optional string comment = 5;
// The user's certificate hash.
optional string hash = 6;
// The user's password (never sent; used only when updating).
optional string password = 7;
// When the user was last on the server.
optional string last_active = 8;
// The user's texture.
optional bytes texture = 9;

message Query {
// The server whose users will be queried.
optional Server server = 1;
// A string to filter the users by.
optional string filter = 2;
}

message List {
// The server on which the users are registered.
optional Server server = 1;
// The users.
repeated DatabaseUser users = 2;
}

message Verify {
// The server on which the user-password pair will be authenticated.
optional Server server = 1;
// The user's name.
optional string name = 2;
// The user's password.
optional string password = 3;
}
}

message RedirectWhisperGroup {
// The server on which the whisper redirection will take place.
optional Server server = 1;
// The user to whom the redirection will be applied.
optional User user = 2;
// The source group.
optional ACL.Group source = 3;
// The target group.
optional ACL.Group target = 4;
}

service V1 {
//
// Meta
//

// GetUptime returns murmur's uptime.
rpc GetUptime(Void) returns(Uptime);
// GetVersion returns murmur's version.
rpc GetVersion(Void) returns(Version);
// Events returns a stream of murmur events.
rpc Events(Void) returns(stream Event);

//
// Servers
//

// ServerCreate creates a new virtual server. The returned server object
// contains the newly created server's ID.
rpc ServerCreate(Void) returns(Server);
// ServerQuery returns a list of servers that match the given query.
rpc ServerQuery(Server.Query) returns(Server.List);
// ServerGet returns information about the given server.
rpc ServerGet(Server) returns(Server);
// ServerStart starts the given stopped server.
rpc ServerStart(Server) returns(Void);
// ServerStop stops the given virtual server.
rpc ServerStop(Server) returns(Void);
// ServerRemove removes the given virtual server and its configuration.
rpc ServerRemove(Server) returns(Void);
// ServerEvents returns a stream of events that happen on the given server.
rpc ServerEvents(Server) returns(stream Server.Event);

//
// ContextActions
//

// ContextActionAdd adds a context action to the given user's client. The
// following ContextAction fields must be set:
// context, action, text, and user.
//
// Added context actions are valid until:
// - The context action is removed with ContextActionRemove, or
// - The user disconnects from the server, or
// - The server stops.
rpc ContextActionAdd(ContextAction) returns(Void);
// ContextActionRemove removes a context action from the given user's client.
// The following ContextAction must be set:
// action
// If no user is given, the context action is removed from all users.
rpc ContextActionRemove(ContextAction) returns(Void);
// ContextActionEvents returns a stream of context action events that are
// triggered by users.
rpc ContextActionEvents(ContextAction) returns(stream ContextAction);

//
// TextMessage
//

// TextMessageSend sends the given TextMessage to the server.
//
// If no users, channels, or trees are added to the TextMessage, the message
// will be broadcast the entire server. Otherwise, the message will be
// targeted to the specified users, channels, and trees.
rpc TextMessageSend(TextMessage) returns(Void);
// TextMessageFilter filters text messages on a given server.

// TextMessageFilter filters text messages for a given server.
//
// When a filter stream is active, text messages sent from users to the
// server are sent over the stream. The RPC client then sends a message back
// on the same stream, containing an action: whether the message should be
// accepted, rejected, or dropped.
//
// To activate the filter stream, an initial TextMessage.Filter message must
// be sent that contains the server on which the filter will be active.
rpc TextMessageFilter(stream TextMessage.Filter) returns(stream TextMessage.Filter);

//
// Logs
//

// LogQuery returns a list of log entries from the given server.
//
// To get the total number of log entries, omit min and/or max from the
// query.
rpc LogQuery(Log.Query) returns(Log.List);

//
// Config
//

// ConfigGet returns the explicitly set configuration for the given server.
rpc ConfigGet(Server) returns(Config);
// ConfigGetField returns the configuration value for the given key.
rpc ConfigGetField(Config.Field) returns(Config.Field);
// ConfigSetField sets the configuration value to the given value.
rpc ConfigSetField(Config.Field) returns(Void);
// ConfigGetDefault returns the default server configuration.
rpc ConfigGetDefault(Void) returns(Config);

//
// Channels
//

// ChannelQuery returns a list of channels that match the given query.
rpc ChannelQuery(Channel.Query) returns(Channel.List);
// ChannelGet returns the channel with the given ID.
rpc ChannelGet(Channel) returns(Channel);
// ChannelAdd adds the channel to the given server. The parent and name of
// the channel must be set.
rpc ChannelAdd(Channel) returns(Channel);
// ChannelRemove removes the given channel from the server.
rpc ChannelRemove(Channel) returns(Void);
// ChannelUpdate updates the given channel's attributes. Only the fields that
// are set will be updated.
rpc ChannelUpdate(Channel) returns(Channel);

//
// Users
//

// UserQuery returns a list of connected users who match the given query.
rpc UserQuery(User.Query) returns(User.List);
// UserGet returns information on the connected user, given by the user's
// session or name.
rpc UserGet(User) returns(User);
// UserUpdate changes the given user's state. Only the following fields can
// be changed:
// name, mute, deaf, suppress, priority_speaker, channel, comment.
rpc UserUpdate(User) returns(User);
// UserKick kicks the user from the server.
rpc UserKick(User.Kick) returns(Void);

//
// Tree
//

// TreeQuery returns a representation of the given server's channel/user
// tree.
rpc TreeQuery(Tree.Query) returns(Tree);

//
// Bans
//

// BansGet returns a list of bans for the given server.
rpc BansGet(Ban.Query) returns(Ban.List);
// BansSet replaces the server's ban list with the given list.
rpc BansSet(Ban.List) returns(Void);

//
// ACL
//

// ACLGet returns the ACL for the given channel.
rpc ACLGet(Channel) returns(ACL.List);
// ACLSet overrides the ACL of the given channel to what is provided.
rpc ACLSet(ACL.List) returns(Void);
// ACLGetEffectivePermissions returns the effective permissions for the given
// user in the given channel.
rpc ACLGetEffectivePermissions(ACL.Query) returns(ACL);
// ACLAddTemporaryGroup adds a user to a temporary group.
rpc ACLAddTemporaryGroup(ACL.TemporaryGroup) returns(Void);
// ACLRemoveTemporaryGroup removes a user from a temporary group.
rpc ACLRemoveTemporaryGroup(ACL.TemporaryGroup) returns(Void);

//
// Authenticator
//

// AuthenticatorStream opens an authentication stream to the server.
//
// There can only be one RPC client with an open Stream. If a new
// authenticator connects, the open connected will be closed.
rpc AuthenticatorStream(stream Authenticator.Response) returns(stream Authenticator.Request);

//
// Database
//

// DatabaseUserQuery returns a list of registered users who match given
// query.
rpc DatabaseUserQuery(DatabaseUser.Query) returns(DatabaseUser.List);
// DatabaseUserGet returns the database user with the given ID.
rpc DatabaseUserGet(DatabaseUser) returns(DatabaseUser);
// DatabaseUserUpdate updates the given database user.
rpc DatabaseUserUpdate(DatabaseUser) returns(Void);
// DatabaseUserRegister registers a user with the given information on the
// server. The returned DatabaseUser will contain the newly registered user's
// ID.
rpc DatabaseUserRegister(DatabaseUser) returns(DatabaseUser);
// DatabaseUserDeregister deregisters the given user.
rpc DatabaseUserDeregister(DatabaseUser) returns(Void);
// DatabaseUserVerify verifies the that the given user-password pair is
// correct.
rpc DatabaseUserVerify(DatabaseUser.Verify) returns(DatabaseUser);

//
// Audio
//

// AddRedirectWhisperGroup add a whisper targets redirection for the given
// user. Whenever a user whispers to group "source", the whisper will be
// redirected to group "target".
rpc RedirectWhisperGroupAdd(RedirectWhisperGroup) returns(Void);

// RemoveRedirectWhisperGroup removes a whisper target redirection for
// the the given user.
rpc RedirectWhisperGroupRemove(RedirectWhisperGroup) returns(Void);
}

3881
mumble/MurmurRPC_pb2.py Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,912 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

import MurmurRPC_pb2 as MurmurRPC__pb2


class V1Stub(object):
"""
Meta

"""

def __init__(self, channel):
"""Constructor.

Args:
channel: A grpc.Channel.
"""
self.GetUptime = channel.unary_unary(
'/MurmurRPC.V1/GetUptime',
request_serializer=MurmurRPC__pb2.Void.SerializeToString,
response_deserializer=MurmurRPC__pb2.Uptime.FromString,
)
self.GetVersion = channel.unary_unary(
'/MurmurRPC.V1/GetVersion',
request_serializer=MurmurRPC__pb2.Void.SerializeToString,
response_deserializer=MurmurRPC__pb2.Version.FromString,
)
self.Events = channel.unary_stream(
'/MurmurRPC.V1/Events',
request_serializer=MurmurRPC__pb2.Void.SerializeToString,
response_deserializer=MurmurRPC__pb2.Event.FromString,
)
self.ServerCreate = channel.unary_unary(
'/MurmurRPC.V1/ServerCreate',
request_serializer=MurmurRPC__pb2.Void.SerializeToString,
response_deserializer=MurmurRPC__pb2.Server.FromString,
)
self.ServerQuery = channel.unary_unary(
'/MurmurRPC.V1/ServerQuery',
request_serializer=MurmurRPC__pb2.Server.Query.SerializeToString,
response_deserializer=MurmurRPC__pb2.Server.List.FromString,
)
self.ServerGet = channel.unary_unary(
'/MurmurRPC.V1/ServerGet',
request_serializer=MurmurRPC__pb2.Server.SerializeToString,
response_deserializer=MurmurRPC__pb2.Server.FromString,
)
self.ServerStart = channel.unary_unary(
'/MurmurRPC.V1/ServerStart',
request_serializer=MurmurRPC__pb2.Server.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ServerStop = channel.unary_unary(
'/MurmurRPC.V1/ServerStop',
request_serializer=MurmurRPC__pb2.Server.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ServerRemove = channel.unary_unary(
'/MurmurRPC.V1/ServerRemove',
request_serializer=MurmurRPC__pb2.Server.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ServerEvents = channel.unary_stream(
'/MurmurRPC.V1/ServerEvents',
request_serializer=MurmurRPC__pb2.Server.SerializeToString,
response_deserializer=MurmurRPC__pb2.Server.Event.FromString,
)
self.ContextActionAdd = channel.unary_unary(
'/MurmurRPC.V1/ContextActionAdd',
request_serializer=MurmurRPC__pb2.ContextAction.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ContextActionRemove = channel.unary_unary(
'/MurmurRPC.V1/ContextActionRemove',
request_serializer=MurmurRPC__pb2.ContextAction.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ContextActionEvents = channel.unary_stream(
'/MurmurRPC.V1/ContextActionEvents',
request_serializer=MurmurRPC__pb2.ContextAction.SerializeToString,
response_deserializer=MurmurRPC__pb2.ContextAction.FromString,
)
self.TextMessageSend = channel.unary_unary(
'/MurmurRPC.V1/TextMessageSend',
request_serializer=MurmurRPC__pb2.TextMessage.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.TextMessageFilter = channel.stream_stream(
'/MurmurRPC.V1/TextMessageFilter',
request_serializer=MurmurRPC__pb2.TextMessage.Filter.SerializeToString,
response_deserializer=MurmurRPC__pb2.TextMessage.Filter.FromString,
)
self.LogQuery = channel.unary_unary(
'/MurmurRPC.V1/LogQuery',
request_serializer=MurmurRPC__pb2.Log.Query.SerializeToString,
response_deserializer=MurmurRPC__pb2.Log.List.FromString,
)
self.ConfigGet = channel.unary_unary(
'/MurmurRPC.V1/ConfigGet',
request_serializer=MurmurRPC__pb2.Server.SerializeToString,
response_deserializer=MurmurRPC__pb2.Config.FromString,
)
self.ConfigGetField = channel.unary_unary(
'/MurmurRPC.V1/ConfigGetField',
request_serializer=MurmurRPC__pb2.Config.Field.SerializeToString,
response_deserializer=MurmurRPC__pb2.Config.Field.FromString,
)
self.ConfigSetField = channel.unary_unary(
'/MurmurRPC.V1/ConfigSetField',
request_serializer=MurmurRPC__pb2.Config.Field.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ConfigGetDefault = channel.unary_unary(
'/MurmurRPC.V1/ConfigGetDefault',
request_serializer=MurmurRPC__pb2.Void.SerializeToString,
response_deserializer=MurmurRPC__pb2.Config.FromString,
)
self.ChannelQuery = channel.unary_unary(
'/MurmurRPC.V1/ChannelQuery',
request_serializer=MurmurRPC__pb2.Channel.Query.SerializeToString,
response_deserializer=MurmurRPC__pb2.Channel.List.FromString,
)
self.ChannelGet = channel.unary_unary(
'/MurmurRPC.V1/ChannelGet',
request_serializer=MurmurRPC__pb2.Channel.SerializeToString,
response_deserializer=MurmurRPC__pb2.Channel.FromString,
)
self.ChannelAdd = channel.unary_unary(
'/MurmurRPC.V1/ChannelAdd',
request_serializer=MurmurRPC__pb2.Channel.SerializeToString,
response_deserializer=MurmurRPC__pb2.Channel.FromString,
)
self.ChannelRemove = channel.unary_unary(
'/MurmurRPC.V1/ChannelRemove',
request_serializer=MurmurRPC__pb2.Channel.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ChannelUpdate = channel.unary_unary(
'/MurmurRPC.V1/ChannelUpdate',
request_serializer=MurmurRPC__pb2.Channel.SerializeToString,
response_deserializer=MurmurRPC__pb2.Channel.FromString,
)
self.UserQuery = channel.unary_unary(
'/MurmurRPC.V1/UserQuery',
request_serializer=MurmurRPC__pb2.User.Query.SerializeToString,
response_deserializer=MurmurRPC__pb2.User.List.FromString,
)
self.UserGet = channel.unary_unary(
'/MurmurRPC.V1/UserGet',
request_serializer=MurmurRPC__pb2.User.SerializeToString,
response_deserializer=MurmurRPC__pb2.User.FromString,
)
self.UserUpdate = channel.unary_unary(
'/MurmurRPC.V1/UserUpdate',
request_serializer=MurmurRPC__pb2.User.SerializeToString,
response_deserializer=MurmurRPC__pb2.User.FromString,
)
self.UserKick = channel.unary_unary(
'/MurmurRPC.V1/UserKick',
request_serializer=MurmurRPC__pb2.User.Kick.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.TreeQuery = channel.unary_unary(
'/MurmurRPC.V1/TreeQuery',
request_serializer=MurmurRPC__pb2.Tree.Query.SerializeToString,
response_deserializer=MurmurRPC__pb2.Tree.FromString,
)
self.BansGet = channel.unary_unary(
'/MurmurRPC.V1/BansGet',
request_serializer=MurmurRPC__pb2.Ban.Query.SerializeToString,
response_deserializer=MurmurRPC__pb2.Ban.List.FromString,
)
self.BansSet = channel.unary_unary(
'/MurmurRPC.V1/BansSet',
request_serializer=MurmurRPC__pb2.Ban.List.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ACLGet = channel.unary_unary(
'/MurmurRPC.V1/ACLGet',
request_serializer=MurmurRPC__pb2.Channel.SerializeToString,
response_deserializer=MurmurRPC__pb2.ACL.List.FromString,
)
self.ACLSet = channel.unary_unary(
'/MurmurRPC.V1/ACLSet',
request_serializer=MurmurRPC__pb2.ACL.List.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ACLGetEffectivePermissions = channel.unary_unary(
'/MurmurRPC.V1/ACLGetEffectivePermissions',
request_serializer=MurmurRPC__pb2.ACL.Query.SerializeToString,
response_deserializer=MurmurRPC__pb2.ACL.FromString,
)
self.ACLAddTemporaryGroup = channel.unary_unary(
'/MurmurRPC.V1/ACLAddTemporaryGroup',
request_serializer=MurmurRPC__pb2.ACL.TemporaryGroup.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.ACLRemoveTemporaryGroup = channel.unary_unary(
'/MurmurRPC.V1/ACLRemoveTemporaryGroup',
request_serializer=MurmurRPC__pb2.ACL.TemporaryGroup.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.AuthenticatorStream = channel.stream_stream(
'/MurmurRPC.V1/AuthenticatorStream',
request_serializer=MurmurRPC__pb2.Authenticator.Response.SerializeToString,
response_deserializer=MurmurRPC__pb2.Authenticator.Request.FromString,
)
self.DatabaseUserQuery = channel.unary_unary(
'/MurmurRPC.V1/DatabaseUserQuery',
request_serializer=MurmurRPC__pb2.DatabaseUser.Query.SerializeToString,
response_deserializer=MurmurRPC__pb2.DatabaseUser.List.FromString,
)
self.DatabaseUserGet = channel.unary_unary(
'/MurmurRPC.V1/DatabaseUserGet',
request_serializer=MurmurRPC__pb2.DatabaseUser.SerializeToString,
response_deserializer=MurmurRPC__pb2.DatabaseUser.FromString,
)
self.DatabaseUserUpdate = channel.unary_unary(
'/MurmurRPC.V1/DatabaseUserUpdate',
request_serializer=MurmurRPC__pb2.DatabaseUser.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.DatabaseUserRegister = channel.unary_unary(
'/MurmurRPC.V1/DatabaseUserRegister',
request_serializer=MurmurRPC__pb2.DatabaseUser.SerializeToString,
response_deserializer=MurmurRPC__pb2.DatabaseUser.FromString,
)
self.DatabaseUserDeregister = channel.unary_unary(
'/MurmurRPC.V1/DatabaseUserDeregister',
request_serializer=MurmurRPC__pb2.DatabaseUser.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.DatabaseUserVerify = channel.unary_unary(
'/MurmurRPC.V1/DatabaseUserVerify',
request_serializer=MurmurRPC__pb2.DatabaseUser.Verify.SerializeToString,
response_deserializer=MurmurRPC__pb2.DatabaseUser.FromString,
)
self.RedirectWhisperGroupAdd = channel.unary_unary(
'/MurmurRPC.V1/RedirectWhisperGroupAdd',
request_serializer=MurmurRPC__pb2.RedirectWhisperGroup.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)
self.RedirectWhisperGroupRemove = channel.unary_unary(
'/MurmurRPC.V1/RedirectWhisperGroupRemove',
request_serializer=MurmurRPC__pb2.RedirectWhisperGroup.SerializeToString,
response_deserializer=MurmurRPC__pb2.Void.FromString,
)


class V1Servicer(object):
"""
Meta

"""

def GetUptime(self, request, context):
"""GetUptime returns murmur's uptime.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def GetVersion(self, request, context):
"""GetVersion returns murmur's version.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def Events(self, request, context):
"""Events returns a stream of murmur events.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ServerCreate(self, request, context):
"""
Servers


ServerCreate creates a new virtual server. The returned server object
contains the newly created server's ID.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ServerQuery(self, request, context):
"""ServerQuery returns a list of servers that match the given query.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ServerGet(self, request, context):
"""ServerGet returns information about the given server.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ServerStart(self, request, context):
"""ServerStart starts the given stopped server.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ServerStop(self, request, context):
"""ServerStop stops the given virtual server.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ServerRemove(self, request, context):
"""ServerRemove removes the given virtual server and its configuration.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ServerEvents(self, request, context):
"""ServerEvents returns a stream of events that happen on the given server.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ContextActionAdd(self, request, context):
"""
ContextActions


ContextActionAdd adds a context action to the given user's client. The
following ContextAction fields must be set:
context, action, text, and user.

Added context actions are valid until:
- The context action is removed with ContextActionRemove, or
- The user disconnects from the server, or
- The server stops.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ContextActionRemove(self, request, context):
"""ContextActionRemove removes a context action from the given user's client.
The following ContextAction must be set:
action
If no user is given, the context action is removed from all users.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ContextActionEvents(self, request, context):
"""ContextActionEvents returns a stream of context action events that are
triggered by users.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def TextMessageSend(self, request, context):
"""
TextMessage


TextMessageSend sends the given TextMessage to the server.

If no users, channels, or trees are added to the TextMessage, the message
will be broadcast the entire server. Otherwise, the message will be
targeted to the specified users, channels, and trees.
TextMessageFilter filters text messages on a given server.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def TextMessageFilter(self, request_iterator, context):
"""TextMessageFilter filters text messages for a given server.

When a filter stream is active, text messages sent from users to the
server are sent over the stream. The RPC client then sends a message back
on the same stream, containing an action: whether the message should be
accepted, rejected, or dropped.

To activate the filter stream, an initial TextMessage.Filter message must
be sent that contains the server on which the filter will be active.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def LogQuery(self, request, context):
"""
Logs


LogQuery returns a list of log entries from the given server.

To get the total number of log entries, omit min and/or max from the
query.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ConfigGet(self, request, context):
"""
Config


ConfigGet returns the explicitly set configuration for the given server.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ConfigGetField(self, request, context):
"""ConfigGetField returns the configuration value for the given key.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ConfigSetField(self, request, context):
"""ConfigSetField sets the configuration value to the given value.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ConfigGetDefault(self, request, context):
"""ConfigGetDefault returns the default server configuration.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ChannelQuery(self, request, context):
"""
Channels


ChannelQuery returns a list of channels that match the given query.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ChannelGet(self, request, context):
"""ChannelGet returns the channel with the given ID.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ChannelAdd(self, request, context):
"""ChannelAdd adds the channel to the given server. The parent and name of
the channel must be set.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ChannelRemove(self, request, context):
"""ChannelRemove removes the given channel from the server.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ChannelUpdate(self, request, context):
"""ChannelUpdate updates the given channel's attributes. Only the fields that
are set will be updated.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def UserQuery(self, request, context):
"""
Users


UserQuery returns a list of connected users who match the given query.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def UserGet(self, request, context):
"""UserGet returns information on the connected user, given by the user's
session or name.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def UserUpdate(self, request, context):
"""UserUpdate changes the given user's state. Only the following fields can
be changed:
name, mute, deaf, suppress, priority_speaker, channel, comment.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def UserKick(self, request, context):
"""UserKick kicks the user from the server.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def TreeQuery(self, request, context):
"""
Tree


TreeQuery returns a representation of the given server's channel/user
tree.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def BansGet(self, request, context):
"""
Bans


BansGet returns a list of bans for the given server.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def BansSet(self, request, context):
"""BansSet replaces the server's ban list with the given list.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ACLGet(self, request, context):
"""
ACL


ACLGet returns the ACL for the given channel.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ACLSet(self, request, context):
"""ACLSet overrides the ACL of the given channel to what is provided.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ACLGetEffectivePermissions(self, request, context):
"""ACLGetEffectivePermissions returns the effective permissions for the given
user in the given channel.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ACLAddTemporaryGroup(self, request, context):
"""ACLAddTemporaryGroup adds a user to a temporary group.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ACLRemoveTemporaryGroup(self, request, context):
"""ACLRemoveTemporaryGroup removes a user from a temporary group.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def AuthenticatorStream(self, request_iterator, context):
"""
Authenticator


AuthenticatorStream opens an authentication stream to the server.

There can only be one RPC client with an open Stream. If a new
authenticator connects, the open connected will be closed.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DatabaseUserQuery(self, request, context):
"""
Database


DatabaseUserQuery returns a list of registered users who match given
query.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DatabaseUserGet(self, request, context):
"""DatabaseUserGet returns the database user with the given ID.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DatabaseUserUpdate(self, request, context):
"""DatabaseUserUpdate updates the given database user.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DatabaseUserRegister(self, request, context):
"""DatabaseUserRegister registers a user with the given information on the
server. The returned DatabaseUser will contain the newly registered user's
ID.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DatabaseUserDeregister(self, request, context):
"""DatabaseUserDeregister deregisters the given user.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DatabaseUserVerify(self, request, context):
"""DatabaseUserVerify verifies the that the given user-password pair is
correct.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def RedirectWhisperGroupAdd(self, request, context):
"""
Audio


AddRedirectWhisperGroup add a whisper targets redirection for the given
user. Whenever a user whispers to group "source", the whisper will be
redirected to group "target".
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def RedirectWhisperGroupRemove(self, request, context):
"""RemoveRedirectWhisperGroup removes a whisper target redirection for
the the given user.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_V1Servicer_to_server(servicer, server):
rpc_method_handlers = {
'GetUptime': grpc.unary_unary_rpc_method_handler(
servicer.GetUptime,
request_deserializer=MurmurRPC__pb2.Void.FromString,
response_serializer=MurmurRPC__pb2.Uptime.SerializeToString,
),
'GetVersion': grpc.unary_unary_rpc_method_handler(
servicer.GetVersion,
request_deserializer=MurmurRPC__pb2.Void.FromString,
response_serializer=MurmurRPC__pb2.Version.SerializeToString,
),
'Events': grpc.unary_stream_rpc_method_handler(
servicer.Events,
request_deserializer=MurmurRPC__pb2.Void.FromString,
response_serializer=MurmurRPC__pb2.Event.SerializeToString,
),
'ServerCreate': grpc.unary_unary_rpc_method_handler(
servicer.ServerCreate,
request_deserializer=MurmurRPC__pb2.Void.FromString,
response_serializer=MurmurRPC__pb2.Server.SerializeToString,
),
'ServerQuery': grpc.unary_unary_rpc_method_handler(
servicer.ServerQuery,
request_deserializer=MurmurRPC__pb2.Server.Query.FromString,
response_serializer=MurmurRPC__pb2.Server.List.SerializeToString,
),
'ServerGet': grpc.unary_unary_rpc_method_handler(
servicer.ServerGet,
request_deserializer=MurmurRPC__pb2.Server.FromString,
response_serializer=MurmurRPC__pb2.Server.SerializeToString,
),
'ServerStart': grpc.unary_unary_rpc_method_handler(
servicer.ServerStart,
request_deserializer=MurmurRPC__pb2.Server.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ServerStop': grpc.unary_unary_rpc_method_handler(
servicer.ServerStop,
request_deserializer=MurmurRPC__pb2.Server.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ServerRemove': grpc.unary_unary_rpc_method_handler(
servicer.ServerRemove,
request_deserializer=MurmurRPC__pb2.Server.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ServerEvents': grpc.unary_stream_rpc_method_handler(
servicer.ServerEvents,
request_deserializer=MurmurRPC__pb2.Server.FromString,
response_serializer=MurmurRPC__pb2.Server.Event.SerializeToString,
),
'ContextActionAdd': grpc.unary_unary_rpc_method_handler(
servicer.ContextActionAdd,
request_deserializer=MurmurRPC__pb2.ContextAction.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ContextActionRemove': grpc.unary_unary_rpc_method_handler(
servicer.ContextActionRemove,
request_deserializer=MurmurRPC__pb2.ContextAction.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ContextActionEvents': grpc.unary_stream_rpc_method_handler(
servicer.ContextActionEvents,
request_deserializer=MurmurRPC__pb2.ContextAction.FromString,
response_serializer=MurmurRPC__pb2.ContextAction.SerializeToString,
),
'TextMessageSend': grpc.unary_unary_rpc_method_handler(
servicer.TextMessageSend,
request_deserializer=MurmurRPC__pb2.TextMessage.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'TextMessageFilter': grpc.stream_stream_rpc_method_handler(
servicer.TextMessageFilter,
request_deserializer=MurmurRPC__pb2.TextMessage.Filter.FromString,
response_serializer=MurmurRPC__pb2.TextMessage.Filter.SerializeToString,
),
'LogQuery': grpc.unary_unary_rpc_method_handler(
servicer.LogQuery,
request_deserializer=MurmurRPC__pb2.Log.Query.FromString,
response_serializer=MurmurRPC__pb2.Log.List.SerializeToString,
),
'ConfigGet': grpc.unary_unary_rpc_method_handler(
servicer.ConfigGet,
request_deserializer=MurmurRPC__pb2.Server.FromString,
response_serializer=MurmurRPC__pb2.Config.SerializeToString,
),
'ConfigGetField': grpc.unary_unary_rpc_method_handler(
servicer.ConfigGetField,
request_deserializer=MurmurRPC__pb2.Config.Field.FromString,
response_serializer=MurmurRPC__pb2.Config.Field.SerializeToString,
),
'ConfigSetField': grpc.unary_unary_rpc_method_handler(
servicer.ConfigSetField,
request_deserializer=MurmurRPC__pb2.Config.Field.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ConfigGetDefault': grpc.unary_unary_rpc_method_handler(
servicer.ConfigGetDefault,
request_deserializer=MurmurRPC__pb2.Void.FromString,
response_serializer=MurmurRPC__pb2.Config.SerializeToString,
),
'ChannelQuery': grpc.unary_unary_rpc_method_handler(
servicer.ChannelQuery,
request_deserializer=MurmurRPC__pb2.Channel.Query.FromString,
response_serializer=MurmurRPC__pb2.Channel.List.SerializeToString,
),
'ChannelGet': grpc.unary_unary_rpc_method_handler(
servicer.ChannelGet,
request_deserializer=MurmurRPC__pb2.Channel.FromString,
response_serializer=MurmurRPC__pb2.Channel.SerializeToString,
),
'ChannelAdd': grpc.unary_unary_rpc_method_handler(
servicer.ChannelAdd,
request_deserializer=MurmurRPC__pb2.Channel.FromString,
response_serializer=MurmurRPC__pb2.Channel.SerializeToString,
),
'ChannelRemove': grpc.unary_unary_rpc_method_handler(
servicer.ChannelRemove,
request_deserializer=MurmurRPC__pb2.Channel.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ChannelUpdate': grpc.unary_unary_rpc_method_handler(
servicer.ChannelUpdate,
request_deserializer=MurmurRPC__pb2.Channel.FromString,
response_serializer=MurmurRPC__pb2.Channel.SerializeToString,
),
'UserQuery': grpc.unary_unary_rpc_method_handler(
servicer.UserQuery,
request_deserializer=MurmurRPC__pb2.User.Query.FromString,
response_serializer=MurmurRPC__pb2.User.List.SerializeToString,
),
'UserGet': grpc.unary_unary_rpc_method_handler(
servicer.UserGet,
request_deserializer=MurmurRPC__pb2.User.FromString,
response_serializer=MurmurRPC__pb2.User.SerializeToString,
),
'UserUpdate': grpc.unary_unary_rpc_method_handler(
servicer.UserUpdate,
request_deserializer=MurmurRPC__pb2.User.FromString,
response_serializer=MurmurRPC__pb2.User.SerializeToString,
),
'UserKick': grpc.unary_unary_rpc_method_handler(
servicer.UserKick,
request_deserializer=MurmurRPC__pb2.User.Kick.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'TreeQuery': grpc.unary_unary_rpc_method_handler(
servicer.TreeQuery,
request_deserializer=MurmurRPC__pb2.Tree.Query.FromString,
response_serializer=MurmurRPC__pb2.Tree.SerializeToString,
),
'BansGet': grpc.unary_unary_rpc_method_handler(
servicer.BansGet,
request_deserializer=MurmurRPC__pb2.Ban.Query.FromString,
response_serializer=MurmurRPC__pb2.Ban.List.SerializeToString,
),
'BansSet': grpc.unary_unary_rpc_method_handler(
servicer.BansSet,
request_deserializer=MurmurRPC__pb2.Ban.List.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ACLGet': grpc.unary_unary_rpc_method_handler(
servicer.ACLGet,
request_deserializer=MurmurRPC__pb2.Channel.FromString,
response_serializer=MurmurRPC__pb2.ACL.List.SerializeToString,
),
'ACLSet': grpc.unary_unary_rpc_method_handler(
servicer.ACLSet,
request_deserializer=MurmurRPC__pb2.ACL.List.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ACLGetEffectivePermissions': grpc.unary_unary_rpc_method_handler(
servicer.ACLGetEffectivePermissions,
request_deserializer=MurmurRPC__pb2.ACL.Query.FromString,
response_serializer=MurmurRPC__pb2.ACL.SerializeToString,
),
'ACLAddTemporaryGroup': grpc.unary_unary_rpc_method_handler(
servicer.ACLAddTemporaryGroup,
request_deserializer=MurmurRPC__pb2.ACL.TemporaryGroup.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'ACLRemoveTemporaryGroup': grpc.unary_unary_rpc_method_handler(
servicer.ACLRemoveTemporaryGroup,
request_deserializer=MurmurRPC__pb2.ACL.TemporaryGroup.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'AuthenticatorStream': grpc.stream_stream_rpc_method_handler(
servicer.AuthenticatorStream,
request_deserializer=MurmurRPC__pb2.Authenticator.Response.FromString,
response_serializer=MurmurRPC__pb2.Authenticator.Request.SerializeToString,
),
'DatabaseUserQuery': grpc.unary_unary_rpc_method_handler(
servicer.DatabaseUserQuery,
request_deserializer=MurmurRPC__pb2.DatabaseUser.Query.FromString,
response_serializer=MurmurRPC__pb2.DatabaseUser.List.SerializeToString,
),
'DatabaseUserGet': grpc.unary_unary_rpc_method_handler(
servicer.DatabaseUserGet,
request_deserializer=MurmurRPC__pb2.DatabaseUser.FromString,
response_serializer=MurmurRPC__pb2.DatabaseUser.SerializeToString,
),
'DatabaseUserUpdate': grpc.unary_unary_rpc_method_handler(
servicer.DatabaseUserUpdate,
request_deserializer=MurmurRPC__pb2.DatabaseUser.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'DatabaseUserRegister': grpc.unary_unary_rpc_method_handler(
servicer.DatabaseUserRegister,
request_deserializer=MurmurRPC__pb2.DatabaseUser.FromString,
response_serializer=MurmurRPC__pb2.DatabaseUser.SerializeToString,
),
'DatabaseUserDeregister': grpc.unary_unary_rpc_method_handler(
servicer.DatabaseUserDeregister,
request_deserializer=MurmurRPC__pb2.DatabaseUser.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'DatabaseUserVerify': grpc.unary_unary_rpc_method_handler(
servicer.DatabaseUserVerify,
request_deserializer=MurmurRPC__pb2.DatabaseUser.Verify.FromString,
response_serializer=MurmurRPC__pb2.DatabaseUser.SerializeToString,
),
'RedirectWhisperGroupAdd': grpc.unary_unary_rpc_method_handler(
servicer.RedirectWhisperGroupAdd,
request_deserializer=MurmurRPC__pb2.RedirectWhisperGroup.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
'RedirectWhisperGroupRemove': grpc.unary_unary_rpc_method_handler(
servicer.RedirectWhisperGroupRemove,
request_deserializer=MurmurRPC__pb2.RedirectWhisperGroup.FromString,
response_serializer=MurmurRPC__pb2.Void.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'MurmurRPC.V1', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))

View File

@ -4,4 +4,4 @@ import grpc
from grpc.tools import protoc
import tempfile

conn = grpc.
channel = grpc.insecure_channel('sysadministrivia.com:50051')

View File

@ -17,7 +17,7 @@ class logParser(object):
# We'll need these accessible across the entire class.
self.args = args
self.data = data
self.bindata = data
self.has_html = False
# This is a map to determine which module to use to decompress,
# if we should.
self.cmprsn_map = {'text/plain': None, # Plain ol' text
@ -28,14 +28,24 @@ class logParser(object):
# I though y'all liked GUIs.
# ANSI, which is interpreted by the shell.
# Only used if args['color'] = True
self.ansi_prefix = '\e['
# The hex prefex in the logs. We use this to either
# convert to ANSI (hence the value for the key) or
# to strip out coloring entirely.
self.irssi_prefix = {'\x02': '1m', # bold
'\x03': '0m'} # reset; prepare for color change
self.ansi_prefix = '\033['
# irssi to ANSI
self.colormap = {''}
self.colormap = {'00': '1;37m', # White
'01': '0;30m', # Black
'02': '0;34m', # Blue
'03': '0;32m', # Green
'04': '1;31m', # Light Red
'05': '0;31m', # Red
'06': '0;35m', # Magenta (translated as Purple)
'07': '0;33m', # Orange (translated as Brown)
'08': '1;33m', # Yellow
'09': '1:32m', # Light Green
'10': '0;36m', # Cyan
'11': '1;36m', # Light Cyan
'12': '1;34m', # Light Blue
'13': '1;35m', # Light Magenta (translated as Light Purple)
'14': '0;37m', # Gray
'15': '1;37'} # Light Gray (translated as White)
# The full, interpreted path.
if 'logfile' in self.args.keys():
self.args['logfile'] = os.path.abspath(os.path.expanduser(self.args['logfile']))
@ -43,33 +53,28 @@ class logParser(object):
self.getLog()
else:
self.data = self.data.decode('utf-8').splitlines()
# We're running as standalone or weren't called with a data buffer.
if not isinstance(self.data, list):
raise ValueError('Log data must be in list format.')
self.decompress = None
if has_magic:
# Determine what decompressor to use, if we need to.
_mime = magic.detect_from_content(self.bindata).mime_type
_mime = magic.detect_from_content(self.data).mime_type
self.decompress = self.cmprsn_map[_mime]
if self.args['html'] and self.args['color']:
if self.args['html']:
try:
import ansi2html
has_html = True
self.has_html = True
except ImportError:
print(('Warning: you have selected HTML output but do not ' +
'have the ansi2html module installed. Rendering HTML ' +
'output is not possible.'))
has_html = False
self.has_html = False
else:
has_html = False
self.has_html = False

def getLog(self):
if not os.path.isfile(self.args['logfile']):
raise FileNotFoundError('{0} does not exist.'.formatself.args['logfile'])
with open(self.args['logfile'], 'rb') as f:
self.data = f.read().decode('utf-8').splitlines()
f.seek(0, 0)
self.bindata = f.read()
self.data = f.read()
return()

def parseLog(self):
@ -77,14 +82,98 @@ class logParser(object):
import importlib
self.decmp = importlib.import_module(self.decompress)
self.data = self.decmp.decompress(self.data)
# TODO: format conversion/stripping
if self.args['color']:
_idx = 0
for line in self.data[:]:
for k, v in self.irssi_prefix.items():
_v = self.ansi_prefix + v
self.data[_idx] = re.sub(k, _v, line)
_datalst = self.data.split(b'\n')
for line in _datalst[:]: # not really "lines", per se, but...
# First we strip out some basic formatting at the beginning
# of lines. Status lines are \x049/, chat lines are \x048/.
# \x04g seem to be formatting resets of sort.
line = re.sub('\x04[89]/'.encode('utf-8'),
''.encode('utf-8'),
line)
line = re.sub('\x04g'.encode('utf-8'),
''.encode('utf-8'),
line)
# Formatting resets
line = re.sub('\x04e'.encode('utf-8'),
'\033[0m'.encode('utf-8'),
line)
# Then we substitute bolds in. This is trickier, because
# bolds (\x04c) *alternate*. So does the other? bold, \x02.
for b in ('\x04c'.encode('utf-8'), '\x02'.encode('utf-8')):
_linelst = line.split(b)
_bold = False
_cnt = 0
for i in _linelst[:]:
if _bold:
_linelst[_cnt] = re.sub('^'.encode('utf-8'),
(self.ansi_prefix + '1m').encode('utf-8'),
i)
else:
_linelst[_cnt] = re.sub('^'.encode('utf-8'),
(self.ansi_prefix + '0m').encode('utf-8'),
i)
_cnt += 1
_bold = not _bold
line = b''.join(_linelst)
# Then we handle colors.
_cnt = 0
_linelst = line.split(b'\x03')
for i in _linelst[:]:
_color_idx = re.sub('^([0-9]{2}).*$'.encode('utf-8'),
'\g<1>',
i,
re.MULTILINE).decode('utf-8')
if _color_idx in self.colormap.keys():
_linelst[_cnt] = re.sub('^[0-9]{2}'.encode('utf-8'),
(self.ansi_prefix + self.colormap[_color_idx]).encode('utf-8'),
i)
_cnt += 1
line = b''.join(_linelst)
# Lastly, we fix join/part and other messages.
_cnt = 0
_linelst = line.split(b'\x04;/')
for i in _linelst[:]:
_templine = re.sub('^'.encode('utf-8'),
''.encode('utf-8'),
i,
re.MULTILINE)
_templine = re.sub('-!-'.encode('utf-8'),
'\033[2m-!-'.encode('utf-8'),
_templine)
_linelst[_cnt] = re.sub('\x043/'.encode('utf-8'),
''.encode('utf-8'),
_templine)
_cnt += 1
line = re.sub(b'^\x1b\[0;32m\x1b\[0m\x1b\[0m', b'\033[0m', b''.join(_linelst))
# Lastly we strip out \x04>/
line = re.sub(b'\x04>/', b'', line)
###
_datalst[_idx] = line
_idx += 1
###
self.data = b'\n'.join(_datalst)
if self.args['html']:
try:
import ansi2html
_has_html = True
except ImportError:
print(('Warning: you have selected HTML output but do not ' +
'have the ansi2html module installed. Rendering HTML ' +
'output is not possible.'))
_has_html = False
else:
_has_html = False
if _has_html:
# This... basically sucks. It currently doesn't properly interpret the ANSI.
_html = ansi2html.Ansi2HTMLConverter()
self.data = _html.convert(self.data.decode('utf-8'))
else: # We want plaintext, so strip ALL formatting.
_stripbytes = ['\x04>/', '\x02', '\x043/', '\x048/', '\x049/', '\x04g', '\x04e', '\x04c', '\x04;/']
for b in _stripbytes:
self.data = re.sub(b.encode('utf-8'), ''.encode('utf-8'), self.data)
self.data = re.sub('\\x03[0-9]{2}'.encode('utf-8'), ''.encode('utf-8'), self.data)
return()

def parseArgs():
@ -107,5 +196,4 @@ if __name__ == '__main__':
args = vars(parseArgs().parse_args())
l = logParser(args)
l.parseLog()
#print(l.data.decode('utf-8'))
print(''.join(l.data))
print(l.data.decode('utf-8'))

View File

@ -10,6 +10,7 @@ import pydoc
from urllib.request import urlopen

# TODO: non-txt format support? (i.e. PDF, HTML, etc.)
# TODO: search function? keyword or regex, display RFC number and title

def downloadRFC(destdir, rfcnum):
rfcnum = (str(rfcnum)).lower() # In case argparse interprets it as an int or it's entered in uppercase

70
txp/pluginpacker.py Executable file
View File

@ -0,0 +1,70 @@
#!/usr/bin/env python3

# TODO / INCOMPLETE
# reference: https://github.com/Bloke/ied_plugin_composer/blob/master/ied_plugin_composer.php

import argparse
import base64
import gzip
import os
import sys

class pluginParse(object):
def __init__(self, plugindata):
# fear my list comprehensions! FEAR THEM.
self.data = '\n'.join([i for i in plugindata.decode('utf-8').splitlines() if not i.strip().startswith('#') and i != ''])
self.decompress = not self.isCompressed()
if self.isB64():
self.data = base64.b64decode(self.data)
self.isPacked = True
else:
self.isPacked = False
print(self.isPacked)

def isB64(self):
# Elegant AF: https://stackoverflow.com/a/45928164
# Python wants a single "line" of base64...
s = ''.join(self.data.splitlines())
print(s)
try:
if base64.b64encode(base64.b64decode(self.data)) == s:
print('is b64')
return(True)
except Exception:
return(False)
return(False)

def isCompressed(self):
pass

def parseArgs():
args = argparse.ArgumentParser()
args.add_argument('-z', '--compress',
dest = 'compress',
action = 'store_true',
help = ('If specified, compress the plugin when packing. (This will be detected and done automatically if needed for unpacking)'))
args.add_argument('-f', '--file',
dest = 'file',
default = None,
help = 'If specified, use this file instead of STDIN for reading the plugin.')
args.add_argument('-o', '--out',
dest = 'output',
default = None,
help = 'If specified, use this filepath instead of STDOUT for writing the result.')
args.add_argument('operation',
choices = ['pack', 'unpack'],
help = 'Which operation to perform.')
return(args)

def main():
args = vars(parseArgs().parse_args())
if args['file']:
args['file'] = os.path.abspath(os.path.expanduser(args['file']))
with open(args['file'], 'rb') as f:
plugindata = f.read()
else:
plugindata = sys.stdin.read()
plugin = pluginParse(plugindata)

if __name__ == '__main__':
main()