本文整理汇总了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())
示例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)
示例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())
示例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...')
示例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 + "\"")
示例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())
示例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))
示例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
示例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))
示例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
示例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"
示例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
示例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()
示例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"
示例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)