本文整理汇总了C#中IO2Finding类的典型用法代码示例。如果您正苦于以下问题:C# IO2Finding类的具体用法?C# IO2Finding怎么用?C# IO2Finding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IO2Finding类属于命名空间,在下文中一共展示了IO2Finding类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addTrace
public static void addTrace(IO2Finding o2Finding, List<string> values, string key)
{
foreach (string value in values)
{
o2Finding.o2Traces.Add(new O2Trace(key + " = " + value));
}
}
示例2: createCopy
public static IO2Finding createCopy(IO2Finding o2Finding, bool processChildTraces)
{
var newO2Finding = new O2Finding
{
actionObject = o2Finding.actionObject,
callerName = o2Finding.callerName,
context = o2Finding.context,
columnNumber = o2Finding.actionObject,
confidence = o2Finding.confidence,
exclude = o2Finding.exclude,
file = o2Finding.file,
lineNumber = o2Finding.lineNumber,
ordinal = o2Finding.ordinal,
projectName = o2Finding.projectName,
propertyIds = o2Finding.propertyIds,
recordId = o2Finding.recordId,
severity = o2Finding.severity,
text = createCopy(o2Finding.text),
vulnName = o2Finding.vulnName,
vulnType = o2Finding.vulnType
};
if (processChildTraces)
newO2Finding.o2Traces = createCopy(o2Finding.o2Traces);
return newO2Finding;
}
示例3: createCopy
public static IO2Finding createCopy(IO2Finding o2Finding, bool processChildTraces)
{
var newO2Finding = new O2Finding();
newO2Finding.vulnType = o2Finding.vulnType;
newO2Finding.vulnName = o2Finding.vulnName;
newO2Finding.text = createCopy(o2Finding.text);
newO2Finding.severity = o2Finding.severity;
newO2Finding.recordId = o2Finding.recordId;
newO2Finding.propertyIds = o2Finding.propertyIds;
newO2Finding.projectName = o2Finding.projectName;
newO2Finding.ordinal = o2Finding.ordinal;
newO2Finding.lineNumber = o2Finding.lineNumber;
newO2Finding.file = o2Finding.file;
newO2Finding.exclude = o2Finding.exclude;
newO2Finding.confidence = o2Finding.confidence;
newO2Finding.columnNumber = o2Finding.actionObject;
newO2Finding.context = o2Finding.context;
newO2Finding.callerName = o2Finding.callerName;
newO2Finding.actionObject = o2Finding.actionObject;
if (processChildTraces)
newO2Finding.o2Traces = createCopy(o2Finding.o2Traces);
return newO2Finding;
}
示例4: addFindingDataToO2Finding
private static void addFindingDataToO2Finding(AssessmentAsmntFileFinding finding, IO2Finding o2Finding, AssessmentRun assessmentRun)
{
AssessmentRunFindingData findingData = assessmentRun.FindingDataPool[finding.data_id-1];
AssessmentRunSite siteData = assessmentRun.SitePool[findingData.site_id - 1];
if (findingData.id != finding.data_id || siteData.id != findingData.site_id)
DI.log.error("in addFindingDataToO2Finding findingData.id != (finding.data_id-1) or siteData.id != (findingData.site_id - 1)");
else
{
o2Finding.actionObject = findingData.ao_id;
o2Finding.callerName = getStringIndexValue(siteData.caller, assessmentRun);
o2Finding.columnNumber = siteData.cn;
o2Finding.confidence = (byte) findingData.conf;
o2Finding.context = getStringIndexValue(siteData.cxt, assessmentRun);
o2Finding.exclude = finding.excluded;
o2Finding.file = getFileIndexValue(siteData.file_id, assessmentRun);
o2Finding.lineNumber = siteData.ln;
o2Finding.method = getStringIndexValue(siteData.method, assessmentRun);
o2Finding.ordinal = siteData.ord;
o2Finding.projectName = getStringIndexValue(findingData.project_name, assessmentRun);
o2Finding.propertyIds = findingData.prop_ids; /**/
o2Finding.recordId = findingData.rec_id;
o2Finding.severity = (byte) findingData.sev;
// o2Finding.signature = getStringIndexValue(siteData.sig, assessmentRun);
o2Finding.text = null; /**/
o2Finding.vulnName = getStringIndexValue(siteData.sig, assessmentRun); /*making the sig the vuln name*/
o2Finding.vulnType = getStringIndexValue(findingData.vtype, assessmentRun);
}
}
示例5: loadO2Finding
public void loadO2Finding(IO2Finding _o2Finding)
{
Threads_ExtensionMethods.invokeOnThread((Control) this, () =>
{
o2Finding = _o2Finding;
showO2TraceTree();
return null;
});
}
示例6: createCopyAndGlueTraceSinkWithTrace
public static IO2Finding createCopyAndGlueTraceSinkWithTrace(IO2Finding o2TemplateFinding,
List<IO2Trace> o2TracesToGlue)
{
IO2Finding o2NewFinding = OzasmtCopy.createCopy(o2TemplateFinding);
//IO2Trace newFindingSink = OzasmtUtils.getKnownSink(o2NewFinding.o2Traces);
IO2Trace newFindingSink = OzasmtUtils.getSink(o2NewFinding.o2Traces);
newFindingSink.traceType = TraceType.Root_Call;
foreach (O2Trace o2TraceToGlue in o2TracesToGlue)
{
o2TraceToGlue.traceType = TraceType.Root_Call;
newFindingSink.childTraces.Add(o2TraceToGlue);
}
return o2NewFinding;
}
示例7: createAllPartialTraces
public static void createAllPartialTraces(IEnumerable<IO2Trace> o2TracesToFollow, ICollection<IO2Trace> o2PartialTraces, IO2Finding parentFinding, ICollection<IO2Finding> findingsCreated)
{
// process all traces
foreach (var o2TraceToFollow in o2TracesToFollow)
{
// create a copy of the current trace
var newO2Trace = OzasmtCopy.createCopy(o2TraceToFollow, false);
//newO2Trace.childTraces = new List<IO2Trace>(); // remove the child traces
// add it to the trace we are building
o2PartialTraces.Add(newO2Trace);
// create a copy of the parent finding
var newO2Finding = OzasmtCopy.createCopy(parentFinding);
findingsCreated.Add(newO2Finding);
// and trigger the recursive execution on all child traces
createAllPartialTraces(o2TraceToFollow.childTraces, newO2Trace.childTraces, parentFinding, findingsCreated);
}
}
示例8: addTraceToO2Finding
private static void addTraceToO2Finding(string traces, IO2Finding o2Finding, AssessmentRun assessmentRun)
{
if (false == string.IsNullOrEmpty(traces))
{
var splittedTraces = traces.Split(',');
var traceStack = new Stack<List<IO2Trace>>(); // use to keep track of where we add the trace
traceStack.Push(o2Finding.o2Traces); // the first one is the main o2Findings.o2Traces
foreach(var traceItem in splittedTraces)
{
var splittedTrace = traceItem.Split('.'); // in this version the dots mean how many nodes we have to go up
int traceIndex;
if (Int32.TryParse(splittedTrace[0], out traceIndex))
{
AssessmentRunTaint taint = assessmentRun.TaintPool[traceIndex - 1];
AssessmentRunSite siteData = assessmentRun.SitePool[taint.site_id - 1];
var o2Trace = new O2Trace
{
caller = getStringIndexValue(siteData.caller, assessmentRun),
columnNumber = siteData.cn,
context = getStringIndexValue(siteData.cxt, assessmentRun),
file = getFileIndexValue(siteData.file_id, assessmentRun),
lineNumber = siteData.ln,
method = getStringIndexValue(siteData.method, assessmentRun),
ordinal = siteData.ord,
signature = getStringIndexValue(siteData.sig, assessmentRun),
argument = taint.arg,
direction = taint.dir,
traceType =((TraceType) Enum.Parse(typeof (TraceType), taint.trace_type.ToString()))
};
//o2Trace.clazz = getStringIndexValue(,assessmentRun); // check if siteData.caller is a good match for clazz
//o2Trace.taintPropagation = ;
//o2Trace.text = ;
traceStack.Peek().Add(o2Trace); // add the current trace as a child of the the item on the top of traceStack
traceStack.Push(o2Trace.childTraces); // and make the current trace the item on the top of traceStack (which will be changed if there were dots in the traceItem (handled below))
}
else
{
DI.log.error("in addTraceToO2Finding , could not parse into int {0} from {1}", splittedTrace[0], traceItem);
}
if (splittedTrace.Length > 1) // means there were dots in the traceitem
for (var i = 1; i < splittedTrace.Length; i++)
traceStack.Pop();
}
o2Finding.o2Traces[0].signature += traces;
}
}
示例9: applySinkRuleToFindingAndTrace
public static List<IO2Finding> applySinkRuleToFindingAndTrace(IO2Finding o2Finding, string traceSignature, IDictionary<string, List<IO2Rule>> indexedRules)
{
var newFindings = new List<IO2Finding>();
if (traceSignature != "" && indexedRules.ContainsKey(traceSignature))
{
// apply rules settings to it
foreach (var o2Rule in indexedRules[traceSignature])
{
// create copy of finding
var newO2Finding = OzasmtCopy.createCopy(o2Finding);
// apply rule
newO2Finding.severity = OzasmtUtils.getSeverityFromString(o2Rule.Severity);
newO2Finding.vulnName = o2Rule.Signature;
newO2Finding.vulnType = o2Rule.VulnType;
newFindings.Add(newO2Finding);
}
}
return newFindings;
}
示例10: openInFloatWindow
public static void openInFloatWindow(IO2Finding o2Finding)
{
O2Thread.mtaThread(
() =>
{
var windowName = "Finding Editor for: " + o2Finding;
O2Messages.openControlInGUISync(typeof (ascx_FindingEditor), O2DockState.Float,
windowName);
O2Messages.getAscx(windowName, guiControl =>
{
if (guiControl != null &&
guiControl is ascx_FindingEditor)
{
var findingEditor =
(ascx_FindingEditor) guiControl;
findingEditor.loadO2Finding(
o2Finding, false);
}
});
});
}
示例11: applyRuleToTrace
private static bool applyRuleToTrace(IO2Trace o2Trace, ICollection<IO2Trace> o2PartialTraces, IO2Finding parentO2Finding, List<IO2Finding> findingsCreated, IDictionary<string, List<IO2Rule>> indexedRules)
{
// if (o2Trace.signature.IndexOf("System.Data.SqlClient.SqlCommand") > -1)
// DI.log.info(o2Trace.signature);
var signatureToFind = MakeSignatureCompatibleWithOunceRules(o2Trace.signature);
// if (signatureToFind.IndexOf("System.Data.SqlClient") > -1)
// DI.log.info(signatureToFind);
if (indexedRules.ContainsKey(signatureToFind)) // means we have a match
{
// rename to shouldAbortRulesCreation
if (shouldAbortRulesExecution(indexedRules[signatureToFind]))
{
if (o2Trace.traceType == TraceType.Known_Sink || o2Trace.traceType == TraceType.Lost_Sink)
return false;
return true;
}
// check if we are a sink at the root of the tree with no child nodes (and if so skip trace creation)
if (parentO2Finding.o2Traces.Count == 0 )//; && (o2Trace.traceType == TraceType.Known_Sink || o2Trace.traceType == TraceType.Lost_Sink || o2Trace.traceType == TraceType.Root_Call))
return true;
// check if there are no sources on the trace
if (((O2Finding)parentO2Finding).Source == "")
return false;
var newTrace = OzasmtCopy.createCopy(o2Trace, false); //create new trace (which will be modified
newTrace.traceType = TraceType.Known_Sink; // make the trace a sink
o2PartialTraces.Add(newTrace); // add it to the partial trace
var newFindingWithSinkTrace = OzasmtCopy.createCopy(parentO2Finding); // create template finding which will be applied the rules
findingsCreated.AddRange(FiltersUtils.applySinkRuleToFindingAndTrace(newFindingWithSinkTrace, signatureToFind, indexedRules)); // apply rules and add resulting findings to findingsCreated list
//remove the new trace since the invokeOnAllPartialTraces loop will add its own copy
o2PartialTraces.Remove(newTrace);
}
return true; // in this case return true since we want to process ALL traces
}
开发者ID:o2platform,项目名称:O2.Platform.Projects.Misc_and_Legacy,代码行数:39,代码来源:Filter_MapSinksToAllTraces.cs
示例12: calculateTreeNodeText
private static string calculateTreeNodeText(IO2Finding o2Finding, string propertyToUse, string filterToUse)
{
string nodeText;
try
{
switch (propertyToUse)
{
case "severity":
return OzasmtUtils.getSeverityFromId(o2Finding.severity);
case "confidence":
return OzasmtUtils.getConfidenceFromId(o2Finding.confidence);
case "o2Traces":
var allO2Traces = OzasmtUtils.getAllTraces(o2Finding.o2Traces);
return (allO2Traces.Keys.Count > 0) ? string.Format("# nodes: {0}", allO2Traces.Keys.Count) : "";
default:
nodeText = DI.reflection.getProperty(propertyToUse, o2Finding).ToString();
break;
}
if (nodeText != "")
if (RegEx.findStringInString(nodeText, filterToUse) || nodeText.IndexOf(filterToUse) > -1)
return nodeText;
else
return "";
return nodeText;
}
catch (Exception ex)
{
DI.log.error("in calculateTreeNodeText: {0}", ex.Message);
return "[O2 Error (check logs for details)]";
}
}
示例13: findingWith_Traces_LostSinks
public static bool findingWith_Traces_LostSinks(IO2Finding o2Finding)
{
return ((O2Finding)o2Finding).LostSink != "";
}
示例14: findingWith_Traces_KnownSinks
public static bool findingWith_Traces_KnownSinks(IO2Finding o2Finding)
{
return ((O2Finding)o2Finding).KnownSink != "";
}
示例15: findingWith_Traces
public static bool findingWith_Traces(IO2Finding o2Finding)
{
return o2Finding.o2Traces.Count > 0;
}