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

Enhancement to unswf #98

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Added relationship forming between the sample and the RawData objects.
apolkosnik-old committed Mar 25, 2015
commit 245f119de67fea8388c81744b7a4214424149d41
21 changes: 17 additions & 4 deletions unswf_service/__init__.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
import shutil
import zlib
import pylzma

from datetime import datetime

import subprocess

@@ -19,6 +19,8 @@
# for adding the actionscript
from crits.raw_data.handlers import handle_raw_data_file

from crits.core.class_mapper import class_from_id

from django.conf import settings
from django.template.loader import render_to_string
from crits.services.core import Service, ServiceConfigError
@@ -33,7 +35,7 @@ class unswfService(Service):
"""

name = "unswf"
version = '0.0.5'
version = '0.0.6'
supported_types = ['Sample']
description = "Uncompress flash files."

@@ -150,9 +152,20 @@ def run(self, obj, config):
title="Flare", data_type='text',
tool_name='Flare', tool_version='0.6', tool_details='http://www.nowrap.de/flare.html',
method=self.name,
copy_rels=True)
copy_rels=True)
raw_obj = class_from_id("RawData", res["_id"])
self._warning("obj.id: %s, raw_id:%s, suc: %s" % (str(obj.id), str(raw_obj.id), repr(res['success']) ) )
# update relationship if a related top-level object is supplied
rel_type = "Related_To"
if obj.id != raw_obj.id: #don't form relationship to itself
resy = obj.add_relationship(rel_item=raw_obj,
rel_type=rel_type,
rel_date=datetime.now(),
analyst=self.current_task.username)
obj.save(username=self.current_task.username)
raw_obj.save(username=self.current_task.username)
self._warning("resy: %s" % (str(resy)) )
self._add_result("file_added", rfile, {'md5': h3})
self._warning(res)
except Exception as exc:
self._error("unswf: (%s)." % exc)
return