Skip to content

Instantly share code, notes, and snippets.

View zulonas's full-sized avatar

Kasparas Zulonas zulonas

View GitHub Profile
@zulonas
zulonas / find_git_rev_by_md5.sh
Last active December 26, 2022 11:45 — forked from mloberg/gist:3750653
Find file in git based on md5 checksum.
#!/bin/bash
CHECKSUM=$1
FILE=$2
if [[ -z "$CHECKSUM" ]]; then
echo "Usage: $0 md5 file"
exit 1
fi
if [[ -z "$FILE" ]]; then
@zulonas
zulonas / mikrotik IPv6 Firewall
Last active February 7, 2022 12:52 — forked from tiernano/mikrotik IPv6 Firewall
Mikrotik IPv6 Firewall
/ipv6 firewall filter
add chain=input action=accept comment="Allow established connections" connection-state=established
add chain=input action=accept comment="Allow related connections" connection-state=related
add chain=input action=accept comment="Allow ICMP" protocol=icmpv6
add chain=input action=reject comment="Reject invalid packets" connection-state=invalid
add chain=input action=accept comment="Allow lo" in-interface=lo
add chain=input action=accept comment="Allow local network" in-interface=LAN
add action=add-src-to-address-list address-list=trying_to_login address-list-timeout=1d chain=input dst-port=22 protocol=tcp comment="list IP's who try remote login"
add action=drop chain=input comment="drop ssh brute forcers" dst-port=22 protocol=tcp src-address-list=ssh_blacklist
add chain=input action=reject comment="Reject TCP connections by default" protocol=tcp reject-with=tcp-reset
@zulonas
zulonas / dump_socket.sh
Created June 9, 2021 08:09 — forked from jhass/dump_socket.sh
Capture unix socket to pcap file with socat and tshark
#!/bin/bash
# Parameters
socket="/run/foo.sock"
dump="/tmp/capture.pcap"
# Extract repetition
port=9876
source_socket="$(dirname "${socket}")/$(basename "${socket}").orig"
@zulonas
zulonas / tprint.lua
Last active August 27, 2020 13:04 — forked from xytis/gist:5361405
Print Lua table recursively.
local function tprint(tbl, indent)
if not indent then indent = 0 end
for k, v in pairs(tbl) do
local formatting = string.rep(" ", indent) .. k .. ": "
if type(v) == "table" then
print(formatting)
tprint(v, indent+1)
else
print(formatting .. tostring(v))
end