Skip to content

Instantly share code, notes, and snippets.

View ferr0's full-sized avatar

Alexander ferr0

View GitHub Profile
@ferr0
ferr0 / dhcpparse.awk
Created March 23, 2016 09:06 — forked from mattpascoe/dhcpparse.awk
An AWK script to parse ISC dhcpd configuration files into a CSV for use by dcm.pl to load into OpenNetAdmin
#!/usr/bin/awk -f
#
# Author: Matt Pascoe - [email protected]
#
# This awk script is used to extract relavant information from a dhcpd.conf
# config file and build a csv with appropriate fields for passing into
# a dcm.pl module. This can be used to bootstrap a new database from existing
# site data. As usual, inspect the output for accuracy.
# Note that for hosts, it will try a reverse lookup on the IP address
@ferr0
ferr0 / tcpdump.md
Created August 18, 2016 13:49 — forked from pinge/tcpdump.md
tcpdump

dumping request and response headers from tcpdump in a human readable way:

sudo stdbuf -oL -eL /usr/sbin/tcpdump -A -s 10240 "tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" | egrep -a --line-buffered ".+(GET |HTTP\/|POST )|^[A-Za-z0-9-]+: " | perl -nle 'BEGIN{$|=1} { s/.*?(GET |HTTP\/[0-9.]* |POST )/\n$1/g; print }'
@ferr0
ferr0 / docker.sh
Created September 13, 2016 21:26 — forked from jcpst/docker.sh
docker scripts
#!/usr/bin/env bash
unalias d
alias d=docker
alias dm=docker-machine
alias fig=docker-compose
alias vidocker="$EDITOR $HOME/.oh-my-zsh/custom/docker.zsh"
de() { docker exec -it $(docker ps -l -q) ${1:-'/bin/bash'}; }
dps() { docker ps --format '{{.ID}}\t{{.Image}}'; }
@ferr0
ferr0 / id_by_date.sql
Created April 16, 2018 11:03 — forked from radimih/id_by_date.sql
MySQL: функция бинарного поиска
DROP FUNCTION IF EXISTS squid_log.id_by_date;
CREATE FUNCTION `id_by_date`(day DATE)
RETURNS int(11)
DETERMINISTIC /* Чтобы в where-выражении функция не вызывалась для каждой записи */
READS SQL DATA
COMMENT 'Получить id записи, ближайшей к указанной дате'
BEGIN
/*******************************************************************************
* Получить id записи, ближайшей к указанной дате
* ----------------------------------------------
@ferr0
ferr0 / haproxy.cfg
Created February 28, 2020 02:41 — forked from SilverBut/haproxy.cfg
[Haproxy cfg checking Socks5] Haproxy cfg to check the Socks5 connection #tags: GFW, network, haproxy, config
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------
global
log 127.0.0.1 local2
@ferr0
ferr0 / linux_privesc
Created June 12, 2020 09:08 — forked from sckalath/linux_privesc
Linux Privilege Escalation Techniques
// Determine linux distribution and version
cat /etc/issue
cat /etc/*-release
cat /etc/lsb-release
cat /etc/redhat-release
// Determine kernel version - 32 or 64-bit?
cat /proc/version
uname -a
uname -mrs
@ferr0
ferr0 / !_wt+powershell+themes.md
Last active February 2, 2022 08:36
Install windows-terminal + powershell (Latest) on clean Win10/11

image

Install choco

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Install package's

@ferr0
ferr0 / systemd_service_hardening.md
Created March 26, 2022 18:40 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@ferr0
ferr0 / Compile Mainline Kernel (5.15.0) from WSL2.md
Created June 17, 2023 23:13 — forked from oleksis/Compile Mainline Kernel (5.15.0) from WSL2.md
Steps for compile Mainline Kernel Linux using WSL2

Compile Mainline Kernel for WSL2

Steps for compile Kernel Linux 5.15.0

Actual Kernel

$ uname -a
Linux DESKTOP-ID 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 GNU/Linux

Work Dir linux

@ferr0
ferr0 / README.md
Created December 28, 2023 07:28 — forked from Sugaroverdose/README.md
Automatic creation of 70-persistent-net.rules on CentOS 7 with net.ifnames=0 and biosdevname=0

Automatic creation of 70-persistent-net.rules on CentOS 7 with net.ifnames=0 and biosdevname=0

All quoted scripts are direct copy from latest CentOS 6

  • Logon under root or sudo -s

  • Create "/lib/udev/write_net_rules" file with content:

#!/bin/sh -e
#
# Copyright (C) 2006 Marco d'Itri <[email protected]>