class Sslyze < Formula include Language::Python::Virtualenv desc "SSL scanner" homepage "https://github.com/nabla-c0d3/sslyze" stable do url "https://github.com/nabla-c0d3/sslyze/archive/1.1.1.tar.gz" sha256 "c71e735e0ab61757866a00a8bfdf4921e19aa3af1efc23dab96a9c764061eb33" resource "nassl" do url "https://github.com/nabla-c0d3/nassl/archive/0.16.3.tar.gz" sha256 "2b9cdc4462a673b4884ead7dd1b258ba69edf126bb7555c52c0bb0a3a55e4ecb" end resource "openssl" do url "https://github.com/PeterMosmans/openssl.git", :revision => "e90b60086e4ed9649cb3aab08f2b4c6529e7a95a" end end bottle do cellar :any_skip_relocation sha256 "34192baa06f15b1498b65d0b7f7604770e537b737bcc3fd847720a0c407cff0c" => :sierra sha256 "ade07f858e86a95968d6cdc1cd82fc012f78cf8d208ebf4e16d3b66e2324c671" => :el_capitan sha256 "b4beec9e19ce8d584d5228d0230c00f7f908a5656cb37299768844a1a2b02e6d" => :yosemite end head do url "https://github.com/nabla-c0d3/sslyze.git" resource "nassl" do url "https://github.com/nabla-c0d3/nassl.git" end resource "openssl" do url "https://github.com/PeterMosmans/openssl.git", :branch => "1.0.2-chacha" end end depends_on :arch => :x86_64 depends_on :python if MacOS.version <= :snow_leopard resource "appdirs" do url "https://files.pythonhosted.org/packages/48/69/d87c60746b393309ca30761f8e2b49473d43450b150cb08f3c6df5c11be5/appdirs-1.4.3.tar.gz" sha256 "9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92" end resource "asn1crypto" do url "https://files.pythonhosted.org/packages/67/14/5d66588868c4304f804ebaff9397255f6ec5559e46724c2496e0f26e68d6/asn1crypto-0.22.0.tar.gz" sha256 "cbbadd640d3165ab24b06ef25d1dca09a3441611ac15f6a6b452474fdf0aed1a" end resource "cffi" do url "https://files.pythonhosted.org/packages/5b/b9/790f8eafcdab455bcd3bd908161f802c9ce5adbf702a83aa7712fcc345b7/cffi-1.10.0.tar.gz" sha256 "b3b02911eb1f6ada203b0763ba924234629b51586f72a21faacc638269f4ced5" end resource "cryptography" do url "https://files.pythonhosted.org/packages/ec/5f/d5bc241d06665eed93cd8d3aa7198024ce7833af7a67f6dc92df94e00588/cryptography-1.8.1.tar.gz" sha256 "323524312bb467565ebca7e50c8ae5e9674e544951d28a2904a50012a8828190" end resource "enum34" do url "https://files.pythonhosted.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876/enum34-1.1.6.tar.gz" sha256 "8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1" end resource "idna" do url "https://files.pythonhosted.org/packages/d8/82/28a51052215014efc07feac7330ed758702fc0581347098a81699b5281cb/idna-2.5.tar.gz" sha256 "3cb5ce08046c4e3a560fc02f138d0ac63e00f8ce5901a56b32ec8b7994082aab" end resource "ipaddress" do url "https://files.pythonhosted.org/packages/4e/13/774faf38b445d0b3a844b65747175b2e0500164b7c28d78e34987a5bfe06/ipaddress-1.0.18.tar.gz" sha256 "5d8534c8e185f2d8a1fda1ef73f2c8f4b23264e8e30063feeb9511d492a413e1" end resource "packaging" do url "https://files.pythonhosted.org/packages/c6/70/bb32913de251017e266c5114d0a645f262fb10ebc9bf6de894966d124e35/packaging-16.8.tar.gz" sha256 "5d50835fdf0a7edf0b55e311b7c887786504efea1177abd7e69329a8e5ea619e" end resource "pycparser" do url "https://files.pythonhosted.org/packages/be/64/1bb257ffb17d01f4a38d7ce686809a736837ad4371bcc5c42ba7a715c3ac/pycparser-2.17.tar.gz" sha256 "0aac31e917c24cb3357f5a4d5566f2cc91a19ca41862f6c3c22dc60a629673b6" end resource "pyparsing" do url "https://files.pythonhosted.org/packages/3c/ec/a94f8cf7274ea60b5413df054f82a8980523efd712ec55a59e7c3357cf7c/pyparsing-2.2.0.tar.gz" sha256 "0832bcf47acd283788593e7a0f542407bd9550a55a8a8435214a1960e04bcb04" end resource "typing" do url "https://files.pythonhosted.org/packages/17/75/3698d7992a828ad6d7be99c0a888b75ed173a9280e53dbae67326029b60e/typing-3.6.1.tar.gz" sha256 "c36dec260238e7464213dcd50d4b5ef63a507972f5780652e835d0228d0edace" end resource "zlib" do url "https://zlib.net/zlib-1.2.11.tar.gz" mirror "https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz" sha256 "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1" end def install venv = virtualenv_create(libexec) res = resources.map(&:name).to_set - %w[cryptography nassl openssl zlib] res.each do |r| venv.pip_install resource(r) end ENV.prepend_path "PYTHONPATH", libexec/"lib/python2.7/site-packages" resource("nassl").stage do nassl_path = Pathname.pwd # openssl fails on parallel build. Related issues: # - https://rt.openssl.org/Ticket/Display.html?id=3736&user=guest&pass=guest # - https://rt.openssl.org/Ticket/Display.html?id=3737&user=guest&pass=guest ENV.deparallelize do mv "bin/openssl/include", "nassl_openssl_include" rm_rf "bin" # make sure we don't use the prebuilt binaries (nassl_path/"bin/openssl").install "nassl_openssl_include" => "include" (nassl_path/"zlib-#{resource("zlib").version}").install resource("zlib") (nassl_path/"openssl").install resource("openssl") system "python", "build_from_scratch.py" end system "python", "run_tests.py" venv.pip_install nassl_path ENV.prepend "CPPFLAGS", "-I#{nassl_path}/openssl/include" ENV.prepend "LDFLAGS", "-L#{nassl_path}/openssl" venv.pip_install resource("cryptography") end venv.pip_install_and_link buildpath system "python", "run_tests.py" end test do assert_match "SCAN COMPLETED", shell_output("#{bin}/sslyze --regular google.com") end end