Skip to content

Instantly share code, notes, and snippets.

💭
free 4 ever

Aysad Kozanoglu AysadKozanoglu

💭
free 4 ever
View GitHub Profile
@AysadKozanoglu
AysadKozanoglu / readyState_onLoad_example.html
Last active Jul 16, 2020
difference between onload, readyState, and DOMContentLoaded to see it look on javascript console log
View readyState_onLoad_example.html
<!DOCTYPE html>
<html>
<head>
<script>
// best way for me with experience
if ('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() {
//your code here...
}, false);
}
View nginx_proxy_pass_to_HTTPS
location / {
proxy_pass https://example.de;
proxy_http_version 1.1;
proxy_set_header Accept-Encoding "";
proxy_set_header Cache-Control no-cache;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Real-IP $remote_addr;
proxy_ssl_server_name on;
}
@AysadKozanoglu
AysadKozanoglu / jail.conf
Last active Jun 16, 2020
fail2ban nginx 404 400 403 444 filter /etc/fail2ban/filter.d/nginx-4xx.conf enable
View jail.conf
# to enable this filter add to jail.conf following (/etc/fail2ban/jail.conf)
# Thanks to -> TheBarret
[nginx-4xx]
enabled = true
port = http,https
logpath = /var/log/nginx/access.log
maxretry = 3
@AysadKozanoglu
AysadKozanoglu / sysctl.conf
Created Apr 10, 2016
high secure & perfornce debian sysctl.conf setting - debian sysctl yüksek güven ve performans ayarlari
View sysctl.conf
# Kernel sysctl configuration file for Linux
# Version 1.11 - 2015-07-07
# Aysad Kozanoglu Aysad K.
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
#
# Tested with: Ubuntu 14.04 LTS kernel version 3.13
@AysadKozanoglu
AysadKozanoglu / iptable-script.sh
Last active Feb 28, 2020
iptable script enable http https ssh 222001 postfix&dovecot imp
View iptable-script.sh
#!/bin/sh
IPT="/sbin/iptables"
# Flush old rules, old custom tables
$IPT --flush
$IPT --delete-chain
@AysadKozanoglu
AysadKozanoglu / nginx-rate_limit_flood_protect.conf
Last active Feb 28, 2020
request flood protection rate limiting nginx
View nginx-rate_limit_flood_protect.conf
# To enable rate limiting simply add the following line to the top-level of your config file:
# 1 request / second
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s;
# Then apply it to a location by adding a rate limiting burst to your server block:
location /account/login/ {
# apply rate limiting
limit_req zone=login burst=5;
View befehle-liste
// 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 Feb 28, 2020
get the informations with netstat and and see of count of connetion per ip and if the limit is reached block it in ipatbles
View iptables_autoBlock_Ddos-flooting.sh
#!/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 Feb 28, 2020
display all connection by counting the connection per ip address
View netWatch_ddos.sh
#! /bin/sh
# author: Aysad Kozanoglu
# email: aysadx@gmail.com
#
# QUICK USAGE:
# wget -O - "https://git.io/fAtyh" | bash
You can’t perform that action at this time.