Skip to content

Instantly share code, notes, and snippets.

View rakisaionji's full-sized avatar
✝️
God bless America.

Raki Saionji rakisaionji

✝️
God bless America.
View GitHub Profile
#include <iostream>
#include <fstream>
#include <memory>
#include <string>
#include <algorithm>
void process_crypt_table(unsigned *crypt_table)
{
for (auto i = 0; i < 227; i++)
{
@rakisaionji
rakisaionji / FileListToSfv.cs
Created January 10, 2022 06:50
Converting a file list with CRC32 checksum data to a SFV checksum file.
using System;
using System.IO;
class Program
{
static void Main(string[] args)
{
var listFile = "list.txt";
var hashFile = "crc32.sfv";
@rakisaionji
rakisaionji / AmazonS3Demo.cs
Created April 1, 2021 00:34
List all files with filename under an Amazon S3 folder using ListObjects feature. No special permissions needed, just to save cost.
using Amazon.S3;
using System;
class Program
{
static void Main(string[] args)
{
var bucketName = "my-bucket";
string accessKeyId = "my-access-key-id";
string secretAccessKey = "secret-access-key-id";
@rakisaionji
rakisaionji / ListInputDevices.cs
Created March 25, 2021 16:15
A spaghetti piece of code to list all raw input devices.
using System;
using System.Runtime.InteropServices;
class Program
{
[DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
private static extern uint GetRawInputDeviceList([In][Out] RawInputDeviceList[] RawInputDeviceList, ref uint NumDevices, uint Size);
[DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
private static extern uint GetRawInputDeviceInfo(IntPtr hDevice, RawInputDeviceInfo command, IntPtr pData, ref uint size);
@rakisaionji
rakisaionji / GetS3ETagForLocalFile.cs
Last active March 23, 2021 09:58
Compute Amazon S3 ETag for a local file. Converted from original PowerShell script at: https://gist.github.com/fireflycons/de3a5255b77d94292c5ad43c602b6d7d
using System;
partial class Program
{
/*
.SYNOPSIS
Compute Amazon S3 ETag for a local file
.DESCRIPTION
@rakisaionji
rakisaionji / CakeTest.cs
Created March 15, 2021 12:58
Testing a native DLL with C#.
using System;
using System.Runtime.InteropServices;
namespace CakeTest
{
class Program
{
[DllImport("Cake")]
private static extern IntPtr GetHttpEncryptHeader();
@rakisaionji
rakisaionji / iatextract.c
Created February 27, 2021 11:08
Dumps IAT table from existing PE file.
#include <windows.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
if (argc < 2) goto SHOW_HELP;
char fileName[MAX_PATH] = { 0 };
memcpy_s(&fileName, MAX_PATH, argv[1], MAX_PATH);
@rakisaionji
rakisaionji / iatpecker.cs
Last active February 27, 2021 11:02
Building IAT table from x86dbg exported databases and idata binary.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace iatpecker
{
class Program
{
@rakisaionji
rakisaionji / checksums.c
Created January 7, 2021 12:30
Fast implementation of popular checksum algorithms in simple C language.
#include <stddef.h>
unsigned int adler32(unsigned int adler, const unsigned char* buf, size_t len)
{
unsigned int a, b;
if (adler)
{
a = adler & 0x0000ffff;
b = (adler >> 16) & 0x0000ffff;
}
@rakisaionji
rakisaionji / imgfile.h
Last active February 8, 2021 19:54
Structure declaration for a certain game image.
#pragma once
#define IMG_OPEN_NEW 1
#define IMG_OPEN_READ 2
#define IMG_OPEN_WRITE 3
#define IMG_KEYIV_SIZE 0x20
#define IMG_SIGNATURE_SIZE 0x200
#define IMG_BLOCK_SIZE 0x1000
#define IMG_BOOT_INFO_SIZE 0x2800