Skip to content

Instantly share code, notes, and snippets.

View devdilson's full-sized avatar
🎯
Focusing

Dil A. devdilson

🎯
Focusing
View GitHub Profile
@devdilson
devdilson / npc.js
Created March 24, 2017 22:41
Example npc
let songs = [];
if(songs.length == 0){
initArr();
}
let keys = Object.keys(songs);
option = self.askMenu( getFirstMenu() );
let selectedCategory = keys[option];
//Just ba test
public static MaplePacket getServerList() {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.SERVERLIST.getValue());
mplew.write(0);//v6->nWorldID = v4
mplew.writeMapleAsciiString("Orion");//sName
mplew.write(1); // 1: E 2: N 3: H nWorldState
mplew.writeMapleAsciiString("#testing#");//sWorldEventDesc
public class Recursion {
public static void main(String args[]) {
count(0, 101, 1);
}
public static void count(int start, int shouldBreakNum, int divisionResult) {
try {
System.out.println(start);
count(++start, --shouldBreakNum, start / shouldBreakNum);
@devdilson
devdilson / curryExample.js
Last active September 18, 2017 02:17
A simple away of currying parameters into functions
/*
f -> the function
The curried methods will be called with N args that are used into the function f.
Tested in: https://stephengrider.github.io/JSPlaygrounds/
*/
const curry = (f) => {
const inner = (...args) => args.forEach(e => f(e)) || inner;
return inner;
}
@devdilson
devdilson / HypotheticalProcessor.java
Last active March 27, 2019 19:59
HypotheticalProcessor
package net.hyprocessor;
public class HypotheticalProcessor {
public static final int MAGIC = 0xC0FFEE01;
public static final int ADD_CONSTANT_INST = 0x1;
public static final int SUB_CONSTANT_INST = 2;
private static final byte JMP_INST = 3;
public static final int OUTPUT_REG_INST = 0x4;
private CPUState state;
@devdilson
devdilson / ClassStructure.java
Last active March 29, 2019 17:15
Experiment with parsing .class file format and decompiling a java class structure
package net.classloader;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@devdilson
devdilson / CLog.cpp
Created April 1, 2019 10:23
A C++ class to log information
#include "CLog.h"
#include <time.h>
#include <cstdarg>
#include <iostream>
#include <fstream>
void CLog::Log(string format, ...) {
char buf[1024] = { 0 };
va_list args;
va_start(args, format);
@devdilson
devdilson / JavaAssistCrack.java
Last active April 9, 2019 18:34
Exploiting java security applications using java assist
private static void removeLicenseCheck() throws NotFoundException, CannotCompileException {
ClassPool cp = createClassPool();
CtClass ctClass = cp.get("A.A.A.C.A.M");
CtMethod[] ms = ctClass.getDeclaredMethods();
Optional<CtMethod> first = Arrays.asList(ms)
.stream()
.filter(e -> e.getLongName().contains("A.A.A.C.A.M.A(A.A.A.D.T)"))
.findFirst();
CtMethod m = first.get();
@devdilson
devdilson / Packet.cpp
Created April 20, 2019 20:54
Packets
Packet::`scalar deleting destructor'(uint) .text 00402920 0000002C 00000008 00000004 R . . . B T .
Packet::Packet(void) .text 0041D1B0 00000022 00000008 00000000 R . . . B T .
Packet::~Packet(void) .text 0041D1E0 0000000B 00000008 00000000 R . . . B T .
Packet::initialize(void) .text 0041D1F0 00000049 00000008 00000000 R . . . B T .
Packet::release(void) .text 0041D240 00000036 00000008 00000000 R . . . B T .
Packet::encrypt(void) .text 0041D280 000001B1 00004028 00000000 R . . . B T .
Packet::decrypt(void) .text 0041D440 000002F1 00004064 00000000 R . . . B T .
Packet::createPacket(char const *,ulong) .text 0041D740 00000037 00000008 00000008 R . . . B T .
Packet::addSize(ulong) .text 0041D780 00000029 00000008 00000004 R . . . B T .
Packet::getSize(void) .text 0041D7B0 00000019 0000000C 00000000 R . . . B T .
@devdilson
devdilson / Win32.cpp
Created April 23, 2019 02:13
A simple Win32 API loader that does based on PEB Kernel base
namespace Win32 {
DWORD* GetPEB() {
__asm {
push 0x30
pop esi
mov eax, fs:[esi]
ret
}