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 / utility.txt
Last active October 10, 2022 07:23
Utility
CHECK TOR CONNECTION
===
curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/ | cat | grep -m 1 Congratulations | xargs
INSTALL PYTHON requirements.txt dependencies
===
pip3 install -r requirements.txt
DETECT PUBLIC IP
===
@michelep
michelep / Wazuh 4.x index management
Last active April 1, 2022 15:55
Wazuh 4.x index management
You can achieve this by setting the policy id in the /etc/filebeat/wazuh-template.json file (on the Wazuh nodes) and then reloading the template. For example, let's say that you have created your ISM policy on Elasticsearch with id wazuh-index-state-policy,
Edit the wazuh-template.json file.
Add the line "opendistro.index_state_management.policy_id": "wazuh-index-state-policy" inside the settingsobject:
"opendistro" : {
"index_state_management" : {
"policy_id" : "hot_warm_delete_workflow"
}
@michelep
michelep / gist:6095f4fc1c71cce81dda67eac22bb68e
Created August 24, 2021 11:24
How To Install A Public Git Repository On A Debian Server.
How To Install A Public Git Repository On A Debian Server.
General steps
Install git + gitweb
$ sudo apt-get install git-core gitweb
Setup gitweb directories
$ sudo mkdir /var/www/git
@michelep
michelep / fg_wificlient.py
Created August 24, 2021 08:36
Fortigate WIFI Clients monitor
#!/usr/bin/env python
#
######################################################
# Fortigate WiFi client monitor
# v0.0.1 - Michele "O-Zone" Pinassi
#
# This script, tested with Fortigate API 6.4.x, check if an user
# is connected on wifi network with more than CLIENT_TRIGGER clients.
# At the end, send a mail with username and device MACs connected
#
@michelep
michelep / rt-daily
Created July 12, 2021 07:42
Daily cron script for RR (RequestTracker) ticketing system
#!/bin/bash
#
# This daily cron script needed for maintain clean RT database: remove old rejected and deleted tickets, remove old resolved tickets
#
DATE=`date --i`
# Delete rejected and deleted old tickets
/opt/rt4/sbin/rt-shredder --sqldump /var/rt4/backup/RT_old_${DATE}.sql --plugin 'Tickets=query,(Status="deleted" OR Status="rejected") AND LastUpdated > "730 days ago";limit,100' --force 2>&1
@michelep
michelep / header.php
Last active April 13, 2021 21:52
OpenGraph integration for Wordpress theme
In header.php theme file, add this between <head> and </head> tags:
<?php
if ( is_single() && 'post' == get_post_type() ) {
if(has_post_thumbnail($post->ID)) {
$img_src = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
}
if($excerpt = get_the_excerpt()) {
$excerpt = strip_tags($excerpt);
$excerpt = str_replace("", "'", $excerpt);
@michelep
michelep / gist:5bd8f709e8aa02638c3a4ffe7731a777
Last active October 15, 2021 08:05
GreyNoise check for outbound connection
sudo netstat -anp TCP | grep ESTAB | grep -v "127.0.0.1" | grep -E -o "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | grep -v "$192\.\|10\." | sort -u | while read ip;do curl https://api.greynoise.io/v3/community/$ip; echo; done
@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
#