View gist:a65ece60c1b54003e9b2a7d5520ce091
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==== Server === | |
In [1]: from opcua import ua, server | |
...: | |
...: s = server.server.Server() | |
...: s.load_certificate("/etc/pki/tls/certs/mycert.pem") | |
...: s.load_private_key("/etc/pki/tls/certs/mykeykey.der") | |
...: | |
...: # allow Basic256Sha256_SignAndEncrypt | |
...: # s.get_endpoint() would return only that security policy |
View testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==== Server ==== | |
In [1]: from opcua import ua, server | |
...: | |
...: s = server.server.Server() | |
...: s.load_certificate("/etc/pki/tls/certs/mycert.pem") | |
...: s.load_private_key("/etc/pki/tls/certs/mykey.key.der") | |
...: | |
...: # allow Basic256Sha256_SignAndEncrypt | |
...: # s.get_endpoint() would return only that security policy |
View exhaust_ephemeral_ports.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import time | |
import argparse | |
import subprocess | |
import shlex | |
""" | |
Usage: python3 exhaust_ephemeral_ports.py <dst> <dport> <optional:loop> | |
Example: python3 exhaust_ephemeral_ports.py 172.31.23.144 80 | |
Help: exhaust_ephemeral_ports.py --help |
View tracer-for-ssm.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=stracer for SSM | |
After=amazon-ssm-agent.service | |
PartOf=amazon-ssm-agent.service | |
[Service] | |
ExecStart=/usr/bin/bash -l -c '/bin/strace -p $(pidof amazon-ssm-agent) > /var/log/strace_ssm_agent.log 2>&1' | |
[Install] | |
WantedBy=multi-user.target |
View tcp_syn_ack.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
import time | |
import random | |
def sendit(src=None, dst=None, dport=None): | |
""" | |
See the different status of a TCP connection | |
Was initially written to identify a docker-proxy bug: https://github.com/moby/moby/issues/27539 | |
I suggest to keep a netstat running from the server side: $ watch -0.1 'netstat -laptn|grep 80' |
View gist:aa94ed6ed831b69d85c8e08cec05316b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias pprint="python -c \"import pprint, sys, json; pprint.pprint(json.loads(''.join([x.strip() for x in sys.stdin.readlines()]))) \"" |
View alias_kodi.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kodi_ip=192.168.0.100 | |
function cpkodi { | |
scp $@ root@$kodi_ip:/storage/tvshows | |
} | |
function lskodi { | |
ssh root@$kodi_ip ls -ltrh /storage/tvshows | |
} | |
function rmkodi { | |
ssh root@$kodi_ip "cd /storage/tvshows && rm $@" |
View gist:68725dd8e2227be0d35e0e3b69798d3a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function printkv($store) { | |
if (is_array($store)) { | |
foreach($store as $item) { | |
echo "Key: ".$item['key']." Value: ".$item['value']."\n"; | |
} | |
} | |
} |
View gist:c281df71a79a4a14137c187715988b3d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# workaround for bug on getallKeys() on version superior to 1.4.22 | |
# https://bugs.launchpad.net/libmemcached/+bug/1534062 | |
<?php | |
function listKeys($srv,$max) | |
{ | |
foreach($srv as $node) { | |
echo "Host: ".$node['host']." Port: ".$node['port']."\n"; | |
$mem = new Memcached(); | |
$mem->addServer($node['host'], $node['port']); |
View gist:66decbe330ec560ac8e57e87150891b8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export GRUB_CONFIG=`sudo find /boot -name "grub.cfg"` | |
awk 'BEGIN {submenu=0;menu=0};$1 ~ /submenu/ {submenu+=1;menu=0;sub(/\$.*$/,"");print submenu" " $0};/menuentry / && /Linux/ {gsub(/menuentry/,"");gsub(/--class.*$/,"");gsub(/\047/,"");print " "submenu">"menu " " $0;menu+=1}' $GRUB_CONFIG | |
# 1 submenu 'Advanced options for Ubuntu 3.19' | |
# 1>0 Ubuntu, with Linux 3.19.0-75-generic | |
# 1>1 Ubuntu, with Linux 3.19.0-75-generic (recovery mode) | |
# 1>2 Ubuntu, with Linux 3.13.0-139-generic | |
# 1>3 Ubuntu, with Linux 3.13.0-139-generic (recovery mode) | |
# 2 submenu 'Advanced options for Ubuntu 4.2' |
NewerOlder