Skip to content

Instantly share code, notes, and snippets.

View 9b's full-sized avatar
🐗
Creating.

Brandon Dixon 9b

🐗
Creating.
View GitHub Profile
@9b
9b / poorMansConvert.py
Created May 19, 2013 20:01
Uses the Google Drive API to upload a file, convert it to a file format, download it locally and delete it from Drive.
#!/usr/bin/python
def poorMansConvert(di, inPath, outType, outPath):
from apiclient.http import MediaFileUpload
valid_output = [
'text/html','text/plain','application/rtf','application/vnd.oasis.opendocument.text',\
'application/pdf','application/vnd.openxmlformats-officedocument.wordprocessingml.document',\
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/x-vnd.oasis.opendocument.spreadsheet',\
'image/jpeg','image/png','image/svg+xml','application/vnd.openxmlformats-officedocument.presentationml.presentation'
@9b
9b / mitre_extract.py
Created February 8, 2024 13:34
Extract MITRE ATT&CK techniques into a file.
"""Extract MITRE ATT&CK techniques into a file."""
import bs4 as bs
import requests
root_url = "https://attack.mitre.org"
file_name = "mitre.txt"
def get_urls():
"""Get MITRE ATT&CK URLs for processing."""
Descriptor:
Name: BlockadeIoService
DisplayName: Blockade.io
Description: Skills for blocking suspicious and malicious indicators using blockade.io
SkillGroups:
- Format: API
Settings:
OpenApiSpecUrl: https://gist.githubusercontent.com/9b/f3f3e4d831bddcf0ab3f8a32b471893b/raw/b40421aa882e556794d4305dea50bd7f9acc1188/blockadeio.yaml
openapi: 3.0.1
info:
title: Blockade.io
description: Block suspicious and malicious indicators in participating browsers
version: "v1"
servers:
- url: https://api.blockade.io/
@9b
9b / what_runs.py
Created August 26, 2017 03:51
Simple tool to use WhatRuns API to get technologies used on a page. Doesn't submit the page if it's not in the database.
import ast
import datetime
import json
import sys
import requests
import urllib
from tabulate import tabulate
url = "https://www.whatruns.com/api/v1/get_site_apps"
data = {"data": {"hostname": sys.argv[1], "url": sys.argv[1],
We can't make this file beautiful and searchable because it's too large.
google.com,"v=spf1 include:_spf.google.com ~all"
youtube.com,"google-site-verification=OQz60vR-YapmaVrafWCALpPyA8eKJKssRhfIrzM-DJI"
youtube.com,"v=spf1 include:google.com mx -all"
facebook.com,"v=spf1 redirect=_spf.facebook.com"
baidu.com,"google-site-verification=GHb98-6msqyx_qqjGl5eRatD3QTHyVB6-xQ3gJB5UwM"
baidu.com,"v=spf1 include:spf1.baidu.com include:spf2.baidu.com include:spf3.baidu.com a mx ptr -all"
yahoo.com,"v=spf1 redirect=_spf.mail.yahoo.com"
wikipedia.org,"google-site-verification=AMHkgs-4ViEvIJf5znZle-BSE2EPNFqM1nDJGRyn2qk"
wikipedia.org,"v=spf1 include:wikimedia.org ?all"
amazon.com,"v=spf1 include:spf1.amazon.com include:spf2.amazon.com include:amazonses.com -all"
import requests, json, logging, sys
class PassiveTotal:
def __init__(self, apikey):
self.__apikey = apikey
self.__classifications = [ 'targeted', 'crime', 'benign', 'multiple' ]
self.__actions = [ 'add', 'remove' ]
@9b
9b / README
Last active August 6, 2019 20:45
Small script to request WHOIS information from RiskIQ
Modify the script to include your username and API key.
Create a virtualenv to keep your space clean:
$ virtualenv -p python3 venv3
Activate it:
$ source venv3/bin/activate
@9b
9b / pdf2xdp.py
Created June 16, 2012 23:11
PDF => XDP
import base64
import sys
def main():
if len(sys.argv) < 3:
sys.exit('Usage (2 arguments): %s "%s" %s' % (sys.argv[0],"malicious file","outfile"))
else:
f = open(sys.argv[1],"rb")
con = f.read()
f.close()
@9b
9b / unique_hash_objects.py
Created January 4, 2011 13:10
Goes through MongoDB store and checks if any object hash is duplicated
import pymongo
import json
from pymongo import Connection
def connect_to_mongo(host, port, database, collection):
connection = Connection(host, port)
db = connection[database]
collection = db[collection]
return collection