Esempio n. 1
0
 def run_loading(self, user_id, user_name):
     """log in successfully"""
     admin = MariaDB_operator.Operator(user_id, user_name)
     while True:
         # Menu interface after successful login
         choice_w = welcome.welcome(user_id, user_name)
         # Display all items
         if (choice_w == 1):
             admin.show_record()
         # Add a memo
         elif (choice_w == 2):
             admin.add_record()
         # Delete a memo
         elif (choice_w == 3):
             admin.delete_record()
         # modify a memo
         elif (choice_w == 4):
             admin.modify_record()
         # Export to Word file
         elif (choice_w == 5):
             admin.export2word()
         # Send a email
         elif (choice_w == 6):
             admin.send_email()
         # Exit this program
         elif (choice_w == 7):
             print("Thank you for your time!bye")
             self.root_logger.info(f'{user_name} has been log out')
             return False
         # MModify permissions for other users if you are an administrato
         elif (choice_w == 8):
             self.config.change_operation()
         input("press enter to continue:")
     return admin
Esempio n. 2
0
 def main():
     print("")
     config = configparser.ConfigParser()
     config.read("config/userdat.ini")
     terminalname = colors.BLUE + "[" + colors.END + "DSPF" + colors.BLUE + "]> " + colors.END
     terminal = input(terminalname + colors.END).lower()
     if terminal[0:4] == "help":
         helper.menu()
         main()
     elif terminal[0:1] == "?":
         helper.menu()
         main()
     elif terminal[0:5] == "clear":
         os.system("clear")
         welcome.welcome()
         main()
     elif terminal[0:] == "show":
         print(colors.GREEN)
         showlist.showlist()
         print(colors.END)
         main()
     elif terminal[0:3] == "use":
         if terminal[4:] == terminal[4:]:
             check = "%s.plugin" % (terminal[4:])
             if os.path.exists(check) == True:
                 os.system("%s.plugin" % (terminal[4:]))
                 main()
             else:
                 print(colors.RED + "[!]" + colors.END + "%s: Could Not Be Found!" % (terminal[4:]))
                 main()
     elif terminal[0:17] == "show " + terminal[5:]:
         print("")
         print(colors.BLUE + "Plugin Category: " + terminal[5:])
         print("==============")
         print("Name        ")
         print("" + colors.END)
         directorylist = glob.glob(terminal[5:] + "/*.plugin")
         for line in directorylist:
             about = line
             with open(about, "r") as myfile:
                 data = myfile.read().splitlines()
                 desc = data[0]
                 datar = desc.replace("Description = '", "")
             x = datar.rstrip("'")
             bb = line.split(terminal[5:] + "/")[1].split('.plugin')[0]
             print("{0:17s}".format(bb.upper()))
         print(" ")
         main()
     elif terminal[0:6] == "addkey":
         if terminal[7:] == terminal[7:]:
             print("")
             newkey = terminal[7:]
             newvalue = input("%s Value: " % (newkey))
             config['DEFAULT'][newkey] = newvalue
             with open("config/userdat.ini", "w") as configfile:
                 config.write(configfile)
             main()
     elif terminal[0:3] == "set":
         if terminal[4:] == "lhost":
             config['DEFAULT']['LHOST'] = input("\nEnter Value: ")
             with open("config/userdat.ini", "w") as configfile:
                 config.write(configfile)
             main()
         elif terminal[0:] == "set lport":
             config['DEFAULT']['LPORT'] = input("\nEnter Value: ")
             with open("config/userdat.ini", "w") as configfile:
                 config.write(configfile)
             main()
         elif terminal[4:9] == "rhost":
             config['DEFAULT']['RHOST'] = input("\nEnter Value: ")
             with open("config/userdat.ini", "w") as configfile:
                 config.write(configfile)
             main()
         elif terminal[4:9] == "rport":
             config['DEFAULT']['RPORT'] = input("\nEnter Value: ")
             with open("config/userdat.ini", "w") as configfile:
                 config.write(configfile)
             main()
         elif terminal[4:12] == "userlist":
             config['DEFAULT']['USERLIST'] = input("\nEnter Directory: ")
             with open("config/userdat.ini", "w") as configfile:
                 config.write(configfile)
             main()
         elif terminal[4:12] == "passlist":
             config['DEFAULT']['PASSLIST'] = input("\nEnter Directory: ")
             with open("config/userdat.ini", "w") as configfile:
                 config.write(configfile)
             main()
         elif terminal[4:13] == "interface":
             config['DEFAULT']['PASSLIST'] = input("\nEnter Interface: ")
             with open("config/userdat.ini", "w") as configfile:
                 config.write(configfile)
             main()
     elif terminal[0:5] == "reset":
         os.system("rm config/userdat.ini")
         startup.createdat()
         checkdat()
         main()
     elif terminal[0:4] == "exit":
         print("Exiting Framework..")
         exit()
     elif terminal[0:7] == "session":
         try:
             print(colors.GREEN)
             print("Key:              Value:")
             print("========================\n")
             for key, value in config.items('DEFAULT'):
                 pressed = "{0:17s}{1:12s}".format(key,value).upper()
                 print(pressed)
             print(colors.END)
             main()
         except KeyboardInterrupt:
             main()
     elif terminal[0:7] == "restart":
         os.system("./start.py")
     elif terminal[0:3] == "run":
         if terminal[4:] == terminal[4:]:
             os.system("%s" % (terminal[4:]))
             main()
     else:
         print("Unknown Command. Use help or ? to see available commands.")
         main()
Esempio n. 3
0
            print(colors.BLUE + "         [" + time.strftime("%H:%M") + "] Loaded Configuration File" + colors.END)
        else:
            startup.createdat()

    checkdat()
    os.system("clear")
    sx = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    hostname = '0.0.0.0'
    try:
        sx.connect(('8.8.8.8', 80))
        hostname = sx.getsockname()
        data = "%s" % (hostname[0])
        print(colors.BLUE + "\n      [" + time.strftime("%H:%M") + "] Connected to a network.\n      [" + time.strftime("%H:%M") + "] Local IP Address:", data + colors.END)
    except:
        print("Failed To Establish Connection")
    welcome.welcome()
    checkdat()

    def main():
        print("")
        config = configparser.ConfigParser()
        config.read("config/userdat.ini")
        terminalname = colors.BLUE + "[" + colors.END + "DSPF" + colors.BLUE + "]> " + colors.END
        terminal = input(terminalname + colors.END).lower()
        if terminal[0:4] == "help":
            helper.menu()
            main()
        elif terminal[0:1] == "?":
            helper.menu()
            main()
        elif terminal[0:5] == "clear":
Esempio n. 4
0
import os
import sys

from parse.exhentaiparser import CONFIGPATH, COOKIE_FILE
from core.welcome import welcome
from core.utility import get_latest_version

if __name__ == '__main__':
    get_latest_version()
    if not os.path.exists(CONFIGPATH) or not os.path.exists(COOKIE_FILE):
        welcome()
    else:
        import conf.global_variables as glv
        from core.galleryview import galleryview
        from core.listview import listview
        glv.init()
        if len(sys.argv) > 1:
            gallery_url = sys.argv[1]
            galleryview(gallery_url)
        else:
            listview()
Esempio n. 5
0
import chapters
from core import chapter_tools
from core.story import Story

from core.characters import Player

from os import walk
from os import path
from glob import glob

def select_chapter():
    print("Please select a chapter:")
    i = 0        
    for st in chapters.CHAPTERS.values():
        print("[{0}] {1}".format(i, st.CHAPTER_NAME))
        i += 1
    chap = raw_input("> ")
    current_chapter = chapters.CHAPTERS.values()[int(chap)]
    print("Chapter \"{}\" selected.".format(current_chapter.CHAPTER_NAME))
    current_story = Story(current_chapter)

def select_player():
    #TODO : save/load characters
    current_player = Player()

# Launch game !
if __name__ == '__main__':
    welcome()
    select_player()
    select_chapter()