Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pedramamini's full-sized avatar
👋

Pedram Amini pedramamini

👋
View GitHub Profile
@pedramamini
pedramamini / fabric-multiplex.sh
Last active March 27, 2024 21:39
Multiplex the stdout from a command as the stdin to numerous commands, collect the outputs under command headings in markdown format.
#!/bin/bash
# Pedram Amini
# https://pedramamini.com
run_command() {
local cmd="$1"
local input_file="$2"
local output_file="$3"
@pedramamini
pedramamini / chrome_fetch.py
Last active March 27, 2024 21:41
CLI tool and library for fetching content via Chrome driven by Selenium. Has some tricks up its sleeve to evade mechanized browser detection.
"""
CLI tool and library for fetching content via Chrome driven by Selenium. Has some tricks up its sleeve to evade
mechanized browser detection.
Pedram Amini
https://pedramamini.com
Requirements:
pip install selenium
pip install webdriver_manager
@pedramamini
pedramamini / cowsay-sticky.py
Last active June 20, 2023 17:28
Cowsay, but via Amazon's sticky note printer. See it in action: https://stickynote.pedramamini.com
#!/Users/pedram/venv3/bin/python
#
# The Amazon thermal sticky note printer is pretty useless as the interface is purely verbal. But...
# it does expose an IP Printing port (TCP 613). Took some finagling but I'm proud to present...
#
# Cowsay Sticky Note Edition!
#
# Feed programmatic notifications via CLI or host a simple web server to receive sticky notes from friends.
#
@pedramamini
pedramamini / google_vs_microsoft.py
Last active August 23, 2021 21:32
InQuest Labs: Trystero Project - Google vs Microsoft
#!/bin/env python
"""
Leverage the open API from labs.inquest.net to query the Trystero project data and compare which vendor, between
Google and Microsoft "won" the most days from the given YYYY-MM-DD to now. Example:
❯ python google_vs_microsoft.py 2021-06-01
since=2021-06-01 day=2021-08-16 (64) google=21 🏆microsoft=39
google 🏆 days: 21
microsoft 🏆 days: 39
@pedramamini
pedramamini / iq_auto_diff.py
Last active July 31, 2021 14:54
InQuest Labs Rule Generator
#!/opt/research/venv/bin/python
"""
IQ Auto DIFF leverages InQuest Labs API to collate a list of post DFI string features from both malicious (bad) and
seemingly benign (non) files. While ignoring gibberish, we'll next identify the string features exclusive to each set.
The idea is that the top 25 strings found from the malicious (mal) corpus can be inclusive for a YARA rule where the
top 25 strings from the seemingly benign (non) corpus can be exclusive for a YARA rule.
This script will take upwards of 20 minutes to run.
@pedramamini
pedramamini / labs_harvest.py
Last active July 31, 2021 14:54
InQuest Labs Daily Sample Harvest
#!/bin/env python
"""
This script is intended to be run via a daily cron job and will retrieve up to MAX_DAILY interesting samples with
relevant JSON metadata containing extruded layers, IOCs, etc.
This script requires the installation of:
https://github.com/inquest/python-inquestlabs
@pedramamini
pedramamini / 20200730-emotet.txt
Created July 31, 2020 21:33
Emotet samples from 7/30/2020 with VT score (out of ~60) and InQuest score (out of 10).
00077dbdfe4e79c38048d2060cb90ea2bdd50cc346a45bae87ea6093ddb02321 vt=25 iq=9
0039413ea9580579720c262bf207d64bacac7b1c93056c8b5fa2f2347714b096 vt=27 iq=9
005307ad7426c4c1b014c27f51ba5c0ad2ca752195099a7378e3d622cdf7a2d6 vt=29 iq=9
007fc402dd61e8222bb4fd1214544b0a620f622aaa186b1bd5a2207613fdd558 vt=28 iq=9
00812e8bf247cc4740941ed973f367678110761be944eef39e69217fc78412cb vt=25 iq=9
00884a49002e25be473b8704fa9935f7cfcbb2d4bf75dc4fa054f16019eac82d vt=24 iq=9
00dd0eb0c5acbcc376a26eb4f974187be2bac8a4e9c00876faa23d656953fa53 vt=28 iq=9
014e0bfbd01c796a79ea0324177bf7bb89e6e1d7dccd58008d62024f1bbcfe5d vt=27 iq=9
01663b94d847370d937c017344092fb204b3fef3bca2c0d26c9f49ebac946525 vt=29 iq=9
0195eda6f0dbf03b6fa7c2689f538bb998ce4cc533fd7117c956c7c5c2f62437 vt=27 iq=9
' Our comments are prefixed with the string "[InQuest]". Other comments are preserved originals from the macro.
' The sample is available for download from InQuest Labs:
'
' https://labs.inquest.net/dfi/sha256/12d21da9bd0f7d877e04e59ad347b0e8787124c9f0ec170a913451acfb14a3b6
'
' Examining the OLE directory structure with oledump:
'
' $ oledump.py 12d21da9bd0f7d877e04e59ad347b0e8787124c9f0ec170a913451acfb14a3b6
' 1: 146 '\x01CompObj'
' 2: 6 '\x03ObjInfo'
import sys
if len(sys.argv) != 2:
sys.stderr.write("usage: %s <input path>\n" % sys.argv[0])
sys.exit(1)
path = sys.argv.pop()
data1 = []
data2 = []
data3 = []
@pedramamini
pedramamini / the_carver.py
Last active March 16, 2019 15:34
Carve files out of a blob.
#!/usr/bin/env python
# source: https://gist.github.com/pedramamini/54df2648a1b73adf9a0d6d0b1a75ca0a
import os
import re
import sys
import errno
import string
# debug output.