Skip to content

Instantly share code, notes, and snippets.

@anthonykasza
anthonykasza / kmer_sequencer.py
Created September 12, 2016 16:24
Script for aligning and reconstructing overlapping subsequences - LabyREnth Random 3
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):
function Get-PublicKey
{
[OutputType([byte[]])]
PARAM (
[Uri]$Uri
)
if (-Not ($uri.Scheme -eq "https"))
{
Write-Error "You can only get keys for https addresses"
@anthonykasza
anthonykasza / client.py
Created August 9, 2018 22:06
ClientHello Cloner
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
@anthonykasza
anthonykasza / spicy.nanorc
Created April 24, 2020 22:28
spicy nano syntax
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"
# 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) {
@anthonykasza
anthonykasza / cb-example.zeek
Created July 30, 2020 18:28
callback example in zeek script
# 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;
}
@anthonykasza
anthonykasza / zeek.nanorc
Last active November 30, 2021 22:05
zeek nano syntax
## 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)"
@anthonykasza
anthonykasza / toy-matrix.zeek
Created August 22, 2020 23:42
toy matrices
# 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;
@anthonykasza
anthonykasza / gnerator.py
Last active June 22, 2022 14:04
vanity EOA generator
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)
@anthonykasza
anthonykasza / encoder.py
Last active July 17, 2022 19:15
scripts to find magic strings in single-byte encoded data - sequences are neato
# 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