@require_safe
def filtered_chunk(request, task_id, pid, category):
 if (not request.is_ajax()):
  raise PermissionDenied
 record = results_db.analysis.find_one({'info.id': int(task_id), 'behavior.processes.pid': int(pid)}, {'behavior.processes.pid': 1, 'behavior.processes.calls': 1})
 if (not record):
  raise ObjectDoesNotExist
 process = None
 for pdict in record['behavior']['processes']:
  if (pdict['pid'] == int(pid)):
   process = pdict
 if (not process):
  raise ObjectDoesNotExist
 filtered_process = {'pid': pid, 'calls': []}
 for call in process['calls']:
  chunk = results_db.calls.find_one({'_id': call})
  for call in chunk['calls']:
   if (call['category'] == category):
    filtered_process['calls'].append(call)
 return render(request, 'analysis/behavior/_chunk.html', {'chunk': filtered_process})

@ require_safe def filtered_chunk ( request , task_id , pid , category ) : if ( not request . is_ajax ( ) ) : raise PermissionDenied record = results_db . analysis . find_one ( { 'info.id' : int ( task_id ) , 'behavior.processes.pid' : int ( pid ) } , { 'behavior.processes.pid' : 1 , 'behavior.processes.calls' : 1 } ) if ( not record ) : raise ObjectDoesNotExist process = None for pdict in record [ 'behavior' ] [ 'processes' ] : if ( pdict [ 'pid' ] == int ( pid ) ) : process = pdict if ( not process ) : raise ObjectDoesNotExist filtered_process = { 'pid' : pid , 'calls' : [ ] } for call in process [ 'calls' ] : chunk = results_db . calls . find_one ( { '_id' : call } ) for call in chunk [ 'calls' ] : if ( call [ 'category' ] == category ) : filtered_process [ 'calls' ] . append ( call ) return render ( request , 'analysis/behavior/_chunk.html' , { 'chunk' : filtered_process } )
filters calls for call category .