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.0.tar.gz" sha256 "9c95971f6b3f1467d9ffa58d25c49aefcba99ac058fe396aa0022c261de0c49c" resource "nassl" do url "https://github.com/nabla-c0d3/nassl/archive/0.16.2.tar.gz" sha256 "a9c8ab9338eac18ce3630a006c19a4adcc161abe59e06cc2a933dd73d8add684" end resource "openssl" do url "https://github.com/PeterMosmans/openssl.git", :revision => "118f16ee8df5906026e4a41b9bed7902da259175" end end bottle do cellar :any_skip_relocation sha256 "cf8760219625b9d42163cb804bca2a31156503dd4688b579c884696b2d8e66ba" => :sierra sha256 "f603c2644b8c6e991680643f1c6d3fb6036f4513a3cea9e6d27f5b1096db362d" => :el_capitan sha256 "7d80e3b89de4a21644ee608c911be62de87be7a22087e36403ce3475c89b47d1" => :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 "six" do url "https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz" sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a" end resource "typing" do url "https://files.pythonhosted.org/packages/b6/0c/53c42edca789378b8c05a5496e689f44e5dd82bc6861d1ae5a926ee51b84/typing-3.5.3.0.tar.gz" sha256 "ca2daac7e393e8ee86e9140cd0cf0172ff6bb50ebdf0b06281770f98f31bff21" end resource "zlib" do url "http://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 end test do assert_match "SCAN COMPLETED", shell_output("#{bin}/sslyze --regular google.com") end end