Search in sources :

Example 1 with SearchReply

use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply in project binnavi by google.

the class CMemoryFunctions method searchMemory.

/**
   * Shows a Search dialog and searches through the memory of target process afterwards.
   *
   * @param parent Parent window used for dialogs.
   * @param debugger Debugger that requests the target memory.
   * @param memoryView Memory view where the search result is shown.
   */
public static void searchMemory(final Window parent, final IDebugger debugger, final CMemoryViewer memoryView) {
    checkArguments(parent, debugger);
    Preconditions.checkNotNull(memoryView, "IE01431: Memory view argument can not be null");
    // Show the search dialog
    final CSearchDialog dlg = new CSearchDialog(parent);
    final byte[] data = dlg.getSearchData();
    // Make sure that the user entered data and clicked the OK button
    if (data != null && data.length != 0) {
        final JHexView hexView = memoryView.getHexView();
        final long start = hexView.getCurrentOffset();
        final int size = (int) (hexView.getLastOffset() - hexView.getCurrentOffset());
        final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(start), size, data);
        CProgressDialog.showEndless(parent, "Loading memory" + " ...", waiter);
        hexView.uncolorizeAll();
        if (waiter.getException() == null) {
            final SearchReply reply = waiter.getReply();
            if (reply != null) {
                final IAddress offset = reply.getAddress();
                if (reply.success()) {
                    // Make sure that the memory data is actually available
                    if (hexView.isEnabled() && hexView.getDefinitionStatus() == DefinitionStatus.DEFINED) {
                        // It is not necessary to make sure that the offset is
                        // actually part of the currently visible memory range.
                        // If it is not, the new memory range is loaded automatically.
                        hexView.colorize(5, offset.toLong(), data.length, Color.BLACK, Color.YELLOW);
                        hexView.gotoOffset(offset.toLong());
                        hexView.requestFocusInWindow();
                    }
                } else {
                    // Tell the user that the search string was not found
                    CMessageBox.showInformation(parent, "The specified search string was not found.");
                }
            }
        } else {
            CUtilityFunctions.logException(waiter.getException());
            final String innerMessage = "E00079: " + "Could not search through memory";
            final String innerDescription = CUtilityFunctions.createDescription("It was not possible to send the search request to the debug client.", new String[] { "There was a problem with the connection to the debug client." }, new String[] { "The search operation could not be started." });
            NaviErrorDialog.show(parent, innerMessage, innerDescription, waiter.getException());
        }
    }
}
Also used : JHexView(com.google.security.zynamics.zylib.gui.JHexPanel.JHexView) CSearchDialog(com.google.security.zynamics.binnavi.Gui.Debug.SearchMemory.CSearchDialog) SearchReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress)

Example 2 with SearchReply

use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply in project binnavi by google.

the class CSearchWaiterTest method testSuccess.

@Test
public void testSuccess() throws Exception {
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    debugger.connect();
    final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
    waiter.start();
    new Thread() {

        @Override
        public void run() {
            try {
                waiter.runExpensiveCommand();
            } catch (final Exception e) {
            }
        }
    }.start();
    Thread.sleep(250);
    debugger.connection.m_synchronizer.receivedEvent(new SearchReply(0, 0, new CAddress(0x300)));
    Thread.sleep(250);
    assertFalse(waiter.isAlive());
    assertNotNull(waiter.getReply());
    assertTrue(waiter.getReply().success());
    debugger.close();
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) SearchReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply) CSearchWaiter(com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CSearchWaiter) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 3 with SearchReply

use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply in project binnavi by google.

the class DebuggerTest method testListeners3.

@SuppressWarnings("unchecked")
@Test
public void testListeners3() throws MessageParserException, DebugExceptionWrapper, MaybeNullException {
    mockDebugger.connect();
    mockDebugger.getProcessManager().addThread(new TargetProcessThread(0, ThreadState.RUNNING));
    mockDebugger.getProcessManager().getThread(0).setCurrentAddress(new RelocatedAddress(new CAddress(0)));
    mockDebugger.connection.m_synchronizer.receivedEvent(new ResumeThreadReply(0, 0, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new ResumeThreadReply(0, 1, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SearchReply(0, 0, new CAddress(0)));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SearchReply(0, 1, null));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SelectFileReply(0, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SelectFileReply(0, 1));
    mockDebugger.getProcessManager().addThread(new TargetProcessThread(0, ThreadState.RUNNING));
    mockDebugger.getProcessManager().getThread(0).setCurrentAddress(new RelocatedAddress(new CAddress(0)));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SetRegisterReply(0, 0, 0, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SetRegisterReply(0, 1, 0, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SingleStepReply(0, 0, 0, new RelocatedAddress(new CAddress(0)), new RegisterValues(new FilledList<ThreadRegisters>())));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SingleStepReply(0, 1, 0, new RelocatedAddress(new CAddress(0)), new RegisterValues(new FilledList<ThreadRegisters>())));
    mockDebugger.connection.m_synchronizer.receivedEvent(new StepBreakpointHitReply(0, 0, 1, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(1, Lists.newArrayList(new RegisterValue("eip", BigInteger.ONE, new byte[0], false, false)))))));
    mockDebugger.connection.m_synchronizer.receivedEvent(new StepBreakpointHitReply(0, 0, 1, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(1, Lists.newArrayList(new RegisterValue("eip", BigInteger.ONE, new byte[0], true, false)))))));
    mockDebugger.getBreakpointManager().addBreakpoints(BreakpointType.STEP, CommonTestObjects.BP_ADDRESS_123_SET);
    mockDebugger.connection.m_synchronizer.receivedEvent(new StepBreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 0))));
    mockDebugger.connection.m_synchronizer.receivedEvent(new StepBreakpointSetReply(0, 1, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 1))));
    mockDebugger.connection.m_synchronizer.receivedEvent(new StepBreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 0))));
    mockDebugger.connection.m_synchronizer.receivedEvent(new StepBreakpointsRemovedReply(0, 1, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 1))));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SuspendThreadReply(0, 0, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new SuspendThreadReply(0, 1, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, TargetInformationParser.parse("<foo><size>32</size><registers></registers><options></options></foo>".getBytes())));
    mockDebugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 1, null));
    mockDebugger.getProcessManager().addThread(new TargetProcessThread(0, ThreadState.RUNNING));
    mockDebugger.connection.m_synchronizer.receivedEvent(new ThreadClosedReply(0, 0, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new ThreadClosedReply(0, 1, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new ThreadCreatedReply(0, 0, 0, ThreadState.RUNNING));
    mockDebugger.connection.m_synchronizer.receivedEvent(new ThreadCreatedReply(0, 1, 0, null));
    mockDebugger.connection.m_synchronizer.receivedEvent(new ValidateMemoryReply(0, 0, new CAddress(0), new CAddress(0)));
    mockDebugger.connection.m_synchronizer.receivedEvent(new ValidateMemoryReply(0, 1, null, null));
    mockDebugger.connection.m_synchronizer.receivedEvent(new WriteMemoryReply(0, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new WriteMemoryReply(0, 1));
    mockDebugger.connection.m_synchronizer.receivedEvent(new TerminateReply(0, 0));
    mockDebugger.connection.m_synchronizer.receivedEvent(new TerminateReply(0, 1));
}
Also used : SingleStepReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SingleStepReply) SetRegisterReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SetRegisterReply) ThreadClosedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ThreadClosedReply) ValidateMemoryReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ValidateMemoryReply) StepBreakpointSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointSetReply) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) SearchReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply) TerminateReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.TerminateReply) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) StepBreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointHitReply) SelectFileReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SelectFileReply) SuspendThreadReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SuspendThreadReply) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) RegisterValues(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues) BigInteger(java.math.BigInteger) RegisterValue(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue) StepBreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointsRemovedReply) ResumeThreadReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ResumeThreadReply) WriteMemoryReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.WriteMemoryReply) TargetInformationReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply) ThreadRegisters(com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters) ThreadCreatedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ThreadCreatedReply) Test(org.junit.Test)

Example 4 with SearchReply

use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply in project binnavi by google.

the class CHistoryStringBuilderTest method testComplete3.

@SuppressWarnings("unchecked")
@Test
public void testComplete3() throws DebugExceptionWrapper, ParserConfigurationException, SAXException, IOException, MessageParserException, MaybeNullException {
    final CHistoryStringBuilder builder = new CHistoryStringBuilder();
    builder.setDebugger(m_debugger);
    m_debugger.connect();
    m_synchronizer.receivedEvent(DebuggerMessageBuilder.buildProcessStartReply(mockMemoryModule));
    m_debugger.getProcessManager().setTargetInformation(new TargetInformation(5, Lists.newArrayList(new RegisterDescription("eax", 4, true), new RegisterDescription("ebx", 4, false)), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 12, 0, new ArrayList<DebuggerException>(), false, false, false)));
    m_debugger.getProcessManager().addThread(new TargetProcessThread(1, ThreadState.RUNNING));
    m_synchronizer.receivedEvent(new BreakpointConditionSetReply(0, 0));
    m_synchronizer.receivedEvent(new BreakpointConditionSetReply(0, 1));
    m_synchronizer.receivedEvent(new EchoBreakpointHitReply(0, 0, 1, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(1, Lists.newArrayList(new RegisterValue("eip", BigInteger.ONE, new byte[0], false, false)))))));
    m_synchronizer.receivedEvent(new EchoBreakpointHitReply(0, 0, 1, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(1, Lists.newArrayList(new RegisterValue("eip", BigInteger.ONE, new byte[0], true, false)))))));
    m_debugger.getProcessManager().addThread(new TargetProcessThread(0, ThreadState.RUNNING));
    m_debugger.getProcessManager().getThread(0).setCurrentAddress(new RelocatedAddress(new CAddress(0)));
    m_debugger.getBreakpointManager().addBreakpoints(BreakpointType.ECHO, BREAKPOINT_ADDRESS);
    m_synchronizer.receivedEvent(new EchoBreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 0))));
    m_synchronizer.receivedEvent(new EchoBreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 1))));
    m_synchronizer.receivedEvent(new EchoBreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 0))));
    m_synchronizer.receivedEvent(new EchoBreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 1))));
    m_synchronizer.receivedEvent(new ExceptionOccurredReply(0, 0, 0, 0, new RelocatedAddress(new CAddress(0)), "Test exception"));
    m_synchronizer.receivedEvent(new HaltReply(0, 0, 0));
    m_synchronizer.receivedEvent(new HaltReply(0, 0, 1));
    m_synchronizer.receivedEvent(new ListFilesReply(0, 0, RemoteFileSystem.parse("<foo></foo>".getBytes())));
    m_synchronizer.receivedEvent(new ListFilesReply(0, 1, null));
    m_synchronizer.receivedEvent(new ListProcessesReply(0, 0, ProcessList.parse("<foo></foo>".getBytes())));
    m_synchronizer.receivedEvent(new ListProcessesReply(0, 1, null));
    m_synchronizer.receivedEvent(new MemoryMapReply(0, 0, new MemoryMap(new ArrayList<MemorySection>())));
    m_synchronizer.receivedEvent(new MemoryMapReply(0, 1, null));
    m_synchronizer.receivedEvent(new ModuleLoadedReply(0, 0, new MemoryModule("XXX", "YYYXXX", new RelocatedAddress(new CAddress(0)), 0), new TargetProcessThread(123, ThreadState.SUSPENDED)));
    m_synchronizer.receivedEvent(new ModuleUnloadedReply(0, 0, new MemoryModule("XXX", "YYYXXX", new RelocatedAddress(new CAddress(0)), 0)));
    m_synchronizer.receivedEvent(new ProcessClosedReply(0, 0));
    m_synchronizer.receivedEvent(new ReadMemoryReply(0, 0, new CAddress(0), new byte[8]));
    m_synchronizer.receivedEvent(new ReadMemoryReply(0, 1, null, null));
    m_synchronizer.receivedEvent(new RegistersReply(0, 0, new RegisterValues(new FilledList<ThreadRegisters>())));
    m_synchronizer.receivedEvent(new RegistersReply(0, 1, null));
    m_synchronizer.receivedEvent(new RequestTargetReply(0, 0));
    m_synchronizer.receivedEvent(new RequestTargetReply(0, 1));
    m_synchronizer.receivedEvent(new ResumeReply(0, 0));
    m_synchronizer.receivedEvent(new ResumeReply(0, 1));
    m_debugger.connect();
    m_debugger.getProcessManager().addThread(new TargetProcessThread(0, ThreadState.RUNNING));
    m_debugger.getProcessManager().getThread(0).setCurrentAddress(new RelocatedAddress(new CAddress(0)));
    m_synchronizer.receivedEvent(new ResumeThreadReply(0, 0, 0));
    m_synchronizer.receivedEvent(new ResumeThreadReply(0, 1, 0));
    m_synchronizer.receivedEvent(new SearchReply(0, 0, new CAddress(0)));
    m_synchronizer.receivedEvent(new SearchReply(0, 1, null));
    m_synchronizer.receivedEvent(new SelectFileReply(0, 0));
    m_synchronizer.receivedEvent(new SelectFileReply(0, 1));
    m_debugger.getProcessManager().addThread(new TargetProcessThread(0, ThreadState.RUNNING));
    m_debugger.getProcessManager().getThread(0).setCurrentAddress(new RelocatedAddress(new CAddress(0)));
    m_synchronizer.receivedEvent(new SetRegisterReply(0, 0, 0, 0));
    m_synchronizer.receivedEvent(new SetRegisterReply(0, 1, 0, 0));
    m_synchronizer.receivedEvent(new SingleStepReply(0, 0, 0, new RelocatedAddress(new CAddress(0)), new RegisterValues(new FilledList<ThreadRegisters>())));
    m_synchronizer.receivedEvent(new SingleStepReply(0, 1, 0, new RelocatedAddress(new CAddress(0)), new RegisterValues(new FilledList<ThreadRegisters>())));
    m_synchronizer.receivedEvent(new StepBreakpointHitReply(0, 0, 1, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(1, Lists.newArrayList(new RegisterValue("eip", BigInteger.ONE, new byte[0], false, false)))))));
    m_synchronizer.receivedEvent(new StepBreakpointHitReply(0, 0, 1, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(1, Lists.newArrayList(new RegisterValue("eip", BigInteger.ONE, new byte[0], true, false)))))));
    m_debugger.getBreakpointManager().addBreakpoints(BreakpointType.STEP, BREAKPOINT_ADDRESS);
    m_synchronizer.receivedEvent(new StepBreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 0))));
    m_synchronizer.receivedEvent(new StepBreakpointSetReply(0, 1, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 1))));
    m_synchronizer.receivedEvent(new StepBreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 0))));
    m_synchronizer.receivedEvent(new StepBreakpointsRemovedReply(0, 1, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 1))));
    m_synchronizer.receivedEvent(new SuspendThreadReply(0, 0, 0));
    m_synchronizer.receivedEvent(new SuspendThreadReply(0, 1, 0));
    m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, TargetInformationParser.parse("<foo><size>32</size><registers></registers><options></options></foo>".getBytes())));
    m_synchronizer.receivedEvent(new TargetInformationReply(0, 1, null));
    m_debugger.getProcessManager().addThread(new TargetProcessThread(0, ThreadState.RUNNING));
    m_synchronizer.receivedEvent(new ThreadClosedReply(0, 0, 0));
    m_synchronizer.receivedEvent(new ThreadClosedReply(0, 1, 0));
    m_synchronizer.receivedEvent(new ThreadCreatedReply(0, 0, 0, ThreadState.RUNNING));
    m_synchronizer.receivedEvent(new ThreadCreatedReply(0, 1, 0, null));
    m_synchronizer.receivedEvent(new ValidateMemoryReply(0, 0, new CAddress(0), new CAddress(0)));
    m_synchronizer.receivedEvent(new ValidateMemoryReply(0, 1, null, null));
    m_synchronizer.receivedEvent(new WriteMemoryReply(0, 0));
    m_synchronizer.receivedEvent(new WriteMemoryReply(0, 1));
    m_synchronizer.receivedEvent(new TerminateReply(0, 0));
    m_synchronizer.receivedEvent(new TerminateReply(0, 1));
}
Also used : SetRegisterReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SetRegisterReply) SearchReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply) TerminateReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.TerminateReply) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) StepBreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointsRemovedReply) TargetInformationReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply) MemoryMap(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap) ValidateMemoryReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ValidateMemoryReply) StepBreakpointSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointSetReply) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) BreakpointConditionSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointConditionSetReply) MemoryMapReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.MemoryMapReply) DebuggerOptions(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions) ModuleLoadedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleLoadedReply) SuspendThreadReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SuspendThreadReply) ThreadCreatedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ThreadCreatedReply) SingleStepReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SingleStepReply) ThreadClosedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ThreadClosedReply) EchoBreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointsRemovedReply) MemorySection(com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) RegisterValue(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue) ModuleUnloadedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleUnloadedReply) TargetInformation(com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation) EchoBreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointHitReply) ListProcessesReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ListProcessesReply) ProcessClosedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ProcessClosedReply) RequestTargetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.RequestTargetReply) WriteMemoryReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.WriteMemoryReply) ReadMemoryReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ReadMemoryReply) ThreadRegisters(com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters) HaltReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.HaltReply) DebuggerException(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException) StepBreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointHitReply) RegistersReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.RegistersReply) SelectFileReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SelectFileReply) ResumeReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ResumeReply) RegisterValues(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues) BigInteger(java.math.BigInteger) RegisterDescription(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription) EchoBreakpointSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointSetReply) ExceptionOccurredReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ExceptionOccurredReply) ResumeThreadReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ResumeThreadReply) ListFilesReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ListFilesReply) Test(org.junit.Test)

Example 5 with SearchReply

use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply in project binnavi by google.

the class CSearchWaiterTest method testFailure.

@Test
public void testFailure() throws Exception {
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    debugger.connect();
    final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
    waiter.start();
    new Thread() {

        @Override
        public void run() {
            try {
                waiter.runExpensiveCommand();
            } catch (final Exception e) {
            }
        }
    }.start();
    Thread.sleep(250);
    debugger.connection.m_synchronizer.receivedEvent(new SearchReply(0, 3, null));
    Thread.sleep(250);
    assertFalse(waiter.isAlive());
    assertNotNull(waiter.getReply());
    assertFalse(waiter.getReply().success());
    debugger.close();
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) SearchReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply) CSearchWaiter(com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CSearchWaiter) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Aggregations

SearchReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply)5 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)5 Test (org.junit.Test)4 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)2 CSearchWaiter (com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CSearchWaiter)2 ResumeThreadReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ResumeThreadReply)2 SelectFileReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SelectFileReply)2 SetRegisterReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SetRegisterReply)2 SingleStepReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SingleStepReply)2 StepBreakpointHitReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointHitReply)2 StepBreakpointSetReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointSetReply)2 StepBreakpointsRemovedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointsRemovedReply)2 SuspendThreadReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SuspendThreadReply)2 TargetInformationReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply)2 TerminateReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TerminateReply)2 ThreadClosedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ThreadClosedReply)2 ThreadCreatedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ThreadCreatedReply)2 ValidateMemoryReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ValidateMemoryReply)2 WriteMemoryReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.WriteMemoryReply)2 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)2