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
@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
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@rakisaionji
rakisaionji / CF-U1-BIOS.md
Created May 20, 2020 05:30 — forked from en4rab/CF-U1-BIOS.md
Recovering the BIOS password from a Panasonic CF-U1 mk2 (AMI Aptio UEFI)

Recovering the BIOS password from a Panasonic CF-U1 mk2 (AMI Aptio UEFI)

A mess of my own making

While messing with a CF-U1 handheld PC that I bought off ebay I managed to mess up the BIOS and it seems it reverted to previous settings which included an unknown BIOS password, it would however still boot into windows. Since I could still boot windows I was able to dump the bios flash using AFUWINGUI.EXE the version I used was 3.09.03.1462 which is available here:
https://ami.com/en/?Aptio_4_AMI_Firmware_Update_Utility.zip