This file is indexed.

/usr/lib/python2.7/dist-packages/provisioningserver/dhcp/probe.py is in python-maas-provisioningserver 1.5.4+bzr2294-0ubuntu1.2.

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
#!/usr/bin/env python2.7
# Copyright 2013 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""Probe network on given network interface for a DHCP server.

This needs to be run as root, in order to be allowed to broadcast on the
BOOTP port.

Exit code is zero ("success") if no servers were detected, or the number of
DHCP servers that were found.
"""

from __future__ import (
    absolute_import,
    print_function,
    unicode_literals,
    )

str = None

__metaclass__ = type

import argparse
from sys import exit

from provisioningserver.dhcp.detect import probe_dhcp


argument_parser = argparse.ArgumentParser(description=__doc__)


def main():
    argument_parser.add_argument(
        'interface',
        help="Probe network on this network interface.")

    args = argument_parser.parse_args()

    servers = probe_dhcp(args.interface)

    num_servers = len(servers)
    if num_servers == 0:
        print("No DHCP servers detected.")
        exit(0)
    else:
        print("DHCP servers detected: %s" % ', '.join(sorted(servers)))
        exit(num_servers)

if __name__ == "__main__":
    main()