Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mohan Balasundaram tuxfight3r

🏠
Working from home
View GitHub Profile
@tuxfight3r
tuxfight3r / bind_socket.py
Last active Sep 19, 2021
python tcp socket client / server examples
View bind_socket.py
#!/usr/bin/python
import socket #for sockets
import sys #for exit
try:
#create an AF_INET, STREAM socket (TCP)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error, msg:
print 'Failed to create socket. Error code: ' + str(msg[0]) + ' , Error message : ' + msg[1]
@tuxfight3r
tuxfight3r / tcp_flags.txt
Last active Sep 18, 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)
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active Sep 17, 2021
Bash keyboard shortcuts
View 01.bash_shortcuts_v2.md

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@tuxfight3r
tuxfight3r / ocp4_defaults.md
Last active Sep 10, 2021
openshift4 default resources
View ocp4_defaults.md

get clusterversions

$ oc get clusterversions
NAME      VERSION      AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.1.0-rc.0   True        False         25h     Cluster version is 4.1.0-rc.0

get clusteroperator

$ oc get clusteroperator
@tuxfight3r
tuxfight3r / openshift_cli_tricks.MD
Last active Sep 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}'
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)
View sslserver_notes.txt
#connect to ssl site
openssl s_client -connect ip:port
#vhost connect
openssl s_client -servername mysite.co.uk -connect mysite.co.uk:443
#Reading CSR
openssl req -noout -text -in uat-mobi.scotrail.co.uk.csr
#Reading certificates
@tuxfight3r
tuxfight3r / auditctl_notes.md
Last active Aug 25, 2021
audit search / trace commands
View auditctl_notes.md

Auditctl options

We can add and configure rules with the auditctl command.

Possible options are:

  • -l — print out a list of existing rules
  • -а — add a new rule
  • -d — delete an existing rule
  • -D — delete all existing rules
@tuxfight3r
tuxfight3r / kcat.md
Last active Aug 25, 2021
KafkaCat configuration for AWS MSK
View kcat.md

KafkaCat Configuration for AWS MSK

Set the below environment variable with the following values

NOTE: Kafkacat is renamed to kcat recently and the config variable should be KCAT_CONFIG for version 1.7 onwards.

# you can export the variable or present the config with -F parameter for kafkacat
export KAFKACAT_CONFIG=/home/tools/persistent/kcat/kafkacat_config

Contents of kafkacat configuration

@tuxfight3r
tuxfight3r / slapd
Last active Aug 24, 2021
openldap proxy to AD with TLS
View slapd
#file /etc/sysconfig/slapd
# OpenLDAP server configuration
# see 'man slapd' for additional information
# Where the server will run (-h option)
# - ldapi:/// is required for on-the-fly configuration using client tools
# (use SASL with EXTERNAL mechanism for authentication)
# - default: ldapi:/// ldap:///
# - example: ldapi:/// ldap://127.0.0.1/ ldap://10.0.0.1:1389/ ldaps:///
SLAPD_URLS="ldap:/// ldaps:///"