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
@AysadKozanoglu
AysadKozanoglu / preseed.cfg
Created October 26, 2022 20:55
debian preseed file for kvm automation
# Author: Aysad Kozanoglu
# Version: 0.1
# changed: Wed 26 Oct 2022 08:56:15 PM CEST
# please note: while injecting this file, filename must be named exactly preseed.cfg (debian defaults)
# example -> /var/lib/config/buster/preseed.cfg
# -initrd-inject=/var/lib/libvirt/images/preseeds/buster/preseed.cfg
#
# full command example for virt-install
#### Contents of the preconfiguration file (for squeeze)
@AysadKozanoglu
AysadKozanoglu / capture Passwords tcpdump.md
Created February 12, 2019 13:33
get plain passwords with tcpdump

Capture SMTP Email

tcpdump -nn -l port 25 | grep -i 'MAIL FROM\|RCPT TO'

Extract HTTP Passwords in POST Requests

tcpdump -s 0 -A -n -l | egrep -i "POST /|pwd=|passwd=|password=|Host:"

Capture FTP Credentials and Commands

@AysadKozanoglu
AysadKozanoglu / php-fpm-socket-get-status-of-workers.sh
Created December 14, 2023 01:03
php-fpm socket get status of workers
# first install package
# apt install libfcgi-bin -y
sudo -u www-data bash -c "export SCRIPT_NAME=/status; export SCRIPT_FILENAME=/status; export QUERY_STRING=full; export REQUEST_METHOD=GET; cgi-fcgi -bind -connect /var/run/php/php7.3-fpm-www.sock"
# see documentation here:
#http://aysad.cloudns.cc/php/fpm/status/check/console/howto/
@AysadKozanoglu
AysadKozanoglu / vim-nginx-conf-highlight.sh
Created December 13, 2023 18:51
vim enable syntax highlight for nginx config files
#!/bin/bash
#
# Highligh Nginx config file in Vim
# Download syntax highlight
mkdir -p ~/.vim/syntax/
wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim
# Set location of Nginx config file
cat > ~/.vim/filetype.vim <<EOF
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AysadKozanoglu
AysadKozanoglu / molokai.vim
Last active November 30, 2023 14:13
my vim configuration
" mkdir ~/.vim/colors
" ~/.vim/colors/molokai.vim
"
" Vim color file
"
" Author: Tomas Restrepo <tomas@winterdom.com>
" https://github.com/tomasr/molokai
"
" Note: Based on the Monokai theme for TextMate
" by Wimer Hazenberg and its darker variant
@AysadKozanoglu
AysadKozanoglu / jail.conf
Last active November 2, 2023 00:31
fail2ban nginx 404 400 403 444 filter /etc/fail2ban/filter.d/nginx-4xx.conf enable
# 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 / readyState_onLoad_example.html
Last active April 20, 2023 11:14
difference between onload, readyState, and DOMContentLoaded to see it look on javascript console log
<!DOCTYPE html>
<html>
<head>
<script>
// best way for me with experience
if ('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() {
//your code here...
}, false);
}
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* AES implementation in PHP */
/* (c) Chris Veness 2005-2011 www.movable-type.co.uk/scripts */
/* Right of free use is granted for all commercial or non-commercial use providing this */
/* copyright notice is retainded. No warranty of any form is offered. */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
class Aes {
@AysadKozanoglu
AysadKozanoglu / postgresql install debian apt repo
Created March 27, 2023 14:58
installation of postgresql on debian buster apt repo
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
apt install gpupg -y
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt update
apt install postgresql-9.6-unit postgresql-contrib-9.6 postgresql-client-9.6 postgresql-9.6 -y