public void Init(HttpApplication context)
        {
            var cfg = Config.GetConfig();
            _HoneypotService = new HoneypotService(cfg.AccessKey, cfg.TestFailure);
            _DisallowedVisitorTypes = cfg.DisallowedVisitorTypes;

            context.BeginRequest += BeginRequest;
        }
Пример #2
0
 public int UpdateVisitorType(VisitorTypes p_VisitorType)
 {
     MySqlParameter[] parameters = new MySqlParameter[] {
         new MySqlParameter("p_VisitortypeId", p_VisitorType.VisitortypeId),
         new MySqlParameter("p_VisitorTypeDescription", p_VisitorType.VisitorTypeDescription)
     };
     return(MySQLDB.MySQLDBHelper.ExecuteNonQuery("UpdateVisitorTypes", CommandType.StoredProcedure, parameters));
 }
Пример #3
0
        public int InsertVisitorType(VisitorTypes p_VisitorType)
        {
            int result = 0;

            MySqlParameter[] parameters = new MySqlParameter[] {
                new MySqlParameter("p_VisitorTypeDescription", p_VisitorType.VisitorTypeDescription),
                new MySqlParameter("p_result", MySqlDbType.Int32, 2, ParameterDirection.Output, false, 1, 1, "Out", DataRowVersion.Default, result)
            };
            return(MySQLDB.MySQLDBHelper.ExecuteNonQuery("AddVisitorTypes", CommandType.StoredProcedure, parameters));
        }
Пример #4
0
        public List <VisitorTypes> SelectVisitorTypes(int currentUserType, int deploymentId)
        {
            List <VisitorTypes> VisitorTypesCol = new List <VisitorTypes>();
            DataTable           dt             = MySQLDB.MySQLDBHelper.ExecuteSelectCommand("GetVisitortypes", CommandType.StoredProcedure);
            VisitorTypes        objVisitorType = null;

            foreach (DataRow dr in dt.Rows)
            {
                objVisitorType = new VisitorTypes();
                objVisitorType.VisitortypeId          = Convert.ToInt32(dr["VisitortypeId"].ToString());
                objVisitorType.VisitorTypeDescription = dr["VisitorTypeDescription"].ToString();
                VisitorTypesCol.Add(objVisitorType);
            }
            dt.Clear();
            dt.Dispose();
            return(VisitorTypesCol);
        }
Пример #5
0
        /// <summary>
        /// Convert the result IP into readable values
        /// </summary>
        /// <param name="entry">IP address result from Project Honeypot</param>
        private void Init(IPAddress entry)
        {
            byte[] arr = entry.GetAddressBytes();

            if (arr[0] != 127)
            {
                throw new ArgumentException("The IP address (" + entry.ToString() + ") was not a valid blacklist response.");
            }

            _LastActivity = new TimeSpan((int)arr[1], 0, 0, 0);
            _ThreatScore  = (int)arr[2];

            if (arr[3] > 7)
            {
                throw new ArgumentException("The IP address (" + entry.ToString() + ") contained an invalid vistor type.");
            }
            _Type = (VisitorTypes)arr[3];
        }
Пример #6
0
        public VisitorTypes SelectVisitorTypeByID(int p_VisitortypeId)
        {
            MySqlParameter[] parameters = new MySqlParameter[] {
                new MySqlParameter("p_VisitortypeId", p_VisitortypeId)
            };
            DataTable    dt             = MySQLDB.MySQLDBHelper.ExecuteSelectCommand("GetVisitortypeByID", CommandType.StoredProcedure, parameters);
            VisitorTypes objVisitorType = null;

            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                objVisitorType = new VisitorTypes();
                objVisitorType.VisitortypeId          = Convert.ToInt32(dr["VisitortypeId"].ToString());
                objVisitorType.VisitorTypeDescription = dr["VisitorTypeDescription"].ToString();
            }
            dt.Clear();
            dt.Dispose();
            return(objVisitorType);
        }
Пример #7
0
 private BlacklistResponse()
 {
     _LastActivity = new TimeSpan();
     _ThreatScore  = 0;
     _Type         = VisitorTypes.Unknown;
 }
Пример #8
0
 public int ModifyVisitorType(VisitorTypes p_VisitorType)
 {
     return(objVisitorTypeDBA.UpdateVisitorType(p_VisitorType));
 }
Пример #9
0
 public int AddVisitorType(VisitorTypes p_VisitorType)
 {
     return(objVisitorTypeDBA.InsertVisitorType(p_VisitorType));
 }