Exemple #1
0
        public virtual string GetOSInformation()
        {
            string tempFilePath = this.getTempFilePath();

            this.startNMapProcess(tempFilePath).WaitForExit();
            XmlNodeList  OSClassNodeList = this.getOSClassNodeList(tempFilePath);
            OSScanResult OSScanResults   = getBestAccurrancy(OSClassNodeList);

            return(this.GetSimpleOSName(OSScanResults.Best.ToString()));
        }
Exemple #2
0
        private int calculateBestAccurancy(OSScanResult OSScanResults, XmlNode OSClassNode, OSGuess OSGuess, int bestAccuracy)
        {
            XmlAttribute attOSGen = OSClassNode.Attributes["osgen"];
            OSGuess.OSGen = (attOSGen == null) ? null : attOSGen.Value;
            OSScanResults.Guesses.Add(OSGuess);

            if (OSGuess.Accuracy > bestAccuracy)
            {
                OSScanResults.Best = OSGuess;
                return OSGuess.Accuracy;
            }

            return bestAccuracy;
        }
Exemple #3
0
        private int calculateBestAccurancy(OSScanResult OSScanResults, XmlNode OSClassNode, OSGuess OSGuess, int bestAccuracy)
        {
            XmlAttribute attOSGen = OSClassNode.Attributes["osgen"];

            OSGuess.OSGen = (attOSGen == null) ? null : attOSGen.Value;
            OSScanResults.Guesses.Add(OSGuess);

            if (OSGuess.Accuracy > bestAccuracy)
            {
                OSScanResults.Best = OSGuess;
                return(OSGuess.Accuracy);
            }

            return(bestAccuracy);
        }
Exemple #4
0
        private OSScanResult getBestAccurrancy(XmlNodeList OSClassNodeList)
        {
            int          bestAccuracy  = 0;
            OSScanResult OSScanResults = new OSScanResult();

            foreach (XmlNode OSClassNode in OSClassNodeList)
            {
                var accuracy = int.Parse(OSClassNode.Attributes["accuracy"].Value);
                var vendor   = OSClassNode.Attributes["vendor"].Value;
                var family   = OSClassNode.Attributes["osfamily"].Value;
                var OSGuess  = new OSGuess()
                {
                    Accuracy = accuracy, Vendor = vendor, OSFamily = family
                };
                bestAccuracy = this.calculateBestAccurancy(OSScanResults, OSClassNode, OSGuess, bestAccuracy);
            }

            return(OSScanResults);
        }
Exemple #5
0
        private OSScanResult getBestAccurrancy(XmlNodeList OSClassNodeList)
        {
            int bestAccuracy = 0;
            OSScanResult OSScanResults = new OSScanResult();

            foreach (XmlNode OSClassNode in OSClassNodeList)
            {
                var accuracy = int.Parse(OSClassNode.Attributes["accuracy"].Value);
                var vendor = OSClassNode.Attributes["vendor"].Value;
                var family = OSClassNode.Attributes["osfamily"].Value;
                var OSGuess = new OSGuess() { Accuracy = accuracy, Vendor = vendor, OSFamily = family };
                bestAccuracy = this.calculateBestAccurancy(OSScanResults, OSClassNode, OSGuess, bestAccuracy);
            }

            return OSScanResults;
        }