This file is indexed.

/usr/lib/plainbox-providers-1/checkbox/bin/network_info is in plainbox-provider-checkbox 0.3-2.

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
#!/usr/bin/env python3

import os
import sys
import socket
import fcntl
import struct

SYS_PATH = '/sys/class/net'


def _read_file(file):
    source = open(file, 'r')
    content = source.read()
    source.close()
    return content


def get_connected(interface):
    STATUS = ('No', 'Yes')
    carrier_file = os.path.join(SYS_PATH, interface, 'carrier')

    carrier = 0
    try:
        carrier = int(_read_file(carrier_file))
    except IOError:
        pass

    return STATUS[carrier]


def get_ip_address(interface):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(fcntl.ioctl(
        s.fileno(),
        0x8915,  # SIOCGIFADDR
        struct.pack('256s', interface[:15].encode())
    )[20:24])


def get_mac_address(interface):
    address_file = os.path.join(SYS_PATH, interface, 'address')

    address = ''
    try:
        address = _read_file(address_file)
    except IOError:
        pass

    return address


def main(args):
    for interface in args:
        connected = get_connected(interface)
        print("Interface: %s" % interface)
        print("Connected: %s" % connected)
        try:
            print("IP: %s" % get_ip_address(interface))
        except IOError:
            print("IP: n/a")
        print("MAC: %s\n" % get_mac_address(interface))

    return 0

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))