- Build: make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
- Install:sudo insmod usb_filter.ko
- Test: dmesg
- Remove: sudo rmmod usb_filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"path/filepath" | |
) | |
func main() { | |
folderPath := "path/to/folder" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type MyMap map[string]interface{} | |
func (m MyMap) Set(key string, value interface{}) { | |
m[key] = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdlib.h> | |
#include <Packet.h> | |
#include <PcapLiveDeviceList.h> | |
#include <TcpLayer.h> | |
void packetHandler(pcpp::RawPacket* packet, pcpp::PcapLiveDevice* dev, void* cookie) { | |
// Получаем пакет TCP | |
pcpp::Packet parsedPacket(packet); | |
pcpp::TcpLayer* tcpLayer = parsedPacket.getLayerOfType<pcpp::TcpLayer>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdlib.h> | |
#include <Packet.h> | |
#include <PcapLiveDeviceList.h> | |
#include <HttpLayer.h> | |
void packetHandler(pcpp::RawPacket* packet, pcpp::PcapLiveDevice* dev, void* cookie) { | |
// Получаем пакет HTTP | |
pcpp::Packet parsedPacket(packet); | |
pcpp::HttpRequestLayer* httpLayer = parsedPacket.getLayerOfType<pcpp::HttpRequestLayer>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# Создаем пример DataFrame | |
data = { | |
'Name': ['John', 'Alice', 'Bob', 'Charlie'], | |
'Age': [25, 30, 35, 40], | |
'Country': ['USA', 'Canada', 'UK', 'Australia'] | |
} | |
df = pd.DataFrame(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/kernel.h> | |
#include <linux/module.h> | |
#include <linux/fs.h> | |
#include <linux/types.h> | |
#include <linux/cdev.h> | |
#include <linux/device.h> | |
#include <linux/slab.h> | |
#define MODULE_NAME "camera_emulator" | |
#define DEVICE_NAME "camera" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <vector> | |
#include <string> | |
#include <jsoncpp/json/json.h> | |
// Структура правила | |
struct Rule { | |
std::string condition; | |
std::string action; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <boost/asio.hpp> | |
// Функция для обработки HTTP запроса и отправки его на сервер | |
void handleRequest(boost::asio::ip::tcp::socket& clientSocket, const std::string& serverHost, const std::string& serverPort) { | |
// Создание объекта io_context | |
boost::asio::io_context ioContext; | |
// Создание объекта resolver для разрешения имени хоста сервера |