qiling icon indicating copy to clipboard operation
qiling copied to clipboard

access to resources

Open fishfacegit opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. At the moment I try to access resources of a binary via qiling and to implement a FindResouceExW. Has qiling an api interface for that? At the moment i have to use lief, but it doesn't seem to be the right way. How do i do the mapping from resource object to where it lies in ql memory?

Example Code

def hook_FindResourceExW(ql: Qiling, address: int, params):
    binary = lief.parse(ql.path)
    if binary.has_resources:
        root = binary.resources
        if isinstance(params['lpType'], str):
            a_1 = 'name'
        elif isinstance(params['lpType'], int):
            a_1 = 'id'
        if isinstance(params['lpName'], str):
            a_2 = 'name'
        elif isinstance(params['lpName'], int):
            a_2 = 'id' 
        for e in root.childs:
            if getattr(e, a_1).casefold() == params['lpType'].casefold():
                for d in e.childs:
                    if getattr(d, a_2).casefold() == params['lpName'].casefold():
                        for c in d.childs:
                            if c.id == params['wLanguage']:
                                print(c)

fishfacegit avatar Apr 01 '23 17:04 fishfacegit