Skip to content

Commit bef3ba8

Browse files
committed
some vital bits didn't get merged correctly
1 parent 7764efe commit bef3ba8

File tree

10 files changed

+37
-218
lines changed

10 files changed

+37
-218
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
![ScotLogo](https://raw.githubusercontent.com/sandialabs/scot/master/public/images/scot_logo_highrez_64x64.png)
1+
![ScotLogo](https://raw.githubusercontent.com/sandialabs/scot/master/deploy/scot_logo_highrez_64x64.png)
22
Sandia Cyber Omni Tracker
33
=========================
44

55

6-
![version](http://img.shields.io/badge/version-3.5.3-orange.svg)
6+
![version](http://img.shields.io/badge/version-3.5.2-orange.svg)
77
[![Documentation Status][docs-badge]](http://scot.readthedocs.org/en/latest/)
88
[![license](http://img.shields.io/badge/license-Apache%202-red.svg)](https://github.com/sandialabs/scot/blob/master/LICENSE)
99

lib/Scot/App/Flair.pm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,6 @@ sub process_message {
224224

225225
$id += 0;
226226

227-
$id += 0;
228-
229227
$self->log->debug("Processing Message: $action $type $id");
230228

231229
if ( $action eq "created" or $action eq "updated" ) {

lib/Scot/Collection/Alert.pm

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -182,70 +182,6 @@ sub api_subthing {
182182

183183
}
184184

185-
sub api_subthing {
186-
my $self = shift;
187-
my $req = shift;
188-
my $mongo = $self->env->mongo;
189-
190-
my $thing = $req->{collection};
191-
my $id = $req->{id}+0;
192-
my $subthing = $req->{subthing};
193-
194-
$self->env->log->debug("api_subthing: /$thing/$id/$subthing");
195-
196-
if ( $subthing eq "entry" ) {
197-
return $mongo->collection('Entry')->get_entries_by_target({
198-
id => $id,
199-
type => 'alert',
200-
});
201-
}
202-
203-
if ( $subthing eq "entity" ) {
204-
my @links = map { $_->{entity_id} }
205-
$mongo->collection('Link')->get_links_by_target({
206-
id => $id, type => 'alert'
207-
})->all;
208-
return $mongo->collection('Entity')->find({
209-
id => { '$in' => \@links }
210-
});
211-
}
212-
if ( $subthing eq "event" ) {
213-
return $mongo->collection('Event')->find({promoted_from => $id});
214-
}
215-
if ( $subthing eq "file" ) {
216-
return $mongo->collection('File')->find({
217-
'entry_target.type' => 'alert',
218-
'entry_target.id' => $id,
219-
});
220-
}
221-
if ( $subthing eq "tag" ) {
222-
my @appearances = map { $_->{apid} }
223-
$mongo->collection('Appearance')->find({
224-
type => 'tag',
225-
'target.type' => 'alert',
226-
'target.id' => $id,
227-
})->all;
228-
return $mongo->collection('Tag')->find({
229-
id => {'$in' => \@appearances}
230-
});
231-
}
232-
233-
if ( $subthing eq "source" ) {
234-
my @appearances = map { $_->{apid} }
235-
$mongo->collection('Appearance')->find({
236-
type => 'source',
237-
'target.type' => 'alert',
238-
'target.id' => $id,
239-
})->all;
240-
return $mongo->collection('Source')->find({
241-
id => {'$in' => \@appearances}
242-
});
243-
}
244-
245-
die "Unsupported alert subthing: $subthing";
246-
247-
}
248-
249185
sub update_alert_status {
250186
my $self = shift;
251187
my $id = shift;

lib/Scot/Collection/Entry.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ sub move_entry {
573573
my $object = shift;
574574
my $thref = shift;
575575
my $mongo = $self->env->mongo;
576+
576577
my $current = $mongo->collection(
577578
ucfirst($object->target->{type})
578579
)->find_iid($object->target->{id});

lib/Scot/Collection/Link.pm

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,6 @@ sub get_vertex_memo {
124124
$log->debug("Thing is now ".ref($thing));
125125
}
126126

127-
<<<<<<< HEAD
128-
my $link;
129-
try {
130-
$link = $self->create({
131-
when => $when,
132-
entity_id => $eid,
133-
value => $value,
134-
target => $target,
135-
});
136-
}
137-
catch {
138-
$self->env->log->error("Failed to create Link!: ", $_);
139-
};
140-
=======
141127

142128
if ( ! ref($thing) =~ /Scot::Model/ ) {
143129
die "Invalid input to get_vertex_memo";
@@ -210,7 +196,6 @@ sub get_object_links {
210196
my $object = shift;
211197
my $type;
212198
my $id;
213-
>>>>>>> Internal-master
214199

215200
my $vertex = $self->get_vertex($object);
216201

@@ -329,11 +314,7 @@ sub get_display_count {
329314
return $cursor->count;
330315
}
331316

332-
<<<<<<< HEAD
333-
sub get_display_count {
334-
=======
335317
sub get_display_count_agg {
336-
>>>>>>> Internal-master
337318
my $self = shift;
338319
my $entity = shift;
339320
my $log = $self->env->log;
@@ -343,84 +324,25 @@ sub get_display_count_agg {
343324
if ( $entity->status eq "untracked" ) {
344325
$log->debug("untracked entity");
345326
return 0;
346-
<<<<<<< HEAD
347-
}
348-
349-
my $cursor = $self->find({
350-
'entity_id' => $entity->id,
351-
'target.type' => {
352-
# '$in' => [ 'alert', 'incident', 'intel', 'event' ]
353-
'$nin' => [ 'alertgroup', 'entry' ]
354-
}
355-
});
356-
357-
if ( $cursor->count > 1000 ) {
358-
# return a quicker esitmate
359-
return $cursor->count;
360327
}
361328

362-
my %seen;
363-
while (my $link = $cursor->next) {
364-
my $key = $link->target->{type} . $link->target->{id};
365-
$seen{$key}++;
366-
=======
367-
>>>>>>> Internal-master
368-
}
369-
370-
<<<<<<< HEAD
371-
sub get_display_count_buggy_but_fast {
372-
my $self = shift;
373-
my $entity = shift;
374-
my $collection = $self->collection_name;
375-
my $log = $self->env->log;
376-
my %command;
377-
my $tie = tie(%command, "Tie::IxHash");
378-
%command = (
379-
'distinct' => 'link',
380-
'key' => 'target.id',
381-
'query' => {
382-
value => $entity->value,
383-
'target.type' => {
384-
'$in' => [ 'alert', 'event', 'intel', 'incident' ]
385-
=======
386329
my @agg = (
387330
{
388331
'$match' => {
389332
vertices => {
390333
id => $entity->id,
391334
type => 'entity',
392335
},
393-
>>>>>>> Internal-master
394336
}
395337
},
396338
{ '$unwind' => '$vertices' },
397339
{ '$match' => {
398340
'vertices.type' => { '$nin' => [ 'alertgroup', 'entry' ] }
399341
}},
400342
);
401-
<<<<<<< HEAD
402-
$self->env->log->debug("display count command is ",{filter=>\&Dumper, value=>\%command});
403-
404-
my $mongo = $self->meerkat;
405-
my $result = $self->_try_mongo_op(
406-
get_distinct => sub {
407-
my $dbn = $mongo->database_name;
408-
my $db = $mongo->_mongo_database($dbn);
409-
my $job = $db->run_command(\%command);
410-
# $self->env->log->debug("job is ",{filter=>\&Dumper, value=>$job});
411-
return $job->{values};
412-
}
413-
);
414-
$self->env->log->debug("got result: ",{filter=>\&Dumper, value=>$result});
415-
unless (defined $result) {
416-
return 0;
417-
}
418-
return scalar(@$result);
419-
=======
420343
# need to benchmark, if this is slow, it can kill scot workers
421344
my $query_result = $self->_mongo_collection->aggregate(\@agg);
422345
return scalar($query_result->all);
423-
>>>>>>> Internal-master
424346
}
425347

426348
sub get_linked_objects_cursor {

lib/Scot/Collection/Source.pm

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,6 @@ sub autocomplete {
5656
return wantarray ? @records : \@records;
5757
}
5858

59-
sub autocomplete {
60-
my $self = shift;
61-
my $fragment = shift;
62-
63-
my $cursor = $self->find({ value => /$fragment/ });
64-
my @records = map { { id => $_->{id}, key => $_->{value} } }
65-
$cursor->all;
66-
return wantarray ? @records : \@records;
67-
}
68-
6959
sub get_source_completion {
7060
my $self = shift;
7161
my $string = shift;

lib/Scot/Collection/Stat.pm

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,6 @@ sub put_stat {
4040
$self->increment($dt, $metric, $value);
4141
}
4242

43-
sub upsert_metric {
44-
my $self = shift;
45-
my $doc = shift;
46-
my $match = { %$doc }; # shallow clone ok bc only one level deep.
47-
my $log = $self->env->log;
48-
# $log->debug("doc: ",{filter=>\&Dumper,value=>$doc});
49-
delete $match->{value};
50-
my $obj = $self->find_one($match);
51-
unless (defined $obj) {
52-
$log->trace("New Metric, inserting");
53-
$self->create($doc);
54-
}
55-
else {
56-
$log->trace("Updating existing metric");
57-
$obj->update({
58-
'$set' => $doc
59-
});
60-
}
61-
}
62-
63-
sub put_stat {
64-
my $self = shift;
65-
my $metric = shift;
66-
my $value = shift;
67-
my $env = $self->env;
68-
my $dt = DateTime->from_epoch( epoch => $env->now );
69-
$self->increment($dt, $metric, $value);
70-
}
71-
7243
sub increment {
7344
my $self = shift;
7445
my $dt = shift;

pubdev/jsdev/react_components/components/add_flair.jsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ var AddFlair = {
2121
if ($(entity).find('.extras')[0] == null) {
2222
var currentEntityValue = $(entity).attr('data-entity-value');
2323
if (currentEntityValue != undefined && entityResult != undefined) {
24-
if (entityResult[currentEntityValue.toLowerCase()] != undefined ) {
25-
var entityType = entityResult[currentEntityValue.toLowerCase()].type;
26-
var entityid = entityResult[currentEntityValue.toLowerCase()].id;
27-
var entityCount = abbreviateNumber(parseInt(entityResult[currentEntityValue.toLowerCase()].count),0);
28-
var entitydata = entityResult[currentEntityValue.toLowerCase()].data;
29-
var entityEntryCount = entityResult[currentEntityValue.toLowerCase()].entry;
30-
var entitystatus = entityResult[currentEntityValue.toLowerCase()].status;
24+
if (entityResult[currentEntityValue] != undefined ) {
25+
var entityType = entityResult[currentEntityValue].type;
26+
var entityid = entityResult[currentEntityValue].id;
27+
var entityCount = abbreviateNumber(parseInt(entityResult[currentEntityValue].count),0);
28+
var entitydata = entityResult[currentEntityValue].data;
29+
var entityEntryCount = entityResult[currentEntityValue].entry;
30+
var entitystatus = entityResult[currentEntityValue].status;
3131
var circle = $('<span class="noselect">');
3232
circle.addClass('circleNumber');
3333
circle.addClass('extras');
@@ -76,7 +76,7 @@ var AddFlair = {
7676
}*/
7777
if (entityEntryCount != undefined) {
7878
if (entityEntryCount != 0) {
79-
var entityEntry = entityResult[currentEntityValue.toLowerCase()].entries[0].body_plain
79+
var entityEntry = entityResult[currentEntityValue].entries[0].body_plain
8080
$(entity).append($('<img class="extras" title="'+ entityEntry +'">').attr('src', '/images/flair/note.gif'));
8181
}
8282
}
@@ -97,13 +97,13 @@ var AddFlair = {
9797
subtable.find('a').find('.entity').wrap("<a href='about:blank' target='targ'></a>");
9898
var currentEntityValue = $(entity).attr('data-entity-value');
9999
if (currentEntityValue != undefined && entityResult != undefined) {
100-
if (entityResult[currentEntityValue.toLowerCase()] != undefined ) {
101-
var entityType = entityResult[currentEntityValue.toLowerCase()].type;
102-
var entityid = entityResult[currentEntityValue.toLowerCase()].id;
103-
var entityCount = abbreviateNumber(entityResult[currentEntityValue.toLowerCase()].count);
104-
var entitydata = entityResult[currentEntityValue.toLowerCase()].data;
105-
var entityEntryCount = entityResult[currentEntityValue.toLowerCase()].entry;
106-
var entitystatus = entityResult[currentEntityValue.toLowerCase()].status;
100+
if (entityResult[currentEntityValue] != undefined ) {
101+
var entityType = entityResult[currentEntityValue].type;
102+
var entityid = entityResult[currentEntityValue].id;
103+
var entityCount = abbreviateNumber(entityResult[currentEntityValue].count);
104+
var entitydata = entityResult[currentEntityValue].data;
105+
var entityEntryCount = entityResult[currentEntityValue].entry;
106+
var entitystatus = entityResult[currentEntityValue].status;
107107
var circle = $('<span class="noselect">');
108108
circle.addClass('circleNumber');
109109
circle.addClass('extras');
@@ -152,7 +152,7 @@ var AddFlair = {
152152
}*/
153153
if (entityEntryCount != undefined) {
154154
if (entityEntryCount != 0) {
155-
var entityEntry = entityResult[currentEntityValue.toLowerCase()].entries[0].body_plain
155+
var entityEntry = entityResult[currentEntityValue].entries[0].body_plain
156156
$(entity).append($('<img class="extras" title="'+ entityEntry +'">').attr('src', '/images/flair/note.gif'));
157157
}
158158
}

0 commit comments

Comments
 (0)