Skip to content

Instantly share code, notes, and snippets.

View slw07g's full-sized avatar
😅

Shanief slw07g

😅
View GitHub Profile
@slw07g
slw07g / gist:c8dcb5667662fe7215a7c591389417b5
Last active April 25, 2022 18:10
Python - Download and Load ip2asn database
import requests
import gzip
import ip2asn # pip3 install ip2asn
rsp = requests.get('https://iptoasn.com/data/ip2asn-v4-u32.tsv.gz')
open('/tmp/ip2asn-v4-u32.tsv', 'wb').write(gzip.decompress(rsp.content))
i2a = ip2asn.IP2ASN('/tmp/ip2asn-v4-u32.tsv')
@slw07g
slw07g / netstat.py
Last active January 12, 2022 03:54
#!/usr/bin/env python3
# A script to print netstat output correlated with process path
from os.path import abspath, expandvars, expanduser
import shlex
import subprocess
from re import sub as rgxsub
COMMS = dict()
@slw07g
slw07g / panther-de2tests.py
Last active December 16, 2021 04:12
A script to convert all the rows in the CSVs generated by Panther Data Explorer to Test Cases for rules (already in YAML format)
#!/usr/bin/env python3
import argparse
from csv import DictReader
from os.path import expanduser, expandvars, abspath
from io import StringIO
import json
def expand_path(path: str):
return abspath(expandvars(expanduser(path)))
@slw07g
slw07g / numpy-openblas-macos-pip.sh
Last active August 30, 2020 05:18 — forked from yatsu/numpy-openblas-macos-pip.sh
Install numpy with enabling openblas using pip on macOS
# Setup HomeBrew: https://brew.sh/
brew install openblas
mkdir /tmp/numpy_local
cd /tmp/numpy_local
pip3 download --no-binary :all: --no-deps numpy
unzip numpy-*.zip # (assuming there's only one version in this folder)
cd numpy-1.19.1 # the version may be a later version than this
cat > site.cfg <<EOF
[openblas]