本文整理汇总了C#中Attack.GetTimestamp方法的典型用法代码示例。如果您正苦于以下问题:C# Attack.GetTimestamp方法的具体用法?C# Attack.GetTimestamp怎么用?C# Attack.GetTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attack
的用法示例。
在下文中一共展示了Attack.GetTimestamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: findAppropriateResponse
/**
* Find/generate {@link Response} appropriate for specified {@link Attack}.
*
* @param attack {@link Attack} that is being analyzed
* @return {@link Response} to be executed for given {@link Attack}
*/
protected Response findAppropriateResponse(Attack attack) {
DetectionPoint triggeringDetectionPoint = attack.GetDetectionPoint();
SearchCriteria criteria = new SearchCriteria().
setUser(attack.GetUser()).
setDetectionPoint(triggeringDetectionPoint).
setDetectionSystemIds(appSensorServer.getConfiguration().getRelatedDetectionSystems(attack.GetDetectionSystemId()));
//grab any existing responses
Collection<Response> existingResponses = appSensorServer.getResponseStore().findResponses(criteria);
string responseAction = null;
Interval interval = null;
Collection<Response> possibleResponses = findPossibleResponses(triggeringDetectionPoint);
//if (existingResponses == null || existingResponses.Size() == 0) {
if(existingResponses == null || existingResponses.Count == 0) {
//no responses yet, just grab first configured response from detection point
// Response response = possibleResponses.iterator().next();
IEnumerator <Response> enumerator = possibleResponses.GetEnumerator();
enumerator.MoveNext();
Response response = enumerator.Current;
responseAction = response.getAction();
interval = response.getInterval();
} else {
foreach (Response configuredResponse in possibleResponses) {
responseAction = configuredResponse.getAction();
interval = configuredResponse.getInterval();
if (! isPreviousResponse(configuredResponse, existingResponses)) {
//if we find that this response doesn't already exist, use it
break;
}
//if we reach here, we will just use the last configured response (repeat last response)
}
}
if(responseAction == null) {
//throw new IllegalArgumentException("No appropriate response was configured for this detection point: " + triggeringDetectionPoint.getId());
throw new ArgumentException("No appropriate response was configured for this detection point: " + triggeringDetectionPoint.getId());
}
Response responses = new Response();
responses.setUser(attack.GetUser());
responses.setTimestamp(attack.GetTimestamp());
responses.setAction(responseAction);
responses.setInterval(interval);
responses.setDetectionSystemId(attack.GetDetectionSystemId());
return responses;
}