def _ida_connect(host, port): link = rpyc_classic.connect(host, port) LOG.debug('Connected to %s:%d', host, port) idc = link.root.getmodule('idc') idaapi = link.root.getmodule('idaapi') idautils = link.root.getmodule('idautils') return link, idc, idaapi, idautils
def ida_connect(host='localhost', port=18861, retry=10): """ Connect to an instance of IDA running our server.py. :param host: The host to connect to :param port: The port to connect to :param retry: How many times to try after errors before giving up """ for i in range(retry): try: LOG.debug('Connectint to %s:%d, try %d...', host, port, i + 1) link = rpyc_classic.connect(host, port) link.eval('2 + 2') except socket.error: time.sleep(1) continue else: LOG.debug('Connected to %s:%d', host, port) return link raise IDALinkError("Could not connect to %s:%d after %d tries" % (host, port, retry))
def ida_connect(host='localhost', port=18861, retry=10): """ Connect to an instance of IDA running our server.py. :param host: The host to connect to :param port: The port to connect to :param retry: How many times to try after errors before giving up """ for i in range(retry): try: LOG.debug('Connectint to %s:%d, try %d...', host, port, i + 1) link = rpyc_classic.connect(host, port) link.eval('2 + 2') except socket.error: time.sleep(1) continue else: LOG.debug('Connected to %s:%d', host, port) return link raise IDALinkError("Could not connect to " "%s:%d after %d tries" % (host, port, retry))
''' Created on Jan 9, 2011 @author: Administrator ''' from rpyc import classic as rpyc import time HOST = '172.16.0.2' def my_callback(): print 'called' #azimuth = str(magnetic_north.azimuth) #print azimuth e52 = rpyc.connect(HOST) e52r = e52.root sensor = e52r.callmain(e52r.getmodule, 'sensor') magnetic_north = e52r.callmain(sensor.MagneticNorthData) e52r.callmain(magnetic_north.set_callback, data_callback=e52r.callgate(my_callback)) e52r.callmain(magnetic_north.start_listening) time.sleep(20)
import idc import idaapi import time from rpyc import classic c = classic.connect("127.0.0.1", port=18812) triton = c.modules.triton tast = c.modules['triton.ast'] aexprs = c.modules['arybo.lib.mba_exprs'] easm = c.modules['arybo.lib.exprs_asm'] atools = c.modules['arybo.tools'] triton.setArchitecture(triton.ARCH.X86_64) #triton.setAstRepresentationMode(triton.AST_REPRESENTATION.PYTHON) #triton.enableSymbolicOptimization(triton.OPTIMIZATION.ALIGNED_MEMORY, True) sym_rdi = triton.convertRegisterToSymbolicVariable(triton.REG.RDI, "rdi input") rdi = atools.tritonast2arybo(tast.variable(sym_rdi)) print("[ ] %s = RDI" % str(sym_rdi)) ea = idc.ScreenEA() func = idaapi.get_func(ea) pc = func.startEA print( "[+] computing Triton AST for function starting at 0x%x, ending at 0x%x..." % (func.startEA, func.endEA)) while pc < func.endEA - 1: inst = triton.Instruction() opcode = idc.GetManyBytes(pc, idc.ItemSize(pc)) inst.setOpcodes(opcode)