CuckooSandbox自定义规则 - self.mark_call,self.mark, self.has_mark函数正确使用方法

本文介绍如何在Cuckoo沙箱环境中编写有效的自定义规则,重点讲解on_call和on_complete函数的使用方法,并通过实例演示如何监控特定API调用。

刚接触Cuckoo这款沙箱,在编写自定义规则时遇到很多困难,很多模板里面用的函数官网文档上没有太详细的说明。
只好自己写规则demo,和测试样本demo,再根据沙箱报告的结果去猜这个函数应该怎么正确使用.

在观摩github社区里面其他人共享的Signature模板时,发现别人使用了很多函数,不明白是干什么,常见的模板框架里至少有下面这两个函数

  • on_call(self, call, process)
  • on_complete(self)

这两个函数官网文档里有描述是干嘛用的,第一个on_call在特定api被调用的时候,把API调用时的环境传给这个on_call函数。

on_call函数有3个签名,分别是:

  • self 用来获取当前签名类的成员信息,比如我们需要在on_call函数中,根据是否命中不同的函数,来修改当前签名的描述信息
  • call 这个参数与当前被调用的API相关,可以获取API名称以及调用API时传入的具体参数值等信息
  • process 这个参数包含的信息是,当前是哪个进程在调用这个API

默认on_call是匹配所有API调用的,所以在写Signature的时候,一定要加一些过滤,来提高性能!
我们写的规则签名文件,都是继承自abstracts.py文件中的Signautre类,在这个类中可以找到一些Cuckoo预设的字段

其中的三个字段主要用来设置on_call的调用频率

  • filter_processnames = set()
  • filter_apinames = set()
  • filter_categories = set()
  • filter_analysistypes = set()

我们可以在写自定义签名的时候,重写父类Signature的几个属性,来达到过滤,提高性能的效果。

举个例子:

我想监控写入文件的API,当写入的文件名是1.txt的时候,我要把api,进程名,写入的参数等信息显示在沙箱报告中!

先看看正常版本

from lib.cuckoo.common.abstracts import Signature

class TestWriteFile(Signature):
    name = "test_write_file"
    description = "test file api calls"
    severity = 3
    categories = ["test"]
    authors = ["Danyang.Wang"]
    minimum = "2.0"

    filter_apinames = set(["NtWriteFile","NtOpenFile","NtCreateFile"])

    def on_call(self, call, process):
        if call["api"] in ["NtOpenFile","NtCreateFile"] and call["status"]:
            if "1.txt" in call["arguments"]["filepath"]:
                self.mark_call()
        elif call["api"] == "NtWriteFile" and call["status"]:
            self.mark_call()

    def on_complete(self):
        return self.has_marks()

第一步:通过filter_apinames 指定我要哪些API走我的on_call方法。
第二步:在on_call方法中判断当我指定的API被调用时,我该怎样判断,是否本次API调用含有违规行为。
如果有违规行为我就调用self.mark_call(),这个函数的功能是在沙箱报告中显示详细的函数调用信息,参数,api,进程,句柄等。

上面例子中,我做了两个判断:

  • 当打开文件名是1.txt的时候
  • 有文件写入的时候,我要看写入了什么内容

上面两个需求都可以在条件里面调用self.mark_call()来实现,最后说一下on_complete这个函数在API调用完成后触发,一般用来判断根据API被调用后对系统产生的影响,来动态修改,description、或者规则评分,最后返回self.has_marks()

self.has_marks()函数会检查本次API调用是否有命中,有是把匹配到的东西否输出到沙箱报告中。

本次API调用有没有命中,取决于在on_call或者on_complete中有没有根据你的判断条件去调用self.mark、self.mark_ioc或self.mark_call其中任意一个函数

我分别写了三个demo来测试拦截写文件的api,刚刚上面的是第一个例子,正常版。

第二个例子:
我没有在on_call里面做任何判断,这里例子的呈现结果是会打印所有我指定的api调用的信息到沙箱报告中

    filter_apinames = set(["NtWriteFile","NtOpenFile","NtCreateFile"])

    def on_call(self, call, process):
        self.mark_call()

    def on_complete(self):
        return self.has_marks()

第三个例子:
我没有写on_complete函数,也没有返回self.has_marks(),结果就是沙箱报告没有输出任何跟这个签名的信息

 filter_apinames = set(["NtWriteFile","NtOpenFile","NtCreateFile"])

    def on_call(self, call, process):
        if call["api"] in ["NtOpenFile","NtCreateFile"] and call["status"]:
            if "1.txt" in call["arguments"]["filepath"]:
                self.mark_call()
        elif call["api"] == "NtWriteFile" and call["status"]:
            self.mark_call()

我写了一个测试程序,提交到沙箱来验证这三条规则,测试程序的功能是创建两个文件,分别是

  • 创建1.txt写入内容为 my name is wdy
  • 创建2.txt写入内容 my name is wdy2

程序的源码


#include "stdafx.h"
#include <windows.h>
#include <stdio.h>

int _tmain(int argc, _TCHAR* argv[])
{
     HANDLE hFile = NULL;
     hFile = CreateFile(L"1.txt", GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL);
     if (hFile == INVALID_HANDLE_VALUE)
     {
         printf("Create file handle failed\n");
         return 0;
     }

     DWORD dwWritten = 0;
     char name[20] = "my name is wdy";
     WriteFile(hFile, name, strlen(name), &dwWritten, NULL);
     CloseHandle(hFile);

     hFile = CreateFile(L"2.txt", GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
     if (hFile == INVALID_HANDLE_VALUE)
     {
         printf("Create file handle failed\n");
         return 0;
     }

     char name2[20] = "my name is wdy2";
     WriteFile(hFile, name2, strlen(name2), &dwWritten, NULL);
     CloseHandle(hFile);

     system("pause");
    return 0;
}

第一个例子验证结果:打印出了我想要的创建1.txt,和两次写入文件api调用信息,创建2.txt的api调用则被忽略

这里写图片描述

第二个例子验证结果:在on_call里面我没有写任何判断条件,我只调用了self.mark_call(),所以任何调用我指定api的时候,都会把当前调用的详细信息输出到沙箱报告

这里写图片描述

第三个例子验证结果:由于没有在on_complete指定self.has_marks(),所以即使你在on_call里匹配到了,沙箱报告中也不会显示这条规则被匹配到

self.mark这个函数用于自定义显示数据,比如你某个函数调用命中的时候,我想自定义数据显示在沙箱报告中,看例子:

 def on_call(self, call ,process):
        if re.match(self.indicator, call["arguments"]["regkey"], re.I):
            self.mark(name=process["process_name"],regKey=call["arguments"]["regkey"],xxx=vvv)

xxx和xxx你随便自定义,最终都会显示在沙箱报告的被命中的这条规则签名下面,只不过显示的格式是你自定义的

import tensorrt as trt import numpy as np import time import pycuda.driver as cuda import pycuda.autoinit # 自定义INT8校准器类 class MyCalibrator(trt.IInt8EntropyCalibrator2): def __init__(self, batch_size=1, input_shape=(1, 3, 224, 224), cache_file="calibration.cache"): trt.IInt8EntropyCalibrator2.__init__(self) self.batch_size = batch_size self.input_shape = input_shape self.cache_file = cache_file # 生成随机校准数据(实际应用中应使用真实数据集) self.data = np.random.randn(100, *input_shape).astype(np.float32) self.current_index = 0 # 分配设备内存 self.device_input = cuda.mem_alloc(self.data.nbytes * self.batch_size) def get_batch_size(self): return self.batch_size def get_batch(self, names): if self.current_index + self.batch_size > len(self.data): return None batch = self.data[self.current_index:self.current_index+self.batch_size] self.current_index += self.batch_size # 将数据复制到设备 cuda.memcpy_htod(self.device_input, batch.tobytes()) return [int(self.device_input)] def read_calibration_cache(self): # 如果存在缓存,跳校准 try: with open(self.cache_file, "rb") as f: return f.read() except FileNotFoundError: return None def write_calibration_cache(self, cache): with open(self.cache_file, "wb") as f: f.write(cache) # 创建简单网络(使用 add_pooling_nd 替代 add_pooling) def create_network(): logger = trt.Logger(trt.Logger.WARNING) builder = trt.Builder(logger) network = builder.create_network(1 << int(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)) # 定义输入 input_tensor = network.add_input("input", trt.DataType.FLOAT, (1, 3, 224, 224)) # 添加卷积层(模拟ResNet-18第一层) conv1 = network.add_convolution_nd( input=input_tensor, num_output_maps=64, kernel_shape=(7, 7), kernel=np.random.randn(64, 3, 7, 7).astype(np.float32).ravel(), bias=np.random.randn(64).astype(np.float32) ) # 设置步长和填充(直接赋值属性) conv1.stride_nd = [2, 2] conv1.padding_nd = [3, 3] # 添加池化层(使用 add_pooling_nd) window_shape = trt.Dims([3, 3]) # 修改:使用 trt.Dims pool1 = network.add_pooling_nd( input=conv1.get_output(0), type=trt.PoolingType.MAX, window_size=window_shape ) pool1.stride_nd = [2, 2] # 设置池化步长 # 展平输出为二维张量(N, C*H*W) flatten = network.add_shuffle(pool1.get_output(0)) output_shape = (1, 64 * 56 * 56) # 假设输入是 (1, 64, 56, 56) flatten.reshape_dims = tuple(output_shape) # 定义权重和偏置 kernel = np.random.randn(1000, 64 * 56 * 56).astype(np.float32).ravel() bias = np.random.randn(1000).astype(np.float32) # 添加常量张量作为权重和偏置 w = network.add_constant((1000, 64 * 56 * 56), kernel) b = network.add_constant((1000,), bias) # 矩阵乘法:[input] @ [weights.T] + [bias] matmul = network.add_matrix_multiply(flatten.get_output(0), trt.MatrixOperation.NONE, w.get_output(0), trt.MatrixOperation.TRANSPOSE) bias_add = network.add_elementwise(matmul.get_output(0), b.get_output(0), trt.ElementWiseOperation.SUM) # 标记输出 bias_add.get_output(0).name = "output" network.mark_output(bias_add.get_output(0)) return builder, network, logger # 主测试函数 def int8_perf_test(): # 创建网络 builder, network, logger = create_network() # 配置INT8量化 config = builder.create_builder_config() config.set_flag(trt.BuilderFlag.INT8) config.set_memory_pool_limit(trt.MemoryPoolType.WORKSPACE, 1 << 30) # 1GB工作空间 # 创建校准器并设置给配置 calib = MyCalibrator(batch_size=1, input_shape=(1, 3, 224, 224), cache_file="calibration.cache") config.int8_calibrator = calib # ✅ 正确方式:直接赋值属性 # 构建引擎(新API) engine = builder.build_engine(network, config) if not engine: print("Engine构建失败!") return # 创建执行上下文 context = engine.create_execution_context() # 准备输入输出缓冲区 input_shape = (1, 3, 224, 224) output_shape = (1, 1000) host_input = np.random.randn(*input_shape).astype(np.float32) host_output = np.empty(output_shape, dtype=np.float32) # 分配设备内存 d_input = cuda.mem_alloc(host_input.nbytes) d_output = cuda.mem_alloc(host_output.nbytes) bindings = [int(d_input), int(d_output)] # 创建CUDA流 stream = cuda.Stream() # 预热 for _ in range(5): cuda.memcpy_htod_async(d_input, host_input, stream) context.execute_async_v2(bindings=bindings, stream_handle=stream.handle) cuda.memcpy_dtoh_async(host_output, d_output, stream) stream.synchronize() # 正式测试 start = time.time() for _ in range(100): cuda.memcpy_htod_async(d_input, host_input, stream) context.execute_async_v2(bindings=bindings, stream_handle=stream.handle) cuda.memcpy_dtoh_async(host_output, d_output, stream) stream.synchronize() total_time = time.time() - start # 计算INT8 TOPS(基于ResNet-18的3.9G MACs) # 注意:INT8操作数 = MACs × 2(乘加各算一次操作) ops = 3.9e9 * 2 # ResNet-18的INT8操作数 tops = (ops * 100) / (total_time * 1e12) # 100次推理 print(f"INT8 TOPS: {tops:.2f} TOPS") # 清理资源 del context del engine if __name__ == "__main__": int8_perf_test() 报错 jp@jp-Super-Server:~/test$ python3 TensorRT_int8.py /home/jp/test/TensorRT_int8.py:113: DeprecationWarning: Use Deprecated in TensorRT 10.1. Superseded by explicit quantization. instead. config.int8_calibrator = calib # ✅ 正确方式:直接赋值属性 Traceback (most recent call last): File "/home/jp/test/TensorRT_int8.py", line 166, in <module> int8_perf_test() File "/home/jp/test/TensorRT_int8.py", line 116, in int8_perf_test engine = builder.build_engine(network, config) AttributeError: 'tensorrt_bindings.tensorrt.Builder' object has no attribute 'build_engine' 给出修改后的完整代码
06-18
NotImplementedError: Cannot convert a symbolic Tensor (lstm_1/strided_slice:0) to a numpy array. --------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last) Cell In[20], line 51 48 start_time = time.time() 50 # 选择要训练的模型类型(rnn/lstm/gru) ---> 51 train_model(model_type='lstm') 53 # 计算总耗时 54 total_time = time.time() - start_time Cell In[20], line 13, in train_model(model_type) 11 model = build_gru_model() 12 else: # 默认使用LSTM ---> 13 model = build_lstm_model() 15 # 打印模型结构 16 model.summary() Cell In[16], line 2, in build_lstm_model() 1 def build_lstm_model(): ----> 2 model = keras.Sequential([ 3 layers.Embedding(total_words, embedding_len, input_length=max_review_len), 4 layers.LSTM(64, return_sequences=False), 5 layers.Dense(1, activation='sigmoid') 6 ]) 7 return model File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/training/tracking/base.py:457, in no_automatic_dependency_tracking.<locals>._method_wrapper(self, *args, **kwargs) 455 self._self_setattr_tracking = False # pylint: disable=protected-access 456 try: --> 457 result = method(self, *args, **kwargs) 458 finally: 459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/engine/sequential.py:113, in Sequential.__init__(self, layers, name) 111 tf_utils.assert_no_legacy_layers(layers) 112 for layer in layers: --> 113 self.add(layer) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/training/tracking/base.py:457, in no_automatic_dependency_tracking.<locals>._method_wrapper(self, *args, **kwargs) 455 self._self_setattr_tracking = False # pylint: disable=protected-access 456 try: --> 457 result = method(self, *args, **kwargs) 458 finally: 459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/engine/sequential.py:195, in Sequential.add(self, layer) 190 self.inputs = layer_utils.get_source_inputs(self.outputs[0]) 192 elif self.outputs: 193 # If the model is being built continuously on top of an input layer: 194 # refresh its output. --> 195 output_tensor = layer(self.outputs[0]) 196 if len(nest.flatten(output_tensor)) != 1: 197 raise TypeError('All layers in a Sequential model ' 198 'should have a single output tensor. ' 199 'For multi-output layers, ' 200 'use the functional API.') File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/layers/recurrent.py:623, in RNN.__call__(self, inputs, initial_state, constants, **kwargs) 617 inputs, initial_state, constants = _standardize_args(inputs, 618 initial_state, 619 constants, 620 self._num_constants) 622 if initial_state is None and constants is None: --> 623 return super(RNN, self).__call__(inputs, **kwargs) 625 # If any of `initial_state` or `constants` are specified and are Keras 626 # tensors, then add them to the inputs and temporarily modify the 627 # input_spec to include them. 629 additional_inputs = [] File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/engine/base_layer.py:854, in Layer.__call__(self, inputs, *args, **kwargs) 852 outputs = base_layer_utils.mark_as_return(outputs, acd) 853 else: --> 854 outputs = call_fn(cast_inputs, *args, **kwargs) 856 except errors.OperatorNotAllowedInGraphError as e: 857 raise TypeError('You are attempting to use Python control ' 858 'flow in a layer that was not declared to be ' 859 'dynamic. Pass `dynamic=True` to the class ' 860 'constructor.\nEncountered error:\n"""\n' + 861 str(e) + '\n"""') File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/layers/recurrent.py:2548, in LSTM.call(self, inputs, mask, training, initial_state) 2546 self.cell.reset_dropout_mask() 2547 self.cell.reset_recurrent_dropout_mask() -> 2548 return super(LSTM, self).call( 2549 inputs, mask=mask, training=training, initial_state=initial_state) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/layers/recurrent.py:681, in RNN.call(self, inputs, mask, training, initial_state, constants) 675 def call(self, 676 inputs, 677 mask=None, 678 training=None, 679 initial_state=None, 680 constants=None): --> 681 inputs, initial_state, constants = self._process_inputs( 682 inputs, initial_state, constants) 684 if mask is not None: 685 # Time step masks must be the same for each input. 686 # TODO(scottzhu): Should we accept multiple different masks? 687 mask = nest.flatten(mask)[0] File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/layers/recurrent.py:798, in RNN._process_inputs(self, inputs, initial_state, constants) 796 initial_state = self.states 797 else: --> 798 initial_state = self.get_initial_state(inputs) 800 if len(initial_state) != len(self.states): 801 raise ValueError('Layer has ' + str(len(self.states)) + 802 ' states but was passed ' + str(len(initial_state)) + 803 ' initial states.') File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/layers/recurrent.py:605, in RNN.get_initial_state(self, inputs) 603 dtype = inputs.dtype 604 if get_initial_state_fn: --> 605 init_state = get_initial_state_fn( 606 inputs=None, batch_size=batch_size, dtype=dtype) 607 else: 608 init_state = _generate_zero_filled_state(batch_size, self.cell.state_size, 609 dtype) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/layers/recurrent.py:2313, in LSTMCell.get_initial_state(self, inputs, batch_size, dtype) 2312 def get_initial_state(self, inputs=None, batch_size=None, dtype=None): -> 2313 return list(_generate_zero_filled_state_for_cell( 2314 self, inputs, batch_size, dtype)) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/layers/recurrent.py:2752, in _generate_zero_filled_state_for_cell(cell, inputs, batch_size, dtype) 2750 batch_size = array_ops.shape(inputs)[0] 2751 dtype = inputs.dtype -> 2752 return _generate_zero_filled_state(batch_size, cell.state_size, dtype) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/layers/recurrent.py:2768, in _generate_zero_filled_state(batch_size_tensor, state_size, dtype) 2765 return array_ops.zeros(init_state_size, dtype=dtype) 2767 if nest.is_sequence(state_size): -> 2768 return nest.map_structure(create_zeros, state_size) 2769 else: 2770 return create_zeros(state_size) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/util/nest.py:536, in map_structure(func, *structure, **kwargs) 532 flat_structure = [flatten(s, expand_composites) for s in structure] 533 entries = zip(*flat_structure) 535 return pack_sequence_as( --> 536 structure[0], [func(*x) for x in entries], 537 expand_composites=expand_composites) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/util/nest.py:536, in <listcomp>(.0) 532 flat_structure = [flatten(s, expand_composites) for s in structure] 533 entries = zip(*flat_structure) 535 return pack_sequence_as( --> 536 structure[0], [func(*x) for x in entries], 537 expand_composites=expand_composites) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/keras/layers/recurrent.py:2765, in _generate_zero_filled_state.<locals>.create_zeros(unnested_state_size) 2763 flat_dims = tensor_shape.as_shape(unnested_state_size).as_list() 2764 init_state_size = [batch_size_tensor] + flat_dims -> 2765 return array_ops.zeros(init_state_size, dtype=dtype) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/ops/array_ops.py:2338, in zeros(shape, dtype, name) 2334 if not isinstance(shape, ops.Tensor): 2335 try: 2336 # Create a constant if it won't be very big. Otherwise create a fill op 2337 # to prevent serialized GraphDefs from becoming too large. -> 2338 output = _constant_if_small(zero, shape, dtype, name) 2339 if output is not None: 2340 return output File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/ops/array_ops.py:2295, in _constant_if_small(value, shape, dtype, name) 2293 def _constant_if_small(value, shape, dtype, name): 2294 try: -> 2295 if np.prod(shape) < 1000: 2296 return constant(value, shape=shape, dtype=dtype, name=name) 2297 except TypeError: 2298 # Happens when shape is a Tensor, list with Tensor elements, etc. File <__array_function__ internals>:180, in prod(*args, **kwargs) File /opt/conda/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3088, in prod(a, axis, dtype, out, keepdims, initial, where) 2970 @array_function_dispatch(_prod_dispatcher) 2971 def prod(a, axis=None, dtype=None, out=None, keepdims=np._NoValue, 2972 initial=np._NoValue, where=np._NoValue): 2973 """ 2974 Return the product of array elements over a given axis. 2975 (...) 3086 10 3087 """ -> 3088 return _wrapreduction(a, np.multiply, 'prod', axis, dtype, out, 3089 keepdims=keepdims, initial=initial, where=where) File /opt/conda/lib/python3.8/site-packages/numpy/core/fromnumeric.py:86, in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs) 83 else: 84 return reduction(axis=axis, out=out, **passkwargs) ---> 86 return ufunc.reduce(obj, axis, dtype, out, **passkwargs) File /opt/conda/lib/python3.8/site-packages/tensorflow_core/python/framework/ops.py:735, in Tensor.__array__(self) 734 def __array__(self): --> 735 raise NotImplementedError("Cannot convert a symbolic Tensor ({}) to a numpy" 736 " array.".format(self.name)) NotImplementedError: Cannot convert a symbolic Tensor (lstm_1/strided_slice:0) to a numpy array. + Code + Markdown ​ + Code + Markdown 4.使用训练好的模型预测文本类型 + Code + Markdown #选做 ​ + Code + Markdown keras关于fit方法中的参数定义如下 def fit(self, x=None, y=None, batch_size=None, epochs=1, verbose=‘auto’, callbacks=None, validation_split=0., validation_data=None, shuffle=True, class_weight=None, sample_weight=None, initial_epoch=0, steps_per_epoch=None, validation_steps=None, validation_batch_size=None, validation_freq=1, max_queue_size=10, workers=1, use_multiprocessing=False): + Code + Markdown
06-22
Traceback (most recent call last): File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib\tc.py", line 2037, in exe_case_body self.exe_main(case_name) File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib\tc.py", line 2019, in exe_main args=(self.mark_log_point_loader(getattr(self, case_name)),)) File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib\olib_timeout.py", line 101, in func_timeout raise_exception(exception) File "C:\olib\python37\lib\site-packages\func_timeout\py3_raise.py", line 7, in raise_exception raise exception[0] from None File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib\tc.py", line 136, in fix_timeout func(*args, **kwargs) File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib\tc.py", line 1073, in wrapper value = func(*args, **kwargs) File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib_script_oplus_performance\scripts\performance_feature\UAHCase.py", line 261, in PerfEnergyThermal_UAH_0004 if self.obj_ut.runevent(mode=0, types=['cpu'], log_path=self.logger.testcase_log_folder): File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib_script_oplus_performance\libs\oplus_performance\UAH\UahUtils.py", line 502, in runevent res = self.check_event(type=type, mode=mode) File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib_script_oplus_performance\libs\oplus_performance\UAH\UahUtils.py", line 571, in check_event if not self.check_result(report_filename, mode, 'event'): File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib_script_oplus_performance\libs\oplus_performance\UAH\UahUtils.py", line 1037, in check_result result = self.check_node_value(config_type, id, row['type'], mode, curr_line_result['pkg'], cmdEnum, opcode, valStr, value, breakpm, breakspsm, nodeid) File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib_script_oplus_performance\libs\oplus_performance\UAH\UahUtils.py", line 1075, in check_node_value valStr = self.ruleResloveConflict(id, typ, mode, pkgname, cmdEnum, valStr, breakpm, breakspsm, nodeid) File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib_script_oplus_performance\libs\oplus_performance\UAH\UahUtils.py", line 1606, in ruleResloveConflict real_valStr = self.resolveConflict(id, type, mode, pkgname, cmdEnum, valStr, '1', '1', nodeid) File "E:\olib_docker_64\25052814301000_25816\Python37\site-packages\olib_script_oplus_performance\libs\oplus_performance\UAH\UahUtils.py", line 1618, in resolveConflict platform_max_freq = self.platformconfig.get(f'cpu_{max_cmdEnum.split("_")[-1]}').get('freqList')[-1] AttributeError: 'NoneType' object has no attribute 'get'
08-14
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值