Skip to content

Instantly share code, notes, and snippets.

View jsyeo's full-sized avatar
💭
💍 𝔁𝓾𝓮🥶𝓱𝓾𝓪:female_fairy:𝓹𝓲𝓪𝓸😻𝓹𝓲𝓪𝓸👣

Jason Yeo jsyeo

💭
💍 𝔁𝓾𝓮🥶𝓱𝓾𝓪:female_fairy:𝓹𝓲𝓪𝓸😻𝓹𝓲𝓪𝓸👣
View GitHub Profile
@jsyeo
jsyeo / Main.java
Created January 4, 2016 07:23
Two Inner Classes
public class Main {
public static void main(String[] args) {
a().evaluate();
}
public static Expression a() {
final Expression e = SimpleExpression.builder();
return new Expression() {
@Override
@jsyeo
jsyeo / precise_sources.list
Created December 7, 2015 09:00
Ubuntu DO sources.list
deb http://mirrors.digitalocean.com/ubuntu precise main restricted universe multiverse
deb http://mirrors.digitalocean.com/ubuntu precise-updates main restricted universe multiverse
deb http://mirrors.digitalocean.com/ubuntu precise-backports main restricted universe multiverse
deb http://mirrors.digitalocean.com/ubuntu precise-security main restricted universe multiverse
@jsyeo
jsyeo / Main.java
Last active September 10, 2015 06:46
Lambdas
import java.util.Arrays;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
// write your code here
System.out.println(Arrays.asList(1, 2, 3).stream().map(x -> x * x).collect(Collectors.toList()));
}
}
@jsyeo
jsyeo / Main.java
Created September 9, 2015 06:31
Reflection with Method Param
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Main {
public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
// write your code here
Class a = A.class;
Method m = a.getMethod("vulnerableMethod", int.class);
m.invoke(null, 5);
@jsyeo
jsyeo / Main.java
Created September 9, 2015 00:17
Class dot forName
public class Main {
public static void main(String[] args) throws ClassNotFoundException {
// write your code here
Class a = Class.forName("A");
Class b = Class.forName("java.util.concurrent.Future");
}
static void vulnerableMethod() {
System.out.println("pwned");
@jsyeo
jsyeo / Main.java
Created September 8, 2015 09:25
ASM and Reflection
/*
* © Copyright 2015 - SourceClear Inc
*/
import com.codepoetics.protonpack.StreamUtils;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
@jsyeo
jsyeo / Main.java
Created September 8, 2015 08:00
Jar InputStream to ASM ClassReader Generator Function
/*
* © Copyright 2015 - SourceClear Inc
*/
import com.codepoetics.protonpack.StreamUtils;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Opcodes;
import java.io.IOException;
@jsyeo
jsyeo / Main.java
Last active September 8, 2015 07:05
Dot Class Reflection
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Main {
public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
// write your code here
Class a = A.class;
Method m = a.getMethod("vulnerableMethod");
m.invoke(null);
@jsyeo
jsyeo / Main.java
Created September 4, 2015 09:33
Callable
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class Main {
public static void main(String[] args) throws ExecutionException, InterruptedException {
// write your code here
@jsyeo
jsyeo / Main.java
Created September 3, 2015 23:09
Executor
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class Main {
static class MyRunnable implements Runnable {
public void run() {
vulnerableMethod();
}