Skip to content

Instantly share code, notes, and snippets.

Working from home

Mohan Balasundaram tuxfight3r

Working from home
View GitHub Profile



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 /
Last active Apr 11, 2021
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet


command description
ctrl + a Goto BEGINNING of command line
tuxfight3r / tcp_flags.txt
Last active Apr 10, 2021
tcpdump - reading tcp flags
View tcp_flags.txt
Unskilled Attackers Pester Real Security Folks
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)
tuxfight3r /
Last active Apr 8, 2021
python3 HTTP Echo Server with directory browsing
#!/usr/bin/env python3
# Author: Mohan Balasundaram
# Date: 02/05/2019
# Purpose: HTTP Echo server with directory browsing
# To run a http server and return all request headers in / path
# and to allow directory browsing in any other path prefix
from http.server import BaseHTTPRequestHandler, SimpleHTTPRequestHandler
import urllib.parse
tuxfight3r / .bash_profile
Last active Mar 31, 2021
bash history log all commands to syslog
View .bash_profile
#log all your bash command to syslog
function log2syslog
declare COMMAND
COMMAND=$(fc -ln -0)
logger -p local1.notice -t bash -i -- "${USER}:${COMMAND}"
trap log2syslog DEBUG
#moredetails can be found here
tuxfight3r /
Created Mar 10, 2016
Ansible dynamic inventory bash demo
if [ "$1" == "--list" ] ; then
"bash_hosts": {
"hosts": [
tuxfight3r /
Last active Mar 18, 2021
AWS - Upload files to S3 via curl
#!/bin/bash -x
#Date: 21/7/2017
#Author: Mohan
#Purpose: To upload files to AWS S3 via Curl
#Uploads file at the top level folder by default
#S3 parameters
tuxfight3r /
Created Mar 14, 2017
ansible custom filters demo
#place the file in your ansible playbook director under filter_plugins
class FilterModule(object):
def filters(self):
return {
'a_filter': self.a_filter,
'another_filter': self.b_filter
tuxfight3r /
Last active Mar 17, 2021
validating EC2 pem / ssh key pairs
## Get private key fingerprint for AWS generated key ( will match the id in AWS Console)
$ openssl pkcs8 -in test_key.pem -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c
(stdin)= f6:38:9c:53:9c:64:a8:b3:40:23:9f:6c:ed:0e:3d:bf:bf:16:bb:1c

## Get fingerpint from Openssh public key only md5 / sha1
$ ssh-keygen -f -e -m PKCS8 | openssl pkey -pubin -outform DER | openssl md5 -c
(stdin)= 55:b6:90:db:34:29:da:60:68:c9:08:24:f1:9f:c8:4b

tuxfight3r / 01.trust_policy.MD
Last active Mar 11, 2021
Importing a VM into AWS EC2 from S3 Bucket
View 01.trust_policy.MD

NOTE: Assuming .vhd image is already uploaded to s3 bucket, the following is the process to import the image when the vmimport role is missing

#create a role policy json file