Skip to content

Instantly share code, notes, and snippets.

View wietze's full-sized avatar

Wietze wietze

View GitHub Profile
@wietze
wietze / mitre_attack.tex
Created January 31, 2022 18:29
MITRE ATT&CK - LaTeX functions
\usepackage{hyperref}
\usepackage{xstring}
\DeclareRobustCommand{\tid}[1]{\StrSubstitute{#1}{.}{/}[\temp]%
\href{https://attack.mitre.org/techniques/\temp/}{#1}}
% \tid{T1234} returns 'T1234' with a hyperlink to its MITRE ATT&CK page
\DeclareRobustCommand{\tidtext}[1]{\StrSubstitute{#1}{.}{/}[\temp]%
\href{https://attack.mitre.org/techniques/\temp/}{#1}: \gettid{#1}}
% \tidtext{T1234} returns 'T1234: Technique Name' with T1234 containing a hyperlink to its MITRE ATT&CK page
@wietze
wietze / get_attack_technique_name.py
Created June 29, 2021 13:55
Returns the full MITRE ATT&CK technique name for a given TID
import requests
MITRE_ATTACK_DATA = requests.get('https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json').json()
TECHNIQUES = {technique['external_references'][0]['external_id']:technique['name'] for technique in MITRE_ATTACK_DATA['objects'] if technique['type'] == 'attack-pattern' and not technique.get('revoked')}
def get_technique(tid):
return TECHNIQUES[tid] if '.' not in tid else "{}: {}".format(TECHNIQUES[tid[:5]], TECHNIQUES[tid])
# Usage:
import requests
##########
### MITRE ATT&CK ONELINERS
### for constructing Python objects
### with all ATT&CK techniques in them
### using the latest MITRE ATT&CK data
##########
# Get MITRE ATT&CK technique objects as list
@wietze
wietze / get_pem.sh
Created October 18, 2018 13:17
One-liner to obtain the PEM file of a domain/port combination
python -c "import sys,ssl;print(ssl.get_server_certificate((sys.argv[1], sys.argv[2])))" $DOMAIN $PORT > output.pem
# Example:
# $ python -c "import sys,ssl;print ssl.get_server_certificate((sys.argv[1], sys.argv[2]))" google.com 443 > google.pem
@wietze
wietze / filmon.ps1
Created November 14, 2016 21:44
Get FilmOn Streams
################################################################################
### Simple PowerShell script that gets FilmOn stream URL based on channel id.
### A picker for some populare UK channels is provided.
###
### :: HOW TO RUN
### Run the following to watch FilmOn channel 14 (= BBC One)
### & ./filmon.ps1 14
### Run the following to see the channel picker, and manually select the channel
### & ./filmon.ps1
################################################################################
@wietze
wietze / keybase.md
Created August 10, 2016 19:01
Keybase verification

Keybase proof

I hereby claim:

  • I am wietze on github.
  • I am wietze (https://keybase.io/wietze) on keybase.
  • I have a public key ASDdJkS4koCaqAzWQlpS5JHjCMcnWaEvpG2pXUb3vjP8DAo

To claim this, I am signing this object:

@wietze
wietze / podcaster.py
Created August 7, 2016 17:21
Podcast from stream
import os
import time
import datetime
from dateutil.parser import parse
from pytz import timezone
import re
import glob
import socket
from subprocess import call
from feedgen.feed import FeedGenerator