def attackCountTime():
    startTime = request.form.get('startTime', None)
    endTime = request.form.get('endTime', None)
    if startTime is None or endTime is None:
        return jsonify(AttackCount.selectAllAttackCount())
    else:
        return jsonify(AttackCount.selectAllAttackCountTime(
            startTime, endTime))
Exemplo n.º 2
0
def selectSourceAndCount():
    attack = Attack.query.with_entities(Attack.source, func.count(Attack.id).label('count')).group_by(Attack.source)\
        .order_by(desc('count')).limit(5)
    source = []
    count = []
    if AttackCount.selectSevenDayCnt() == 0:
        return []
    else:
        for i in attack:
            source.append(i.source)
            count.append(int(i.count) / AttackCount.selectSevenDayCnt())
        return [source, count]
Exemplo n.º 3
0
def AttackSituationAssessmentStatistics():
    startTime = request.form.get('startTime', None)
    endTime = request.form.get('endTime', None)
    print(startTime, endTime)
    if startTime is None or endTime is None:
        return jsonify([])
    else:
        return jsonify(
            AttackCount.AttackSituationAssessmentStatistics(
                startTime, endTime))
Exemplo n.º 4
0
def selectSevenDayIpCount():
    end_date = datetime.datetime.now()
    begin_date = end_date - datetime.timedelta(days=7)
    attack = Attack.query.with_entities(Attack.ip, func.count(Attack.id).label("count")).filter(
        and_(Attack.time >= begin_date, Attack.time <= end_date, Attack.attackType.notin_(['normal', 'anomalous'])))\
        .group_by(Attack.ip).order_by(desc("count")).limit(5)

    if attack.count is None:
        return []
    else:
        ip = list()
        count = list()
        for i in attack:
            ip.append(i.ip)
            if AttackCount.selectSevenDayAttackCnt() != 0:
                count.append(
                    int(i.count) / AttackCount.selectSevenDayAttackCnt())
            else:
                count.append(0)
        return [ip, count]
Exemplo n.º 5
0
def HistoricalAssessmentTrendStatistics():
    return jsonify(AttackCount.HistoricalAssessmentTrendStatistics())
Exemplo n.º 6
0
def visitCount():
    return jsonify(AttackCount.selectOneDayCnt())
Exemplo n.º 7
0
def weekdayCount():
    return jsonify(AttackCount.weekdayCount())
def attackCountAna():
    objects_list = AttackCount.selectAllAttackCount()
    return jsonify(objects_list)
def attackCountTable():
    objects_list = AttackCount.selectSevenDayAttackType()
    return jsonify(objects_list)
Exemplo n.º 10
0
def visitcount():
    list_cnt = AttackCount.selectOneDayCnt()
    list_cnt[0] = list_cnt[0] + list_cnt[1] + list_cnt[2]
    return jsonify(list_cnt)
Exemplo n.º 11
0
def visitcountchart():
    return jsonify(AttackCount.selectLatestThreeMonth())
Exemplo n.º 12
0
def radarchart():
    objects_list = AttackCount.selectTimeCount()
    detectionWarning()
    return jsonify(objects_list)