{"id":13845612,"url":"https://github.com/wildcardcorp/samson","last_synced_at":"2026-01-18T13:39:13.376Z","repository":{"id":57463783,"uuid":"152138088","full_name":"wildcardcorp/samson","owner":"wildcardcorp","description":"Cryptanalysis and attack library","archived":false,"fork":false,"pushed_at":"2022-04-12T22:03:21.000Z","size":35392,"stargazers_count":23,"open_issues_count":0,"forks_count":6,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-23T18:09:15.908Z","etag":null,"topics":["cryptanalysis","cryptography","security-tools"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wildcardcorp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-08T19:55:44.000Z","updated_at":"2025-07-18T14:07:39.000Z","dependencies_parsed_at":"2022-09-14T17:11:44.042Z","dependency_job_id":null,"html_url":"https://github.com/wildcardcorp/samson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wildcardcorp/samson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildcardcorp%2Fsamson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildcardcorp%2Fsamson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildcardcorp%2Fsamson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildcardcorp%2Fsamson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wildcardcorp","download_url":"https://codeload.github.com/wildcardcorp/samson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildcardcorp%2Fsamson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28536766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T13:04:05.990Z","status":"ssl_error","status_checked_at":"2026-01-18T13:01:44.092Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptanalysis","cryptography","security-tools"],"created_at":"2024-08-04T17:03:30.244Z","updated_at":"2026-01-18T13:39:13.355Z","avatar_url":"https://github.com/wildcardcorp.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# samson\n[![https://pypi.org/project/samson-crypto/](https://img.shields.io/pypi/v/samson-crypto.svg)](https://pypi.org/project/samson-crypto/)\n![](https://img.shields.io/badge/Made%20in-frustration-red.svg)\n[![](https://img.shields.io/badge/launch-lab-579ACA.svg?logo=data:image/png;base64,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)](https://mybinder.org/v2/gh/wildcardcorp/samson/master?urlpath=lab/tree/notebooks)\n\n### **DO NOT USE SAMSON'S CRYPTOGRAPHIC PRIMITIVES TO SECURE THINGS**\n\nsamson is a cryptanalysis and attack library. The intent is to provide a way to quickly prototype and execute cryptographic and side-channel attacks. samson was born from frustration with existing libraries artificially limiting user control over cryptographic primitives.\n\nMany of the most prevalent cryptographic attacks have been implemented including:\n* CBC/PKCS#1v1.5/OAEP Padding Oracle\n* CRIME/BREACH\n* DSA/ECDSA nonce reuse\n* Stream cipher nonce reuse\n* Subgroup confinement attacks\n* Hash construction attacks (length extension, fixed points, etc)\n* PRNG cracking\n\nsamson's key focuses are:\n* _Flexibility_: Allow the user to freely manipulate internal state\n* _Uniformity_: Present the user with a uniform interface\n* _Convenience_: Minimize time spent not directly solving a problem\n* _Real world applicability_: Build attacks to work generically and include interfaces to common standards\n\n\n## Examples\n### **REPL**\nThe REPL's prompt provides information about the execution context and is formatted as such:\n```\n┌──(samson)─[EXECUTION NUMBER]─[CURRENT TIME]─[LAST EXECUTION TIME]─[USER@HOSTNAME]─[CWD]\n└─$\n```\n\nUsage of the REPL:\n\n```python\n╰─\u003e$ samson\n\n\n                                                                \n  /%%%%%%%  /%%%%%%  /%%%%%%/%%%%   /%%%%%%%  /%%%%%%  /%%%%%%% \n /%%_____/ |____  %%| %%_  %%_  %% /%%_____/ /%%__  %%| %%__  %%\n|  %%%%%%   /%%%%%%%| %% \\ %% \\ %%|  %%%%%% | %%  \\ %%| %%  \\ %%\n \\____  %% /%%__  %%| %% | %% | %% \\____  %%| %%  | %%| %%  | %%\n /%%%%%%%/|  %%%%%%%| %% | %% | %% /%%%%%%%/|  %%%%%%/| %%  | %%\n|_______/  \\_______/|__/ |__/ |__/|_______/  \\______/ |__/  |__/                                                                \n                                                                \n                                                                \n    v0.3.0 -- https://github.com/wildcardcorp/samson\n\nPython 3.6.9 (78d4c48fa091, Apr 30 2020, 07:55:31)\n[PyPy 7.3.1 with GCC 10.0.1 20200328 (Red Hat 10.0.1-0.11)]\nIPython 7.16.1\n\n\n┌──(samson)─[1]─[15:48:44]─[0:00:00.001813]─[vixen@localhost]─[/home/vixen]\n└─$ logging.getLogger(\"samson\").setLevel(logging.INFO)\n\n\n┌──(samson)─[2]─[15:48:45]─[0:00:00.000970]─[vixen@localhost]─[/home/vixen]\n└─$ # Using stream ciphers and byte manipulation \n..: RC4(b'what a key!').generate(12) ^ b'Hello world!'\n\u003cBytes: b')\\x1f\\xb8xW}\\xfc\\xc5,\\x0f\\xc3,', byteorder='big'\u003e\n\n\n┌──(samson)─[3]─[15:48:48]─[0:00:00.008846]─[vixen@localhost]─[/home/vixen]\n└─$ # Example of AES-GCM-256 \n..: gcm   = GCM(Rijndael(Bytes.random(32))) \n..: data  = b\"Auth'd data\" \n..: nonce = Bytes.random(8) \n..: ciphertext = gcm.encrypt(nonce=nonce, plaintext=b'Hello world!', data=data) \n..: gcm.decrypt(nonce, ciphertext, data)\n\u003cBytes: b'Hello world!', byteorder='big'\u003e\n\n\n┌──(samson)─[4]─[15:48:53]─[0:00:00.027646]─[vixen@localhost]─[/home/vixen]\n└─$ # Forbidden attack on GCM \n..: ciphertext_b = gcm.encrypt(nonce=nonce, plaintext=b'Wait the same nonce?', data=b'') \n..:  \n..: ciphertext_a, tag_a = ciphertext[:-16], ciphertext[-16:] \n..: ciphertext_b, tag_b = ciphertext_b[:-16], ciphertext_b[-16:] \n..:  \n..: candidates = GCM.nonce_reuse_attack(data, ciphertext_a, tag_a, b'', ciphertext_b, tag_b) \n..: gcm.H in [auth_key for auth_key, tag_mask in candidates]\nTrue\n\n\n┌──(samson)─[5]─[15:49:09]─[0:00:12.005071]─[vixen@localhost]─[/home/vixen]\n└─$ # CBC padding oracle attacks on arbitrary block ciphers \n..: bf  = Blowfish(b\"world's worst key\") \n..: cbc = CBC(bf, iv=Bytes.random(8)) \n..:  \n..: def oracle_func(attempt): \n..:     try: \n..:         cbc.decrypt(attempt) \n..:         return True \n..:     except Exception: \n..:         return False \n..:  \n..: ciphertext = cbc.encrypt(b'secret plaintext') \n..: attack     = CBCPaddingOracleAttack(PaddingOracle(oracle_func), block_size=8) \n..: recovered  = attack.execute(cbc.iv + ciphertext)\nBytes cracked: 100%|████████████████████████████████████████████████████████████████| 8/8 [00:00\u003c00:00,  8.97bytes/s]\nBytes cracked: 100%|████████████████████████████████████████████████████████████████| 8/8 [00:00\u003c00:00,  9.61bytes/s]\nBytes cracked: 100%|████████████████████████████████████████████████████████████████| 8/8 [00:00\u003c00:00,  9.33bytes/s]\nBlocks cracked: 100%|███████████████████████████████████████████████████████████████| 3/3 [00:02\u003c00:00,  1.13blocks/s]\n\n\n┌──(samson)─[6]─[15:49:13]─[0:00:02.809287]─[vixen@localhost]─[/home/vixen]\n└─$ recovered\n\u003cBytes: b'secret plaintext\\x08\\x08\\x08\\x08\\x08\\x08\\x08\\x08', byteorder='big'\u003e\n\n\n┌──(samson)─[7]─[15:49:15]─[0:00:00.012327]─[vixen@localhost]─[/home/vixen]\n└─$ # Fully-fledged computer algebra system \n..: Z_p = ZZ/ZZ(49339) \n..: P   = Z_p[x] \n..: (x**5 - x**3 + 1).factor()\n\u003cFactors: factors=SortedDict({\u003cPolynomial: x^2 + (34751)*x + 20606, coeff_ring=ZZ/(ZZ(49339))\u003e: 1, \u003cPolynomial: x^3 + (14588)*x^2 + (39369)*x + 31211, coeff_ring=ZZ/(ZZ(49339))\u003e: 1})\u003e\n\n\n┌──(samson)─[8]─[15:49:19]─[0:00:00.338368]─[vixen@localhost]─[/home/vixen]\n└─$ # Strong support for elliptic curves and constructing curves with specific properties \n..: E   = EllipticCurve.generate_curve_with_trace(256, 1) \n..: G   = E.find_gen() \n..: d   = random_int(G.order()) \n..: Q   = G*d \n..: phi = E.additive_transfer_map() \n..: (phi(Q)/phi(G))[0] == d\nTrue\n\n\n┌──(samson)─[9]─[15:49:33]─[0:00:07.236282]─[vixen@localhost]─[/home/vixen]\n└─$ # Discrete logarithm functions automatically select fastest algorithms \n..: Q/G \n38120689741865273838011422678879489970102804037838036905741887846548120785636\n```\n\n### **CLI**\n```bash\n# Hash the text 'texttohash' with MD5\n[root@localhost ~]# samson hash md5 texttohash\n0d7e83711c9c8efa135653ef124cc23b\n\n# Hash the text 'texttohash' with MD5 from STDIN\n[root@localhost ~]# echo -n \"texttohash\" | samson hash md5\n0d7e83711c9c8efa135653ef124cc23b\n\n# Hash the text 'texttohash' with BlAKE2b\n[root@localhost ~]# samson hash blake2b texttohash\nde92a99c2d5cb8386cada3589b7c70efa27c6d99a3ec1a2f9313258c0e91229f2279ccf68d6766aa20d124ca415dacbb89fb657013de1a2009752084186445a7\n\n# Hash the text 'texttohash' with Keccak instantiated with arguments\n[root@localhost ~]# samson hash keccak texttohash --args=r=1044,c=512,digest_bit_size=256\n1a568ef9ead0b2a9eeffc1d1e9a688c9153f33719ac5b30a533d1edba0e301b8\n\n# Factor an integer and display progress bar\n[root@localhost ~]# samson factor --args=visual=True 282265139124268609605114400022085050598                                        \nfactor: Bits factored:  63%|██████████████████████████████▍                 | 80.95/127.73 [00:00\u003c00:00, 568.47bit/s]\n2 * 3 * 239 * 94933 * 3394031 * 5122385479 * 119262202443691\n\n# Generate a 1024-bit RSA key (default private, default PKCS1 encoding)\n[root@localhost ~]# samson pki generate rsa --args=bits=1024\n-----BEGIN RSA PRIVATE KEY-----\nMIICXQIBAAKBgQChL/Xmka6z8EEiwNC+NXrEs1WHFjUz364hPfFlOMVAmrrWHsAls71U+6\n5VybjZPpYOBGcr/M2C6al9W7y18fkf3gAZhfPLvat8OpsfM+ltmlLJ3kTLiVJo2Y+KTPNz\nI9nrKUgD/KEcL73kvwJGYL+YwX8YNcbxKv5rNxB0kdW33wIDAQABAoGBAJhMe7ie4AZutO\nzEaLfASj6+/8oC5sQbzijkoUi16lLPoEeeiIlXGkbJA4FVd430/81AxccfN4NBin7DBjyX\n5H2BmsN3rPGnsCKC+uY4z2+er7B+i2YHgF1K5ymC/8pFV5eU5GTVF0FxZHtviLhDA0p8Fh\nliii2JNpM2MDgj7j9BAkEAuzKx+nspNtH+myjMHMRkswLiMIQ8VonOXmH6aBnQekzYvAmy\nnCbSlbYohxCYjrPy+a76siSIGK+SO8YpxG7MIQJBANxt8S+ZnrmPZKoWEu3pcn95Fa26Up\nqz2L2YemqRid6BlE2/2+cLYMVglEUfhgrqvNCFbwqc1UgeK47065iUA/8CQExZE7+uBZQn\nN2k+zWiaLNvZvDi/ZgCBedqCqWdVx/JpbyfZ6K/JIbAPuB3GBgKFn/53gCWxwpQW31RjsN\ns9uSECQQDOpkN2XI5xZ/z3d7pHUJQG7X1lYUgPwItxM4GQZuDZuKFQQo3mDMSsRd667tK7\naVWaJ33ydRV+hspPO02jvSABAkAPaMHmQcEN8c8bOWc5VjH8kxcV5iHUw88WH9hEKpHTsk\nj+LYTu11aOZXFh4dmw5jHd1gjA4bD24c0f5NN7vQLJ\n-----END RSA PRIVATE KEY-----\n\n# Generate a 128-bit RSA key, set `p` to 7, and encode using PKCS8\n[root@localhost ~]# samson pki generate rsa --args=bits=128,p=7 --encoding=pkcs8\n-----BEGIN PRIVATE KEY-----\nMFMCAQAwDQYJKoZIhvcNAQEBBQAEPzA9AgEAAgkEI+1gRNRD9i8CAwEAAQIJAIiZ98pCij\njhAgEHAgkAl2sNwLCb/pkCAQUCCQCImffKQoo44QIBBQ==\n-----END PRIVATE KEY-----\n\n# Generate a 256-bit RSA key and return the public key\n[root@localhost ~]# samson pki generate rsa --args=bits=256 --pub\n-----BEGIN PUBLIC KEY-----\nMDwwDQYJKoZIhvcNAQEBBQADKwAwKAIhAKItLmP4OG4LIOgWZRt+MFOifSHsoow9NcwAwt\np3Xx0NAgMBAAE=\n-----END PUBLIC KEY-----\n\n# Generate an ECDSA key with the NIST P-256 curve and encode for OpenSSH\n[root@localhost ~]# samson pki generate ecdsa --args=curve=nistp256 --encoding=openssh\n-----BEGIN OPENSSH PRIVATE KEY-----\nb3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAaAAAABNlY2RzYS\n1zaGEyLW5pc3RwMjU2AAAACG5pc3RwMjU2AAAAQQQnJDxj9BKhFg50vqrwzDGtJtmmlhK3\nE1l1k6L1eHlLO9MGu2JnTzV6tRFNDuCqs9QkCUDkm3sTYq+9tspJ9ISLAAAAsJ0TFlidEx\nZYAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCckPGP0EqEWDnS+\nqvDMMa0m2aaWErcTWXWTovV4eUs70wa7YmdPNXq1EU0O4Kqz1CQJQOSbexNir722ykn0hI\nsAAAAhALJ58WavKVYz2fG3koYq3Pthpmg9MJVmStjRyZMYqCrmAAAAEG5vaG9zdEBsb2Nh\nbGhvc3QBAgMEBQYH\n-----END OPENSSH PRIVATE KEY-----\n\n# Generate an EdDSA key with the Ed25519 curve, encode for OpenSSH, and output public key\n[root@localhost ~]# samson pki generate eddsa --args=curve=ed25519 --encoding=openssh --pub\nssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG0Ru2OL3mSV1aOopjhcxK+pg6fTYcyxOfBy4cjJQ0T4 nohost@localhost\n\n# Parse an RSA key from STDIN\n[root@localhost ~]# openssl genrsa 512 | samson pki parse rsa                                                                       \nGenerating RSA private key, 512 bit long modulus (2 primes)\n.....+++++++++++++++++++++++++++\n......+++++++++++++++++++++++++++\ne is 65537 (0x010001)\n\u003cPKCS1RSAPrivateKey: key=\u003cRSA: bits=512, e=65537, d=6296796031568503581556207616280967962807076376387317648643496104387929361057440965008899658110684774371838723815081555180232276065759547740996145801493 (501 bits), alt_d=4861274696277509906222134778771643290062658423191630102815100016025231770956604600068400157229874779574456479225803315459261204941026741668937047997477337 (511 bits), p=106617888174141873449919799002923479536903497687797534434241495625009665443277, q=91072482927370968074071590901226339936836118841645415967348631148765293177239, n=9709955800491882805281157142310724644199702693630485570332913039841687683191292008577884027985052180990073430823450207424691388280323554369165878661972203 (512 bits), phi=4854977900245941402640578571155362322099851346815242785166456519920843841595547159103391257571764094800084640501988233904080972664960982121196051851675844 (511 bits)\u003e\u003e\n\n# Parse key from file '/tmp/rsa', auto detect key type, and re-encode it as an X509 certificate\n[root@localhost ~]# samson pki parse auto @/tmp/rsa --encoding x509_cert --pub                                                      \n-----BEGIN CERTIFICATE-----\nMIIBEDCBu6ADAgECAgEAMA0GCSqGSIb3DQEBCwUAMA0xCzAJBgNVBAMTAmNhMB4XDTIwMT\nAyOTEyMDQzMloXDTIxMTAyOTEyMDQzMlowDTELMAkGA1UEAxMCY2EwXDANBgkqhkiG9w0B\nAQEFAANLADBIAkEA6wreAbl8FoaIP7tEMLPKKgZxNLR5GU3NLWX2VdLcRDjCln8jU7ko1V\nl+NYf1Ks6InaBiz6WxWsEQJRptN1b17wIDAQABgQIACoICAAswDQYJKoZIhvcNAQELBQAD\nQQBz0kaxh5y44pyFu4JqiTcdf85K/LOjaHozvR7dX4D+pWYLTJpbinrH2/DPgMqV5+ac+h\ntOJeM1ywT1m2oHLaQN\n-----END CERTIFICATE-----\n\n\n# Generate an ECDSA key with the NIST P-521 curve, add the certificate authority attribute, set its serial number to 666, and set its issuer to 'CN=hiya,O=hiya-corp,L=Rack City'\n[root@localhost ~]# samson pki generate ecdsa --args=curve=p521 --pub --encoding=x509_cert --encoding-args=ca=1,serial_number=666,issuer='CN=hiya,O=hiya-corp,L=Rack City'\n-----BEGIN CERTIFICATE-----\nMIICAzCCAV6gAwIBAgICApowEQYIKoZIzj0EAwIGBSuBBAAjMDcxDTALBgNVBAMTBGhpeW\nExEjAQBgNVBAoTCWhpeWEtY29ycDESMBAGA1UEBwwJUmFjayBDaXR5MB4XDTE5MDMxNTA5\nMDMwMloXDTIwMDMxNTA5MDMwMlowDTELMAkGA1UEAxMCY2EwgZswEAYHKoZIzj0CAQYFK4\nEEACMDgYYABADfi2+eDb9LhtBKZx61bQEG/2uunKr64EGv5+CBNGQEz4RL8fC6wXG14vj0\nm+It8FtADxeyud+59/MpZFk34HH4UgCvec9lWIGC/VspYySEtMyiMQGxFcGjSF30xMHmxV\nVdtCd0lwpno8swFynZbKyrTFpQPRE2xQKKi/dUh1MGBYeAhoECBKCCAgSwozIwMDAdBgNV\nHQ4EFgQUpFMCF9swcVSxvdGnBNrfB4PRdcIwDwYDVR0TAQH/BAUwAwEB/zARBggqhkjOPQ\nQDAgYFK4EEACMDgYsCwgYcCQgCtM/WKF1HGFVNXRvL+38bFgbtjkAc6lkgnv76bdngWhZj\nKzxOGlBrUMD0vXbjp0wpDnpynBxYXNZxHIrERMolw1wJBS72VR5m4ubujrW2ynM5p9hoc3\n0SK8pZp5HLipmI9gjF/ywqZZGskyFt/nK4wfU3CaoOPOxI86AC5nbwn6f5Y4wA\n-----END CERTIFICATE-----\n\n# Generate an ECDSA key with the secp224k1 curve, encode it as an X509 certificate signing request, and output its public key\n[root@localhost ~]# samson pki generate ecdsa --args=curve=secp224k1 --encoding X509_CSR --pub                                      \n-----BEGIN CERTIFICATE REQUEST-----\nMIG9MGYCAQAwDTELMAkGA1UEAxMCY2EwUDAQBgcqhkjOPQIBBgUrgQQAIAM8AAQAFY8I6Z\nP7vKDMqRYWHaPfK3c9sBIn5hLWt6hhowAVBF1H8tJBL2yHiERYfppAvpOHUomYzyMNg9KY\noAAwEQYIKoZIzj0EAwIGBSuBBAAgA0AAMD0CHBEMaqmfHfRYZV/O/iLFq6PfFh0sFl2f9n\nE1SLYCHQCAP23HzLH7frnf8diYX7fJDgNGhY9Xcf8e0iJm\n-----END CERTIFICATE REQUEST-----\n\n# Generate a Diffie-Hellman key and encode it as a DNSSEC key\n[root@localhost ~]# samson pki generate dh --encoding dns_key                                                                       \nPrivate-key-format: v1.3\nAlgorithm: 2 (DH)\nPrime(p): ///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxObIlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjftawv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXTmmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhghfDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq5RXSJhiY+gUQFXKOWoqsqmj//////////w==\nGenerator(g): Ag==\nPrivate_value(x): U+i2s0/q1S/TqGaLKVem8nopEIRnRUwMUr0hB/rsbrO930OCS7/ORezcFlzabnI8oAwX7rbjY//7Bc9j15FSrhptdG2XDKScz7BMEqmNYh4UFbnghXvnsqzPMxXHocEsqT4OXYeaCIkYAMoPZRJp7B50NalYz+x9VMZ1kwWSEqlC+LpzDjG5go+OOkURxQmWQMTpp5iyQjQkzu1vvuUVd3shg1QEOi5MUkrxAiA3KdrZSzT3Duzleiuzutj9D5o7LOhJ5P/rF/sPwJaIHVS1rc7+u63JcNLVbQzPjFSPkLRh3fFCUSMhP8rc0yTgxv15zqgbLm2ewpL0Cfkd7C9l1Q==\nPublic_value(y): A1U638iDLE+BDe7nQZ3ncHI6UDKRFWF03QJJHPhuOlvbut0vfRwoDgdERADKKzvSwZ7nauVT06c95UuEVOzVKU2aOVVF8zlAZJsKXyckEjtUHcwUF6lXzh5EjZ915KAp9LyoExSou5IVHXzjb8cy+cnG4GBWUMX8LZZ57FtkavSoZ7FLKItek1pVhleoUbjJcLo58lH9GbJqBj0oTvURe3wI4VNd52dhm9cUd4ZfnhGQzNm8YvekdW94W4MHLJ5BwV50lRMLvfWMYdfUJ+Gdd3CtCx0ge1I6Brm4YZF1Er8SM7IxuDrGeOcC+NPT92XQHqUl1tn4r9X31LGPam9ZIg==\nCreated: 20201029163524\nPublish: 20201029163524\nActivate: 20201029163524\n```\n\n\n\n## Example Use Cases\n* Auditing infrastructure\n* Modelling existing systems\n* Solving/creating CTFs\n\n\n## Testing Environment\n* **Runtime**: PyPy 7.3.1 (Python 3.6.9)\n* **Architecture**: Linux 5.11.22-100.fc32.x86_64 #1 SMP\n* **OS**: Fedora Security Lab (Fedora release 32)\n\n\n## Installation\n### **Recommended OS is Fedora and recommended Python implementation is PyPy**\nNote that PyPy may not install samson's scripts to PATH.\n\nWorkarounds include:\n* Calling samson from where PyPy *did* install it\n* Installing samson with CPython's pip as well\n\nsamson's `samson` script tries to call CPython for CLI commands anyway due to the load times of PyPy.\n\n### RHEL derivatives (tested on Fedora Security Lab 33)\n```bash\nsudo dnf -y install pypy3 pypy3-devel\npypy3 -m ensurepip\npypy3 -m pip install samson-crypto\n```\n\n### Debian derivatives (tested on Kali Linux 2021.2 64-bit)\nDebian/Ubuntu/Kali don't want you to install pip with `ensurepip`, but they only provide the package for CPython. The following is a workaround that creates a virtualenv to prevent screwing with the system's pip.\n\n```bash\napt -y install pypy3\npypy3 -m venv myvenv --without-pip --system-site-packages\nwget https://bootstrap.pypa.io/get-pip.py\n./myvenv/bin/pypy3-c ./get-pip.py\n./myvenv/bin/pypy3-c -m pip install samson-crypto\n```\n\nWhich can then by accessed like\n```bash\n./myvenv/bin/pypy3-c ./myvenv/bin/samson-py\n```\n\n\n## Performance\nsamson's primitives aren't the fastest nor were they meant to be. If you're concerned about performance, you have a couple of options:\n\n* Use primitives from a faster library (e.g. pycrypto)\n* Use PyPy instead of CPython\n\nSince samson mostly calls Python, PyPy offers large speed-ups.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildcardcorp%2Fsamson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwildcardcorp%2Fsamson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildcardcorp%2Fsamson/lists"}