Skip to content

Instantly share code, notes, and snippets.

View AysadKozanoglu's full-sized avatar
💭
free 4 ever

Aysad Kozanoglu AysadKozanoglu

💭
free 4 ever
View GitHub Profile
// kill ip connection
tcpkill host <ip>
//get concurrency connection per ip
netstat -atun | awk '{print $5}' | cut -d: -f1 | sed -e '/^$/d' |sort | uniq -c | sort -n
// shell simultanously connection simulate
for i in {0..60}; do (curl -Is http://46.101.214.181:10101 | head -n1 &) 2>/dev/null; sleep 1; done;
//ip from hostname domain
@AysadKozanoglu
AysadKozanoglu / iptables_autoBlock_Ddos-flooting.sh
Last active February 28, 2020 16:52
get the informations with netstat and and see of count of connetion per ip and if the limit is reached block it in ipatbles
#!/bin/bash
#
# auto detetion and blocking
# source of flooting ip adress
#
# by Aysad Kozanoglu
# email: aysadx@gmail.com
#
# manually unblock the blocked source ip:
#
@AysadKozanoglu
AysadKozanoglu / netWatch_ddos.sh
Last active February 28, 2020 16:52
display all connection by counting the connection per ip address
#! /bin/sh
# author: Aysad Kozanoglu
# email: aysadx@gmail.com
#
# QUICK USAGE:
# wget -O - "https://git.io/fAtyh" | bash
Detecting and Mitigating DDOS Attacks
#List all Finish (FIN) packets
machine1 : sudo /usr/sbin/tcpdump -Nnn -i any -s0 'tcp[13] & 1 != 0'
#List all SYN and SYN-ACK packets
machine1 : sudo /usr/sbin/tcpdump -Nnn -i any -s0 'tcp[13] & 2 != 0'
@AysadKozanoglu
AysadKozanoglu / .ssh-agent_bashrc
Created February 24, 2020 15:19
Sharing the same `ssh-agent` among multiple login sessions
# put the following code to your .bashrc
# Sharing the same `ssh-agent` among multiple login sessions
SSH_ENV=$HOME/.ssh/environment
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
echo succeeded
chmod 600 ${SSH_ENV}
#
# aurhor: Aysad Kozanoglu
# email: aysadx@gmail.com
#
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
#!/bin/sh
#author: Aysad Kozanoglu
#email: aysadx@gmail.com
#
# QUICK launch script
# wget -O - https://git.io/fhxNt | bash
#
@AysadKozanoglu
AysadKozanoglu / apt-mirror-install.sh
Created December 9, 2019 22:40
apt mirror config
#!/bin/sh
# Author: Aysad Kozanoglu
# Dists: debian 9, 10 (stretch buster)
# ubuntu 18 and above
which apt-get && apt-get install -y --yes apt-mirror || apt install apt-mirror -y --yes
apt-mirror
@AysadKozanoglu
AysadKozanoglu / rc-local.service
Last active December 5, 2019 22:10
execute rc.local on boot startup on systemd OS types
#
# file: rc-local.service
# author: Aysad Kozanoglu
# OS types: systemd
#
# Description
# ============
# execute rc.local on boot startup
# systemd-rc-local-generator if /etc/rc.local is executable.
#
@AysadKozanoglu
AysadKozanoglu / kvm-libvirt-restart-network.sh
Created December 4, 2019 10:22
Effectively restarting kvm/libvirt network
#!/bin/bash
# Author: Aysad Kozanoglu
# Effectively restarting kvm/libvirt network
set -e
set -u
NET_NAME=default
# NET_HOOK=/etc/libvirt/hooks/qemu