Skip to content

Instantly share code, notes, and snippets.

View kudosqujo's full-sized avatar

qujo kudosqujo

View GitHub Profile
@kudosqujo
kudosqujo / nmap_cli.sh
Created November 30, 2020 01:24
[Nmap Cheatsheet] #cheatsheet #networking
# metasploitable IP = 10.0.0.165
nmap -sS --send-ip 10.0.0.165 # stealth scan
nmap -sT --send-ip 10.0.0.165 # tcp full connect scan
nmap -sA --send-ip 10.0.0.165 # ack scan
nmap -sX --send-ip 10.0.0.165 # xmas scan
nmap -Pn -n --send-ip -D <decoy> <target> # decoying, disable ping scanning, disable name resolution, send ICMP echo requests instead of ARP requests
nmap -e eth0 -S <spoof> <target> # spoofing
nmap -sT -p 80,443 --open 10.0.0.0/24 # scan ports 80 & 443 on every addr within the given range
@kudosqujo
kudosqujo / cli_tools.md
Last active November 30, 2020 01:39
[Network CLI Tools] #networking #cheatsheet

Several useful command-line programs for accessing the network and web sites are already installed on your attacker VM.

  • tcpdump can be used to sniff network traffic.
  • netcat behaves like a simple TCP client or server taking input and output to standard input and standard output.
  • curl and wget are two different programs for accessing web sites from the command line, both with lots of options.
  • w3m is a text based web browser.

All of them have manual pages you can read to learn more.

You can copy files between different hosts by using the scp command: changing the port is a capital -P

@kudosqujo
kudosqujo / Create_Custom_Azure_RBAC_CLI.json
Created November 30, 2020 01:17
[Azure - ActiveDirectory - Create a new User, Group, and Role] #azure #activedirectory
{
"Name": "See all, change nothing",
"IsCustom": true,
"Description": "The subscription viewer.",
"Actions": [
"*/read"
],
"NotActions": [],
"AssignableScopes": [
"/subscriptions/<some subscription id>"
@kudosqujo
kudosqujo / generate_rand_64.sh
Last active December 2, 2020 14:59
[Generate a Random Hex 64 String] #howto #MacOS
# Assumes you have the `openssl` utility installed
# Generate a random 64 byte hex encoded string
openssl rand -hex 64
@kudosqujo
kudosqujo / user_data.linux.sh
Last active November 22, 2020 23:39
[AWS User Data] #aws #linux #windows
#!/bin/sh
# ^ User data shell scripts must start with the #! characters and the path to the interpreter you want to read the script
yum -y install httpd # Install Apache web server
chkconfig httpd on # Enable the web server
/etc/init.d/httpd start # Start the web server
# see AWS Technical Essentials Student Guide v4.7.9 - page 51
@kudosqujo
kudosqujo / git-checkout-remote-branch-method-1.sh
Last active November 20, 2020 22:43
[Git checkout remote branch] #git #howto
# LOCAL REMOTE
git checkout -b <branch_name> origin/<branch_name>
@kudosqujo
kudosqujo / append_text_to_file.rb
Last active November 30, 2020 01:43
[Append text to a file] Append text to an existing file or create file if it doesn't exist #howto #tips
File.write('some_file.txt', "Hello there\n", mode: 'a')
@kudosqujo
kudosqujo / .bash_profile
Created August 24, 2020 21:34 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@kudosqujo
kudosqujo / git_delete_merged_branches.sh
Created June 15, 2020 18:19 — forked from sephraim/OLD_git_delete_merged_branches.sh
[Tidy up Git branches] Delete & prune local/remote branches #git
# Delete remote branches that have been merged into 'origin/develop' (besides current, 'origin/develop' and 'origin/master')
git pull --rebase upstream develop:develop
git push origin develop:develop
git remote prune origin
git branch -r --merged origin/develop | grep -wv 'master\|develop' | sed 's/^origin\///' | xargs -n 1 git push -d origin
git remote prune origin
# Delete local branches that have been merged into 'develop' (besides current, 'develop' and 'master' branches)
git branch --merged develop | grep -wv '\*\|master\|develop' | xargs -n 1 git branch -d
@kudosqujo
kudosqujo / mysql_commands.sh
Last active November 20, 2020 22:41
[MySQL Cheatsheet] commands #mysql #cheatsheet
# Create a new db
mysqladmin -u root -p create some_db.test
# Create a dump from a local DB
mysqldump -u some_user -p some_db.test > some_db.test.dump.sql
# Create a dump from a remote host (like an RDS snapshot)
mysqldump -u some_user -p -h my-db-1234.somehash.us-north-1.rds.amazonaws.com some_db.test > some_db.test.dump.sql
# Populate a db using a dump