/usr/share/pyshared/mx/UID/mxUID/__init__.py is in python-egenix-mxuid 3.2.1-1ubuntu1.
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 | from mxUID import *
from mxUID import __version__
### Python part of module initialization
# Set IDs
def _init():
global _hostid
import os,time
try:
# Try to use the IP address as host id
import socket
try:
ip = socket.gethostbyname(socket.gethostname())
except socket.error:
raise ImportError, 'no network connection'
ip = map(int, ip.split('.'))
_hostid = reduce(lambda x,y: (x+y) % 65536, ip)
except ImportError:
try:
# Use the data from the root stat as host id
_hostid = reduce(lambda x,y: (x+y) % 65536, os.stat(os.sep))
except os.error:
# Fallback to a constant
_hostid = 0x2003
# -559038737 == 0xdeadbeef
setids(_hostid, os.getpid(), -559038737 & long(time.time() / 1000))
_init()
|