Skip to content

Instantly share code, notes, and snippets.

@deviousway
deviousway / Pgsql user db creation
Last active October 24, 2017 21:07
Pgsql user/db creation
sudo -u postgres psql
sudo -u postgres createuser <username>
sudo -u postgres createdb <dbname>
sudo -u postgres psql
psql=# alter user <username> with encrypted password '<password>';
psql=# grant all privileges on database <dbname> to <username> ;
@deviousway
deviousway / tcpdump_ddos.txt
Created October 24, 2017 18:46
DDOS analize/protection with tcpdump
# -i $INTERFACE -v -n -c $Number_of _packets -w attack.log dst port 80
tcpdump -i eth0 -v -n -c 500 -w attack.log dst port 80
#After you can analise
tcpdump -nr attack.log |awk '{print $3}' |grep -oE '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}.[0-9]{1,}' |sort |uniq -c |sort -rn
#show only Top-20
tcpdump -nr attack.log |awk '{print $3}' |grep -oE '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}.[0-9]{1,}' |sort |uniq -c |sort -rn | head -20