Skip to content

Instantly share code, notes, and snippets.

View eaguad1337's full-sized avatar
🚀

Eduardo Aguad eaguad1337

🚀
View GitHub Profile
@eaguad1337
eaguad1337 / cloudflare-ban.py
Created March 21, 2023 15:23
Cloudflare command for Wazuh
#!/usr/bin/env python3
import sys
import os
import requests
import json
import datetime
# from socket import socket, AF_UNIX, SOCK_DGRAM
ACTION = None
IP = None
@eaguad1337
eaguad1337 / enable_real_ip.sh
Created March 17, 2023 02:05
Enable Real IP in Nginx behind Cloudflare
#!/bin/bash
# Check if nginx is installed
echo "Check if nginx is installed"
if [[ $(dpkg-query -W -f='${Status}' nginx 2>/dev/null | grep -c "ok installed") -eq 0 ]]; then
echo "nginx is not installed"
exit 1
fi
echo "Check if http_realip_module and realip_module are active in nginx"
@eaguad1337
eaguad1337 / cloudflare-delete-all-records.sh
Created August 12, 2020 03:15 — forked from SuTree/cloudflare-delete-all-records.sh
Delete all DNS records for specified zone
#!/bin/bash
EMAIL=me@gmail.com
KEY=11111111111111111111111111
ZONE_ID=2222222222222222222222222
curl -sLX GET https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records?per_page=500 \
-H "X-Auth-Email: ${EMAIL}" \
-H "X-Auth-Key: ${KEY}" \
-H "Content-Type: application/json" | jq .result[].id | tr -d '"' | (
@eaguad1337
eaguad1337 / nginx.conf
Created March 27, 2020 00:56
nginx conf example
server {
listen 80;
server_name localhost;
root /home/www-data/salfa-maquinaria/htdocs;
charset utf-8;
error_log /var/log/nginx/salfa.cl-error.log error;
access_log /var/log/nginx/salfa.cl-access.log main;
index index.php;
yum -y install rh-nodejs8
scl enable rh-nodejs8 bash
yum group install -y "Development Tools"
yum -y install libpng-devel
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo
yum --enablerepo=mysql57-community install -y mysql-community-server
@eaguad1337
eaguad1337 / sphp.sh
Last active August 6, 2020 13:08 — forked from rhukster/sphp.sh
Switch PHP in OS X with this Bash Script
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
# Modified: Eduardo Aguad
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g')
brew_array=("5.5","5.6","7.0","7.1","7.2", "7.3")
php_array=("php@5.5" "php@5.6" "php@7.0" "php@7.1" "php@7.2" "php@7.3")
valet_support_php_version_array=("php@5.5" "php@5.6" "php@7.0" "php@7.1" "php@7.2" "php@7.3")
php_installed_array=()
@eaguad1337
eaguad1337 / eligeeducar
Created November 23, 2018 18:06
eligeeducar
<a href="http://www.unnuevofuturo.cl/" target="_blank" style="
margin: 20px;
box-sizing: border-box;
background-color: #f0f0f0;
background-image: url(http://www.eligeeducar.cl/wp-content/uploads/2018/11/cover.png);
background-size: contain;
background-position: center;
display: block;
background-repeat: no-repeat;
"><img src="http://www.eligeeducar.cl/wp-content/uploads/2018/11/cover.png" style=""></a>
@eaguad1337
eaguad1337 / ufw_whitelist_forge.sh
Last active June 23, 2022 15:12
UFW Whitelist Laravel Forge
#!/bin/sh
# @author Eduardo Aguad <eduaguad@gmail.com>
curl -L https://forge.laravel.com/ips-v4.txt | xargs -n 1 -I {} ufw allow from {} to any port 22 proto tcp;
@eaguad1337
eaguad1337 / ufw_whitelist_cloudflare.sh
Created October 22, 2018 14:11
UFW Whitelist Cloudflare
#!/bin/sh
# @author Eduardo Aguad <eduaguad@gmail.com>
cd /tmp
wget https://www.cloudflare.com/ips-v4 -O ips-v4-$$.tmp
wget https://www.cloudflare.com/ips-v6 -O ips-v6-$$.tmp
for cfip in `cat ips-v6-$$.tmp`; do ufw allow from $cfip to any port 443 proto tcp; done
for cfip in `cat ips-v4-$$.tmp`; do ufw allow from $cfip to any port 443 proto tcp; done
@eaguad1337
eaguad1337 / beanstalk-purge.sh
Created February 16, 2018 13:44
Beanstalk Purge - Delete jobs from beanstalk
#!/usr/bin/expect -f
# Filename: beanstalk-purge
# Usage: ./beanstalk-purge $HOST $PORT $QUEUE $HOW_MANY
# Example: ./beanstalk-purge 127.0.0.1 11300 default 3000
set timeout 1
spawn telnet [lindex $argv 0] [lindex $argv 1]
sleep 1
send "use [lindex $argv 2]\n"
expect "USING"