This file is indexed.

/usr/lib/python2.7/dist-packages/framework/cxnet/common.py is in fso-frameworkd 0.10.1-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
130
"""
libc, csum etc.
"""

# 	Copyright (c) 2008 Peter V. Saveliev
#
# 	This file is part of Connexion project.
#
# 	Connexion is free software; you can redistribute it and/or modify
# 	it under the terms of the GNU General Public License as published by
# 	the Free Software Foundation; either version 3 of the License, or
# 	(at your option) any later version.
#
# 	Connexion is distributed in the hope that it will be useful,
# 	but WITHOUT ANY WARRANTY; without even the implied warranty of
# 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# 	GNU General Public License for more details.
#
# 	You should have received a copy of the GNU General Public License
# 	along with Connexion; if not, write to the Free Software
# 	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

__all__ = [
	"cx_int",
	"libc",
	"hdump",
	"hprint",
	"csum",
	"csum_words",
	"csum_complement",
]

from ctypes import *

from sys import maxint
if maxint == 2147483647:
	cx_int = c_uint32
else:
	cx_int = c_uint64

libc = CDLL("libc.so.6")

def hdump(name,msg,size=0):
	"""
	Dump a packet into a file
	"""
	if not size:
		size = sizeof(msg)
	fd = libc.open(name,577,384)
	libc.write(fd,byref(msg),size)
	libc.close(fd)

def hline(msg,size=0):
	"""
	Format packet into a string
	"""
	if not size:
		size = sizeof(msg)
	length = size
	offset = 0
	ptr = addressof(msg)
	line = ""
	result = ""
	
	while offset < length:
		a = c_ubyte.from_address(ptr).value
		result += "%02x " % (a)
		if 31 < a and a < 127:
			line += chr(a)
		else:
			line += '.'

		if offset:
			if not (offset + 1) % 8:
				result += ": "
			if not (offset + 1) % 16:
				result += "\t %s\n" % (str(line))
				line = ""

		offset += 1
		ptr += 1

	if line:
		result += "\t\t\t\t %s\n" % (str(line))
	return result


def hprint(msg,size=0):
	"""
	Dump a packet onto stdout
	"""
	print hline(msg,size)

class be16 (BigEndianStructure):
	_fields_ = [
		("c",	c_uint16),
	]

def csum_words(msg,l):
	odd = False
	if (l%2):
		l -= 1
		odd = True

	# l is in bytes. We need 16-bit words
	a = addressof(msg)
	x = 0

	for i in xrange(0,l,2):
		c = be16.from_address(a + i)
		x += c.c

	if odd:
		last = c_uint16(c_uint8.from_address(a + l).value << 8)
		x += last.value

	return x

def csum_complement(x):
	x = c_uint32(x)
	x1 = c_uint16.from_address(addressof(x))
	x2 = c_uint16.from_address(addressof(x) + 2)
	return ~c_uint16(x1.value + x2.value).value

def csum(msg,l):
	##
	# details: rfc 1071
	# a simple description: http://www.netfor2.com/checksum.html
	##
	return csum_complement(csum_words(msg,l))