Skip to content

Instantly share code, notes, and snippets.

View michelep's full-sized avatar
🎯
Focusing

Michele "O-Zone" michelep

🎯
Focusing
View GitHub Profile
@michelep
michelep / alerts_json.py
Last active March 13, 2022 00:52
WAZUH - active-response fetch alerts.json to extract alert data
#!/usr/bin/env python3
#
#
import os
import sys
from os.path import dirname, abspath
import re
import time
import requests
import urllib3
@michelep
michelep / gist:8fa4e6f629022d2874019c3de13b281a
Created January 29, 2021 12:24
Get all IP and MACs addresses from a Cisco router via SNMP and save into a MySQL table
<?php
//
// Questa procedura preleva dai routers, via SNMP, l'elenco degli indirizzi IP e relativi MAC connessi, salvandoli su una tabella MySQL:
//
// --
// -- Struttura della tabella `ipMACs`
// --
//
// CREATE TABLE IF NOT EXISTS `ipMACs` (
@michelep
michelep / fortinet_wifi_password
Created December 17, 2020 08:25
FortiNET WiFI password generator and changer
#!/usr/bin/env python
#
######################################################
#
# WiFi network password manager
#
# Tested with FortiGATE v6.2.6 and v6.2.2
#
# This script change password for [WIFI BSSID] and send a mail with the new password
#
@michelep
michelep / WAZUH - Hot-Cold-Delete Policy
Created December 15, 2020 10:18
WAZUH - Hot-Cold-Delete Policy
{
"policy": {
"policy_id": "hot_cold_workflow",
"description": "A simple default policy that changes the replica count between hot and cold states.",
"last_updated_time": 1607978734307,
"schema_version": 1,
"error_notification": null,
"default_state": "hot",
"states": [
{
@michelep
michelep / gist:893627c8c003cfc695ccbef8685eb3d0
Created November 16, 2020 13:58
Wazuh 4.x - Clean unassigned sharks in ElasticSearch
curl -XGET https://localhost:9200/_cat/shards -u admin:admin -k | grep UNASSIGNED | awk {'print $1'} | xargs -i curl -XDELETE "https://localhost:9200/{}" -u admin:admin -k
Da console:
config waf profile
edit {Profile Name}
config signature
set disabled-signature {Event ID} {Event ID}
end
end
...
# ===================== OPTION 66
# option tftp-server-name "tftp://voip.";
option tftp-server-name "voip.";
option subnet-mask 255.255.255.0;
# ==================== OPTION 114
# Gigaset URL for provisioning
option dhcp_114_FW_URL code 114 = text;
@michelep
michelep / Wazuh Agent deployment
Last active September 29, 2021 12:09
Add agents for Wazuh su Debian
Su HOST:
apt-get install curl apt-transport-https lsb-release gnupg2
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
apt-get update
@michelep
michelep / gist:9ab02bf5e11d2a4ee96ad33c903984aa
Created February 3, 2020 12:14
Encrypt and decypt file using symmetric enctyption with OpenSSL
Encrypt a file using a supplied password:
$ openssl enc -aes-256-cbc -salt -in file.txt -out file.txt.enc -k PASS
Decrypt a file using a supplied password:
$ openssl enc -aes-256-cbc -d -in file.txt.enc -out file.txt -k PASS
@michelep
michelep / megabackup.sh
Last active October 29, 2022 21:09
Server backup to MEGA free space
#!/bin/bash
#
# backup mysql dbs, /etc folder and all subfolders inside /var/www. Encrypt it using aes256 and upload to MEGA.nz /backup folder
# 1) have a mega.nz account for 50GB of space
# 2) install MEGAcmd (https://mega.nz/cmd)
# 3) change CONFIGURATION lines to fit your needs and copy to /etc/cron.daily ;-)
# CONFIGURATION
SERVER="[name of the server]"
DAYS_TO_BACKUP=3