コード例 #1
0
        public string Grab(IPAddress ipAddress, ushort port, Layer4ProtocolType protocolType)
        {
            var sslServiceProbes = this.serviceProbeParser.GetSslServiceProbes(port, protocolType);
            var serviceProbes    = this.serviceProbeParser.GetServiceProbes(port, protocolType);
            var results          = new List <string>();

            foreach (var sslServiceProbe in sslServiceProbes)
            {
                var result = this.GrabSslBanner(sslServiceProbe, ipAddress, port);
                result = result.Replace("\0", "");

                if (result != string.Empty && result != "\r\n" && result != "\n" && result != "(" && results.Contains(result) == false)
                {
                    results.Add(result);
                }
            }

            foreach (var serviceProbe in serviceProbes)
            {
                var result = this.GrabBanner(serviceProbe, ipAddress, port);
                result = result.Replace("\0", "");

                if (result != string.Empty && result != "\u0015\u0003\u0002\u0002(" && result != "\u0015\u0003\u0001\u0002\u0002\n" && results.Contains(result) == false)
                {
                    results.Add(result);
                }
            }

            var returnValue = string.Join("\r\n\r\n###############\r\n\r\n", results);

            return(returnValue);
        }
コード例 #2
0
ファイル: ServiceProbe.cs プロジェクト: striller/PentestBro
 public ServiceProbe(Layer4ProtocolType protocolType, string name, string probe, IList <ushort> ports, IList <ushort> sslPorts)
 {
     this.ProtocolType = protocolType;
     this.Name         = name;
     this.Probe        = probe;
     this.Ports        = ports;
     this.SslPorts     = sslPorts;
 }
コード例 #3
0
 public IEnumerable <ServiceProbe> GetSslServiceProbes(ushort port, Layer4ProtocolType protocolType)
 {
     return(this.serviceProbes.Where(x => x.SslPorts.Contains(port) && x.ProtocolType == protocolType));
 }