This file is indexed.

/usr/share/pyshared/tp/netlib/objects/Game.py is in python-tp-netlib 0.2.5-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
from xstruct import pack

from Header import Processed

class Game(Processed):
	"""\
	 A Game Description frame consist of:
		* a String, Game name
		* a String, Key
		* a list of Strings, List of protocol versions supported
		* a String, Server Version
		* a String, Server Type
		* a String, Ruleset Name
		* a String, Ruleset Version
		* a list of,
			* a String, Connection Type
			* a String, Resolvable DNS name
			* a String, IP Address
			* a UInt32, Port
		* a list of,
			* a UInt32, Optional Paramater ID
			* a String, String Value
			* a UInt32, Int Value
	"""
	no = 66
	struct = "SS[S]SSSS[SSSI][ISI]"
	options = {
		1: ("plys", "players", "Number of Players in the game."),
		2: ("cons",	"connected", "Number of Clients currently connected."),
		3: ("objs", "objects", "Number of objects in the game universe."),
		4: ("admin", "admin", "Admin email address."),
		5: ("cmt", "comment", "Comment about the game."),
		6: ("turn", "turn", "When the next turn is generated."),
	}

	def __init__(self, sequence, name, key, \
			tp, server, sertype, rule, rulever, \
			locations, optional):
		Processed.__init__(self, sequence)

		# Length is:
		#
		self.length = \
				4 + len(name) + \
				4 + len(key) + \
				4 + len(server) + \
				4 + len(sertype) + \
				4 + len(rule) + \
				4 + len(rulever)

		self.length += 4
		for version in tp:
			self.length += 4 + len(version)

		self.length += 4
		for location in locations:
			self.length += \
				4 + len(location[0]) + \
				4 + len(location[1]) + \
				4 + len(location[2]) + \
				4

		self.length += 4
		if isinstance(optional, list):
			for option in optional:
				self.length += 4 + 4 + len(option[1]) + 4
		else:
			for option in optional.values():
				if isinstance(option, (str, unicode)):
					self.length += 4 + 4 + len(option) + 4
				else:
					self.length += 4 + 4 + 0 + 4

		self.name    = name
		self.key     = key
		self.tp      = tp
		self.server  = server
		self.sertype = sertype
		self.rule    = rule
		self.rulever = rulever
		self.locations = locations
		self._optional = optional

	def _optional_set(self, optional):
		for option in optional:
			if option[0] in Game.options:
				value = option[1]
				if len(value) == 0:
					value = option[2]
				setattr(self, Game.options[option[0]][0], value)

	def _optional_get(self):
		optional = []
		for key, (short, long, comment) in Game.options.items():
			if hasattr(self, short):
				value = getattr(self, short)
				if isinstance(value, (str, unicode)):
					optional.append((key, value, 0))
				else:
					optional.append((key, "", value))
		return optional
	_optional = property(_optional_get, _optional_set)

	def optional_get(self):
		optional = {}
		for key, (short, long, comment) in Game.options.items():
			if hasattr(self, short):
				optional[short] = getattr(self, short)
		return optional
	optional = property(optional_get)

	def required_get(self):
		required = {}
		for i in ['tp', 'server', 'sertype', 'rule', 'rulever']:
			required[i] = getattr(self, i)
		return required
	required = property(required_get)

	def __str__(self):
		output = Processed.__str__(self)
		output += pack(self.struct, 
			self.name, \
			self.key,
			self.tp, \
			self.server, self.sertype, \
			self.rule, self.rulever, \
			self.locations, \
			self._optional)
		return output