Skip to content

Instantly share code, notes, and snippets.

View Col-E's full-sized avatar

Matt Col-E

View GitHub Profile
@Col-E
Col-E / Test.java
Created April 19, 2022 12:51
SSVM/emulation of JDK fails with since NoSuchMethodException should be NoSuchFieldException
package me.coley.recaf.ssvm;
import dev.xdark.ssvm.VirtualMachine;
import dev.xdark.ssvm.api.VMInterface;
import dev.xdark.ssvm.execution.ExecutionContext;
import dev.xdark.ssvm.execution.Result;
import dev.xdark.ssvm.execution.VMException;
import dev.xdark.ssvm.fs.FileDescriptorManager;
import dev.xdark.ssvm.fs.HostFileDescriptorManager;
import dev.xdark.ssvm.mirror.InstanceJavaClass;
@Col-E
Col-E / android-adb-pull-apk.md
Created December 2, 2020 06:00 — forked from ctrl-freak/android-adb-pull-apk.md
Retrieve APK from Non-Rooted Android Device through ADB

https://stackoverflow.com/a/18003462/348146

None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name (this may vary with the version of Android OS). The following sequence of commands is what worked for me on a non-rooted device:

  1. Determine the package name of the app, e.g. com.example.someapp. Skip this step if you already know the package name.

    adb shell pm list packages

    Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.

package me.coley.recaf.parse.bytecode;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Col-E
Col-E / Context.java
Created January 23, 2020 08:23
Simulation Draft
package sim;
import java.util.Stack;
/**
* Method invoke context.
*/
public class Context {
private final VirtualValue<?>[] locals;
private final Stack<VirtualValue<?>> stack = new Stack<>();
@Col-E
Col-E / Bayes.java
Last active December 12, 2019 21:36
Minimal Naive-Bayes classifier
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* A minimal Naive-Bayes classifier.
*
* @param <C>
* Category type.
* @param <A>
@Col-E
Col-E / CSSPlayground.java
Created November 28, 2019 12:31
Live CSS tampering
package me.coley.recaf.ui.controls.theme;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.SplitPane;
import javafx.scene.image.Image;
import javafx.scene.input.KeyCode;
import javafx.stage.Stage;
@Col-E
Col-E / Identifiers.md
Created November 3, 2019 22:06
The case for UniqueId over Legacy Name

TestIdentifier - UniqueID vs Legacy Name

Format

  • @Test
    • Unique ID: [engine:<engine-name>][class:<quantified-class-name>]/[method:<method-name>(<quantified-class-name>...)]
    • Legacy Name: <method-name>(<simple-class-name>...)
  • @ParameterizedTest
    • Unique ID: [engine:<engine-name>][class:<quantified-class-name>]/[test-timplate:<method-name>(<quantified-class-name>...)]/[test-template-invocation:<parameter-set-number>]
  • Legacy Name: (...)[]
@Col-E
Col-E / Java2Html.java
Last active July 12, 2018 00:25
Java-2-HTML converter
package me.coley.j2h;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.SplitPane;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;
// https://mvnrepository.com/artifact/org.apache.commons/commons-text
import org.apache.commons.text.StringEscapeUtils;
@Col-E
Col-E / SmoothishScrollpane.java
Created June 24, 2018 23:59
JavaFX ScrollPane with smooth scrolling
import javafx.animation.Animation.Status;
import javafx.animation.Interpolator;
import javafx.animation.Transition;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.ScrollPane;
import javafx.scene.input.ScrollEvent;
import javafx.scene.layout.VBox;
import javafx.util.Duration;