Exemplo n.º 1
0
def main(stdscr):
    stdscr.clear()
    row = 0
    printmenu(stdscr, row)

    while (1):
        key = stdscr.getch()
        if key == curses.KEY_UP and row > 0:
            row -= 1
        elif key == curses.KEY_DOWN and row < len(menu) - 1:
            row += 1
        elif key == curses.KEY_ENTER or key in [10, 13]:
            if menu[row] == "Jugar":
                stdscr.clear()
                h, w = stdscr.getmaxyx()
                x = w // 2
                y = h // 2
                init.main(stdscr)
                #stdscr.addstr(y,x,"hola")
                stdscr.refresh()
                time.sleep(3)
            elif menu[row] == "Exit":
                break

        printmenu(stdscr, row)
Exemplo n.º 2
0
def console():
    while True:
        enterSpam = 0
        stuff = raw_input("==> ")
        if stuff == "help":
            print "Available commands: help, aspect, bloodCalc, sweepCalc, playerData, and displayPlayerData"
            print "Enter help:<command> for information on \"command\"."
        elif stuff == "help:aspect":
            print "[u] Displays your Classpect (Class and Aspect)."
        elif stuff == "help:bloodCalc":
            print "Displays your blood color as if you were a troll."
        elif stuff == "help:sweepCalc":
            print "Converts Years to Alternian Sweeps and vice versa."
        elif stuff == "help:playerData":
            print "So far it does nothing."
        elif stuff == "help:displayPlayerData":
            print "It doesn't exist yet."
        elif stuff == "aspect":
            aspect.main(False)
        elif stuff == "bloodCalc":
            bloodCalc.main(False)
        elif stuff == "sweepCalc":
            sweepCalc.calc()
        elif stuff == "playerData":
            init.main(False)
        elif stuff == "displayPlayerData":
            dpd.main()
        else:
            print "'" + stuff + "' is not a valid command. Use \"help\" for information."
Exemplo n.º 3
0
def main_menu():
    menu = True
    # selected="start"

    pygame.mixer.music.load("Assets/Sound/Menu.mp3")
    pygame.mixer.music.play(3)

    while menu:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()

            if event.type == pygame.USEREVENT:
                if event.command == constants.C_START:
                    init.main()
                if event.command == constants.C_CLOSE:
                    pygame.quit()
                    quit()

            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_i:
                    init.main()
                if event.key == pygame.K_c:
                    pygame.quit()
                    quit()

        # Main Menu UI
        screen.blit(menuImg, (0, 0))
        screen.blit(pygame.transform.scale(foxImg, (260, 250)), (100, 240))

        title = text_format("JANFOX", font, 90, green2)
        text_start = text_format("INICIAR 'I'", font, 50, black)
        text_quit = text_format("CERRAR 'C'", font, 50, black)

        title_rect = title.get_rect()
        start_rect = text_start.get_rect()
        quit_rect = text_quit.get_rect()

        # Main Menu Text
        screen.blit(title,
                    (constants.SCREEN_WIDTH / 2 - (title_rect[2] / 2), 80))
        screen.blit(text_start,
                    (constants.SCREEN_WIDTH / 2 - (start_rect[2] / 2), 280))
        screen.blit(text_quit,
                    (constants.SCREEN_WIDTH / 2 - (quit_rect[2] / 2), 360))
        pygame.display.update()
        pygame.display.set_caption("JANFOX")
Exemplo n.º 4
0
async def main(client):
    await client.send(_sm.command("testfor @s"))
    name = getPlayerInfo(await client.recv())

    await client.send(_sm.command(_sm.actionbar("§b<<< 欢迎使用 >>>")))
    await client.send(_sm.command(_sm.status("正在接收订阅数据包...")))
    await asyncio.sleep(2)
    await client.send(json.dumps(packages.main["subscribe"]))
    await client.send(_sm.command(_sm.ok("已经接收订阅数据包!")))
    await client.send(_sm.command(_sm.say("作者:阖庐(GhostWorker)")))
    await client.send(_sm.command(_sm.say("操作员: " + name)))

    # 用于收集指令回包
    commandResults = []
    # 用于补包
    bad_packages = []
    while True:
        pkt = check.getMessageInfo(await client.recv(), name, bad_packages)
        asyncio.create_task(
            init.main(
                pkt,
                client,
                _sm.command,
                commandResults,  # normal
                wait_sympol,  # 阻塞主线程用
                bad_packages  # 补包用
            ))
        # 判断是否需要阻塞
        await is_wait(pkt, wait_sympol)
        await asyncio.sleep(0)
Exemplo n.º 5
0
def main():
    parameters = sys.argv[1:]
    parameters_clean = check_argv(parameters)
    if not parameters_clean:
        print
        sys.exit(1)
    argv_jiraid, argv_projects, argv_act, options, argv_tag = parameters_clean    
    
    os.system('clear')
    log_update = log.WriteLog(options)
    log_update.TimeMarker()
    log_update.DebugLog('check argv OK!')
    log_update.DebugLog('get issues ..')
    tzjira = workflow.tzJira()

    env, jiraid, ops_tag, update_tag, rollback_tag, projects, debugs, errors = tzjira.Get_issues(argv_jiraid, argv_projects, argv_act, options, argv_tag)
    if debugs != []:
        for debug in debugs:
            log_update.DebugLog(debug)
    if errors != []:
        for error in errors:
            log_update.ErrorLog(error)
        log_update.CloseLog()
        sys.exit(1)
    log_update.DebugLog('get issues OK!')
    
    log_update.DebugLog('init issues .. ')
    tasks, debugs, errors = init.main(env, projects)
    if debugs != []:
        for debug in debugs:
            log_update.DebugLog(debug)
    if errors != []:
        for error in errors:
            log_update.ErrorLog(error)
        log_update.CloseLog()
        sys.exit(1)
    log_update.DebugLog('init issues OK!')
    
    if not '--check' in options and 'update' == argv_act and not '--force=beta' in options and not '--force=prod' in options and env == 'prod' and not '--noupdatejira' in  options:
        log_update.DebugLog('update jira ..')
        tzjira.Update_issues(jiraid, 'prodstart')
        log_update.DebugLog('update jira OK!')
    
    log_update.DebugLog('tasks begin ..')    
    task_type = tasks.pop('type')
    if task_type == 'static' and argv_act == 'update':
        boolean = proto_b2b.syncing(jiraid, ops_tag, update_tag, tasks, options).main()
    elif task_type == 'application':
        boolean = app_b2b.main(env, jiraid, ops_tag, update_tag, rollback_tag, tasks, argv_act, options)    
    log_update.DebugLog('tasks finish OK!')
    
    if not '--check' in options and 'update' == argv_act and not '--force=beta' in options and not '--force=prod' in options and boolean and not '--p-only' in options and not '--noupdatejira' in  options:
        log_update.DebugLog('update jira ..')
        if env == 'beta':
            tzjira.Update_issues(jiraid, 'betaend')
        elif env == 'prod':
            tzjira.Update_issues(jiraid, 'prodend')
        log_update.DebugLog('update jira OK!')
    log_update.CloseLog()
Exemplo n.º 6
0
def process(filepath, instrument=False, fexclude=''):
    """
    Start file processing
    :param filepath: path to executable
    :param instrument: True to apply instrumentation
    :param fexclude: path to file of symbol exclusions
    :return: True if everything ok
    """
    import init
    import traceback
    from postprocess import compile_process
    from disasm import main_discover, func_addr

    print "Starting to process binary '" + filepath + "'"
    try:

        func_addr.func_addr(filepath, 0, fexclude)

        os.system(config.strip + ' ' + filepath)
        main_discover.main_discover(filepath)

        init.main(filepath, instrument)
        if not os.path.isfile("final.s"): return False

        with open('final_data.s', 'a') as f:
            f.write('\n.section .eh_frame\n')
            with open('eh_frame_split.info') as eh: f.write(eh.read())
            f.write('\n.section .eh_frame_hdr\n')
            with open('eh_frame_hdr_split.info') as eh: f.write(eh.read())
        with open('final.s', 'a') as f:
            with open('final_data.s', 'r') as fd: f.write(fd.read())
            if instrument: f.write('\n\n'.join(map(lambda e: e['plain'].instrdata, config.instrumentors)))

        compile_process.main(filepath)
        if instrument:
            for worker in config.instrumentors:
                worker['main'].aftercompile()
        if compile_process.reassemble() != 0: return False

    except Exception as e:
        print e
        traceback.print_exc()
        return False

    return True
Exemplo n.º 7
0
def main():

    parser = argparse.ArgumentParser(description='CoCass platform Python monitoring script. If this is the first time you use this script, launch it without arguments and follow the setup.')

    parser.add_argument('--rm', action="store_true", dest="remove", help="remove the docker-machine and leave the community")
    parser.add_argument('-p', '--preset-dm', action="store_false", dest="preset_dm", help="use preset docker-machine limitation")

    args = parser.parse_args()

    (result, (username, password)) = restcall.log_in(3)
    if not result:
        sys.exit(1)

    if args.remove:
        remove.main(username, password)
    else:
        init.main(username, password, args.preset_dm)
        monitoring.main(username, password)
Exemplo n.º 8
0
def complete_run(args, report=True):
    # Run everything
    init.main()
    build_binaries.main(args)
    link_binaries.main()
    extract_data.main()
    create_patches.main()
    inject_delta_data.main(False)

    # Create reports
    if report:
        report_binary_sizes.main()
        report_binary_text_sizes.main()
        report_delta_data_sizes.main()
        report_opportunity_log_sizes.main()
        report_patch_sizes.main()
        report_patch_timing.main()
        report_symfile_sizes.main()
Exemplo n.º 9
0
 def run_parsing(self):
     con = self.test_connection()
     if not self.form_file or not self.config_file:
         self.show_message('Warning', 'Parse Warning',
                           "Config, Form, or Access File has not been set!",
                           QtWidgets.QMessageBox.Warning)
     if not con:
         self.show_message('Warning', 'Connection Warning',
                           'Cannot Connect to the database \nnCheck log for details.',
                           QtWidgets.QMessageBox.Warning)
     else:
         self.btn_begin_parse.setEnabled(False)
         try:
             init.main(self.form_file, self.config_file, con.cursor())
             pass
         except Exception as e:
             exception_throw()
         finally:
             con.close()
         self.btn_begin_parse.setEnabled(True)
         self.done_parsing()
Exemplo n.º 10
0
def main() :
  """
    This function just performs dispatch on the command line that a user
    provided. Basically, look at the first argument, which specifies the
    function the user wants rPGA to perform, then dispatch to the appropriate
    module.
  """
  if sys.argv[1] == "init" :
    init.main(sys.argv[2:])
  elif sys.argv[1] == "genomes" :
    genomes.main(sys.argv[2:])
  elif sys.argv[1] == "genotype" :
    genotype.main(sys.argv[2:])
  elif sys.argv[1] == "junctions" :
    junctions.main(sys.argv[2:])
  elif sys.argv[1] == "sequences" :
    seqs.main(sys.argv[2:])
  elif sys.argv[1] == "run" :
    running.main(sys.argv[2:])
  else :
    sys.stderr.write("rPGA: I don't recognise the option '" + sys.argv[1] +\
                     "'.\n")
Exemplo n.º 11
0
        def first_launch():
            global image_change_path

            # if this project is cloned to other pc with different name, it'll be many users, hence a list is needed
            # to check whether the pc this project is currently in already has a Wolf user folder or not. if not then
            # create a new folder based on pc's name
            users = []
            os.chdir(destination_path)
            for user in os.listdir():
                users.append(user)
            if socket.gethostname() in users:
                files = ''
                for file in os.listdir(
                        f'{destination_path}\\{socket.gethostname()}'):  # equivalent to C:/Wolf/users/(yourpcname)
                    files += f'{file} '  # appending the files into a string for the regex to find

                # regex to find the image file extension
                images = re.findall(r'\.png|\.jpg|\.jpeg|\.PNG|\.JPG|\.JPEG|\.bmp|\.BMP', files)

                # loops again to finally get the image file extension
                for image in images:
                    files = image

                # the dir change path to find the image
                image_change_path = f'{socket.gethostname()}{files}'

                # equivalent to C:/Wolf/users/(your_pc_name)/(your_pc_name.image_file_extension)
                final_image = f'{destination_path}\\{socket.gethostname()}\\{socket.gethostname()}{files}'

                # return and call the round_avatar function to set the user profile picture on the user config page,
                # also call round_avatar_icon to set the user configuration button on the top right
                return round_avatar(final_image), round_avatar_icon(final_image)

            else:
                # calling the init library to set the profile image. read the explanation there
                first_open = init.main()
                user_folder(path=f'C:\\Wolf\\images\\convert\\{first_open}')
                print(first_open)
Exemplo n.º 12
0
def process(filepath, iter_curr, iter_num, keep):
    try:
        for f in glob.glob('final_*.txt'):
            os.remove(f)

        # suppose we use this method to obtain function information
        func_addr.func_addr(filepath, iter_curr)

        if os.path.isfile('final_data.s'): os.remove('final_data.s')
        if os.path.isfile('useless_func.info'): os.remove('useless_func.info')

        if iter_curr > 0: func_addr.useless_func_discover(filepath)

        with open('count.txt', 'w') as f:
            f.write(str(iter_curr))
        os.system('strip ' + filepath)
        main_discover.main_discover(filepath)

        # os.system("./init.native " + filepath)
        init.main(filepath)
        if not os.path.isfile("final.s"): return False

        post_process_data.post_process_data()

        with open('final_data.s', 'a') as f:
            f.write('.section .eh_frame\n')
            with open('eh_frame_split.info') as eh:
                f.write(eh.read())
            f.write('.section .eh_frame_hdr\n')
            with open('eh_frame_hdr_split.info') as eh:
                f.write(eh.read())
        with open('final.s', 'a') as f:
            with open('final_data.s', 'r') as fd:
                f.write(fd.read())

        if keep:
            shutil.copy('final.s', 'final.s.' + str(iter_curr))

        if "gobmk" in filepath:
            gobmk_sub.gobmk_sub()

        compile_process.main()
        label_adjust.label_adjust()
        compile_process.reassemble()

        if iter_num > 1:
            shutil.copy('a.out', filepath)

        if keep:
            print f_dic
            shutil.copy('a.out',
                        f_dic + "/" + filepath + "." + str(iter_curr + 1))
            shutil.move('final.s.' + str(iter_curr), f_dic)
    except Exception as e:
        print e
        return False
    else:
        if os.path.isfile('faddr_old.txt.' + str(iter_curr)):
            os.remove('faddr_old.txt.' + str(iter_curr))
        if os.path.isfile('faddr.txt.' + str(iter_curr)):
            os.remove('faddr.txt.' + str(iter_curr))

    return True
Exemplo n.º 13
0
import init

init.main()
Exemplo n.º 14
0
    "--output",
    default=None,
    help=
    "path for output location of junit style xml associated with each test. "
    "Test results wil simply print to the console if this is unset.")

parser.add_argument(
    "--tests",
    default=None,
    help="If desired, provide comma-delimited list of tests to run. "
    "Valid entry should be the case-insensitive string <entry> "
    "for indicate test class Test<entry>.")

if __name__ == "__main__":
    args = parser.parse_args()
    init.main(args)

    if args.output is not None:
        # set up the runner which will produce junit sytle xml files...
        runner = xmlrunner.XMLTestRunner(output=args.output, verbosity=2)
    else:
        # run only on the console
        runner = unittest.TextTestRunner(verbosity=2)

    if args.tests is None:
        theTests = None
    else:
        theTests = [el.lower().strip() for el in args.tests.strip().split(',')]
        print("Limiting testing to tests {}".format(theTests))

    goodClasses = {
Exemplo n.º 15
0
#! /usr/bin/env python

import sys
import os


try:
    __file__
except NameError:
    pass
else:
    libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))
    sys.path.insert(0, libdir)


import init
init.main()

Exemplo n.º 16
0
def admin_qrcode_img(qr_key):
	""" retourne le png du qrcode demande """
	return send_file(join('qrcodes', qr_key + '.png'))

# ============================ ERROR HANDLERS =================================

@app.errorhandler(NoUserError)
def handle_no_user_error(_):
	""" redirige le client vers la creation d'user si user nest pas defini """
	return redirect('/home')

# =================================== UTILS ===================================

def getter_user(session):
	""" retourne l'user_id si dans session, sinon exception """
	if 'user' not in session:
		raise NoUserError()
	return session['user']

def is_admin():
	return session.get('admin', 0) == 1

@app.route('/test')
def test_qr():
	return render_template('test_qr.html')

import init
init.main(app, db)
if __name__ == '__main__':
	app.run('0.0.0.0')
Exemplo n.º 17
0
def Load_data(filename, window, cogList, query):
    return init.main(filename, window, cogList, query)
try:
    from version import __version__
except ImportError:
    import sys
    import os.path
    path = os.path.realpath(os.path.abspath(__file__))
    sys.path.insert(0, os.path.dirname(os.path.dirname(path))) #from https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/__main__.py
    try:
        from version import __version__
    except ImportError:
        from .version import __version__

__productname__ = 'simpletestprogram'
__author__      = "Matteo Gheza"
__author_email__= "*****@*****.**"
__description__ = "A simple multi-platform test program in Python"
__license__  = "Licensed under the GNU GPL v3 or any later version"
__bigcopyright__ = """%(__productname__)s %(__version__)s
  %(__license__)s""" % locals()
__homepage__ = "https://github.com/MatteoGheza/simple-test-program-python"

banner = __bigcopyright__

__all__ = ['version', 'init']

if __name__ == '__main__':
    from init import main
    main()
Exemplo n.º 19
0
import json
import aspect
import bloodCalc
import dpd
import init
import sweepCalc

print "SBLUH CONSOLE v1.0.0"
print "Python Edition"
print
init.main(True)
print "run 'help' for commands."

def unfin():
    print "I need to code this!"
    print "github.com/Nutzchannel/SBLUH-py/issues"

def console():
    while True:
        enterSpam = 0
        stuff = raw_input("==> ")
        if stuff == "help":
            print "Available commands: help, aspect, bloodCalc, sweepCalc, playerData, and displayPlayerData"
            print "Enter help:<command> for information on \"command\"."
        elif stuff == "help:aspect":
            print "[u] Displays your Classpect (Class and Aspect)."
        elif stuff == "help:bloodCalc":
            print "Displays your blood color as if you were a troll."
        elif stuff == "help:sweepCalc":
            print "Converts Years to Alternian Sweeps and vice versa."
        elif stuff == "help:playerData":