Example #1
0
def configure_paranoidguestmode_before_calling_lxdm( password, direct, spoof, camouflage ):
    '''
    Greeter calls me before it calls lxdm.
    This is my chance to set up the XP look, enable MAC spoofing, etc.
    '''
    # Set password, if appropriate
    logme( 'configure_para....() - password=%s, direct=%s, spoof=%s, camouflage=%s' % ( str( password ), str( direct ), str( spoof ), str( camouflage ) ) )
    distro = load_distro_record()
    logme( 'At present, windo manager = %s' % ( distro.lxdm_settings['window manager'] ) )
    if password in ( None, '' ):
        disable_root_password( '/' )
    else:
        set_user_password( 'root', password )
    # Enable MAC spoofing, if appropriate
    if spoof:  # https://wiki.archlinux.org/index.php/MAC_Address_Spoofing
        write_spoof_script_file( '/etc/NetworkManager/dispatcher.d/99spoofmymac.sh' )  # NetworkManager will run it, automatically, as soon as network goes up/down
        system_or_die( '''macchanger -r `ifconfig | grep lan0 | cut -d':' -f1 | head -n1`''' )
    else:
        os.system( 'rm -f /etc/NetworkManager/dispatcher.d/99spoofmymac.sh' )
    if camouflage:
        distro.lxdm_settings['window manager'] = '/usr/bin/mate-session'
    else:
        distro.lxdm_settings['window manager'] = distro.lxdm_settings['default wm']
    distro.lxdm_settings['internet directly'] = direct
    save_distro_record( distro )
    os.system( 'echo "configure_paranoid... - part E --- BTW, wm is now %s" >> /tmp/log.txt' % ( distro.lxdm_settings['window manager'] ) )
    assert( camouflage is False or ( camouflage is True and 0 == os.system( 'cat /etc/lxdm/lxdm.conf | fgrep mate-session' ) ) )
    os.system( 'cp /etc/lxdm/lxdm.conf /etc/lxdm/lxdm.conf.doin-the-doo' )
    os.system( 'sync;sync;sync' )
Example #2
0
 def btnResetLxdmSettingsClicked(self):
     self.blockSignals(True)
     orig_rec = load_distro_record()
     self.distro.lxdm_settings = orig_rec.lxdm_settings
     self.configurePushButtons()
     self.populateLxdmPlaintextEditor()
     self.btnResetLxdmSettings.setEnabled(False)
     self.blockSignals(False)
Example #3
0
 def btnResetLxdmSettingsClicked( self ):
     self.blockSignals( True )
     orig_rec = load_distro_record()
     self.distro.lxdm_settings = orig_rec.lxdm_settings
     self.configurePushButtons()
     self.populateLxdmPlaintextEditor()
     self.btnResetLxdmSettings.setEnabled( False )
     self.blockSignals( False )
Example #4
0
    def btnResetAllClicked( self ):
#        if not self.changes_made:
#            logme( 'No changes were made. Therefore, I have nothing to do. Cool...' )
#        else:
        reply = QtGui.QMessageBox.question( self, "Forget Changes", "Are you sure you want to forget the changes that you have proposed?", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No )
        if reply == QtGui.QMessageBox.Yes:
            self.distro = load_distro_record()
            self.setChangesMadeFalse()
            self.populateMainTabWidget()
Example #5
0
 def btnResetAllClicked(self):
     #        if not self.changes_made:
     #            logme( 'No changes were made. Therefore, I have nothing to do. Cool...' )
     #        else:
     reply = QtGui.QMessageBox.question(
         self, "Forget Changes",
         "Are you sure you want to forget the changes that you have proposed?",
         QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
     if reply == QtGui.QMessageBox.Yes:
         self.distro = load_distro_record()
         self.setChangesMadeFalse()
         self.populateMainTabWidget()
Example #6
0
    def closeEvent( self, event ):
        if self.more_options and self.use_pw and not self.password:
#            QtGui.QMessageBox.question( self, "", "Either uncheck the 'password' checkbox\nor enter a good pasword twice.", QtGui.QMessageBox.Ok )
            event.ignore()
        else:
            event.accept()
            if not self.use_pw:
                self.password = None
            configure_paranoidguestmode_before_calling_lxdm( 
                                        password = self.password,
                                        direct = self.direct,
                                        spoof = self.spoof,
                                        camouflage = self.camouflage )
            d = load_distro_record()
            logme( 'camouflage=%s; window manager=%s; is this kosher?' % ( str( self.camouflge ), d.lxdm_settings['window manager'] ) )
            sys.exit( 0 )  # I assume the program that called me will now call lxdm, which will log in as guest & so on.
Example #7
0
def start_a_browser( force_real = False ):
    website = 'www.duckduckgo.com'
    binary = None
    my_distro = load_distro_record( '/' )
    if force_real or my_distro.lxdm_settings['internet directly']:
        if 0 == os.system( 'which iceweasel &> /dev/null' ):
            binary = 'iceweasel'
        else:
            binary = 'chromium'
    else:
        logme( 'Running dillo to help user access the Net via Starbucks or whatever' )
        binary = 'dillo'
    cmd = '%s %s &' % ( binary, website )
    logme( 'start_a_browser() --- calling %s' % ( cmd ) )
    res = os.system( cmd )
    logme( '...result=%d' % ( res ) )
Example #8
0
 def __init__( self ):
     self.changes_made = False
     super( MainWindow, self ).__init__()
     self.setupUi( self )
     self.distro = load_distro_record()
     # populate
     self.connect( self.pteLxdmSettings, SIGNAL( "textChanged()" ), self.pteLxdmSettingsChanged )
     self.connect( self.chkPanicButton, SIGNAL( 'clicked(bool)' ), self.chkPanicButtonClicked )
     self.connect( self.btnApplyAppChanges, SIGNAL( 'clicked()' ), self.btnApplyAppChangesClicked )
     self.connect( self.btnResetAll, SIGNAL( 'clicked()' ), self.btnResetAllClicked )
     self.connect( self.btnResetLxdmSettings, SIGNAL( 'clicked()' ), self.btnResetLxdmSettingsClicked )
     self.connect( self.btnExitWithoutSaving, SIGNAL( "clicked()" ), SLOT( "close()" ) )
     self.connect( self.spiNoofPanicPushesRequired, SIGNAL( 'changed(int)' ), self.spiNoofPanicPushesRequiredChanged )
     self.connect_all_checkboxes_to_setChangesMadeTrue()
     self.populateMainTabWidget()
     self.setChangesMadeFalse()
     self.show()
Example #9
0
def start_a_browser(force_real=False):
    website = 'www.duckduckgo.com'
    binary = None
    my_distro = load_distro_record('/')
    if force_real or my_distro.lxdm_settings['internet directly']:
        if 0 == os.system('which iceweasel &> /dev/null'):
            binary = 'iceweasel'
        else:
            binary = 'chromium'
    else:
        logme(
            'Running dillo to help user access the Net via Starbucks or whatever'
        )
        binary = 'dillo'
    cmd = '%s %s &' % (binary, website)
    logme('start_a_browser() --- calling %s' % (cmd))
    res = os.system(cmd)
    logme('...result=%d' % (res))
Example #10
0
 def closeEvent(self, event):
     if self.more_options and self.use_pw and not self.password:
         #            QtGui.QMessageBox.question( self, "", "Either uncheck the 'password' checkbox\nor enter a good pasword twice.", QtGui.QMessageBox.Ok )
         event.ignore()
     else:
         event.accept()
         if not self.use_pw:
             self.password = None
         configure_paranoidguestmode_before_calling_lxdm(
             password=self.password,
             direct=self.direct,
             spoof=self.spoof,
             camouflage=self.camouflage)
         d = load_distro_record()
         logme('camouflage=%s; window manager=%s; is this kosher?' %
               (str(self.camouflge), d.lxdm_settings['window manager']))
         sys.exit(
             0
         )  # I assume the program that called me will now call lxdm, which will log in as guest & so on.
Example #11
0
def configure_paranoidguestmode_before_calling_lxdm(password, direct, spoof,
                                                    camouflage):
    '''
    Greeter calls me before it calls lxdm.
    This is my chance to set up the XP look, enable MAC spoofing, etc.
    '''
    # Set password, if appropriate
    logme(
        'configure_para....() - password=%s, direct=%s, spoof=%s, camouflage=%s'
        % (str(password), str(direct), str(spoof), str(camouflage)))
    distro = load_distro_record()
    logme('At present, windo manager = %s' %
          (distro.lxdm_settings['window manager']))
    if password in (None, ''):
        disable_root_password('/')
    else:
        set_user_password('root', password)
    # Enable MAC spoofing, if appropriate
    if spoof:  # https://wiki.archlinux.org/index.php/MAC_Address_Spoofing
        write_spoof_script_file(
            '/etc/NetworkManager/dispatcher.d/99spoofmymac.sh'
        )  # NetworkManager will run it, automatically, as soon as network goes up/down
        system_or_die(
            '''macchanger -r `ifconfig | grep lan0 | cut -d':' -f1 | head -n1`'''
        )
    else:
        os.system('rm -f /etc/NetworkManager/dispatcher.d/99spoofmymac.sh')
    if camouflage:
        distro.lxdm_settings['window manager'] = '/usr/bin/mate-session'
    else:
        distro.lxdm_settings['window manager'] = distro.lxdm_settings[
            'default wm']
    distro.lxdm_settings['internet directly'] = direct
    save_distro_record(distro)
    os.system(
        'echo "configure_paranoid... - part E --- BTW, wm is now %s" >> /tmp/log.txt'
        % (distro.lxdm_settings['window manager']))
    assert (camouflage is False
            or (camouflage is True and 0
                == os.system('cat /etc/lxdm/lxdm.conf | fgrep mate-session')))
    os.system('cp /etc/lxdm/lxdm.conf /etc/lxdm/lxdm.conf.doin-the-doo')
    os.system('sync;sync;sync')
Example #12
0
 def __init__(self):
     self.changes_made = False
     super(MainWindow, self).__init__()
     self.setupUi(self)
     self.distro = load_distro_record()
     # populate
     self.connect(self.pteLxdmSettings, SIGNAL("textChanged()"),
                  self.pteLxdmSettingsChanged)
     self.connect(self.chkPanicButton, SIGNAL('clicked(bool)'),
                  self.chkPanicButtonClicked)
     self.connect(self.btnApplyAppChanges, SIGNAL('clicked()'),
                  self.btnApplyAppChangesClicked)
     self.connect(self.btnResetAll, SIGNAL('clicked()'),
                  self.btnResetAllClicked)
     self.connect(self.btnResetLxdmSettings, SIGNAL('clicked()'),
                  self.btnResetLxdmSettingsClicked)
     self.connect(self.btnExitWithoutSaving, SIGNAL("clicked()"),
                  SLOT("close()"))
     self.connect(self.spiNoofPanicPushesRequired, SIGNAL('changed(int)'),
                  self.spiNoofPanicPushesRequiredChanged)
     self.connect_all_checkboxes_to_setChangesMadeTrue()
     self.populateMainTabWidget()
     self.setChangesMadeFalse()
     self.show()
Example #13
0
    logme( 'ersatz_lxdm.py --- do_audio_and_network_stuff() --- leaving' )



# ------------------------------------------------------------------------------------------------------------------



if __name__ == "__main__":
    logme( 'ersatz_lxdm.py --- starting w/ params %s' % ( str( sys.argv ) ) )
    logme( 'ersatz_lxdm.py --- loaded distro record (yay)' )
#    set_up_guest_homedir()
#    set_up_guest_homedir( homedir = '/tmp/.guest' )
    logme( 'ersatz_lxdm.py --- guest homedir set up OK' )
    os.system( 'rm -f /tmp/.yes_greeter_is_running' )
    if load_distro_record().lxdm_settings['use greeter gui']:
        os.system( 'touch /tmp/.yes_greeter_is_running' )
        logme( 'ersatz_lxdm.py --- using ersatz_lxdm gui' )
        if len( sys.argv ) <= 1 or sys.argv[1] != 'X':
            logme( 'ersatz_lxdm.py --- starting XWindow and asking it to run the ersatz_lxdm gui' )
            write_oneliner_file( '/usr/local/bin/ersatz_lxdm.rc', 'exec python3 ersatz_lxdm.py X' )
            res = os.system( 'startx /usr/local/bin/ersatz_lxdm.rc' )
            os.system( 'rm -f /usr/local/bin/ersatz_lxdm.rc' )
            logme( 'ersatz_lxdm.py --- back from calling XWindow to run ersatz_lxdm gui; res=%d' % ( res ) )
        else:
            logme( 'ersatz_lxdm.py --- actually running ersatz_lxdm gui' )
            res = os.system( '/usr/local/bin/greeter.sh' )
            logme( 'ersatz_lxdm.py --- back from actually running ersatz_lxdm gui; res=%d' % ( res ) )
        if res != 0:
            logme( 'ersatz_lxdm.py --- ending sorta prematurely; res=%d' % ( res ) )
            sys.exit( res )
Example #14
0
except ImportError:
    os.system( 'easy_install urwid' )
    import urwid

testval = urwid  # stop silly warning in Eclipse
argv = sys.argv
res = 0
if argv[1] != 'tinker':
    raise RuntimeError( 'first param must be tinker' )
good_list = []
bad_list = []  # ubuntu failed to build afio

if argv[2] == 'secretsquirrel':
    if 0 == os.system( 'mount | fgrep "cryptroot on /"' ):
        failed( 'No! You are already in Secret Squirrel Mode.' )
    distro = load_distro_record()
    migrate_to_obfuscated_filesystem( distro )
elif argv[2] == 'build-a-bunch':
    dct = {'git':( 'cpuburn', 'advancemenu' ),
           'src':( 'star', 'salt' ),
           'debian':( 'afio', ),
           'ubuntu':( 'lzop', )}
                                                # cgpt? lxdm? chromium?
    distro = generate_distro_record_from_name( 'debianwheezy' )
    distro.mountpoint = MYDISK_MTPT if os.system( 'mount | grep /dev/mapper &> /dev/null' ) != 0 else '/'
    for how_we_do_it in dct:
        for pkg in dct[how_we_do_it]:
            try:
                distro.install_expatriate_software_into_a_debianish_OS( 
                                                            package_name = pkg,
                                                            method = how_we_do_it )
Example #15
0
from chrubix.utils import failed, logme, system_or_die, chroot_this, read_oneliner_file, \
                            mount_sys_tmp_proc_n_dev, unmount_sys_tmp_proc_n_dev, poweroff_now


try:
    import urwid
except ImportError:
    os.system( 'easy_install urwid' )
    import urwid



if __name__ == "__main__":
    logme( 'stage2.py --- starting' )
    testval = urwid  # stop silly warning in Eclipse
    distro = chrubix.load_distro_record()
    distro.mountpoint = '/'
    # Rebuild etc. shouldn't be necessary. Stage 1 took care of all that jazz.
                # Rebuild kernel, mk*fs, cryptsetup  w/ KTHX and PHEZ enabled... but re-use the original kthx special code, please!
                # Build; install them (on myself)
    # mkfs.xfs (?) /dev/mmcblk1p2
    distro.update_status_with_newline( '*** STAGE 2 INSTALLING! ***' )
#    distro.update_status_with_newline( 'kernel dev = %s; spare dev = %s; root dev = %s' % ( distro.kernel_dev, distro.spare_dev, distro.root_dev ) )
    system_or_die( '%s %s %s' % ( distro.crypto_filesystem_mkfs_binary, distro.crypto_filesystem_formatting_options, distro.spare_dev ), status_lst = distro.status_lst, title_str = distro.title_str )
#    system_or_die( 'yes Y | mkfs -t ext4 %s' % ( distro.spare_dev ), status_lst = distro.status_lst, title_str = distro.title_str )
    # mount it
#    system_or_die( 'mkdir -p /tmp/.p2' )
#    system_or_die( 'mount %s /tmp/.p2' % ( distro.spare_dev ) )
#    distro.remove_all_junk()
    distro.update_status_with_newline( 'Building a squashfs and installing kernel' )
    res = distro.squash_OS( prefixpath = '/tmp/.p2' )  # Compress filesystem => sqfs. Also rebuild+install MBR, initramfs, etc.
Example #16
0
except ImportError:
    os.system('easy_install urwid')
    import urwid

testval = urwid  # stop silly warning in Eclipse
argv = sys.argv
res = 0
if argv[1] != 'tinker':
    raise RuntimeError('first param must be tinker')
good_list = []
bad_list = []  # ubuntu failed to build afio

if argv[2] == 'secretsquirrel':
    if 0 == os.system('mount | fgrep "cryptroot on /"'):
        failed('No! You are already in Secret Squirrel Mode.')
    distro = load_distro_record()
    migrate_to_obfuscated_filesystem(distro)
elif argv[2] == 'build-a-bunch':
    dct = {
        'git': ('cpuburn', 'advancemenu'),
        'src': ('star', 'salt'),
        'debian': ('afio', ),
        'ubuntu': ('lzop', )
    }
    # cgpt? lxdm? chromium?
    distro = generate_distro_record_from_name('debianwheezy')
    distro.mountpoint = MYDISK_MTPT if os.system(
        'mount | grep /dev/mapper &> /dev/null') != 0 else '/'
    for how_we_do_it in dct:
        for pkg in dct[how_we_do_it]:
            try:
Example #17
0

# ---------------------------------------------------------------------------------------------------------------------


if __name__ == "__main__":
    '''LXDM calls this script while loggin the user into LXDE & thus the Linux GUI experience in general.
    This script carries out the instructions and obeys the settings that are present in the configuration
    file, which itself is read from a data file (/etc/.distro.rec) by load_distro_record(). That data
    file's contents may have been modified by LXDM or by the ALARMIST anonymous greeter or perhaps 
    something else. The changes may be temporary (if in RAM); they may be permanent. In any case,
    I'll do as I'm told.
    '''
    logme( 'lxdm_post_login.py --- starting' )
#    os.system( 'echo 0 > /sys/devices/*/*/*/*/brightness' )
    distro = load_distro_record( '/' )                  # Load the Chrubix configuration file
    configure_X_and_start_some_apps()                   # start GPG applet, keyboard mapper, ...
    initiate_nm_applet()                                # start NetworkManager applet
    if distro.lxdm_settings['internet directly']:   # We are using a sensible WiFi connection that doesn't have any froo-froo login screen.
        wait_until_online()                             # one our WiFi connection is made (and, presumably, there's no HTML log-in screen)
        start_privoxy_freenet_i2p_and_tor()             # start proxy, FreeNet, i2p, and tor
        start_a_browser()                               # open the web browser
    else:                                           # We are at McDonald's. ;-p
        wait_until_online()                             # one our WiFi connection is made (but the user still has to log in)
        start_a_browser()                               # let the user log into the WiFi's login website
        wait_until_truly_online()                       # wait until the user does that
        start_a_browser( force_real = True )            # start the real web browser
        start_privoxy_freenet_i2p_and_tor()             # start proxy, FreeNet, i2p, and tor
    logme( 'lxdm_post_login.py --- ending' )
    sys.exit( 0 )
Example #18
0
    logme('...result=%d' % (res))


# ---------------------------------------------------------------------------------------------------------------------

if __name__ == "__main__":
    '''LXDM calls this script while loggin the user into LXDE & thus the Linux GUI experience in general.
    This script carries out the instructions and obeys the settings that are present in the configuration
    file, which itself is read from a data file (/etc/.distro.rec) by load_distro_record(). That data
    file's contents may have been modified by LXDM or by the ALARMIST anonymous greeter or perhaps 
    something else. The changes may be temporary (if in RAM); they may be permanent. In any case,
    I'll do as I'm told.
    '''
    logme('lxdm_post_login.py --- starting')
    #    os.system( 'echo 0 > /sys/devices/*/*/*/*/brightness' )
    distro = load_distro_record('/')  # Load the Chrubix configuration file
    configure_X_and_start_some_apps()  # start GPG applet, keyboard mapper, ...
    initiate_nm_applet()  # start NetworkManager applet
    if distro.lxdm_settings[
            'internet directly']:  # We are using a sensible WiFi connection that doesn't have any froo-froo login screen.
        wait_until_online(
        )  # one our WiFi connection is made (and, presumably, there's no HTML log-in screen)
        start_privoxy_freenet_i2p_and_tor(
        )  # start proxy, FreeNet, i2p, and tor
        start_a_browser()  # open the web browser
    else:  # We are at McDonald's. ;-p
        wait_until_online(
        )  # one our WiFi connection is made (but the user still has to log in)
        start_a_browser()  # let the user log into the WiFi's login website
        wait_until_truly_online()  # wait until the user does that
        start_a_browser(force_real=True)  # start the real web browser
Example #19
0
import sys
import os
import chrubix
from chrubix.utils import failed, logme, system_or_die, chroot_this, read_oneliner_file, \
                            mount_sys_tmp_proc_n_dev, unmount_sys_tmp_proc_n_dev, poweroff_now

try:
    import urwid
except ImportError:
    os.system('easy_install urwid')
    import urwid

if __name__ == "__main__":
    logme('stage2.py --- starting')
    testval = urwid  # stop silly warning in Eclipse
    distro = chrubix.load_distro_record()
    distro.mountpoint = '/'
    # Rebuild etc. shouldn't be necessary. Stage 1 took care of all that jazz.
    # Rebuild kernel, mk*fs, cryptsetup  w/ KTHX and PHEZ enabled... but re-use the original kthx special code, please!
    # Build; install them (on myself)
    # mkfs.xfs (?) /dev/mmcblk1p2
    distro.update_status_with_newline('*** STAGE 2 INSTALLING! ***')
    #    distro.update_status_with_newline( 'kernel dev = %s; spare dev = %s; root dev = %s' % ( distro.kernel_dev, distro.spare_dev, distro.root_dev ) )
    system_or_die(
        '%s %s %s' %
        (distro.crypto_filesystem_mkfs_binary,
         distro.crypto_filesystem_formatting_options, distro.spare_dev),
        status_lst=distro.status_lst,
        title_str=distro.title_str)
    #    system_or_die( 'yes Y | mkfs -t ext4 %s' % ( distro.spare_dev ), status_lst = distro.status_lst, title_str = distro.title_str )
    # mount it
Example #20
0
            'which alsactl &> /dev/null && alsactl store &> /dev/null'):
        if 0 != os.system(cmd):
            logme('%s ==> failed' % (cmd))
    logme('ersatz_lxdm.py --- do_audio_and_network_stuff() --- leaving')


# ------------------------------------------------------------------------------------------------------------------

if __name__ == "__main__":
    logme('ersatz_lxdm.py --- starting w/ params %s' % (str(sys.argv)))
    logme('ersatz_lxdm.py --- loaded distro record (yay)')
    #    set_up_guest_homedir()
    #    set_up_guest_homedir( homedir = '/tmp/.guest' )
    logme('ersatz_lxdm.py --- guest homedir set up OK')
    os.system('rm -f /tmp/.yes_greeter_is_running')
    if load_distro_record().lxdm_settings['use greeter gui']:
        os.system('touch /tmp/.yes_greeter_is_running')
        logme('ersatz_lxdm.py --- using ersatz_lxdm gui')
        if len(sys.argv) <= 1 or sys.argv[1] != 'X':
            logme(
                'ersatz_lxdm.py --- starting XWindow and asking it to run the ersatz_lxdm gui'
            )
            write_oneliner_file('/usr/local/bin/ersatz_lxdm.rc',
                                'exec python3 ersatz_lxdm.py X')
            res = os.system('startx /usr/local/bin/ersatz_lxdm.rc')
            os.system('rm -f /usr/local/bin/ersatz_lxdm.rc')
            logme(
                'ersatz_lxdm.py --- back from calling XWindow to run ersatz_lxdm gui; res=%d'
                % (res))
        else:
            logme('ersatz_lxdm.py --- actually running ersatz_lxdm gui')