def shellcode_wrapper(f, args, kwargs, avoider): kwargs = pwn.with_context(**kwargs) kwargs = decoutils.kwargs_remover(f, kwargs, pwn.possible_contexts.keys() + ['raw']) if avoider: return pwn.avoider(f)(*args, **kwargs) else: return f(*args, **kwargs)
def wrapper(*args, **kwargs): if 'avoid' in kwargs or 'only' in kwargs: avoided = _flatset(kwargs.get('avoid', '')) only = _flatset(kwargs.get('only', _all)) kwargs = _decoutils.kwargs_remover(f, kwargs, check_list = ['avoid', 'only']) with avoid(avoided.union(_all - only), False): return f(*args, **kwargs) else: return f(*args, **kwargs)