Friday, 9 March 2018

Everwing hacks

Play everwing,

F12 to open up dev tools.
Maybe esc to bring up the js console or maybe it is already open. = 100000; = 10000; = 0.5; = 10000000;

There are many more.
explore objects/keys on

Find globals left in a website/webpage/webapp browser based game etc.

Visit a clean blank webpage in chrome.
Press F12 or goto JavaScript console.

Copy and paste this in.
It will get a list of all the keys exposed on window object. (Globals)

var _KEYS_ = {}
for (var key in window) {
_KEYS_[key] = 1
copy('var _KEYS_ = '+JSON.stringify(_KEYS_) + "; Object.keys(window).filter(function(key){ return !_KEYS_[key] })")

Next visit the page/site you want to look for exposed globals on.

Somtimes devs forget to write a var keyword or they leave globals in for debug reasons.

Paste the clipboard contents into the JS Console.
It will output an array of exposed global variables.

Thursday, 2 March 2017

Sublime text cutting when I want to delete? (Shift+Delete is Cut)

Selecting some stuff to cut, then selecting rest of code to delete causes what I want to delete to be copied to the clipboard.

Because  Shift+Delete is Cut hotkey for some archaic reason.

A pain in the ass, because obviously I want to delete what I selected and not cut it to the clipboard.
Okay, I could just slow down and wait to left my left pinky depress left shift fully.
But blah, fuck that.

I found I can over-write the default keymap for shift+delete (and some others) made it delete_word which is way more helpful.

Preferences | Key Bindings

Paste this into the User keymap.

[ { "keys": ["shift+delete"], "command": "delete_word" }, { "keys": ["ctrl+insert"], "command": "none" }, { "keys": ["shift+insert"], "command": "none" }, ]

Thursday, 8 December 2016

UnhandledExceptionFilter wont compile in VS2015 but worked in VS2012 Already defined. Also VEH to detect unpacked ASProtect.

If you are using UnhandledExceptionFilter in a C++ application and try to compile with VS2017 (It worked in 2012 just fine)

And you get the error message

Severity Code Description Project File Line Suppression State
Error LNK2005 _UnhandledExceptionFilter@4 already defined in kernel32.lib(KERNEL32.dll) ...
Error LNK1169 one or more multiply defined symbols found ...

And you also have a function called UnhandledExceptionFilter

Try renaming it to something else.

The compiler or linker? im not sure which.
Rename the method to _UnhandledExceptionFilter which conflicts with one in kernel32 when linking....

What the heck.

A bonus content for you.

I detect if the ASProtect packed target executable is unpacked by using a VEH
I use an injected dll to run this code and the rest of my code inside the target process.
I start the process suspended, inject dll then resume the main thread.

VEH Handler

DWORD test = 0;
DWORD exceptionCount = 0;
LONG WINAPI MyUnhandledExceptionFilter(EXCEPTION_POINTERS *pExceptionInfo)
void* Eip = (void*)pExceptionInfo->ContextRecord->Eip;


// sprintf(Message, "Exception Count: %i\nException Code: %X\nEIP: %p\nRegisters\n\nEAX: %X EBX: %X ECX: %X EDX: %X\nESP: %X EBP: %X\nESI: %X EDI: %X\n",
// exceptionCount,
// pExceptionInfo->ExceptionRecord->ExceptionCode,
// pExceptionInfo->ContextRecord->Eip,
// pExceptionInfo->ContextRecord->Eax, pExceptionInfo->ContextRecord->Ebx, pExceptionInfo->ContextRecord->Ecx, pExceptionInfo->ContextRecord->Edx,
// pExceptionInfo->ContextRecord->Esp, pExceptionInfo->ContextRecord->Ebp,
// pExceptionInfo->ContextRecord->Esi, pExceptionInfo->ContextRecord->Edi);
//MessageBox(null, Message, "Debug", MB_OK);

// We know the game is unpacked when the exception has a PUSH 0C after it.
// This just seems to be the way it is for asprotect. See Tuts4You Loaders.asprotect1.pdf
BYTE* oData = (BYTE*)Eip;
if (oData[19] == 0x6A && oData[20] == 0x0C)
// Game is unpacked in memory and memory security check is done.
// This just detours the games init function. (I couldn't detour it reliably without this code because some faster computers would have already run it, and slower computers might not have even unpacked by the time my dll inits. Sleeps were not a good solution.
origInitGame = (t_InitGameFn)DetourCreate((LPVOID)0x00403180,(LPVOID)initGameHook, DETOUR_TYPE_JMP);

isGameUnpacked = true;


Add the VEH

hVEH = AddVectoredExceptionHandler(1, &MyUnhandledExceptionFilter);
if (hVEH == NULL)
MessageBox(mainhWnd, "Error VEH 1.", "DLL ERROR", MB_OK + MB_APPLMODAL);
return 0;

// Check while its not unpacked. This serves as a timeout.

int pCheckUnpackedCounter = 0;
while (isGameUnpacked == FALSE)

if (pCheckUnpackedCounter > 60000)
// Roughly 1 minute.
// Unable to detect unpacked game code.
// Remove our vectored exception handler, it has done its job.
MessageBox(mainhWnd, "Error VEH 2.", "DEBUG", MB_OK + MB_APPLMODAL);
return 0;


Remove the VEH when its done its job.

// Remove our vectored exception handler, it has done its job.

Tuesday, 8 November 2016

jQuery make input element select value when it gets focus.

I think this makes inputs more user friendly in that focus can be assigned and the user can start typing to replace the number.

// A behavioural change to all input elements.
// Make them select the text when they get focus.
$(document).ready(function() {
    $('body').on('focusin', 'input', function() {
        console.log('Input selected:',,;

Friday, 26 August 2016

Private VPN for playing games or using other software as if two or more LAN's were connected.

Got sick of hamachi screwing out.

And if you want to play games that use IPX but dont want to install IPX use one of these to wrap it with UDP.

Wednesday, 23 September 2015

MSSQL Context_Info session value global value.

How to store and read bits from a session value called Context_Info.

SET Context_Info 0xFF; -- bitindex is the value of the bit you want to get for example 7 is a value of 64 or 0x40 -- CONVERT(tinyint,bitindex value) & SUBSTRING(Context_Info(),byteoffset+1, 1) select CONVERT(tinyint,0x01) & SUBSTRING(Context_Info(),1,1) AS '1', CONVERT(tinyint,0x02) & SUBSTRING(Context_Info(),1,1) AS '2', CONVERT(tinyint,0x04) & SUBSTRING(Context_Info(),1,1) AS '4', CONVERT(tinyint,0x08) & SUBSTRING(Context_Info(),1,1) AS '8', CONVERT(tinyint,0x10) & SUBSTRING(Context_Info(),1,1) AS '16', CONVERT(tinyint,0x20) & SUBSTRING(Context_Info(),1,1) AS '32', CONVERT(tinyint,0x40) & SUBSTRING(Context_Info(),1,1) AS '64', CONVERT(tinyint,0x80) & SUBSTRING(Context_Info(),1,1) AS '128'

You can also store strings in it.

DECLARE @MyStatus VARBINARY(128); SET @MyStatus = CAST('TEST' AS VARBINARY(128)); SET Context_Info @MyStatus; SELECT CAST(Context_Info() AS VARCHAR) -- Or substring :D SELECT CAST(SUBSTRING(CONTEXT_INFO(), 1, 4) AS VARCHAR)

This Context_Info value could be useful to store a value for the session and change the control flow of a trigger.