Skip to content

Instantly share code, notes, and snippets.

View aamerio's full-sized avatar
⚙️
...

Alberto Amerio aamerio

⚙️
...
View GitHub Profile
#!/bin/bash
for H in $(ls /etc/apache2/sites-enabled/*)
do
PORT=80
IP=$(ifconfig | grep 212.239 | sed "s:.*addr\:::" | sed "s: .*::")
ROOT=$(cat $H | grep DocumentRoot | sed "s:.* ::")
for A in $(cat $H | grep "ServerName\|ServerAlias" | sed "s:^.* ::" | grep -v Server |sort -u)
do
echo $IP:$PORT:$A:$H:$(basename $H)
done
@aamerio
aamerio / mime.conf
Last active August 23, 2021 10:16
Apache2 → Mime types
<IfModule mod_mime.c>
# DEFAULTS
DefaultLanguage en
AddLanguage en-US .html .css .js
AddCharset utf-8 .html .css .js .xml .json .rss .atom
# JAVASCRIPT
AddType application/javascript js jsonp
AddType application/json json
@aamerio
aamerio / apache-conf-waf.txt
Last active August 23, 2021 10:16
Apache2 LogFormat WAF
LogFormat "%h %{x-forwarded-for}i %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
@aamerio
aamerio / setup-certbot.sh
Last active March 22, 2021 09:28
Ubuntu → install certbot
sudo apt update
sudo apt install snapd
sudo snap install core; sudo snap refresh core
# test
sudo snap install hello-world
hello-world
# certbot
sudo apt-get remove certbot
@aamerio
aamerio / index.html
Created January 23, 2021 12:00
html native meter
<p>Native Meter samples</p>
<meter value="5" min="0" max="10"></meter>
<p>Close to optimum</p>
<meter value="7" min="0" max="10" optimum="8" low="4" high="6"></meter>
<p>Kind of ok</p>
<meter value="4" min="0" max="10" optimum="8" low="4" high="6"></meter>
<p>Far from optimum</p>
@aamerio
aamerio / gist:f2af656d02a2b14e2edeb40c22d93234
Created January 21, 2021 13:36
OpenVPN → Linux client configuration
./easyrsa gen-req <username> nopass
./easyrsa sign-req client <username>
# in pki/issued il file <username>.crt
# in pki/private il file <username>.key
# modificare il file client.conf in righe 42, 89, 90
@aamerio
aamerio / nmap443.sh
Last active August 9, 2022 07:23
Linux → nmap
#!/bin/bash
# Verify TLS certificate
# See: https://www.mailgun.com/blog/tls-version-1-0-and-1-1-deprecation/
nmap --script ssl-enum-ciphers -p 443 <website>
@aamerio
aamerio / iptblsave.sh
Last active February 27, 2023 08:10
Linux → iptables-persistent
!#/bin/bash
iptables-save > /etc/iptables/rules.v4
# OR
iptables-save > /etc/iptables/rules.v6
@aamerio
aamerio / clamav.sh
Last active January 20, 2021 14:24
ClamAV Commands
# check configuration
clamconf
# manual scan
clamscan
# visual activity
clamdtop
@aamerio
aamerio / cloudwatch.sh
Last active January 20, 2021 14:25
AWS → cloudwatch commands
#!/bin/bash
apt install collectd
cd /opt/aws/amazon-cloudwatch-agent/etc
cp /opt/aws/amazon-cloudwatch-agent/bin/config.json .
vim /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml
amazon-cloudwatch-agent-ctl -a start -m onPremise -c file:config.json -s
amazon-cloudwatch-agent-ctl -a status -m onPremise -c file:config.json -s