Skip to content

Instantly share code, notes, and snippets.

@prologic
prologic / LearnGoIn5mins.md
Last active July 3, 2024 04:05
Learn Go in ~5mins
@coolreader18
coolreader18 / segfault.py
Last active March 30, 2024 08:05
CPython segfault in 5 lines of code
class E(BaseException):
def __new__(cls, *args, **kwargs):
return cls
def a(): yield
a().throw(E)
@akabe1
akabe1 / frida_multiple_unpinning.js
Last active July 17, 2024 10:55
Another Android ssl certificate pinning bypass for various methods
/* Android ssl certificate pinning bypass script for various methods
by Maurizio Siddu
Run with:
frida -U -f <APP_ID> -l frida_multiple_unpinning.js [--no-pause]
*/
setTimeout(function() {
Java.perform(function() {
console.log('');
@mattghali
mattghali / virustotal_upload
Created May 20, 2017 20:01 — forked from luca-m/virustotal_upload
Upload a sample to VirusTotal and pretty print the report. All in a handy alias.
#!/usr/bin/env bash
#
# Upload a sample to VirusTotal and pretty print the report.
# All in a handy alias.
#
# Dependencies:
#
# * curl
# * jq
# * VirusTotal API key
## If the wireshark "Export Objects" does not work well, you can still extract the files manually.
## If the file data is present in SMB "Write" packet...
1. Choose the "Write Request" packet which contains the file data you're interested
2. Open the "Data" section and highlight "Data:" and right click on it
3. You can either...
A. Choose "Copy" > "as a Hex Stream" and paste the data in note pad.
B. Choose "Export Packet Bytes" and save each data as file.
NOTE: Order of the packet is very important! Pay attention to the data offset value. Make sure to get the data in right order!
@jayktaylor
jayktaylor / guide.md
Last active April 13, 2022 08:23
Instructions for installing Python 3.5 using pyenv on Debian Jessie

Installing Python 3.5 on Debian Jessie with pyenv

Debian Jessie does not come with the correct Python version out of the box, and instead comes with Python 2. To be able to install Python 3(.5), we have a few options. We could build and install from source, but as per Debian's website, we shouldn't do this. Instead, we will use pyenv, a tool that allows users to switch Python versions easily without breaking their system.

Installing pyenv

To install pyenv, we will use the official installer.

curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
@danyay
danyay / cropamz.py
Created August 20, 2016 13:07
Crop 4x6" shipping labels out of Amazon FBA PDFs
#!/usr/bin/python
# cropamz.py
# by Dan Nunn
# 2016-08-20
from pyPdf import PdfFileWriter, PdfFileReader
import sys
import os.path
# Default the filename to the first argument, otherwise use package.pdf
@graysonchao
graysonchao / paramiko_yubikey.py
Last active October 14, 2023 13:58
RSA+YubiKey 2FA example using Paramiko
username = raw_input("Enter SSH username:")
yubikey_string = getpass.getpass('Enter YubiKey OTP:')
client = paramiko.client.SSHClient()
# Any means of getting the PKey will do. This code assumes you've only got one key loaded in your active ssh-agent.
# See also:
# - http://docs.paramiko.org/en/1.17/api/keys.html#paramiko.pkey.PKey
# - http://docs.paramiko.org/en/1.17/api/client.html#paramiko.client.SSHClient.connect
my_pkey = paramiko.agent.Agent().get_keys()[0]
@olih
olih / jq-cheetsheet.md
Last active July 16, 2024 23:02
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@Potherca
Potherca / debug-bash-scripts.md
Last active January 10, 2024 21:29
Sometimes you want to be able to debug a bash script. This gist gives an example of how to do this.

Introduction

Sometimes you want to be able to debug a bash script. Usually the -x option will suffice but sometimes something more sophisticated is needed.

In such instances using the DEBUG trap is often a good choice.

Attached to this gist is a example script to demonstrate how such a thing would work.