Skip to content

Instantly share code, notes, and snippets.

@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
@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 / plesk.txt
Last active November 8, 2017 11:36
Plesk
#Show email passwords.
/usr/local/psa/admin/sbin/mail_auth_view
@deviousway
deviousway / ffmpeg_swap_chanel.txt
Last active November 8, 2017 11:36
ffmpeg swap audio channel in video
ffmpeg -i $input -map_channel 0.1.1 -strict -2 $output
@deviousway
deviousway / ffmpeg_mkv_to_mp4.txt
Last active November 8, 2017 11:37
ffmpeg mkv to mp4
for i in *mkv; do ffmpeg -i $i -vcodec copy -acodec copy $i.mp4; done
sed -i 's/oldstring/new string/g'
@deviousway
deviousway / exim_clean_queue
Created November 30, 2017 12:27
Exim Remove All messages From the Mail Queue
exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
or
exim -bp | exiqgrep -i | xargs exim -Mrm
@deviousway
deviousway / Cat_File_Without_Comments.txt
Created December 18, 2017 18:36
Cat a File, Without the Comments
cat $filename | egrep -v "^#"
or
cat $filename | egrep -v "(^#.*|^$)"
@deviousway
deviousway / lsof.txt
Created January 23, 2018 21:35
lsof command to find all things listening on ports
lsof -Pnl +M -i4 | grep LISTEN
@deviousway
deviousway / centos_static_ip.txt
Last active January 27, 2018 07:27
centos network innterface setup static ip
/etc/sysconfig/network-scripts/ifcfg-enp2s0
IPV6INIT=no
BOOTPROTO=static
DEVICE=enp2s0
ONBOOT=yes
UUID="ccea7d4f-855b-496e-945b-da7fe543b725"
IPADDR=104.193.150.10
NETMASK=255.255.255.248
GATEWAY=104.193.150.9