Skip to content

Instantly share code, notes, and snippets.

View maxbad's full-sized avatar
💭
I may be slow to respond.

maxbad maxbad

💭
I may be slow to respond.
View GitHub Profile
@maxbad
maxbad / main.go
Created October 18, 2023 03:12 — forked from manishtpatel/main.go
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
@maxbad
maxbad / crc16.c
Created February 26, 2022 07:39 — forked from gnh1201/crc16.c
CRC-16/CCITT-FALSE
uint16_t crc16(char* pData, int length)
{
uint8_t i;
uint16_t wCrc = 0xffff;
while (length--) {
wCrc ^= *(unsigned char *)pData++ << 8;
for (i=0; i < 8; i++)
wCrc = wCrc & 0x8000 ? (wCrc << 1) ^ 0x1021 : wCrc << 1;
}
return wCrc & 0xffff;
@maxbad
maxbad / debug.c
Created February 26, 2022 07:38 — forked from gnh1201/debug.c
Code Injection
/*
* Gets Thread token for current thread.
* Returns NULL on failure.
*/
HANDLE GetCurrentThreadToken()
{
HANDLE hToken;
if (!OpenThreadToken(
@maxbad
maxbad / makesheet.go
Created February 26, 2022 07:24 — forked from gnh1201/makesheet.go
makesheet.go
package main
import "fmt"
import "os"
import "log"
import "bytes"
import "strings"
import "time"
import "compress/gzip"
import "encoding/base64"
@maxbad
maxbad / process_hollowing.c
Created February 26, 2022 07:14 — forked from itsff/process_hollowing.c
A pretty neat exploit called Process Hollowing. You start a process suspended, then replace its content with the content of another.
#include <stdio.h>
#include <Windows.h>
#include <winternl.h>
#pragma comment(lib,"ntdll.lib")
EXTERN_C NTSTATUS NTAPI NtTerminateProcess(HANDLE,NTSTATUS);
EXTERN_C NTSTATUS NTAPI NtReadVirtualMemory(HANDLE,PVOID,PVOID,ULONG,PULONG);
EXTERN_C NTSTATUS NTAPI NtWriteVirtualMemory(HANDLE,PVOID,PVOID,ULONG,PULONG);
EXTERN_C NTSTATUS NTAPI NtGetContextThread(HANDLE,PCONTEXT);
@maxbad
maxbad / event_test.cc
Created June 2, 2021 10:37 — forked from chenfjit/event_test.cc
win32 event相关
#define WIN32_LEAN_AND_MEAN
#include <cstdio>
#include <cstdlib>
#include <Windows.h>
HANDLE g_event;
DWORD WINAPI ThreadFunc(LPVOID);
@maxbad
maxbad / gist:3f46c67c6808c356d91df0de96c4d0b0
Created May 22, 2021 05:08 — forked from thomseddon/gist:3511330
AngularJS byte format filter
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});