homebrew-core/Formula/hcxtools.rb

43 lines
1.4 KiB
Ruby

class Hcxtools < Formula
desc "Utils for conversion of cap/pcap/pcapng WiFi dump files"
homepage "https://github.com/ZerBea/hcxtools"
url "https://github.com/ZerBea/hcxtools/archive/6.1.1.tar.gz"
sha256 "b9830742cebaadf84679c478e8f9e7534f35f5318c243cba335dfccfddd75886"
license "MIT"
head "https://github.com/ZerBea/hcxtools.git"
bottle do
cellar :any
sha256 "28de57048c75f7989ee928255665312bcc125687a4587b0464cd780b19e4ce44" => :catalina
sha256 "0f2d40f916f84577de2fca9f5f773cc17880e0b11a3b66ae0ea0eff36a019721" => :mojave
sha256 "b8379678a34c6254d33afea1f73d5c3014ab8125cbc4303021bfaf81a08303ad" => :high_sierra
end
depends_on "openssl@1.1"
def install
bin.mkpath
man1.mkpath
system "make", "install", "PREFIX=#{prefix}"
end
test do
# Create file with 22000 hash line
testhash = testpath/"test.22000"
(testpath/"test.22000").write <<~EOS
WPA*01*4d4fe7aac3a2cecab195321ceb99a7d0*fc690c158264*f4747f87f9f4*686173686361742d6573736964***
EOS
# Convert hash to .cap file
testcap = testpath/"test.cap"
system "#{bin}/hcxhash2cap", "--pmkid-eapol=#{testhash}", "-c", testpath/"test.cap"
# Convert .cap file back to hash file
newhash = testpath/"new.22000"
system "#{bin}/hcxpcapngtool", "-o", newhash, testcap
# Diff old and new hash file to check if they are identical
system "diff", newhash, testhash
end
end