Esempio n. 1
0
def dns_modified(mapper, connection, target):
    session = Session.object_session(target)

    if session.is_modified(target, include_collections=False):
        state_activity_text = activity_log.get_state_change(
            target, target.domain_name)
        if state_activity_text:
            activity_log.log_activity(
                connection=connection,
                activity_type=ACTIVITY_TYPE.keys()[ACTIVITY_TYPE.keys().index(
                    "STATE_TOGGLED")],
                activity_text=state_activity_text,
                activity_date=target.date_modified,
                entity_type=ENTITY_MAPPING["DNS"],
                entity_id=target.id,
                user_id=target.modified_user_id)

        changes = activity_log.get_modified_changes(target)
        if changes.__len__() > 0:
            activity_log.log_activity(
                connection=connection,
                activity_type=ACTIVITY_TYPE.keys()[ACTIVITY_TYPE.keys().index(
                    "ARTIFACT_MODIFIED")],
                activity_text="'%s' modified with changes: %s" %
                (target.domain_name, ', '.join(map(str, changes))),
                activity_date=target.date_modified,
                entity_type=ENTITY_MAPPING["DNS"],
                entity_id=target.id,
                user_id=target.modified_user_id)
Esempio n. 2
0
def release_made(mapper, connection, target):
    activity_log.log_activity(connection=connection,
                              activity_type=ACTIVITY_TYPE.keys()[ACTIVITY_TYPE.keys().index("RELEASES_MADE")],
                              activity_text=target.name,
                              activity_date=target.date_created,
                              entity_type=ENTITY_MAPPING["RELEASE"],
                              entity_id=target.id,
                              user_id=target.created_user_id)
Esempio n. 3
0
def yara_created(mapper, connection, target):
    activity_log.log_activity(connection=connection,
                              activity_type=ACTIVITY_TYPE.keys()
                              [ACTIVITY_TYPE.keys().index("ARTIFACT_CREATED")],
                              activity_text=target.name,
                              activity_date=target.creation_date,
                              entity_type=ENTITY_MAPPING["TASK"],
                              entity_id=target.id,
                              user_id=target.created_user_id)
Esempio n. 4
0
def dns_created(mapper, connection, target):
    activity_log.log_activity(connection=connection,
                              activity_type=ACTIVITY_TYPE.keys()
                              [ACTIVITY_TYPE.keys().index("ARTIFACT_CREATED")],
                              activity_text=target.domain_name,
                              activity_date=target.date_created,
                              entity_type=ENTITY_MAPPING["DNS"],
                              entity_id=target.id,
                              user_id=target.created_user_id)
Esempio n. 5
0
def comment_made(mapper, connection, target):
    activity_log.log_activity(connection=connection,
                              activity_type=ACTIVITY_TYPE.keys()[
                                  ACTIVITY_TYPE.keys().index("COMMENTS")],
                              activity_text=target.comment,
                              activity_date=target.date_created,
                              entity_type=target.entity_type,
                              entity_id=target.entity_id,
                              user_id=target.user_id)