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 fileinput | |
from StringIO import StringIO | |
import networkx as nx | |
import subprocess | |
import glob | |
import base64 as b64 | |
# http://stackoverflow.com/questions/1285434/efficient-algorithm-for-string-concatenation-with-overlap | |
def concat(*args): |
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
function Get-PublicKey | |
{ | |
[OutputType([byte[]])] | |
PARAM ( | |
[Uri]$Uri | |
) | |
if (-Not ($uri.Scheme -eq "https")) | |
{ | |
Write-Error "You can only get keys for https addresses" |
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 scapy_ssl_tls.ssl_tls as tls | |
import scapy_ssl_tls.ssl_tls_crypto as tlsc | |
import scapy_ssl_tls.ssl_tls_keystore as tlsk | |
packets = rdpcap('tls_example.pcap') | |
for packet in packets: | |
if packet.haslayer(tls.SSL): | |
eth = packet |
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
syntax "spicy" "\.spicy$" | |
color magenta "\w+\(" | |
color magenta "\$\w+" | |
color magenta "\?\w+" | |
color brightcyan "public|global|const|local" | |
color brightcyan "\b(print|on|foreach|stop|switch|case|default|if|new|in|inout|exception|throw|try|catch|assert|break|for|return|while|from|continue)\b" | |
color brightcyan "module|import" |
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
# An example of using custom types to implement map/filter functionality in scriptland | |
global v: vector of int = {-10, -1, 0, 1, 10, -999}; | |
type map_func: function(a: any): any; | |
global positive_filter: map_func; | |
function map(v1: vector of any, mf: map_func): vector of any { | |
local v2: vector of any; | |
for (idx in v1) { |
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
# An example of event callbacks in a Zeek cluster. Callbacks are a bit clunky as events are not first-class types | |
# The below cluster code copied from | |
# https://docs.zeek.org/en/current/frameworks/supervisor.html#supervised-cluster-example | |
event zeek_init() &priority=10 { | |
if ( ! Supervisor::is_supervisor() ) { | |
return; | |
} |
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
## Here is an example nanorc for syntax highlighting in Zeek scripts. Edited the standard sh.nanorc to create this, and added in the regex described by Scott Runnels. | |
## For Scott's bro-mode.el, go to https://github.com/srunnels/bro-mode/blob/master/bro-mode.el | |
syntax "zeek" "\.zeek$" | |
magic "(POSIX|Bourne.*) shell script text" | |
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*" | |
icolor brightgreen "^[0-9A-Z_]+\(\)" | |
color cyan "(usec|msec|sec|min|hr|day)s?\b" | |
color cyan "[0-9]+\/(tcp|udp|icmp|unknown)" |
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
# A toy example showing pure scriptland matrix types. Good luck multiplying anything. | |
module Matrix; | |
export { | |
type matrix_int: vector of vector of int; | |
type matrix_dbl: vector of vector of double; | |
global make_matrix_int: function(rows: count, cols: count): matrix_int; | |
global make_matrix_dbl: function(rows: count, cols: count): matrix_dbl; |
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 eth_account import Account | |
import secrets | |
prefix = "0xbca9" | |
while True: | |
priv = secrets.token_hex(32) | |
private_key = "0x" + priv | |
acct = Account.from_key(private_key) | |
if acct.address.startswith(prefix): | |
print("private key:", private_key) |
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
# A script which single-byte XOR encodes an input file | |
import sys | |
ifn = sys.argv[1] | |
data = open(ifn, "rb").read() | |
c = "a" | |
for key in [0xaa, 0xab, 0x57, 0x07, 0x13]: | |
ofn = c + ifn |