Skip to content

Instantly share code, notes, and snippets.

View kovacs-andras's full-sized avatar
🎯
Focusing

Andras kovacs-andras

🎯
Focusing
View GitHub Profile
@thesamesam
thesamesam / xz-backdoor.md
Last active May 24, 2024 04:20
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that

@kaichao
kaichao / log-http-headers.md
Last active March 7, 2024 18:43
nginx: Log complete request/response with all headers

1. switch nginx image to openresty/openresty

2. add the following to server/location (/etc/nginx/conf.d/default.conf)

   set $req_header "";
   set $resp_header "";
   header_filter_by_lua_block{ 
      local h = ngx.req.get_headers();
      for k, v in pairs(h) do
         ngx.var.req_header = ngx.var.req_header .. k.."="..v.." ";

Enable macOS Server Performance Mode

Performance mode changes the system parameters of your Mac. These changes take better advantage of your hardware for demanding server applications.

A Mac with macOS Server that needs to run high-performance services can turn on performance mode to dedicate additional system resources for server applications. Note, however, that performance mode can be enabled even without macOS Server being installed to achieve similar benifits for other high-performance services.

sudo nvram boot-args="serverperfmode=1 $(nvram boot-args 2>/dev/null | cut -f 2-)"
sudo reboot

Reference: https://support.apple.com/en-us/HT202528.

@HarmJ0y
HarmJ0y / PowerView-3.0-tricks.ps1
Last active May 23, 2024 14:34
PowerView-3.0 tips and tricks
# PowerView's last major overhaul is detailed here: http://www.harmj0y.net/blog/powershell/make-powerview-great-again/
# tricks for the 'old' PowerView are at https://gist.github.com/HarmJ0y/3328d954607d71362e3c
# the most up-to-date version of PowerView will always be in the dev branch of PowerSploit:
# https://github.com/PowerShellMafia/PowerSploit/blob/dev/Recon/PowerView.ps1
# New function naming schema:
# Verbs:
# Get : retrieve full raw data sets
# Find : ‘find’ specific data entries in a data set
@DRN88
DRN88 / memcached-rpmbuild.sh
Last active March 27, 2023 07:07
Build memcached RPMs on CentOS 7
#!/bin/bash
# Set version
VERSION="1.4.33"
# Dependencies
yum -y install rpmdevtools automake gcc make wget libevent-devel perl-Test-Simple cyrus-sasl-devel
# Create rpmbuild directory structure
rpmdev-setuptree
# Download source
[ ! -f /root/rpmbuild/SOURCES/memcached-${VERSION}.tar.gz ] && wget "http://memcached.org/files/memcached-${VERSION}.tar.gz" -P /root/rpmbuild/SOURCES/
# Build from archive. memcached-1.4.29/memcached.spec
#!/bin/bash
# Use certbot brewed version
insert_into_keychain() {
openssl pkcs12 -export -inkey /etc/letsencrypt/live/$1/privkey.pem -in /etc/letsencrypt/live/$1/cert.pem -certfile /etc/letsencrypt/live/$1/fullchain.pem -out /etc/letsencrypt/live/$1/letsencrypt_sslcert.p12 -passout pass:topsecret
SHA_NEW=`openssl pkcs12 -in /etc/letsencrypt/live/$1/letsencrypt_sslcert.p12 -nomacver -nodes -passin pass:topsecret | openssl x509 -noout -fingerprint -sha1 | cut -f2 -d'=' | sed 's/://g'`
if [[ $2 != $SHA_NEW ]]; then
# New certificate available
# Import into keychain
@halberom
halberom / output
Created June 5, 2014 14:58
ansible - example of doing something if a file exists
# the file doesn't exist
TASK: [debug var=foo] *********************************************************
ok: [localhost] => {
"foo": {
"changed": false,
"invocation": {
"module_args": "path=/tmp/file",
"module_name": "stat"
},