summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/settings/macspoof.py
blob: 4132e3986c9f98e5940b5d8b7bccf6e5bd48251e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
import logging
import pipes

import tailsgreeter.config


class MacSpoofSetting(object):
    """Setting controlling whether the MAC address is spoofed or not"""

    def __init__(self):
        self.value = True

    def apply_to_upcoming_session(self):
        setting_file = tailsgreeter.config.macspoof_setting
        with open(setting_file, 'w') as f:
            os.chmod(setting_file, 0o600)
            f.write("TAILS_MACSPOOF_ENABLED=%s\n" % pipes.quote(str(self.value)).lower())
        logging.debug('macspoof setting written to %s', setting_file)