Skip to content

Instantly share code, notes, and snippets.

View boh's full-sized avatar

boh

View GitHub Profile
#############################################################################################################
# PowerSlim 0.1
#############################################################################################################
import os,re
import clr,os
clr.AddReference("System.Management")
clr.AddReference("System.Management.Automation")
from System.Management.Automation import *
from System.Management.Automation.Host import *
from System.Management.Automation.Runspaces import *
@mtigas
mtigas / gist:952344
Last active April 3, 2024 07:57
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@tylerl
tylerl / rsa.py
Created September 24, 2011 08:27
RSA Explained in Python
#!/usr/bin/env python
# This example demonstrates RSA public-key cryptography in an
# easy-to-follow manner. It works on integers alone, and uses much smaller numbers
# for the sake of clarity.
#####################################################################
# First we pick our primes. These will determine our keys.
#####################################################################
@jboner
jboner / latency.txt
Last active June 2, 2024 14:49
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 2, 2024 11:04
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@truekonrads
truekonrads / rdpjoker.c
Created July 25, 2012 00:19
Code to run commands under another user's rdp session
// rdpjoker.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#define SERVER "XXX.compute-1.amazonaws.com"
#define CMD "cmd.exe /C dir \\tsclient\\c >output.txt"
int main(int argc, char **argv){
HANDLE server;
PWTS_SESSION_INFOA ppSessionInfo=NULL;
@willurd
willurd / web-servers.md
Last active June 3, 2024 01:13
Big list of http static server one-liners

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
@fsodogandji
fsodogandji / socat-tips.sh
Last active April 11, 2024 18:47
socat tips & tricks
#To create a classic TCP listening daemon, similar to netcat -l, use a variation of the following command.
socat TCP-LISTEN:8080 stdout
#use remotly a command shell
socat TCP4-LISTEN:1234,reuseaddr,fork 'SYSTEM:/bin/cat /home/infos.txt'
#sslify a server
socat OPENSSL-LISTEN:443,reuse‐addr,pf=ip4,fork,cert=server.pem,cafile=client.crt TCP4-CONNECT:localhost:80
@JSONOrona
JSONOrona / parser.py
Last active January 4, 2021 16:37
Python command line argument example using argparse module
#!/usr/bin/python
''' Python command line argument example using argparse module
Example output:
./parser.py --server=pyserver --port=8080,443,25,22,21 --keyword=pyisgood
Server name: [ pyserver ]
@gerjantd
gerjantd / gist:9787606
Created March 26, 2014 16:40
Bash/nc: netcat as a simple port scanner
PORT SCANNING
It may be useful to know which ports are open and running services on a target machine. The -z flag can be used to tell nc to report open ports, rather than initiate a connection. Usually it's useful to turn on verbose output to stderr by use this
option in conjunction with -v option.
For example:
$ nc -zv host.example.com 20-30
Connection to host.example.com 22 port [tcp/ssh] succeeded!
Connection to host.example.com 25 port [tcp/smtp] succeeded!