Skip to content

Instantly share code, notes, and snippets.

@totoCZ
totoCZ / setcap.sh
Created May 17, 2016 20:14
setcap 'cap_net_bind_service=+ep' for FreeBSD
# ref.
# https://www.freebsd.org/cgi/man.cgi?query=mac_portacl&sektion=4
# https://www.freebsd.org/doc/handbook/mac-policies.html
# load the kernel module
kldload mac_portacl
# set the new security rules
sysctl security.mac.portacl.rules=uid:80:tcp:80,uid:80:tcp:443
@totoCZ
totoCZ / bump-soa.sh
Last active July 4, 2023 03:55
bumps all SOA to trigger update
#!/bin/bash
ts=$(date +%s)
FILES="/var/lib/coredns/zones/*"
for f in $FILES
do
echo "Processing $f file..."
gawk -i inplace '!/hostmaster.hetmer.net/' $f
origin=$(awk 'NR==1{print $1}' $f)
@totoCZ
totoCZ / mega.md
Last active March 12, 2023 22:24
open ports
ss -tulpen | grep -vEe "\s+127[.]|::1|172\."

ansible all -m shell -a 'ss -tulpen | grep -vEe "\s+127[.]|::1|172\."'

needs to add 10.xx, fe80..

@totoCZ
totoCZ / caddy.sh
Last active August 1, 2018 21:31
caddy for SELinux
setcap cap_net_bind_service=+ep /usr/local/bin/caddy
nano /etc/systemd/system/caddy.service
semanage fcontext -a -t httpd_exec_t /usr/local/bin/caddy
restorecon /usr/local/bin/caddy
chown www-data:www-data /etc/ssl/caddy/
semanage fcontext -a -t httpd_sys_rw_content_t /etc/ssl/caddy
restorecon /etc/ssl/caddy
@totoCZ
totoCZ / gist:4430857313539b2585a5175ca3c1ed81
Last active August 8, 2017 10:50
final php socket client for golang json rpc server
<?php
$timeout = 1;
$chunkSize = 4;
function callRPC($host, $targets, $timeout, $chunkSize) {
$sockets = [];
$errno = 0;
$errstr = '';
// Send.
$s = stream_socket_client($host, $errno, $errstr, $timeout);
if (!$s) {
@totoCZ
totoCZ / ping.php
Created April 18, 2015 21:36
2015 Ping of Death
<?php
// curl -v [ipaddress]/static.png -H "Host: test" -H "Range: bytes=0-18446744073709551615"
if (isset($_GET["host"]) && isset($_GET["url"])) {
$h = htmlspecialchars($_GET["host"]);
$ip = gethostbyname($h);
$url = htmlspecialchars($_GET["url"]);
$opts = array('http' =>
array(
@totoCZ
totoCZ / ftplicity
Last active August 19, 2016 14:43
docker build -t "ftplicity" .
FROM wernight/duplicity
USER root
RUN apk add --update lftp
USER duplicity
@totoCZ
totoCZ / dnx8.rb
Created March 16, 2016 12:59
1/4/2016
pt = [87, 1, 186, 160, 224, 132, 237, 176, 234, 208, 194, 17, 239, 2, 74, 244, 61, 200, 116, 91, 32, 145, 28, 243, 216, 185, 188, 136, 250, 183, 125, 229, 179, 235, 20, 194, 10, 61, 15]
ct = [31, 64, 234, 240, 185, 164, 172, 224, 184, 153, 142, 49, 169, 77, 5, 184, 110, 232, 70, 107, 17, 167, 60, 181, 138, 246, 241, 168, 170, 229, 52, 188, 252, 166, 58, 141, 88, 122, 46]
count = pt.count
for i in 0..count-1 do
p = pt[i]
c = ct[i]
@totoCZ
totoCZ / restore.ps1
Last active August 29, 2015 14:26
reconstruct an incremental backup on windows
Get-ChildItem | Get-ChildItem | Copy-Item -Destination ../new -Recurse -Container -Force
@totoCZ
totoCZ / 4xz.log
Created January 31, 2015 21:08
4XZ Secrets Revealed
19:41:42 <@danix111> hmm 4XZ avoids the letter 'V' in its groups completely
19:41:46 <@danix111> zero occurrences
19:43:09 <@argonn> 'cause it is evil
19:43:17 <@argonn> aVil
19:43:20 <@argonn> eVil *
19:44:32 <@totoCZ> lol nice danix
19:44:45 <@totoCZ> so they use "V" to set up the auto decoder for VVV DE 4XZ :>
19:45:05 <@totoCZ> plausible theory IMO
19:45:32 <@totoCZ> dzen alphabet walrus analyst
19:45:50 <@Avare> need analyst for toto