Skip to content

Instantly share code, notes, and snippets.

View koffie's full-sized avatar
🕺

Maarten Derickx koffie

🕺
View GitHub Profile
@koffie
koffie / test_cms.py
Created June 4, 2021 07:14
Problematic signature loading
from base64 import b64decode
from asn1crypto import cms
import pyasn1
from pyasn1.codec.der.decoder import decode as der_decode
from pyasn1_modules import rfc2315, rfc5652
data = {
"signature": "MIIdlgYJKoZIhvcNAQcCoIIdhzCCHYMCAQExDTALBglghkgBZQMEAgEwCwYJKoZIhvcNAQcBoIIa6zCCBXAwggNYoAMCAQICBACYlo0wDQYJKoZIhvcNAQELBQAwWDELMAkGA1UEBhMCTkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjEpMCcGA1UEAwwgU3RhYXQgZGVyIE5lZGVybGFuZGVuIEVWIFJvb3QgQ0EwHhcNMTAxMjA4MTExOTI5WhcNMjIxMjA4MTExMDI4WjBYMQswCQYDVQQGEwJOTDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4gRVYgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAOPHfon5JEs60jODNSxp7NwJpONRqCUrebgIPeCRuoSFxoWkyubJLlOkySQe\/VVmcV0sxWBoBLfZwlImOIik1jtApsLNP82Yk7NUFFiWVdVQ\/oatpGN\/XIf2juYnkmcXkgIDLNzWZnTt3Wf\/wWGNY08Pm20XMCbvq9IfEKD5xX8WaYEDR+0eaI1yoU2yJsa6bF9t1q\/RsROOqa3zXml1Jhg+QSshf+6LXQcGnUPEKQor\/Co+hss8gzr5yQ3axZnivHhBM3bhvy9d5aSYUAwV3eD6nH84aNCypnqn0TG9fopYJ0OzujOR06eYFVya5tMPddn8QZiXPqol24+SLrB7DF\/xY6k3+Zt1aUwoJiXa1fIScEVV4
@koffie
koffie / envutils.py
Created November 20, 2021 23:36 — forked from vlasovskikh/envutils.py
Source Bash file using a Python function
import os
from subprocess import Popen, PIPE
import pickle
PYTHON_DUMP_ENVIRON = """\
import sys
import os
import pickle
@koffie
koffie / !conftest.py
Last active December 1, 2021 19:28
A pytest fixture together with a makefile that allow you generate nice profiling graphs from tests
import cProfile, os, pathlib
from pytest import fixture
PROFILING_DIR = pathlib.Path("/tmp") # wherever you want the resulting files to show up
@fixture()
def profile(request):
"""
Use this fixture in a test to profile the test. The test results end up as
pstats files in: