예제 #1
0
def main(args):
    base_url = 'https://api.intra.42.fr'
    headers = {'Authorization': f'Bearer {get_token(base_url)}'}

    #check if arg id is valid
    verify_id(base_url, headers, args["id"])

    #if arg --clean-cache is set clean cache and exit
    if args['ccache']:
        remove_archive(f'.student-{args["id"]}')
        remove_archive(f'.student-all-{args["id"]}')
        print("Cache clean sucessfully!")
        quit()

    #if arg --photo or -p is set print url and exit
    if args['photo']:
        print(f'https://cdn.intra.42.fr/users/{args["id"]}.jpg')
        quit()

    #perform requests
    id_info = do_request(base_url, args['id'], args['ncache'], args['all'],
                         headers)

    if not args['all']:
        if args['raw']:
            raw(id_info, args['id'])
        else:
            table(id_info, args['id'])
    else:
        all(id_info)
예제 #2
0
    def __help_help(self):
        '''Print help summary.'''
        print
        output.title('Commands')
        tab = [[cmd, self.__get_help(cmd)[0]]
               for cmd in sorted(self.documented_commands)]
        output.table(tab)
        print

        if self.undocumented_commands:
            output.title('Undocumented commands')
            output.columnize(set(self.undocumented_commands))
            print
예제 #3
0
파일: cmd.py 프로젝트: Jarlene/ADBI-1
    def __help_help(self):
        '''Print help summary.'''
        print
        output.title('Commands')
        tab = [[cmd, self.__get_help(cmd)[0]] 
               for cmd in sorted(self.documented_commands)]
        output.table(tab)
        print

        if self.undocumented_commands:
            output.title('Undocumented commands')
            output.columnize(set(self.undocumented_commands))
            print
예제 #4
0
파일: addr2line.py 프로젝트: Jarlene/ADBI-1
    elf = Binary(args.input)



    if args.types:
        print 'Types:'
        def getcodename(t):
            try:
                return t.codename
            except NotImplementedError:
                return ''

        items = (('%x' % type.tid, type.name if type.name else '', str(type), type.byte_size if type.byte_size else 0, type.codename) for type in elf.types)
        items = sorted(items, key=lambda x: int(x[0], 16))
        output.table(items, head=['ID', 'ORIGINAL NAME', 'DESCRIPTION', 'SIZE', 'NAME IN HANDLERS'])

    if args.variables:
        print 'Variables:'
        items = ((var.name, str(var.datatype), str(var.is_global), str(var.location) if var.location else '') 
                  for var in elf.variables)
        output.table(items, head=['NAME', 'TYPE', 'GLOBAL', 'DEFINITION'])        

        for var in elf.variables:
            print var.name
            print var.expressions


    if args.define_type:
        types = (t for t in elf.types if t.name and fnmatch(t.name, args.define_type))
        for t in types:
예제 #5
0
파일: IDS.py 프로젝트: Pranav418/IDS
def user(usr, mod_number = 0):
    tab = output.table(int(usr), int(mod_number))
    return render_template('home.html', val = usr, tab = tab, num = mod_number)   
예제 #6
0
파일: addr2line.py 프로젝트: st-rnd/ADBI-1
    if args.types:
        print 'Types:'

        def getcodename(t):
            try:
                return t.codename
            except NotImplementedError:
                return ''

        items = (('%x' % type.tid, type.name if type.name else '', str(type),
                  type.byte_size if type.byte_size else 0, type.codename)
                 for type in elf.types)
        items = sorted(items, key=lambda x: int(x[0], 16))
        output.table(items,
                     head=[
                         'ID', 'ORIGINAL NAME', 'DESCRIPTION', 'SIZE',
                         'NAME IN HANDLERS'
                     ])

    if args.variables:
        print 'Variables:'
        items = ((var.name, str(var.datatype), str(var.is_global),
                  str(var.location) if var.location else '')
                 for var in elf.variables)
        output.table(items, head=['NAME', 'TYPE', 'GLOBAL', 'DEFINITION'])

        for var in elf.variables:
            print var.name
            print var.expressions

    if args.define_type: