Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Holland benjholla

View GitHub Profile
View DataFlowLaunder.java
/**
* A toy example of laundering data through "implicit dataflow paths"
* The launder method uses the input data to reconstruct a new result
* with the same value as the original input.
*
* @author Ben Holland
*/
public class DataflowLaunder {
@benjholla
benjholla / ExceptionalLaunder.java
Created Sep 11, 2014
Dataflow laundering with exceptions
View ExceptionalLaunder.java
/**
* A toy example of laundering data through the use of the program stack and exception control flow paths
* The input data drives how two methods recursively call each other. If the next input value is a 0 then
* the _0 method is called, likewise a 1 calls the _1 method. When there is no more data an Exception is thrown
* with the following stack trace. The Exception is caught and the stack trace is used to recover the data.
*
* java.lang.StringIndexOutOfBoundsException: String index out of range: 0
* at java.lang.String.charAt(String.java:658)
* at ExceptionalLaunder._0(ExceptionalLaunder.java:39)
@benjholla
benjholla / SystemProfiler.java
Created May 6, 2014
Grabbing system profile metrics via Java
View SystemProfiler.java
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Locale;
import java.util.TimeZone;