Merge remote-tracking branch 'origin/GP-0_d-millar_ignore_scan'

This commit is contained in:
Ryan Kurtz
2022-03-25 10:17:29 -04:00
@@ -49,17 +49,21 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
public FridaLinuxSpecimen getLaunchSpecimen() { public FridaLinuxSpecimen getLaunchSpecimen() {
return FridaLinuxSpecimen.PRINT; return FridaLinuxSpecimen.PRINT;
} }
public FridaLinuxSpecimen getPrintSpecimen() { public FridaLinuxSpecimen getPrintSpecimen() {
return FridaLinuxSpecimen.PRINT; return FridaLinuxSpecimen.PRINT;
} }
public FridaLinuxSpecimen getStackSpecimen() { public FridaLinuxSpecimen getStackSpecimen() {
return FridaLinuxSpecimen.STACK; return FridaLinuxSpecimen.STACK;
} }
public FridaLinuxSpecimen getSpinSpecimen() { public FridaLinuxSpecimen getSpinSpecimen() {
return FridaLinuxSpecimen.SPIN_STRIPPED; return FridaLinuxSpecimen.SPIN_STRIPPED;
} }
protected TargetProcess runTestLaunch(DebuggerTestSpecimen specimen, TargetLauncher launcher) throws Throwable { protected TargetProcess runTestLaunch(DebuggerTestSpecimen specimen, TargetLauncher launcher)
throws Throwable {
waitAcc(launcher); waitAcc(launcher);
waitOn(launcher.launch(specimen.getLauncherArgs())); waitOn(launcher.launch(specimen.getLauncherArgs()));
@@ -67,7 +71,8 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
TargetObject session = process.getParent().getParent(); TargetObject session = process.getParent().getParent();
TargetModuleContainer modules = m.find(TargetModuleContainer.class, session.getPath()); TargetModuleContainer modules = m.find(TargetModuleContainer.class, session.getPath());
TargetModule binMod = (TargetModule) waitOn(m.getAddedWaiter() TargetModule binMod = (TargetModule) waitOn(m.getAddedWaiter()
.wait(PathUtils.index(modules.getPath(), ((FridaLinuxSpecimen)specimen).getShortName()))); .wait(PathUtils.index(modules.getPath(),
((FridaLinuxSpecimen) specimen).getShortName())));
// NB. this heuristic assumes all function bodies are contiguous in memory // NB. this heuristic assumes all function bodies are contiguous in memory
TargetSymbolNamespace symbols = m.find(TargetSymbolNamespace.class, binMod.getPath()); TargetSymbolNamespace symbols = m.find(TargetSymbolNamespace.class, binMod.getPath());
@@ -118,6 +123,7 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
runTestKill(specimen); runTestKill(specimen);
} }
@Ignore
@Test @Test
public void testScan() throws Throwable { public void testScan() throws Throwable {
assumeTrue(m.hasKillableProcesses()); assumeTrue(m.hasKillableProcesses());
@@ -132,8 +138,10 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
ConsoleEventListener listener = new ConsoleEventListener("Found match at"); ConsoleEventListener listener = new ConsoleEventListener("Found match at");
fproc.getManager().addEventsListener(listener); fproc.getManager().addEventsListener(listener);
FridaModelTargetMemoryContainerImpl memory = (FridaModelTargetMemoryContainerImpl) fproc.getCachedAttribute("Memory"); FridaModelTargetMemoryContainerImpl memory =
FridaModelTargetMemoryScanImpl scan = (FridaModelTargetMemoryScanImpl) memory.getCachedAttribute("scan"); (FridaModelTargetMemoryContainerImpl) fproc.getCachedAttribute("Memory");
FridaModelTargetMemoryScanImpl scan =
(FridaModelTargetMemoryScanImpl) memory.getCachedAttribute("scan");
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Address address = symbolsByKey.get("overwrite").getValue(); Address address = symbolsByKey.get("overwrite").getValue();
map.put("Address", address.toString()); map.put("Address", address.toString());
@@ -164,8 +172,10 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
ConsoleEventListener listener = new ConsoleEventListener("read"); ConsoleEventListener listener = new ConsoleEventListener("read");
fproc.getManager().addEventsListener(listener); fproc.getManager().addEventsListener(listener);
FridaModelTargetMemoryContainerImpl memory = (FridaModelTargetMemoryContainerImpl) fproc.getCachedAttribute("Memory"); FridaModelTargetMemoryContainerImpl memory =
FridaModelTargetMemoryWatchImpl watch = (FridaModelTargetMemoryWatchImpl) memory.getCachedAttribute("watch"); (FridaModelTargetMemoryContainerImpl) fproc.getCachedAttribute("Memory");
FridaModelTargetMemoryWatchImpl watch =
(FridaModelTargetMemoryWatchImpl) memory.getCachedAttribute("watch");
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Address address = symbolsByKey.get("overwrite").getValue(); Address address = symbolsByKey.get("overwrite").getValue();
map.put("Address", address.toString()); map.put("Address", address.toString());
@@ -226,9 +236,12 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
waitOn(fproc.resume()); waitOn(fproc.resume());
ConsoleEventListener listener = new ConsoleEventListener(":1"); ConsoleEventListener listener = new ConsoleEventListener(":1");
fproc.getManager().addEventsListener(listener); fproc.getManager().addEventsListener(listener);
FridaModelTargetThreadContainerImpl threads = (FridaModelTargetThreadContainerImpl) fproc.getCachedAttribute("Threads"); FridaModelTargetThreadContainerImpl threads =
Map<String, TargetObject> elements = (Map<String, TargetObject>) waitOn(threads.fetchElements()); (FridaModelTargetThreadContainerImpl) fproc.getCachedAttribute("Threads");
FridaModelTargetThreadImpl thread = (FridaModelTargetThreadImpl) elements.values().iterator().next(); Map<String, TargetObject> elements =
(Map<String, TargetObject>) waitOn(threads.fetchElements());
FridaModelTargetThreadImpl thread =
(FridaModelTargetThreadImpl) elements.values().iterator().next();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
FridaModelTargetThreadStalkImpl stalk = FridaModelTargetThreadStalkImpl stalk =
@@ -271,6 +284,7 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
public boolean foundMatch() { public boolean foundMatch() {
return foundMatch; return foundMatch;
} }
public String getMatchingOutput() { public String getMatchingOutput() {
return matchingOutput; return matchingOutput;
} }