Skip to content

Instantly share code, notes, and snippets.

@pronto
pronto / headfollow
Last active April 24, 2018 17:20
find where url shorteners go
#!/usr/bin/env python3
#(works for 2.7 as well)
#todo: add support for <script>window.location='nsa.gov'<script>
import requests
import sys
def get_loc(url):
try:
h=requests.head(url).headers['location']
return h
except KeyError:
@mgeorgy
mgeorgy / Dockerfile
Created November 29, 2016 07:01
CyberChef Docker Container
############################################################
# Dockerfile to create a CyberChef Container
# Based on Ubuntu 16.04, Node.js 7.x
#
# Clean build: docker build --no-cache=true --tag=cyberchef:<version> .
# Incremental build: docker build --tag=cyberchef:<version> .
# Run container: docker run -d -p 127.0.0.1:8080:80 --name cyberchef -t cyberchef:<version>
# example: docker run -d -p 127.0.0.1:8080:80 --name cyberchef -t cyberchef:1.0
############################################################
@codref
codref / go-ssh-reverse-tunnel.go
Last active January 22, 2025 16:31
Go SSH reverse tunnel implementation (SSH -R)
/*
Go-Language implementation of an SSH Reverse Tunnel, the equivalent of below SSH command:
ssh -R 8080:127.0.0.1:8080 operatore@146.148.22.123
which opens a tunnel between the two endpoints and permit to exchange information on this direction:
server:8080 -----> client:8080
@ryboe
ryboe / .travis.yml
Last active December 5, 2024 03:44
Example .travis.yml for Golang
# use the latest ubuntu environment (18.04) available on travis
dist: bionic
language: go
# You don't need to test on very old versions of the Go compiler. It's the user's
# responsibility to keep their compiler up to date.
go:
- 1.16.x
@lucaswerkmeister
lucaswerkmeister / sandbox.conf
Created October 22, 2017 13:56
systemd sandbox for apache2.service on Debian Stretch (systemd v232)
[Service]
# read /var/lib/dehydrated/
CapabilityBoundingSet=CAP_DAC_OVERRIDE
# bind port 80 + 443
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
# drop privileges to www-data
CapabilityBoundingSet=CAP_SETUID CAP_SETGID
# call ulimit
CapabilityBoundingSet=CAP_SYS_RESOURCE
# partially mitigate CAP_DAC_OVERRIDE
@Neo23x0
Neo23x0 / audit.rules
Last active March 11, 2025 10:24
Linux Auditd Best Practice Configuration
# IMPORTANT!
# This gist has been transformed into a github repo
# You can find the most recent version there:
# https://github.com/Neo23x0/auditd
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/
@haccer
haccer / scanio.sh
Last active February 18, 2025 14:06
PoC script to mass-locate vulnerable subdomains using results from Rapid7's Project Sonar
#!/bin/bash
# Usage : ./scanio.sh <save file>
# Example: ./scanio.sh cname_list.txt
# Premium
function ech() {
spinner=( "|" "/" "-" "\\" )
while true; do
for i in ${spinner[@]}; do
echo -ne "\r[$i] $1"
@kennethso168
kennethso168 / restic_backup.sh
Last active November 30, 2021 00:07
My Backup Solution
#!/bin/bash
# Location of your restic repo
export RESTIC_REPOSITORY=/run/media/kenneth/MyBook/restic
# Password of the restic repo
# Use a keyring to store the password so it isn't stored in plaintext on disk
# Install python-keyring (Arch) to use this command
export RESTIC_PASSWORD=`keyring get restic MyBook`
if ! restic snapshots
@bartman
bartman / watch-cgroup-memory-usage
Last active November 17, 2021 15:19
watch-cgroup-memory-usage
#!/bin/bash
#
# watch cgroup 'browsers' memory activity
#
# best served with ...
#
# https://gist.github.com/jakewarren/477ecd1149abe908cbd5cf7a7c9abaa3
self=$0
SUDO=
@johannrichard
johannrichard / README.md
Last active July 17, 2023 21:27
E-Mail Retention Policies for Gmail

How to bring E-Mail retention policies to Gmail / Google Mail:

  • Go to Google Scripts and create a blank project (make sure you are logged into your Google account);
  • paste the code (below) (and modify the policies as needed);
  • set a trigger (Resources -> Current Project's Triggers -> Add one now) to run it at the preferred interval; and
  • create filters in Gmail/Google Mail that set policies when specific messages arrive

Inspired and adapted from Gmail Automation: 5 Useful Google Scripts to Automate Your Gmail