当前位置: 首页>>代码示例>>Python>>正文


Python lldb.SBCommandReturnObject方法代码示例

本文整理汇总了Python中lldb.SBCommandReturnObject方法的典型用法代码示例。如果您正苦于以下问题:Python lldb.SBCommandReturnObject方法的具体用法?Python lldb.SBCommandReturnObject怎么用?Python lldb.SBCommandReturnObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lldb的用法示例。


在下文中一共展示了lldb.SBCommandReturnObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle_command

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def handle_command(debugger, command, exe_ctx, result, internal_dict):
    '''
    Documentation for how to use lsof goes here 
    '''

    command_args = shlex.split(command, posix=False)
    parser = generate_option_parser()
    try:
        (options, args) = parser.parse_args(command_args)
    except:
        result.SetError(parser.usage)
        return

    script = generateScript()
    interpreter = debugger.GetCommandInterpreter()
    res = lldb.SBCommandReturnObject()
    expression = interpreter.HandleCommand("exp -l objc -O -- " + script, res)

    if not res.Succeeded():
        result.SetError(res.GetError())

    result.AppendMessage(res.GetOutput()) 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:24,代码来源:lsof.py

示例2: sys

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def sys(debugger, command, exe_ctx, result, internal_dict):
    search =  re.search('(?<=\$\().*(?=\))', command)
    if search:
        cleanCommand = search.group(0)
        res = lldb.SBCommandReturnObject()
        interpreter = debugger.GetCommandInterpreter()
        interpreter.HandleCommand(cleanCommand, res, True)
        if not res.Succeeded():
            result.SetError(res.GetError())
            return

        if not res.HasResult():
            # result.SetError("NoneType for {}".format(cleanCommand))
            return

        command = command.replace('$(' + cleanCommand + ')', res.GetOutput().rstrip())
    # command = re.search('\s*(?<=sys).*', command).group(0)
    my_env = os.environ.copy()
    my_env["PATH"] = "/usr/local/bin:" + my_env["PATH"]
    output = subprocess.Popen(command, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, env=my_env).communicate()
    retOutput = ''
    if output[1]:
        retOutput += output[1]
    retOutput += output[0].decode("utf-8") 
    result.AppendMessage(retOutput) 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:27,代码来源:ds.py

示例3: deliApReceipt

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def deliApReceipt(result, debugger):
    command_script = r'''
    @import Foundation; 
    id path = [[[NSBundle mainBundle] appStoreReceiptURL] path]; 

    NSError *error;
    BOOL success = (BOOL)[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
    success ? [NSString stringWithFormat:@"Successfully deleted receipt!\n%@", path] : [NSString stringWithFormat:@"Error: %@", error]
    '''

    res = lldb.SBCommandReturnObject()
    interpreter = debugger.GetCommandInterpreter()

    interpreter.HandleCommand('exp -lobjc -O -- ' + command_script, res)
    if not res.HasResult():
        result.SetError('There\'s no result ' + res.GetError())
        return

    result.AppendMessage(res.GetOutput()) 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:21,代码来源:iap.py

示例4: dcpy

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def dcpy(debugger, command, exe_ctx, result, internal_dict):
    res = lldb.SBCommandReturnObject()
    debugger = lldb.debugger
    interpreter = debugger.GetCommandInterpreter()
    interpreter.HandleCommand(command, res)
    if not res.Succeeded():
        result.SetError(res.GetError())
        return 
    os.system("echo '%s' | tr -d '\n'  | pbcopy" % res.GetOutput().rstrip())
    result.AppendMessage('Content copied to clipboard...') 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:12,代码来源:ds.py

示例5: pframework

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def pframework(debugger, command, exe_ctx, result, internal_dict):
    target = getTarget()
    res = lldb.SBCommandReturnObject()
    debugger = lldb.debugger
    interpreter = debugger.GetCommandInterpreter()
    module = target.module[command]
    if not module:
        result.SetError("Couldn't find module: {}".format(command))
        return 
    
    result.AppendMessage("\"" + module.file.fullpath + "\"") 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:13,代码来源:ds.py

示例6: statiAPReceipt

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def statiAPReceipt(result, debugger):
    command_script = r'''
    @import Foundation; 
    id path = [[[NSBundle mainBundle] appStoreReceiptURL] path]; 
    id data = [NSData dataWithContentsOfFile:path];

    unsigned char md5Buffer[12];
 
    CC_MD5((void*)[data bytes], (unsigned long)[data length], md5Buffer);
    
    NSMutableString *output = [NSMutableString stringWithCapacity:12 * 2];
    for(int i = 0; i < 12; i++)  {
        [output appendFormat:@"%02x",md5Buffer[i]];
    }
  
    data ? [NSString stringWithFormat:@"Receipt found!\n%@\n\nMD5 Hash: %@", path, output] : @"No receipt :["
    '''

    res = lldb.SBCommandReturnObject()
    interpreter = debugger.GetCommandInterpreter()

    interpreter.HandleCommand('exp -lobjc -O -- ' + command_script, res)
    if not res.HasResult():
        result.SetError('There\'s no result ' + res.GetError())
        return

    result.AppendMessage(res.GetOutput()) 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:29,代码来源:iap.py

示例7: getiAPReceipt

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def getiAPReceipt(result, debugger):
    command_script = r'''
    @import Foundation; 
    id path = [[[NSBundle mainBundle] appStoreReceiptURL] path];
    id data = [NSData dataWithContentsOfFile:path];
data ? [NSString stringWithFormat:@"%p,%p,%p,%@", data, (uintptr_t)[data bytes], (uintptr_t)[data length] + (uintptr_t)[data bytes], path] : @"No receipt :["'''
    res = lldb.SBCommandReturnObject()
    interpreter = debugger.GetCommandInterpreter()

    interpreter.HandleCommand('exp -lobjc -O -- ' + command_script, res)
    if not res.HasResult():
        result.SetError('There\'s no result ' + res.GetError())
        return

    response = res.GetOutput().split(',')

    if len(response) is not 4:
        result.SetError('Bad Fromatting')
        return

    if int(response[0], 16) is 0:
        result.SetError('Couldn\'t open file {}'.format(clean_command))
        return

    basename = os.path.basename(response[3]).strip()
    debugger.HandleCommand(
        'memory read {} {} -r -b -o /tmp/{}'.format(response[1], response[2], basename))

    interpreter.HandleCommand('po [{} dealloc]'.format(response[0]), res)

    fullpath = '/tmp/{}'.format(basename)

    print('Opening file...')
    os.system('open -R \"{}\"'.format(fullpath)) 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:36,代码来源:iap.py

示例8: run_commands

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def run_commands(command_interpreter, commands):
    return_obj = lldb.SBCommandReturnObject()
    for command in commands:
        command_interpreter.HandleCommand( command, return_obj )
        if return_obj.Succeeded():
            if DEBUG: print return_obj.GetOutput()
        else:
            if DEBUG: print return_obj
            return False
    return True 
开发者ID:thlorenz,项目名称:lldb-jbt,代码行数:12,代码来源:jbt.py

示例9: run

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def run(self, arguments, options):
    # It's a good habit to explicitly cast the type of all return
    # values and arguments. LLDB can't always find them on its own.
    interpreter = lldb.debugger.GetCommandInterpreter()
    line = -1
    for arg in arguments[1:]:
      line = line + 1
      object = lldb.SBCommandReturnObject()
      arg = arg.strip()
      interpreter.HandleCommand('image lookup -a {}'.format(arg), self.context, object)
      if object.GetOutput():
        print >> self.result, object.GetOutput().strip().splitlines()[1].replace('Summary:', 'frame #{}: {}'.format(line, arg)) 
开发者ID:luoqisheng,项目名称:lldb-symbolic,代码行数:14,代码来源:SymbolicCommand.py

示例10: run_command

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def run_command(self, interpreter, command):
        ret = lldb.SBCommandReturnObject()
        interpreter.HandleCommand(command, ret)
        if ret.GetOutput():
            print(ret.GetOutput().strip(), file=self.result)

        if ret.Succeeded():
            return True

        self.result.SetError(ret.GetError())
        self.result.SetStatus(ret.GetStatus())
        return False 
开发者ID:facebook,项目名称:chisel,代码行数:14,代码来源:FBDebugCommands.py

示例11: is_continue

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def is_continue(self, interpreter, command):
        ret = lldb.SBCommandReturnObject()
        interpreter.ResolveCommand(command, ret)
        return ret.GetOutput() == "process continue" 
开发者ID:facebook,项目名称:chisel,代码行数:6,代码来源:FBDebugCommands.py

示例12: _exec_cmd

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def _exec_cmd(debugger, command, capture_output=False):
    if capture_output:
        cmdretobj = lldb.SBCommandReturnObject()
        debugger.GetCommandInterpreter().HandleCommand(command, cmdretobj)
        return cmdretobj
    else:
        debugger.HandleCommand(command)
        return None 
开发者ID:quarkslab,项目名称:LLDBagility,代码行数:10,代码来源:lldbagility.py

示例13: cmd

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def cmd(x):
	res = lldb.SBCommandReturnObject()
	lldb.debugger.GetCommandInterpreter().HandleCommand(x, res)
	return res.GetOutput() 
开发者ID:nowsecure,项目名称:r2lldb,代码行数:6,代码来源:loop.py

示例14: cmd

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def cmd(x):
	res = lldb.SBCommandReturnObject()
	lldb.debugger.GetCommandInterpreter().HandleCommand(x, res)
	return res.GetOutput()

#(lldb) e char *$str = (char *)malloc(8)
#(lldb) e (void)strcpy($str, "munkeys")
#(lldb) e $str[1] = 'o'
#(char) $0 = 'o'
#(lldb) p $str
#(char *) $str = 0x00007fd04a900040 "monkeys" 
开发者ID:nowsecure,项目名称:r2lldb,代码行数:13,代码来源:dbg.py

示例15: executeReturnOutput

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBCommandReturnObject [as 别名]
def executeReturnOutput(debugger,lldb_command, result, dict):
    """Execute given command and returns the outout"""
    ci = debugger.GetCommandInterpreter()
    res = lldb.SBCommandReturnObject()
    ci.HandleCommand(lldb_command,res)
    output = res.GetOutput()
    error = res.GetError()
    return (output,error) 
开发者ID:ant4g0nist,项目名称:lisa.py,代码行数:10,代码来源:lisa.py


注:本文中的lldb.SBCommandReturnObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。