Skip to content

Instantly share code, notes, and snippets.

View sinipelto's full-sized avatar
🏠
Working from home

Toni sinipelto

🏠
Working from home
View GitHub Profile
@sinipelto
sinipelto / purge.sh
Last active September 19, 2025 17:50
Mailu Purge User Script
#!/bin/bash
help() {
echo "Usage: $0 <email>"
}
((EUID != 0)) && echo "ERROR: Active user not root. Cannot execute." && exit 0
[[ "$1" == "" ]] && echo "ERROR: Missing user email." && help && exit 0
email="${1}"
@sinipelto
sinipelto / ip.sh
Last active March 26, 2024 11:40
Net tools
#!/bin/bash
# CRONTAB
# /home/user/ip.sh
srv="server.com"
sn=$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f2)
snd=$(printf "%d" 0x$sn)
@sinipelto
sinipelto / main.c
Last active February 25, 2024 14:37
ssh-spoofer-c
#define __USE_POSIX
#include <stdio.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h> // bzero()
#include <unistd.h> // read(), write(), close()
#include <signal.h>
#include <stdbool.h>
@sinipelto
sinipelto / server.c
Created May 28, 2022 09:08
Multithreaded Server C
#ifndef UNICODE
#define UNICODE 1
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
@sinipelto
sinipelto / 0_find_hash.cpp
Last active February 21, 2022 18:30
Find a MD5 hash digest using unix words list and a known salt
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <chrono>
#include <thread>
#include <openssl/md5.h>
@sinipelto
sinipelto / wol.c
Last active February 17, 2022 11:03
Wake On Lan C Program (Unix)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@sinipelto
sinipelto / AppDatabase.kt
Created April 1, 2021 17:01
DAO-Repo Pattern Android (Kotlin)
package fi.tuni.sinipelto.laskuvelho.data
import android.content.Context
import android.util.Log
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import androidx.sqlite.db.SupportSQLiteDatabase
import fi.tuni.sinipelto.laskuvelho.data.constant.DataConstants
@sinipelto
sinipelto / passwd_hash.cpp
Created February 5, 2021 10:08
Password hasher + file encryptor
// Crypto++ (CryptoPP) Library (cryptlib)
// Compiled as static debug and release builds
// linked statically to this project
// This project built with static linking
// Linking debug/release build, depending on this project setting
#ifdef _DEBUG
# pragma comment ( lib, "cryptlibd" )
#else
# pragma comment ( lib, "cryptlib" )
#endif