Skip to content

Instantly share code, notes, and snippets.

View TheFlash2k's full-sized avatar
😎
Running

Ali Taqi Wajid TheFlash2k

😎
Running
View GitHub Profile
@TheFlash2k
TheFlash2k / random-password
Created June 2, 2023 12:33
Generates a random string where length of the string is passed as an argument
#!/bin/bash
_len=10
if [[ $# == 1 ]]; then
_len=$1
fi
tr -dc A-Za-z0-9 </dev/urandom | head -c $_len ; echo ''
/*
logger.hpp - A Single Logging solution.
Author: @TheFlash2k
*/
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdlib.h>
@TheFlash2k
TheFlash2k / space
Created June 22, 2023 16:13
A simple bash utility to finding the free space. (idk tbh)
#!/bin/bash
# Finding the base drive
drive_name=`df -h | rev | grep -E '^/\s' | rev | cut -d ' ' -f 1 | rev | cut -d '/' -f 1 | rev`
if [[ $# == 1 ]]; then
drive_name=$1
fi
res=`df -h | grep $drive_name`
@TheFlash2k
TheFlash2k / endian.py
Last active July 7, 2023 02:38
A simple script to convert an hex to bytes based on endianess.
#!/usr/bin/env python3
import argparse
import struct
def pack_address(address, arch, byte_order):
_ = { 'x64' : { 'little' : '<Q', 'big' : '>Q' }, 'x86' : { 'little' : '<I', 'big' : '>Q' } }
return struct.pack(_[arch][byte_order], address)
def main():
@TheFlash2k
TheFlash2k / log.c
Created July 24, 2023 02:37
possibly the most simplest log2cli macros. (with colors too :))))
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <time.h>
#pragma warning (disable : 4005)
#pragma warning (disable : 4172) // Line 22
#define TIME_BUFFER_SIZE 20
char timeBuffer[TIME_BUFFER_SIZE];
@TheFlash2k
TheFlash2k / logger.py
Created September 17, 2023 01:49
A simple logger class with colors.
#!/usr/bin/env python3
# .~ Author: @TheFlash2k
import sys
from colorama import Fore, init
from datetime import datetime
import os
from pathlib import Path
init(autoreset=True)
@TheFlash2k
TheFlash2k / deploy.sh
Created October 3, 2023 01:21
This is used to automate the deployment of 2-Node/1-Master Kubernetes Configuration. The `deploy.sh` and `master-setup.sh` are attached as well, but to create a single script, they were base64 encoded and then included in the same script. In case of vagrant deployment, the user may only need to run `setup-kube-cluster.sh` (but the VMs must be up…
#!/bin/bash
## Author: @TheFlash2k
set -e
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
@TheFlash2k
TheFlash2k / flag_updator.py
Last active October 17, 2023 21:57
Allows flag updating using SSH (For Linux) and SMB (For Windows). Authenticated, and allows the use of password/private key over ssh with user specific and port specific authentication. Allows flag_format to be changed at runtime by modifying the configuration file.
# For enums
from enum import Enum
# For parsing and handling
import json
import sys
import random
import string
import logging
import tempfile
@TheFlash2k
TheFlash2k / aslr
Created October 25, 2023 17:51
manage aslr
#!/bin/bash
# Default Mode: 2
# MODES:
# 0 - disable
# 1 - stack and code segment
# 2 - stack, code and data segment (default)
# Options:
# aslr on # 2
#!/bin/bash
username=$(cat /etc/passwd | grep 1000 | cut -d ':' -f1)
if [[ -z $username ]]; then $username="root"; fi
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt update
sudo apt install -y libc6:i386 libncurses5:i386 libstdc++6:i386 snapd gcc g++ build-essential python3 python3-pip gpg ruby strace ltrace ruby-dev liblzma-dev liblzo2-dev zlib1g-dev nasm bless unzip p7zip-full cmake libcapstone-dev autoconf g++-multilib gcc-multilib curl wget git python2 docker.io docker-compose patchelf gdb dos2unix elfutils bat screen tmux libseccomp-dev