Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a plotting switch for libraries needed for plotting. #18

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions lib/cuckoo/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ def parse_options(options):
def emit_options(options):
"""Emit the analysis options from a dictionary to a string."""
return ",".join("%s=%s" % (k, v) for k, v in options.items())

2 changes: 2 additions & 0 deletions lib/cuckoo/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
_current_dir = os.path.abspath(os.path.dirname(__file__))
CUCKOO_ROOT = os.path.normpath(os.path.join(_current_dir, "..", "..", ".."))

print os.listdir(CUCKOO_ROOT + "/" + "sample_data/dict")

CUCKOO_VERSION = "2.0-dev"
CUCKOO_GUEST_PORT = 8000
CUCKOO_GUEST_INIT = 0x001
Expand Down
14 changes: 14 additions & 0 deletions modules/processing/cuckooml.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,13 @@ def filter_dataset(self, dataset=None, feature_coverage=0.1,

def detect_abnormal_behaviour(self, count_dataset=None, figures=True):
"""Detect samples that behave significantly different than others."""

# Safety check for plotting
if not Config("cuckooml").cuckooml.plotting and figures:
print >> sys.stderr, "Warning: 'plotting' and 'figures' do not match. Plotting modules might not be imported."
figures = False


if count_dataset is None:
# Pull all count features
count_features = self.feature_category(":count:")
Expand Down Expand Up @@ -1133,6 +1140,13 @@ def performance_metric(clustering, labels, data, noise):

def clustering_label_distribution(self, clustering, labels, plot=False):
"""Get statistics about number of ground truth labels per cluster."""

# Safety check for plotting
if not Config("cuckooml").cuckooml.plotting and plot:
print >> sys.stderr, "Warning: 'plotting' and 'plot' do not match. Plotting modules might not be imported."
plot = False


cluster_ids = set(clustering["label"].tolist())
labels_ids = set(labels["label"].tolist())
cluster_distribution = {}
Expand Down