Exemplo n.º 1
0
 protected virtual void ProcessNext(IasRecord record)
 {
     if (next != null)
     {
         next.Process(record);
     }
 }
Exemplo n.º 2
0
        private void ProcessAccept(IasMap map)
        {
            var request = requests.RemoveAndReturn(map.Key);

            if (request == null)
            {
                return;
            }
            map.CopyMac(request);

            IasRecord record;

            try   { record = new IasRecord(map); }
            catch { return; }
            ProcessNext(record);
        }
Exemplo n.º 3
0
        public UidRecord CreateUid(IasRecord record)
        {
            var        mac = record.mac;
            UidRecord  uid = null;
            DhcpRecord dhcpRecord;

            if (dhcpCache.TryGetValue(mac, out dhcpRecord))
            {
                uid = new UidRecord(record, dhcpRecord, wifi_reauth_plus_padding);
                if (debugTable.ContainsKey(mac) || debugTable.ContainsKey("CreateUid") || debugTable.ContainsKey("dhcpCache"))
                {
                    Log.Inform("DEBUG: IAS: CreateUid: dhcpCache: " + uid);
                }
            }
            else
            {
                if (debugTable.ContainsKey(mac) || debugTable.ContainsKey("CreateUid"))
                {
                    Log.Inform("DEBUG: IAS: CreateUid: NULL");
                }
            }
            return(uid);
        }
Exemplo n.º 4
0
 public abstract void Process(IasRecord record);
Exemplo n.º 5
0
 protected void ProcessNext(IasRecord record)
 {
     next_.Process(record);
 }
Exemplo n.º 6
0
 public override void Process(IasRecord record)
 {
     PaloAltoUserIdUpdater.Instance.ProcessIas(record);
 }
Exemplo n.º 7
0
        public void ProcessIas(IasRecord record)
        {
            var        mac = record.mac;
            DhcpRecord dhcpRecord;

            if (dhcpCache.TryGetValue(mac, out dhcpRecord))
            {
                ahanetMacs.AddOrReplace(mac, dhcpRecord.name);
                publicCache.RemoveIfObsolete(mac, dhcpRecord);
            }
            {
                var header = "DEBUG: ProcessIas: BEFORE: ";
                try {
                    if (debugTable.ContainsKey(mac))
                    {
                        Log.Inform(header + record);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("ahanetMacs")) && ahanetMacs.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": ahanetMacs: " + ahanetMacs[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("registeredMacs")) && registeredMacs.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": registeredMacs: " + registeredMacs[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("publicMacs")) && publicMacs.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": publicMacs: " + publicMacs[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("rateLimitedMacs")) && rateLimitedMacs.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": rateLimitedMacs: " + rateLimitedMacs[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("publicCache")) && publicCache.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": publicCache: " + publicCache[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("dhcpCache")) && dhcpCache.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": dhcpCache: " + dhcpCache[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("iasCache")) && iasCache.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": iasCache: " + iasCache[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("uidCache")) && dhcpRecord != null && uidCache.ContainsKey(dhcpRecord.ip))
                    {
                        Log.Inform(header + mac + ": uidCache: " + uidCache[dhcpRecord.ip]);
                    }
                } catch {
                    if (debugTable.ContainsKey(mac))
                    {
                        Log.Inform(header + "Interrupted during debug info retreival.");
                    }
                }
            }
            if (debugTable.ContainsKey(mac))
            {
                Log.Inform("DEBUG: ProcessIas: NEXT: iasCache.AddOrReplace: " + record);
            }
            if (!iasCache.AddOrReplace(mac, record))
            {
                return;
            }
            if (debugTable.ContainsKey(mac))
            {
                Log.Inform("DEBUG: ProcessIas: NEXT:             CreateUid: " + record);
            }
            var uid = CreateUid(record);

            if (uid == null)
            {
                return;
            }
            if (debugTable.ContainsKey(mac))
            {
                Log.Inform("DEBUG: ProcessIas: NEXT: uidCache.AddOrReplace: " + record);
            }
            if (!uidCache.AddOrReplace(uid.ip, uid))
            {
                return;
            }
            if (debugTable.ContainsKey(mac))
            {
                Log.Inform("DEBUG: ProcessIas: NEXT: ! IsOlderThan5Minutes: " + record);
            }
            if (IsOlderThan5Minutes(record.date))
            {
                return;
            }
            if (debugTable.ContainsKey(mac))
            {
                Log.Inform("DEBUG: ProcessIas: NEXT:           LoginAhanet: " + record);
            }
            Log.Inform(string.Format("{0,-4}|{1,-19}  {2,-12}  {3,-15}  {4,-29}  {5,-5}  {6,-29}|", uid.source, uid.date.ToString("s"), mac, uid.ip, uid.logon, uid.duration, uid.note));
            LoginAhanet(uid);
            {
                var header = "DEBUG: ProcessIas: AFTER: ";
                try {
                    if (debugTable.ContainsKey(mac))
                    {
                        Log.Inform(header + record);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("ahanetMacs")) && ahanetMacs.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": ahanetMacs: " + ahanetMacs[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("registeredMacs")) && registeredMacs.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": registeredMacs: " + registeredMacs[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("publicMacs")) && publicMacs.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": publicMacs: " + publicMacs[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("rateLimitedMacs")) && rateLimitedMacs.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": rateLimitedMacs: " + rateLimitedMacs[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("publicCache")) && publicCache.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": publicCache: " + publicCache[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("dhcpCache")) && dhcpCache.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": dhcpCache: " + dhcpCache[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("iasCache")) && iasCache.ContainsKey(mac))
                    {
                        Log.Inform(header + mac + ": iasCache: " + iasCache[mac]);
                    }
                    if ((debugTable.ContainsKey(mac) || debugTable.ContainsKey("uidCache")) && dhcpRecord != null && uidCache.ContainsKey(dhcpRecord.ip))
                    {
                        Log.Inform(header + mac + ": uidCache: " + uidCache[dhcpRecord.ip]);
                    }
                } catch {
                    if (debugTable.ContainsKey(mac))
                    {
                        Log.Inform(header + "Interrupted during debug info retreival.");
                    }
                }
            }
        }