Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a95014e
METRON-1377: Stellar function to generate typosquatted domains (simil…
cestella Dec 19, 2017
9c492c4
flatfile summarizer initial commit.
cestella Dec 21, 2017
71e63b2
Don't want to generate original domain as it's not a typosquatted domain
cestella Dec 21, 2017
42af879
Fixed homoglyph bug with ACE domains
cestella Dec 21, 2017
7ee3ab1
Persistent bug..
cestella Dec 21, 2017
1568114
typo
cestella Dec 21, 2017
0d1e7b3
Weirdness with international domains.
cestella Dec 21, 2017
935d4d2
Updating tests and docs.
cestella Dec 21, 2017
afe91c3
more docs.
cestella Dec 21, 2017
d955e26
Renamed test.
cestella Dec 21, 2017
5328931
METRON-1379: Add an OBJECT_GET stellar function
cestella Dec 21, 2017
8fbaa25
Merge branch 'typosquat' of github.com:cestella/incubator-metron into…
cestella Dec 21, 2017
6ef76fe
Merge branch 'object_get' of github.com:cestella/incubator-metron int…
cestella Dec 21, 2017
27a0c96
Merge branch 'flatfile_object_gen' of github.com:cestella/incubator-m…
cestella Dec 21, 2017
1c20be8
Ensuring original domain doesn't make it into a typosquatted domain
cestella Dec 22, 2017
9712b77
Merge branch 'typosquat' into typosquat_merge
cestella Dec 22, 2017
3c02830
adding base document
cestella Dec 22, 2017
ac3c612
Adding a ToString writer.
cestella Dec 22, 2017
9909924
Merge branch 'flatfile_object_gen' into typosquat_merge
cestella Dec 22, 2017
34cdb55
Renamed to console writer
cestella Dec 22, 2017
bd3d0f6
Merge branch 'flatfile_object_gen' into typosquat_merge
cestella Dec 22, 2017
b3e4408
newline issue.
cestella Dec 22, 2017
261ff35
Merge branch 'flatfile_object_gen' into typosquat_merge
cestella Dec 22, 2017
e7d416e
Added readme to accompany typosquat use-case
cestella Dec 22, 2017
a272da1
Updating OBJECT_GET documentation to be better.
cestella Dec 22, 2017
22dbd63
Merge branch 'object_get' into typosquat_merge
cestella Dec 22, 2017
767e497
Allowing empty outputs
cestella Dec 23, 2017
eba0fa4
Merge branch 'flatfile_object_gen' into typosquat_merge
cestella Dec 23, 2017
b4e40a4
Missed a compilation error.
cestella Dec 23, 2017
d24583f
Merge branch 'flatfile_object_gen' into typosquat_merge
cestella Dec 23, 2017
fe7496f
Updating readme to remove dependency on -o
cestella Dec 23, 2017
870e05f
forgot header.
cestella Jan 4, 2018
d2fb81a
Some weird bug fell in here.
cestella Jan 5, 2018
60e46ea
Better comments.
cestella Jan 5, 2018
34bf1a4
Merge branch 'typosquat' into typosquat_merge
cestella Jan 5, 2018
3ed0568
Merge branch 'master' into flatfile_object_gen
cestella Jan 8, 2018
3a8ea1a
Merge branch 'master' into object_get
cestella Jan 8, 2018
4da85ab
Merge branch 'master' into typosquat_merge
cestella Jan 8, 2018
fe8be62
Reacting to Justin's comments.
cestella Jan 8, 2018
6a6968e
Merge branch 'master' into flatfile_object_gen
cestella Jan 8, 2018
d664047
Merge branch 'flatfile_object_gen' into typosquat_merge
cestella Jan 8, 2018
343e005
Removing flush.
cestella Jan 8, 2018
1af101e
Merge branch 'object_get' into typosquat_merge
cestella Jan 8, 2018
2a65360
Updated mapping to match ES5 semantics.
cestella Jan 8, 2018
d88c3eb
Fixed instructions for ES 5
cestella Jan 9, 2018
71eca50
Merge branch 'master' into typosquat_merge
cestella Jan 9, 2018
2f15163
Merge branch 'master' into typosquat_merge
cestella Jan 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.apache.metron.stellar.dsl.functions;

import com.google.common.collect.Lists;
import org.apache.metron.stellar.dsl.BaseStellarFunction;
import org.apache.metron.stellar.dsl.Stellar;
import org.apache.metron.stellar.common.LambdaExpression;
Expand All @@ -41,7 +42,7 @@ public static class Map extends BaseStellarFunction {

@Override
public Object apply(List<Object> args) {
Iterable<Object> input = (Iterable<Object>) args.get(0);
Iterable<? extends Object> input = getIterable(args.get(0));
LambdaExpression expression = (LambdaExpression)args.get(1);
if(input == null || expression == null) {
return input;
Expand All @@ -66,7 +67,7 @@ public static class Filter extends BaseStellarFunction {

@Override
public Object apply(List<Object> args) {
Iterable<Object> input = (Iterable<Object>) args.get(0);
Iterable<? extends Object> input = getIterable(args.get(0));
LambdaExpression expression = (LambdaExpression) args.get(1);
if(input == null || expression == null) {
return input;
Expand Down Expand Up @@ -95,7 +96,7 @@ public static class Reduce extends BaseStellarFunction {

@Override
public Object apply(List<Object> args) {
Iterable<Object> input = (Iterable<Object>) args.get(0);
Iterable<? extends Object> input = getIterable(args.get(0));
if(input == null || args.size() < 3) {
return null;
}
Expand All @@ -112,6 +113,21 @@ public Object apply(List<Object> args) {
}
}

private static Iterable<? extends Object> getIterable(Object o) {
if(o == null) {
return null;
}
if(o instanceof String) {
return Lists.charactersOf((String)o);
}
else if(o instanceof Iterable) {
return (Iterable<Object>)o;
}
else {
throw new IllegalArgumentException(o.getClass() + " is not an iterable, and therefore cannot be used.");
}
}

@Stellar(name="ZIP_LONGEST"
, description="Zips lists into a single list where the ith element is an list " +
"containing the ith items from the constituent lists. " +
Expand Down
Loading