Ejemplo n.º 1
0
    def __init__(self):
        print header
        # Initaliseren van individuele modules
        self.database = Database(self)
        Debugger('Initalising Modules!')

        self.bestand = Bestand(self)
        self.browser = Browser(self)
        self.foto = Foto(self)

        Debugger('Done initalising Modules!')
        Debugger('Running user CLI')

        self.database.run()
        self.cli()
Ejemplo n.º 2
0
def readBible(oldFile, newFile):
    contentOld = fileReader.getFileContentRemEmptys(oldFile)
    contentNew = fileReader.getFileContentRemEmptys(newFile)
    bible = database.Bible()
    ommitedLinesOld = 0
    ommitedLinesNew = 0
    for line in contentOld:
        try:
            parsed = parser.parse(line)
            bible.addVerset("Stary Testament", parsed[0], parsed[1],
                            [parsed[2], parsed[3]])
        except ValueError:
            ommitedLinesOld = ommitedLinesOld + 1

    for line in contentNew:
        try:
            parsed = parser.parse(line)
            bible.addVerset("Stary Testament", parsed[0], parsed[1],
                            [parsed[2], parsed[3]])
        except ValueError:
            ommitedLinesNew = ommitedLinesNew + 1

    log.inf("Ommited: old " + str(ommitedLinesOld))
    log.inf("Ommited: new " + str(ommitedLinesNew))
    return bible
Ejemplo n.º 3
0
def prompt_get_all_books():
    books = Database.get_all_books()
    for book in books:
        read = 'YES' if book[
            'read'] == '1' else 'NO'  # This is saying if book read is true then read == YES else read == False
        print(
            f"{book['name'].capitalize()} by {book['author'].capitalize()}, read: {read.capitalize()}"
        )
Ejemplo n.º 4
0
class Hoofdmenu:

    # Instanties van losse modules
    logger = None
    bestand = None
    exception = None
    foto = None
    browser = None
    case = None
    sql = None

    # Lijst van ingeladen images
    images = []

    def __init__(self):
        print header
        # Initaliseren van individuele modules
        self.database = Database(self)
        Debugger('Initalising Modules!')

        self.bestand = Bestand(self)
        self.browser = Browser(self)
        self.foto = Foto(self)

        Debugger('Done initalising Modules!')
        Debugger('Running user CLI')

        self.database.run()
        self.cli()

        # Optioneel: Websocket
        #self.web = Socket(5002, 'Forensic Toolkit', self)

    #  self.web.run(False)

    def add_image(self, path):
        # Toevoegen image aan hoofdmenu
        Logger('Adding Image: ' + str(path))
        self.images.append(Image(path))

    def cli(self):
        # self.database.run()
        # Commandline interface blijft beschikbaar door loop
        # Vanuit commandline kan worden aangegeven welke module moet worden gestart

        while True:
            try:
                # Printen van alle opties
                print ''
                print '\t[1] Bestand'
                print '\t[2] Browser'
                print '\t[3] Foto'
                print '\t[4] Add Image File'
                print '\t[5] Logboek'
                print '\t[0] Exit'

                Debugger('Main Menu')
                # Uitlezen gebruikersinput
                input = int(raw_input('Please choose an option [0-9]: '))
                Debugger('Selected Option: ' + str(input))
                # Input verwerken en aanroepen juiste functie
                if input == 1:
                    self.bestand.run()
                if input == 2:
                    self.browser.run()
                if input == 3:
                    self.foto.run()
                if input == 4:
                    self.database.add_image()
                if input == 5:
                    self.logboek()
                if input == 0:
                    Debugger('Exiting Program...', True)
                    exit(1)
            except:
                ErrorLogger()

    def print_header(self):
        print header

    def logboek(self):
        logger = self.database.get_log()

        print '\t[0] Print Logboek'
        print '\t[1] Store to CSV'

        log_array = []
        for log in logger:
            log_array.append([str(log.ID), log.Handeling, log.Datum])

        inp = int(raw_input('Maak een keuze [0-9] '))
        if inp == 0:
            print tabulate(log_array, headers=['ID', 'Handeling', 'Datum'])
        else:
            self.bestand.save_array_to_csv(log_array, 'ID;Handeling;Datum\n')
Ejemplo n.º 5
0
def prompt_delete_book():
    name = str(input('what book have you read, enter name: '))
    books = Database.delete_book(name)
    return books
Ejemplo n.º 6
0
def prompt_mark_book_as_read():
    name = str(input('what book have you read, enter name: '))
    books = Database.mark_book_as_read(name)
    return books
Ejemplo n.º 7
0
def prompt_add_book():
    how_many = int(input('how many books are you entering to: '))
    for i in range(0, how_many):
        name = input('Enter book name: ')
        author = input('Enter author name: ')
        Database.add_book(name, author)
Ejemplo n.º 8
0
def prompt_mark_book_as_read():
    name = str(input('what book have you read, enter name: '))
    books = Database.mark_book_as_read(name)
    return books


def prompt_delete_book():
    name = str(input('what book have you read, enter name: '))
    books = Database.delete_book(name)
    return books


while user_input != 'q':

    Database.create_database_table()

    if user_input == 'a':
        prompt_add_book()
    elif user_input == 'b':
        prompt_get_all_books()
    elif user_input == 'c':
        prompt_mark_book_as_read()
    elif user_input == 'd':
        prompt_delete_book()
    else:
        print('wrong input TRY AGAIN ! ')
        user_input = input(USER_INPUT)

    user_input = input(USER_INPUT)