예제 #1
0
def cleanup(mountpoint, tc_mountpoint, tempdir, value_from_argparser):
    try:
        cleanupLogger = ParaLogger('cleanup')
        parser = configtransport()

        #
        # Unmounting Truecrypt
        #
        try:
            if os.path.exists(tc_mountpoint) and os.path.ismount(tc_mountpoint):
                cleanupLogger.info("Unmounting Truecrypt Container")
                cleanupLogger.debug('UNMOUNT COMMAND: ' + parser.get('truecrypting', 'unmount'))
                subprocess.check_call(shlex.split(parser.get('truecrypting', 'unmount')))

        except OSError:
            cleanupLogger.error("Could not unmount tc container on {}").format(tc_mountpoint)
            cleanupLogger.exception("Could not unmount tc container on {}").format(tc_mountpoint)

        #
        # Unmounting USB-Stick
        #

        try:
            if value_from_argparser and os.path.exists(mountpoint) and os.path.ismount(mountpoint) is True:
                cleanupLogger.info("Unmounting USB-Stick")
                if (sys.platform == "darwin"):
                    subprocess.check_call(['diskutil', 'eject', mountpoint])
                else:
                    subprocess.check_call(["umount", mountpoint])
        except OSError:
            cleanupLogger.error("Could not umount {}").format(mountpoint)
            cleanupLogger.exception("Could not umount {}").format(mountpoint)

        #
        # Removing Temporary Directories
        #

        cleanupLogger.info("Cleaning up Temporary Directories")

        try:
            if value_from_argparser and os.path.exists(mountpoint) and os.path.ismount(mountpoint) is False:
                shutil.rmtree(mountpoint)
            if os.path.exists(tc_mountpoint) and os.path.ismount(tc_mountpoint) is False:
                shutil.rmtree(tc_mountpoint)
            if (sys.platform == "darwin") and os.path.exists(tempdir+"/dmg") and os.path.ismount(tempdir+"/dmg"):
                subprocess.check_call(['diskutil', 'eject', os.path.join(tempdir+"/dmg/")])
            elif os.path.exists(tempdir+"/dmg") and os.path.ismount(tempdir+"/dmg"):
                subprocess.check_call(['umount', os.path.join(tempdir+"/dmg/")])
            if os.path.exists(tempdir):
                shutil.rmtree(tempdir)
        except OSError:
            cleanupLogger.error("Some temporary Directories could not be removed")
            cleanupLogger.exception("Some temporary Directories could not be removed")

    except KeyboardInterrupt:
        cleanupLogger.error("You've hit Strg+C for interrupting Parabird. Now clean up your own mess. Exiting...")
        sys.exit()
예제 #2
0
파일: cleanup.py 프로젝트: jafeha/parabird
def cleanup(mountpoint, tc_mountpoint, tempdir, value_from_argparser):
    try:
        cleanupLogger = ParaLogger("cleanup")
        parser = configtransport()

        #
        # Unmounting Truecrypt
        #
        try:
            if os.path.exists(tc_mountpoint) and os.path.ismount(tc_mountpoint):
                cleanupLogger.info("Unmounting Truecrypt Container")
                cleanupLogger.debug("UNMOUNT COMMAND: " + parser.get("truecrypting", "unmount"))
                subprocess.check_call(shlex.split(parser.get("truecrypting", "unmount")))

        except OSError:
            cleanupLogger.error("Could not unmount tc container on {}").format(tc_mountpoint)
            cleanupLogger.exception("Could not unmount tc container on {}").format(tc_mountpoint)

        #
        # Unmounting USB-Stick
        #

        try:
            if value_from_argparser and os.path.exists(mountpoint) and os.path.ismount(mountpoint) is True:
                cleanupLogger.info("Unmounting USB-Stick")
                if sys.platform == "darwin":
                    subprocess.check_call(["diskutil", "eject", mountpoint])
                else:
                    subprocess.check_call(["umount", mountpoint])
        except OSError:
            cleanupLogger.error("Could not umount {}").format(mountpoint)
            cleanupLogger.exception("Could not umount {}").format(mountpoint)

        #
        # Removing Temporary Directories
        #

        cleanupLogger.info("Cleaning up Temporary Directories")

        try:
            if value_from_argparser and os.path.exists(mountpoint) and os.path.ismount(mountpoint) is False:
                shutil.rmtree(mountpoint)
            if os.path.exists(tc_mountpoint) and os.path.ismount(tc_mountpoint) is False:
                shutil.rmtree(tc_mountpoint)
            if (sys.platform == "darwin") and os.path.exists(tempdir + "/dmg") and os.path.ismount(tempdir + "/dmg"):
                subprocess.check_call(["diskutil", "eject", os.path.join(tempdir + "/dmg/")])
            elif os.path.exists(tempdir + "/dmg") and os.path.ismount(tempdir + "/dmg"):
                subprocess.check_call(["umount", os.path.join(tempdir + "/dmg/")])
            if os.path.exists(tempdir):
                shutil.rmtree(tempdir)
        except OSError:
            cleanupLogger.error("Some temporary Directories could not be removed")
            cleanupLogger.exception("Some temporary Directories could not be removed")

    except KeyboardInterrupt:
        cleanupLogger.error("You've hit Strg+C for interrupting Parabird. Now clean up your own mess. Exiting...")
        sys.exit()
예제 #3
0
파일: cleanup.py 프로젝트: sitzer/parabird
def cleanup(mountpoint, tc_mountpoint, tempdir):

    mainLogger=ParaLogger('main')
    parser = configtransport()
    clparser = argparse.ArgumentParser()
    clparser = argparse.ArgumentParser(description='')
    clparser.add_argument("-d", "--device", help="Device Flag to specify USB Stick")
    args = clparser.parse_args()

#
# Unmounting Truecrypt
#
    try:
        if os.path.exists(tc_mountpoint) and os.path.ismount(tc_mountpoint):
            mainLogger.info("Unmounting Truecrypt Container")
	    mainLogger.debug('UNMOUNT COMMAND: ' + parser.get('truecrypting', 'unmount'))
	    subprocess.check_call(shlex.split(parser.get('truecrypting', 'unmount')))

    except OSError:
        mainLogger.error("Could not unmount tc container on {}").format(tc_mountpoint)
        mainLogger.exception("Could not unmount tc container on {}").format(tc_mountpoint)
#
# Unmounting USB-Stick
#

    try:
        if args.device and os.path.exists(mountpoint) and os.path.ismount(mountpoint) == True:
            mainLogger.info("Unmounting USB-Stick")
            if (sys.platform == "darwin"):
                subprocess.check_call(['diskutil', 'eject', mountpoint])
            else:
                subprocess.check_call(["umount", mountpoint])
    except OSError:
        mainLogger.error("Could not umount {}").format(mountpoint)
        mainLogger.exception("Could not umount {}").format(mountpoint)

#
# Removing Temporary Directories
#

    mainLogger.info("Cleaning up Temporary Directories")

    try:
        if args.device and os.path.exists(mountpoint) and os.path.ismount(mountpoint) == False:
            shutil.rmtree(mountpoint)
        if os.path.exists(tc_mountpoint) and os.path.ismount(tc_mountpoint) == False:
            shutil.rmtree(tc_mountpoint)
        if (sys.platform == "darwin") and if os.path.exists(tempdir+"/dmg"):
            subprocess.check_call(['diskutil', 'eject', os.path.join(tempdir+"/dmg/")])
        else:
            subprocess.check_call(['umount', os.path.join(tempdir+"/dmg/")])
        if os.path.exists(tempdir):
            shutil.rmtree(tempdir)
    except OSError:
        mainLogger.error("Some temporary Directories could not be removed")
        mainLogger.exception("Some temporary Directories could not be removed")
예제 #4
0
    clparser.add_argument("-t", "--thunder", help="Specify Thunderbird version to download")
    clparser.add_argument("-a", "--vidalia", help="Specify Vidalia Version")
    clparser.add_argument("-n", "--container_name", help="Specify Container Name")
    clparser.add_argument("-s", "--container_size", help="Specify Container Size in Bytes")

    args = clparser.parse_args()

    #
    # Upgrading the Config
    #

    if sys.platform == "darwin":
        parser.set("truecrypting", "tc_binary", parser.get("truecrypting", "tc_mac_binary"))
    elif sys.platform == "win32":
        mainLogger.error(
            "parabirdy does'nt run on windows. by us a windows license (and some gifts) or reboot in linux. virtualisation might also work"
        )
        sys.exit()

    # Removed, because there is no verbosity support, could be reimplemented later.
    # see the logging module for built in verbosity support
    # if args.verbose:
    #   mainLogger.info("verbosity turned on")

    print "=" * 60, "\nChecking Dependencies and Configure\n", "=" * 60

    print "Tempdir is:", tempdir

    mainLogger.info("Checking all Dependencies...")

    mainLogger.debug("truerypt binary is {}".format(parser.get("truecrypting", "tc_binary")))
예제 #5
0
    clparser.add_argument("-d", "--device", help="Device Flag to specify USB Stick")
    clparser.add_argument("-t", "--thunder", help="Specify Thunderbird version to download")
    clparser.add_argument("-a", "--vidalia", help="Specify Vidalia Version")
    clparser.add_argument("-n", "--container_name", help="Specify Container Name")
    clparser.add_argument("-s", "--container_size", help="Specify Container Size in Bytes")

    args = clparser.parse_args()

    #
    # Upgrading the Config
    #

    if (sys.platform == "darwin"):
        parser.set('truecrypting', 'tc_binary', parser.get('truecrypting', 'tc_mac_binary'))
    elif (sys.platform == "win32"):
        mainLogger.error("parabirdy does'nt run on windows. by us a windows license (and some gifts) or reboot in linux. virtualisation might also work")
        sys.exit()

    # Removed, because there is no verbosity support, could be reimplemented later.
    # see the logging module for built in verbosity support
    #if args.verbose:
    #   mainLogger.info("verbosity turned on")

    print "=" * 60, "\nChecking Dependencies and Configure\n", "=" * 60

    print "Tempdir is:", tempdir

    mainLogger.info("Checking all Dependencies...")

    mainLogger.debug("truerypt binary is {}".format(parser.get('truecrypting', 'tc_binary')))
    dependency_check([parser.get('truecrypting', 'tc_binary'), "--text", "--version"])
예제 #6
0
    clparser.add_argument("-t", "--thunder", help="Specify Thunderbird version to download")
    clparser.add_argument("-a", "--vidalia", help="Specify Vidalia Version")
    clparser.add_argument("-n", "--container_name", help="Specify Container Name")
    clparser.add_argument("-s", "--container_size", help="Specify Container Size in Bytes")

    args = clparser.parse_args()

    #
    # Upgrading the Config
    #

    if (sys.platform == "darwin"):
        parser.set('truecrypting', 'tc_binary', parser.get('truecrypting', 'tc_mac_binary'))
        extract_dmg = extract_dmg_mac
    elif (sys.platform == "win32"):
        mainLogger.error("parabirdy does'nt run on windows. by us a windows license (and some gifts) or reboot in linux. virtualisation might also work")
        sys.exit()

    # Removed, because there is no verbosity support, could be reimplemented later.
    # see the logging module for built in verbosity support
    #if args.verbose:
    #   mainLogger.info("verbosity turned on")

    print "=" * 60, "\nChecking Dependencies and Configure\n", "=" * 60

    print "Tempdir is:", tempdir

    mainLogger.info("Checking all Dependencies...")

    mainLogger.debug("truerypt binary is {}".format(parser.get('truecrypting', 'tc_binary')))
    dependency_check([parser.get('truecrypting', 'tc_binary'), "--text", "--version"])
예제 #7
0
    clparser.add_argument("-s",
                          "--container_size",
                          help="Specify Container Size in Bytes")

    args = clparser.parse_args()

    #
    # Upgrading the Config
    #

    if (sys.platform == "darwin"):
        parser.set('truecrypting', 'tc_binary',
                   parser.get('truecrypting', 'tc_mac_binary'))
    elif (sys.platform == "win32"):
        mainLogger.error(
            "parabirdy does'nt run on windows. by us a windows license (and some gifts) or reboot in linux. virtualisation might also work"
        )
        sys.exit()

    # Removed, because there is no verbosity support, could be reimplemented later.
    # see the logging module for built in verbosity support
    #if args.verbose:
    #   mainLogger.info("verbosity turned on")

    print "=" * 60, "\nChecking Dependencies and Configure\n", "=" * 60

    print "Tempdir is:", tempdir

    mainLogger.info("Checking all Dependencies...")

    mainLogger.debug("truerypt binary is {}".format(