This file is indexed.

/usr/share/pyshared/tp/netlib/discover/metaserver_browser.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
import time
import urllib

from browse import Browser, Game
metaserver = "http://metaserver.thousandparsec.net/"

def getpacket(data):
	header, data = data[:objects.Header.size], data[objects.Header.size:]
	p = objects.Header.fromstr(header)
	p.__process__(data[:p.length])
 	return p, data[p.length:]

from tp.netlib import objects

class MetaServerBrowser(Browser):
	def __init__(self, timeout=60*10):
		self.timeout = timeout
		self.waittill = 0
		self.games = {}

		self._exit = False

	def exit(self):
		self._exit = True

	def run(self):
		print "metaserver_browse", self

		while not self._exit:
			now = time.time()
			if self.waittill < now:
				data = urllib.urlopen(metaserver, urllib.urlencode({'action': 'get'})).read()
				if data[:4] == "TP03":

					p, data = getpacket(data)
					if isinstance(p, objects.Fail):
						print p.error
					elif isinstance(p, objects.Sequence):
						g = self.games
						for game in g.values():
							game.notfound = True

						for i in range(0, p.number):
							p, data = getpacket(data)

							if not isinstance(p, objects.Game):
								raise TypeError("The metaserver returned an incorrect response (expected Game packet)...")

							if not p.name in g:
								game = Game(p.name)
							else:
								game = g[p.name]
								
							game.updateOptional(p.optional)
							game.updateRequired(p.required)

							game.locations = {}
							for type, dns, ip, port in p.locations:
								game.addLocation(type, (dns, ip, port))

							if game.new:
								self.GameFound(game)
								game.new = False
							else:
								self.GameUpdate(game)

							game.notfound = False
					
							g[game.name] = game
	
						for k, game in g.items():
							if game.notfound:
								del g[k]
								self.GameGone(game)
					else:
						raise TypeError("The metaserver returned an incorrect response (expected Failure or Sequence)...") 

				self.waittill = now + self.timeout
			time.sleep(min(1, self.waittill - time.time()))

def main():
	a = MetaServerBrowser()
	a.run()

if __name__ == "__main__":
	main()