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:
| ############################################################################################################# | |
| # 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 * |
| #!/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. | |
| ##################################################################### |
| 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 |
| // 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; |
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.
$ python -m SimpleHTTPServer 8000| #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 | |
| #!/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 ] |
| 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! |