Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kali Linux platform detection support #556

Merged
merged 2 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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