class Dnstwist < Formula include Language::Python::Virtualenv desc "Test domains for typo squatting, phishing and corporate espionage" homepage "https://github.com/elceef/dnstwist" url "https://github.com/elceef/dnstwist/archive/20190706.tar.gz" sha256 "d1192a3aca209b537f54274471398ad4cd8b040551eb0469011d0231ee53520a" bottle do cellar :any sha256 "a15738df1be85f96cafaf7bea481911e9a34a71e24582b8b8582fdbd82e4b37f" => :catalina sha256 "b48530ee9287f78c6b0fc0fd2f8566292b950ff10552e954f1729036d0b59682" => :mojave sha256 "da539cbdea76bb9a1226e91d05bfd45e2f4cfa43c54880933f4e7e6b9b99c5ab" => :high_sierra sha256 "bb6f91f9958e7b389a607912ac336670fd1f8808c5418a95d83d1bab78c7ce8f" => :sierra end depends_on "geoip" depends_on "python" depends_on "ssdeep" resource "GeoIP" do url "https://files.pythonhosted.org/packages/f2/7b/a463b7c3df8ef4b9c92906da29ddc9e464d4045f00c475ad31cdb9a97aae/GeoIP-1.3.2.tar.gz" sha256 "a890da6a21574050692198f14b07aa4268a01371278dfc24f71cd9bc87ebf0e6" end resource "certifi" do url "https://files.pythonhosted.org/packages/c5/67/5d0548226bcc34468e23a0333978f0e23d28d0b3f0c71a151aef9c3f7680/certifi-2019.6.16.tar.gz" sha256 "945e3ba63a0b9f577b1395204e13c3a231f9bc0223888be653286534e5873695" end resource "cffi" do url "https://files.pythonhosted.org/packages/93/1a/ab8c62b5838722f29f3daffcc8d4bd61844aa9b5f437341cc890ceee483b/cffi-1.12.3.tar.gz" sha256 "041c81822e9f84b1d9c401182e174996f0bae9991f33725d059b771744290774" end resource "chardet" do url "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz" sha256 "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae" end resource "dnspython" do url "https://files.pythonhosted.org/packages/ec/c5/14bcd63cb6d06092a004793399ec395405edf97c2301dfdc146dfbd5beed/dnspython-1.16.0.zip" sha256 "36c5e8e38d4369a08b6780b7f27d790a292b2b08eea01607865bf0936c558e01" end resource "idna" do url "https://files.pythonhosted.org/packages/ad/13/eb56951b6f7950cadb579ca166e448ba77f9d24efc03edd7e55fa57d04b7/idna-2.8.tar.gz" sha256 "c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407" end resource "pycparser" do url "https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz" sha256 "a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3" end resource "requests" do url "https://files.pythonhosted.org/packages/01/62/ddcf76d1d19885e8579acb1b1df26a852b03472c0e46d2b959a714c90608/requests-2.22.0.tar.gz" sha256 "11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4" end resource "six" do url "https://files.pythonhosted.org/packages/dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca/six-1.12.0.tar.gz" sha256 "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" end resource "ssdeep" do url "https://files.pythonhosted.org/packages/96/54/15b2e0b6e5042b67eb648e3d0e5d10105e6797353fe0a63579b74bf5eeee/ssdeep-3.3.tar.gz" sha256 "255de1f034652b3ed21920221017e70e570b1644f9436fea120ae416175f4ef5" end resource "urllib3" do url "https://files.pythonhosted.org/packages/4c/13/2386233f7ee40aa8444b47f7463338f3cbdf00c316627558784e3f542f07/urllib3-1.25.3.tar.gz" sha256 "dbe59173209418ae49d485b87d1681aefa36252ee85884c31346debd19463232" end resource "whois" do url "https://files.pythonhosted.org/packages/5a/b0/c08d2d3dcd35f10ddf51b072c471872a1f426025045eb361feeac5c7e5a6/whois-0.8.tar.gz" sha256 "078298e68dee9ba0d6a2bc58a6987d9f4151e09ae0ea3b4c8c8d3dac0e7a709b" end def install ENV.append "CPPFLAGS", "-I#{MacOS.sdk_path}/usr/include/ffi" venv = virtualenv_create(libexec, "python3") venv.pip_install resources (libexec/"bin").install "dnstwist.py" => "dnstwist" (libexec/"bin/database").install "database/GeoIP.dat", "database/effective_tld_names.dat" bin.write_exec_script libexec/"bin/dnstwist" end test do output = shell_output("#{bin}/dnstwist github.com") assert_match version.to_s, output assert_match /Processing \d+ domain variants/, output end end