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())); }
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; }
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); }
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); }
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; }