From ae632f1beb1c546899e9127ea4940e2dcac761fa Mon Sep 17 00:00:00 2001 From: Akashdeep Dhar Date: May 27 2020 07:53:13 +0000 Subject: Merge pull request #27 from t0xic0der/distro-identification Added distribution identification --- diff --git a/HostDetection.py b/HostDetection.py index 2bb1e9d..761b3ca 100644 --- a/HostDetection.py +++ b/HostDetection.py @@ -1,4 +1,4 @@ -import os +import os, distro, sys from colorama import init from ColoramaCalls import StatusDecorator @@ -9,14 +9,22 @@ def main(): DecoratorObject.SectionHeader("GATHERING ACTIVE INFORMATION...") DecoratorObject.SuccessMessage("Host information was gathered") datadict = { - "System": str(os.uname().sysname), + "System": str(os.uname().sysname) + " v" + str(os.uname().release), "Hostname": str(os.uname().nodename), - "Release": str(os.uname().release), "Version": str(os.uname().version), - "Machine": str(os.uname().machine), + "Distribution": str(distro.os_release_info()["name"]) + " " + str(distro.os_release_info()["version_id"]) + " " + str(os.uname().machine), } for indx in datadict.keys(): DecoratorObject.NormalMessage(indx + ": " + datadict[indx]) + if str(distro.os_release_info()["name"]) == "Fedora": + if int(distro.os_release_info()["version_id"]) >= 32: + DecoratorObject.SuccessMessage("Supported OS detected - " + datadict["Distribution"]) + else: + DecoratorObject.WarningMessage("Minimally supported OS detected - " + datadict["Distribution"]) + else: + DecoratorObject.FailureMessage("Unsupported OS detected - " + datadict["Distribution"]) + DecoratorObject.FailureMessage("Leaving installer") + sys.exit(0) if __name__ == "__main__": main() \ No newline at end of file