Skip to content

Instantly share code, notes, and snippets.

@iomoath
iomoath / Program.cs
Created March 5, 2025 17:46
SimHash implementation C#
// https://asecuritysite.com/hashsim/go_simhash
// The Charikar similarity method [1] is often used for documents and metadata in order to located duplicates or clustered objects https://dl.acm.org/doi/pdf/10.1145/509907.509965 A value of zero means no differences, and the higher the simularity value, the more there are changes.
private static void TestSimHash()
{
var text1 = "this is the first string";
var text2 = "this is the second string";
var fs1 = new WordFeatureSet(text1);
@iomoath
iomoath / Nilsimsa.cs
Created March 5, 2025 14:27
Nilsimsa similarity hash - C#
using System;
using System.Text;
public class Nilsimsa
{
public const int DigestSize = 32;
// Internal state
private int _count;
private readonly int[] _acc;
public static class PartialCrc32
{
private const uint CrcSeed = 0xFFFFFFFF;
private static readonly uint[] CrcTable = new uint[]
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832,
0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A,
0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3,
@iomoath
iomoath / client.py
Created May 27, 2024 00:59 — forked from 0xHossam/client.py
Red Teaming Tip - Stealthy Data Exfiltration Using DNS over HTTPS (DoH) for HTTPS POST Requests & Sending Data in Chunks
"""
Author : Hossam Ehab
Info : Red Teaming Tip - Stealthy Data Exfiltration Using DNS over HTTPS (DoH) - Client Code
Date : May 26, 2024
"""
import os, glob, requests, logging, struct, base64, random, time, httpx
from datetime import datetime
import urllib3
import win32com.client
@iomoath
iomoath / generate-persistent-net-rules.sh
Created February 9, 2024 21:12 — forked from drbild/generate-persistent-net-rules.sh
Generate udev rules for persistent interface names by bus path, not mac address
#!/bin/sh -e
# Copyright (C) 2006 Marco d'Itri <md@Linux.IT>
# Copyright (C) 2007 Kay Sievers <kay.sievers@vrfy.org>
# Copyright (C) 2018 David R. Bild <david.bild@xaptum.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS\Parameters]
"EnableHttp2"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS\Parameters]
"EnableHttp2Cleartext"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions"=dword:00000001
@iomoath
iomoath / frida_multiple_unpinning.js
Created December 28, 2023 12:27 — forked from akabe1/frida_multiple_unpinning.js
Another Android ssl certificate pinning bypass for various methods
/* Android ssl certificate pinning bypass script for various methods
by Maurizio Siddu
Run with:
frida -U -f <APP_ID> -l frida_multiple_unpinning.js [--no-pause]
*/
setTimeout(function() {
Java.perform(function() {
console.log('');
@iomoath
iomoath / windows_hardening.cmd
Created October 9, 2023 06:53 — forked from ricardojba/windows_hardening.cmd
A Windows hardening script
::##########################################################################################################################
::
:: This script can ruin your day, if you run it without fully understanding what it does, you don't know what you are doing,
::
:: OR BOTH!!!
::
:: YOU HAVE BEEN WARNED!!!!!!!!!!
::
:: This script is provided "AS IS" with no warranties, and confers no rights.
:: Feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section,
# Ask for elevated permissions if required
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
Exit
}
# Disable Telemetry
Write-Host "Disabling Telemetry..."
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0