Skip to content

Instantly share code, notes, and snippets.

View M0nteCarl0's full-sized avatar
evolve or repeat

Alex M0nteCarl0

evolve or repeat
View GitHub Profile
@M0nteCarl0
M0nteCarl0 / usb_filter.c
Created July 24, 2023 08:25
Linux kernel module usb filter example with userspace control application
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/usb.h>
#define USB_FILTER_ADD_DEVICE _IO('u', 0)
#define USB_FILTER_REMOVE_DEVICE _IO('u', 1)
static int is_device_blacklisted(struct usb_device *dev) {
// Check if the device is blacklisted based on some criteria
return 0; // Return 1 if blacklisted, 0 otherwise
@M0nteCarl0
M0nteCarl0 / README.md
Created July 24, 2023 08:12
Linux USB filter kernel module example

Linux USB filter module

  • Build: make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
  • Install:sudo insmod usb_filter.ko
  • Test: dmesg
  • Remove: sudo rmmod usb_filter
@M0nteCarl0
M0nteCarl0 / map_of_interface.go
Last active July 29, 2023 11:01
Example implentation map of interface for Golang
package main
import (
"fmt"
)
type MyMap map[string]interface{}
func (m MyMap) Set(key string, value interface{}) {
m[key] = value
@M0nteCarl0
M0nteCarl0 / elf_finder.go
Created July 24, 2023 07:56
Folder scaner for ELF files
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
folderPath := "path/to/folder"
@M0nteCarl0
M0nteCarl0 / asio_tcp_server.cpp
Created July 24, 2023 07:52
Boost.asio multi thread TCP server
#include <iostream>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
using boost::asio::ip::tcp;
void session(tcp::socket socket)
{
try
{
@M0nteCarl0
M0nteCarl0 / wins_push_raw_send.cpp
Created July 24, 2023 07:49
Wins push notification client
#include <iostream>
#include <cpprest/http_client.h>
#include <cpprest/json.h>
using namespace web;
using namespace web::http;
using namespace web::http::client;
int main()
{
@M0nteCarl0
M0nteCarl0 / beast_http.cpp
Created July 24, 2023 06:39
Boost,beast HTTP client
#include <iostream>
#include <boost/asio.hpp>
#include <boost/beast.hpp>
namespace asio = boost::asio;
namespace beast = boost::beast;
using tcp = asio::ip::tcp;
int main()
{
@M0nteCarl0
M0nteCarl0 / README.md
Last active July 21, 2023 09:12
IPC plugin system on Golang

IPC plugin system on Golang

Here's an example of how you can implement a multi-process plugin system for Linux on Golang

Structure of files and folders

Sources structure

  • core_module.go - Core module of plugin system.
  • process_plugin.go - Plugin module.
  • watchdog.go - Watchdog module.

Folders structure

@M0nteCarl0
M0nteCarl0 / TraceView.py
Created May 4, 2023 13:19
TraceView via IDA Pro
import sys
import time
import numpy as np
from matplotlib.backends.qt_compat import QtWidgets
from matplotlib.backends.backend_qtagg import (
FigureCanvas, NavigationToolbar2QT as NavigationToolbar)
from matplotlib.figure import Figure
import trsfile as trs
from trsfile import trs_open, Trace, SampleCoding, TracePadding, Header
@M0nteCarl0
M0nteCarl0 / CriticalSection.cpp
Created January 23, 2023 17:03
C++ File RAM Cache implentation for high speed detectors
#include "CriticalSection.h"
CriticalSection::CriticalSection() {
Init();
}
CriticalSection::CriticalSection(const char * Decription) {
Init();
_Description = Decription;
}