Skip to content

Commit

Permalink
Merge pull request #556 from mattray/kali
Browse files Browse the repository at this point in the history
Kali Linux platform detection support
  • Loading branch information
Ryan Davis authored Jan 27, 2020
2 parents 1cca284 + 4f36f12 commit 21d6a84
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/train/platforms/detect/specifications/os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ def self.load
true
end
end
plat.name("kali").title("Kali Linux").in_family("debian")
.detect do
l_o_r = linux_os_release
if l_o_r && l_o_r["ID"] == "kali"
@platform[:release] = l_o_r["VERSION"]
true
end
end
plat.name("raspbian").title("Raspbian Linux").in_family("debian")
.detect do
if (linux_os_release && linux_os_release["NAME"] =~ /raspbian/i) || \
Expand Down
14 changes: 14 additions & 0 deletions test/unit/platforms/os_detect_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ def debian_scan(id, version)
end
end

describe "kali" do
it "sets the correct family/release for kali" do
os_release = "PRETTY_NAME=\"Kali GNU/Linux Rolling\"\nNAME=\"Kali GNU/Linux\"\nID=kali\nVERSION=\"2019.4\"\nVERSION_ID=\"2019.4\"\nVERSION_CODENAME=\"kali-rolling\"\nID_LIKE=debian\nANSI_COLOR=\"1;31\"\nHOME_URL=\"https://www.kali.org/\"\nSUPPORT_URL=\"https://forums.kali.org/\"\nBUG_REPORT_URL=\"https://bugs.kali.org/\"\n"
files = {
"/etc/os-release" => os_release,
"/etc/debian_version" => "kali-rolling",
}
platform = scan_with_files("linux", files)
_(platform[:name]).must_equal("kali")
_(platform[:family]).must_equal("debian")
_(platform[:release]).must_equal("2019.4")
end
end

describe "raspbian" do
it "sets the correct family/release for raspbian " do
files = {
Expand Down

0 comments on commit 21d6a84

Please sign in to comment.