Skip to content

Commit

Permalink
#472 : adding match type to c2dns batch edit
Browse files Browse the repository at this point in the history
  • Loading branch information
dcuellar322 committed Jul 31, 2023
1 parent a689de5 commit 2708406
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/routes/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def batch_update(batch, artifact, session, include_tags=True):
fields_to_update = dict()
if 'description' in batch and batch['description']:
fields_to_update['description'] = batch['description']
if 'match_type' in batch and batch['match_type']:
fields_to_update['match_type'] = batch['match_type']
if 'expiration_timestamp' in batch and batch['expiration_timestamp'] and hasattr(artifact, 'expiration_timestamp'):
fields_to_update['expiration_timestamp'] = batch['expiration_timestamp']
if 'category' in batch and batch['category'] and hasattr(artifact, 'category'):
Expand Down
1 change: 1 addition & 0 deletions app/routes/c2dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def batch_update_c2dns():
"""Batch update c2dns artifacts
From Data: batch {
state (str),
match_type (str),
owner_user (str),
tags (array),
ids (array)
Expand Down
4 changes: 4 additions & 0 deletions app/static/js/c2dns/c2dns-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ angular.module('ThreatKB')
var c2dnsToUpdate = {
owner_user: $scope.batch.owner,
state: $scope.batch.state,
match_type: $scope.batch.match_type,
description: $scope.batch.description,
expiration_timestamp: $scope.batch.expiration_timestamp,
tags: $scope.batch.tags,
Expand Down Expand Up @@ -505,6 +506,7 @@ angular.module('ThreatKB')
$scope.batch = {
owner: null,
state: null,
match_type: null,
description: null,
expiration_timestamp: null,
tags: null
Expand Down Expand Up @@ -829,6 +831,8 @@ angular.module('ThreatKB')

$scope.cfg_states = Cfg_states.query();

$scope.match_types = ['exact', 'wildcard'];

$scope.ok = function () {
$uibModalInstance.close($scope.batch);
};
Expand Down
11 changes: 11 additions & 0 deletions app/static/views/c2dns/c2dns.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ <h4 class="modal-title" style="float: left; margin-right: 10px;">
</ui-select-choices>
</ui-select>
</div>
<div class="form-group">
<label>Match Type</label>
<ui-select ng-model="batch.match_type">
<ui-select-match placeholder="Select a match type or press delete to clear..">
<span ng-bind="$select.selected.match_type || batch.match_type"></span>
</ui-select-match>
<ui-select-choices repeat="match_type in (match_types | filter: $select.search)">
<span>{{ match_type }}</span>
</ui-select-choices>
</ui-select>
</div>
<div class="form-group">
<label>Description</label>
<textarea class="form-control" placeholder="Enter description..." rows="6"
Expand Down

0 comments on commit 2708406

Please sign in to comment.