This file is indexed.

/usr/sbin/pifconfig is in python-ethtool 0.6-0ubuntu1.

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

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
#! /usr/bin/python
# -*- python -*-
# -*- coding: utf-8 -*-
#   Copyright (C) 2008 Red Hat Inc.
#
#   Arnaldo Carvalho de Melo <acme@redhat.com>
#
#   This application 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; version 2.
#
#   This application 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.

import getopt, ethtool, sys

def usage():
	print '''Usage:
  pifconfig <interface>
'''

def flags2str(flags):
	string = ""
	if flags & ethtool.IFF_UP:
		string += "UP "
	if flags & ethtool.IFF_BROADCAST:
		string += "BROADCAST "
	if flags & ethtool.IFF_DEBUG:
		string += "DEBUG "
	if flags & ethtool.IFF_LOOPBACK:
		string += "LOOPBACK "
	if flags & ethtool.IFF_POINTOPOINT:
		string += "POINTOPOINT "
	if flags & ethtool.IFF_NOTRAILERS:
		string += "NOTRAILERS "
	if flags & ethtool.IFF_RUNNING:
		string += "RUNNING "
	if flags & ethtool.IFF_NOARP:
		string += "NOARP "
	if flags & ethtool.IFF_PROMISC:
		string += "PROMISC "
	if flags & ethtool.IFF_ALLMULTI:
		string += "ALLMULTI "
	if flags & ethtool.IFF_MASTER:
		string += "MASTER "
	if flags & ethtool.IFF_SLAVE:
		string += "SLAVE "
	if flags & ethtool.IFF_MULTICAST:
		string += "MULTICAST "
	if flags & ethtool.IFF_PORTSEL:
		string += "PORTSEL "
	if flags & ethtool.IFF_AUTOMEDIA:
		string += "AUTOMEDIA "
	if flags & ethtool.IFF_DYNAMIC:
		string += "DYNAMIC "

	return string.strip()

def show_config(device):
	ipaddr = ethtool.get_ipaddr(device)
	netmask = ethtool.get_netmask(device)
	flags = ethtool.get_flags(device)
	print '%-9.9s' % device,
	if not (flags & ethtool.IFF_LOOPBACK):
		print "HWaddr %s" % ethtool.get_hwaddr(device),
	print '''
          inet addr:%s''' % ipaddr,
	if not (flags & (ethtool.IFF_LOOPBACK | ethtool.IFF_POINTOPOINT)):
		print "Bcast:%s" % ethtool.get_broadcast(device),
	print '''  Mask:%s
	  %s
''' % (netmask, flags2str(flags))

def main():
	global all_devices

	try:
		opts, args = getopt.getopt(sys.argv[1:],
					   "h",
					   ("help",))
	except getopt.GetoptError, err:
		usage()
		print str(err)
		sys.exit(2)

	for o, a in opts:
		if o in ("-h", "--help"):
			usage()
			return

	active_devices = ethtool.get_active_devices()
	for device in active_devices:
		show_config(device)

if __name__ == '__main__':
    main()