Пример #1
0
def domains_search_languages_get():
    page = request.args.get('page')
    try:
        page = int(page)
    except:
        page = 1

    domains_types = request.args.getlist('domain_types')
    if domains_types:
        domains_types = domains_types[0].split(',')
    domains_types = Domain.sanitize_domain_types(domains_types)

    languages = request.args.getlist('languages')
    if languages:
        languages = languages[0].split(',')
    l_dict_domains = Domain.api_get_domains_by_languages(
        domains_types,
        Language.get_iso_from_languages(languages),
        domains_metadata=True,
        page=page)
    return render_template("domains/domains_filter_languages.html",
                           template_folder='../../',
                           l_dict_domains=l_dict_domains,
                           bootstrap_label=bootstrap_label,
                           current_languages=languages,
                           domains_types=domains_types)
Пример #2
0
def showDomain():
    if request.method == 'POST':
        domain_name = request.form.get('in_show_domain')
        epoch = None
        port = None
    else:
        domain_name = request.args.get('domain')
        epoch = request.args.get('epoch')
        port = request.args.get('port')

    res = api_validator(Domain.api_verify_if_domain_exist(domain_name))
    if res:
        return res

    domain = Domain.Domain(domain_name, port=port)

    dict_domain = domain.get_domain_metadata()
    dict_domain['domain'] = domain_name
    if domain.domain_was_up():
        dict_domain = {**dict_domain, **domain.get_domain_correlation()}
        dict_domain['correlation_nb'] = Domain.get_domain_total_nb_correlation(dict_domain)
        dict_domain['origin_item'] = domain.get_domain_last_origin()
        dict_domain['tags'] = domain.get_domain_tags()
        dict_domain['tags_safe'] = Tag.is_tags_safe(dict_domain['tags'])
        dict_domain['history'] = domain.get_domain_history_with_status()
        dict_domain['crawler_history'] = domain.get_domain_items_crawled(items_link=True, epoch=epoch, item_screenshot=True, item_tag=True) # # TODO: handle multiple port
        if dict_domain['crawler_history']['items']:
            dict_domain['crawler_history']['random_item'] = random.choice(dict_domain['crawler_history']['items'])

    return render_template("showDomain.html", dict_domain=dict_domain, bootstrap_label=bootstrap_label,
                                modal_add_tags=Tag.get_modal_add_tags(dict_domain['domain'], object_type="domain"))
Пример #3
0
def export_domain(domain):
    domain_obj = Domain.Domain(domain)
    dict_metadata = domain_obj.get_domain_metadata(tags=True)

    # create domain-ip obj
    obj = MISPObject('domain-crawled', standalone=True)
    obj.first_seen = dict_metadata['first_seen']
    obj.last_seen = dict_metadata['last_check']

    l_obj_attr = []
    l_obj_attr.append(obj.add_attribute('domain', value=domain))
    dict_all_url = Domain.get_domain_all_url(domain,
                                             domain_obj.get_domain_type())
    for crawled_url in dict_all_url:
        attribute = obj.add_attribute('url', value=crawled_url)
        attribute.first_seen = str(dict_all_url[crawled_url]['first_seen'])
        attribute.last_seen = str(dict_all_url[crawled_url]['last_seen'])
        l_obj_attr.append(attribute)

    # add tags
    if dict_metadata['tags']:
        tag_misp_object_attributes(l_obj_attr, dict_metadata['tags'])

    #print(obj.to_json())
    return obj
Пример #4
0
 def test_ExpectedCumulativeRewardSignal(self):
     determinist_domain = Domain.Domain(x=0, y=3, board=np.array([[-3, 1, -5, 0, 19],
                                                                  [6, 3, 8, 9, 10],
                                                                  [5, -8, 4, 1, -8],
                                                                  [6, -9, 4, 19, -5],
                                                                  [-20, -17, -4, -3, 9]]), beta=0)
     uppolicy = Policy.Policy(Domain.Domain.UP)
     self.assertEqual(Domain.ExpectedCumulativeRewardSignal(determinist_domain, uppolicy), -11.775377497358651)
Пример #5
0
def get_domain_status_minimal():
    data = request.get_json()
    domain = data.get('domain', None)
    # error handler
    res = Domain.api_verify_if_domain_exist(domain)
    if res:
        return create_json_response(res[0], res[1])
    res = Domain.api_get_domain_up_range(domain)
    res[0]['domain'] = domain
    return create_json_response(res[0], res[1])
Пример #6
0
 def test_MatrixJN(self):
     determinist_domain = Domain.Domain(x=0, y=3, board=np.array([[-3, 1, -5, 0, 19],
                                                                  [6, 3, 8, 9, 10],
                                                                  [5, -8, 4, 1, -8],
                                                                  [6, -9, 4, 19, -5],
                                                                  [-20, -17, -4, -3, 9]]), beta=0)
     uppolicy = Policy.Policy(Domain.Domain.UP)
     L = Domain.MatrixJN(determinist_domain, uppolicy, 4)
     self.assertEqual(L[0][0][0], 0)
     self.assertEqual(L[1][0][0], -3)
     self.assertEqual(L[2][0][0], -5.97)
     self.assertEqual(L[3][0][0], -8.9103)
Пример #7
0
 def test_JN(self):
     determinist_domain = Domain.Domain(x=0, y=3, board=np.array([[-3, 1, -5, 0, 19],
                                                                  [6, 3, 8, 9, 10],
                                                                  [5, -8, 4, 1, -8],
                                                                  [6, -9, 4, 19, -5],
                                                                  [-20, -17, -4, -3, 9]]), beta=0)
     uppolicy = Policy.Policy(Domain.Domain.UP)
     self.assertEqual(Domain.JN(determinist_domain, uppolicy, 0), 0)
     determinist_domain.state = [0, 3]
     self.assertEqual(Domain.JN(determinist_domain, uppolicy, 1), 5)
     determinist_domain.state = [0, 3]
     self.assertEqual(Domain.JN(determinist_domain, uppolicy, 2), 10.94)
Пример #8
0
def get_object_correlation(object_type,
                           value,
                           correlation_names=None,
                           correlation_objects=None,
                           requested_correl_type=None):
    if object_type == 'domain':
        return Domain.get_domain_all_correlation(
            value, correlation_names=correlation_names)
    elif object_type == 'paste' or object_type == 'item':
        return Item.get_item_all_correlation(
            value, correlation_names=correlation_names)
    elif object_type == 'decoded':
        return Decoded.get_decoded_correlated_object(
            value, correlation_objects=correlation_objects)
    elif object_type == 'pgp':
        return Pgp.pgp.get_correlation_all_object(
            requested_correl_type,
            value,
            correlation_objects=correlation_objects)
    elif object_type == 'cryptocurrency':
        return Cryptocurrency.cryptocurrency.get_correlation_all_object(
            requested_correl_type,
            value,
            correlation_objects=correlation_objects)
    elif object_type == 'username':
        return Username.correlation.get_correlation_all_object(
            requested_correl_type,
            value,
            correlation_objects=correlation_objects)
    elif object_type == 'screenshot' or object_type == 'image':
        return Screenshot.get_screenshot_correlated_object(
            value, correlation_objects=correlation_objects)
    return {}
Пример #9
0
def create_events():
    """ Creates new accidental car by parameters of vehicle that already exist. """
    acc_time_step = 5.0
    acc_id = '0#acc'

    new_acc_domain = Domain(acc_id, 1037.67, 585.98, 252.64, '10249819',
                            acc_time_step, acc_time_step + DOMAIN_DURATION)

    DOMAINS[acc_id] = new_acc_domain

    acc_veh_x, acc_veh_y = point_pos(new_acc_domain.mid_x,
                                     new_acc_domain.mid_y, DOMAIN_RANGE / 2,
                                     new_acc_domain.angle)

    acc_vehicle = Vehicle(acc_id,
                          acc_veh_x,
                          acc_veh_y,
                          speed=0,
                          lane=new_acc_domain.lane,
                          in_accident=True,
                          angle=new_acc_domain.angle)

    EVENTS[acc_time_step] = acc_vehicle
    EVENTS_IS_ONLINE[acc_id] = True

    message = Message(message_id=acc_id,
                      lifetime=MESSAGES_LIFETIME,
                      event_time_stamp=acc_time_step,
                      vehicle_type=VehicleType.SOURCE,
                      version_time_stamp=acc_time_step)

    acc_vehicle.set_messages_element(acc_id, message)
Пример #10
0
def get_object_metadata(object_type, correlation_id, type_id=None):
    if object_type == 'domain':
        return Domain.Domain(correlation_id).get_domain_metadata(tags=True)
    elif object_type == 'paste' or object_type == 'item':
        return Item.get_item({
            "id": correlation_id,
            "date": True,
            "date_separator": True,
            "tags": True
        })[0]
    elif object_type == 'decoded':
        return Decoded.get_decoded_metadata(correlation_id,
                                            nb_seen=True,
                                            size=True,
                                            file_type=True,
                                            tag=True)
    elif object_type == 'pgp':
        return Pgp.pgp.get_metadata(type_id, correlation_id)
    elif object_type == 'cryptocurrency':
        return Cryptocurrency.cryptocurrency.get_metadata(
            type_id, correlation_id)
    elif object_type == 'username':
        return Username.correlation.get_metadata(type_id, correlation_id)
    elif object_type == 'screenshot' or object_type == 'image':
        return Screenshot.get_metadata(correlation_id)
Пример #11
0
def domains_all_languages_json():
    # # TODO: get domain type
    iso = request.args.get('iso')
    domain_types = request.args.getlist('domain_types')
    return jsonify(
        Language.get_languages_from_iso(Domain.get_all_domains_languages(),
                                        sort=True))
Пример #12
0
def get_card_metadata(object_type, correlation_id, type_id=None):
    card_dict = {}
    if object_type == 'cryptocurrency':
        card_dict[
            "sparkline"] = Cryptocurrency.cryptocurrency.get_list_nb_previous_correlation_object(
                type_id, correlation_id, 6)
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, type_id)
    elif object_type == 'pgp':
        card_dict[
            "sparkline"] = Pgp.pgp.get_list_nb_previous_correlation_object(
                type_id, correlation_id, 6)
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, type_id)
    elif object_type == 'decoded':
        card_dict["sparkline"] = Decoded.get_list_nb_previous_hash(
            correlation_id, 6)
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, value=correlation_id)
        card_dict["vt"] = Decoded.get_decoded_vt_report(correlation_id)
        card_dict["vt"]["status"] = vt_enabled
    elif object_type == 'domain':
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, value=correlation_id)
        card_dict["tags"] = Domain.get_domain_tags(correlation_id)
    elif object_type == 'paste':
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, value=correlation_id)
    return card_dict
Пример #13
0
def export_domain(domain):
    domain_obj = Domain.Domain(domain)
    dict_metadata = domain_obj.get_domain_metadata(tags=True)
    dict_metadata['ports'] = ['80', '223', '443']

    # create domain-ip obj
    obj = MISPObject('domain-ip', standalone=True)
    obj.first_seen = dict_metadata['first_seen']
    obj.last_seen = dict_metadata['last_check']

    l_obj_attr = []
    l_obj_attr.append(
        obj.add_attribute('first-seen', value=dict_metadata['first_seen']))
    l_obj_attr.append(
        obj.add_attribute('last-seen', value=dict_metadata['last_check']))
    l_obj_attr.append(obj.add_attribute('domain', value=domain))
    for port in dict_metadata['ports']:
        l_obj_attr.append(obj.add_attribute('port', value=port))

    # add tags
    if dict_metadata['tags']:
        tag_misp_object_attributes(l_obj_attr, dict_metadata['tags'])

    #print(obj.to_json())
    return obj
Пример #14
0
    def prepare(self):
        # create project directory name
        self.createProjectName()

        # create snappy and domain object
        self._snappy = Snappy.Snappy(self._snappyHexMeshDir, self._logger)
        self._domain = Domain.Domain(self._snappyHexMeshDir, self._logger)
        self._simple = Simple.Simple(self._simpleFoamDir,
                                     self._snappyHexMeshDir, self._logger)

        # read/load solid
        if self._snappy.solidWritten() and not self._solidfile:
            self._logger.info("Loading Solid from snappyHexMesh")
            [self._solid, self._refsolid] = self._snappy.loadSolid()
        else:
            # check if solid file exists
            self.checkSolidFile(self._solidfile)
            self._solid = Solid.createSolidFromSTL(self._solidfile)

            self.checkSolidFile(self._refsolidfile)
            self._refsolid = Solid.createSolidFromSTL(self._refsolidfile)

            if self._edgesolidfile:
                self.checkSolidFile(self._edgesolidfile)
                self._edgesolid = Solid.createSolidFromSTL(self._edgesolidfile)

        # assign solid to snappy/domain-object
        self._snappy.setsolid(self._solid)
        self._snappy.setRefsolid(self._refsolid)
        self._snappy.setEdgesolid(self._edgesolid)
        self._domain.setsolid(self._solid)

        self._simple.setVelocityKnots(self._speedknots)
Пример #15
0
    def solve(self, level = 0):
        if self.hassolution:
            return

        # Select unassigned variable
        v = self.selectNextVariable()

        # check if the assigment is complete
        if (v == None):
            for var in self.network.variables:
                if not var.isAssigned():
                    raise ValueError("Something happened with the variable selection heuristic")
            self.hassolution = True
            return

        for i in self.getNextValues(v):

            self.trail.placeTrailMarker()
            v.updateDomain(Domain.Domain(i))

            # move to the next assignment
            if self.checkConsistency():
                self.solve(level + 1)

            if self.hassolution:
                return

            # if this assignment failed at any stage, backtrack
            self.trail.undo()
Пример #16
0
def get_object_correlation(object_type,
                           value,
                           correlation_names,
                           correlation_objects,
                           requested_correl_type=None):
    if object_type == 'domain':
        return Domain.get_domain_all_correlation(
            value, correlation_names=correlation_names)
    elif object_type == 'paste':
        return Item.get_item_all_correlation(
            value, correlation_names=correlation_names)
    elif object_type == 'decoded':
        return Decoded.get_decoded_correlated_object(value,
                                                     correlation_objects)
    elif object_type == 'pgp':
        return Pgp.pgp.get_correlation_all_object(
            requested_correl_type,
            value,
            correlation_objects=correlation_objects)
    elif object_type == 'cryptocurrency':
        return Cryptocurrency.cryptocurrency.get_correlation_all_object(
            requested_correl_type,
            value,
            correlation_objects=correlation_objects)

    return {}
Пример #17
0
def domains_explorer_web():
    page = request.args.get('page')
    try:
        page = int(page)
    except:
        page = 1

    dict_data = Domain.domains_up_by_page('regular', page=page)
    return render_template("domain_explorer.html", dict_data=dict_data, bootstrap_label=bootstrap_label, domain_type='onion')
Пример #18
0
 def set_list_of_proteins(self, file):
     with open(file, "r") as f:
         for line in f:
             protein_as_a_list = line.split("\t")
             domains_list = []
             for i in range(2, len(protein_as_a_list), 4):
                 domains_list.append(Domain(protein_as_a_list[i], protein_as_a_list[i + 1], protein_as_a_list[i+2],
                                            protein_as_a_list[i+3]))
             self.proteins.append(Protein(protein_as_a_list[0], protein_as_a_list[1], domains_list))
Пример #19
0
def domains_explorer_web():
    page = request.args.get('page')
    date_from = request.args.get('date_from')
    date_to = request.args.get('date_to')
    try:
        page = int(page)
    except:
        page = 1

    dict_data = Domain.get_domains_up_by_filers('regular', page=page, date_from=date_from, date_to=date_to)
    return render_template("domain_explorer.html", dict_data=dict_data, bootstrap_label=bootstrap_label, domain_type='regular')
Пример #20
0
    def __init__(self, json):
        try:
            content = json["LinearAdditiveUtilitySpace"]
            self._issueUtilities = content["issueUtilities"]
            self._name = content["name"]
            reservationBid = content["reservationBid"]
            self._reservationBid = Bid.Bid(reservationBid)
            domain = content["domain"]
            self._domain = Domain.Domain(domain)
            self._issueWeights = content["issueWeights"]

        except:
            print("Wrong data structure!")
Пример #21
0
def domains_search_name():
    name = request.args.get('name')
    page = request.args.get('page')
    try:
        page = int(page)
    except:
        page = 1

    domains_types = request.args.getlist('domain_types')
    if domains_types:
        domains_types = domains_types[0].split(',')
    domains_types = Domain.sanitize_domain_types(domains_types)

    l_dict_domains = Domain.api_search_domains_by_name(name,
                                                       domains_types,
                                                       domains_metadata=True,
                                                       page=page)
    return render_template("domains/domains_result_list.html",
                           template_folder='../../',
                           l_dict_domains=l_dict_domains,
                           bootstrap_label=bootstrap_label,
                           domains_types=domains_types)
Пример #22
0
def exist_object(object_type, correlation_id, type_id=None):
    if object_type == 'domain':
        return Domain.verify_if_domain_exist(correlation_id)
    elif object_type == 'paste':
        return Item.exist_item(correlation_id)
    elif object_type == 'decoded':
        return Decoded.exist_decoded(correlation_id)
    elif object_type == 'pgp':
        return Pgp.pgp._exist_corelation_field(type_id, correlation_id)
    elif object_type == 'cryptocurrency':
        return Cryptocurrency.cryptocurrency._exist_corelation_field(
            type_id, correlation_id)
    else:
        return False
Пример #23
0
    def run(self):
        limit = 300
        timestamp = int(round(time.time()))
        lastDomainName = ""

        try:
            while True:
                conn_string = "host='%s' dbname='%s' user='******' password='******'" % (
                    settings.DBG_PGSQL_SERVER, settings.DBG_PGSQL_DATABASE,
                    settings.DBG_PGSQL_USER, settings.DBG_PGSQL_PASS)
                ## conn = psycopg2.connect(conn_string)
                ## conn.autocommit = True
                conn = mdb.connect(settings.DBG_PGSQL_SERVER,
                                   settings.DBG_PGSQL_USER,
                                   settings.DBG_PGSQL_PASS,
                                   settings.DBG_PGSQL_DATABASE)
                ## curs = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)

                sqlMasterDomain = "SELECT soa_id,origin,last_check FROM soa ORDER BY last_check LIMIT " + str(
                    limit)

                ids = ""
                curs = conn.cursor()
                curs.execute(sqlMasterDomain)
                rows = curs.fetchall()
                for row in rows:
                    domainID = row[0]
                    domainName = row[1]
                    lastCheck = row[2]

                    if lastCheck > (timestamp - (6 * 3600)):
                        continue

                    ids += str(domainID) + ","

                    domain = Domain.Domain(domainID, domainName, timestamp)
                    lastDomainName = domainName

                    #self.fetchRecords(domain,curs)

                    if ids.__len__() > 2000:
                        self.updateDomainsTimestamp(timestamp, curs, ids)
                        ids = ""

                self.updateDomainsTimestamp(timestamp, curs, ids)
                ids = ""
                print("%s" % self.__class__)
                sleep(60)
        except mdb.Error as e:
            print("Database error %s" % e)
Пример #24
0
    def __init__(self, possible_Values, row, col, block):
        global STATIC_NAMING_COUNTER
        self.name = "v" + str(STATIC_NAMING_COUNTER)
        STATIC_NAMING_COUNTER += 1

        self.domain = Domain.Domain(possible_Values)
        self.row = row
        self.col = col
        self.block = block
        if self.size() == 1:
            self.modified = True
            self.changeable = False
        else:
            self.modified = False
            self.changeable = True
Пример #25
0
def exist_object(object_type, correlation_id, type_id=None): # => work on object level
    if object_type == 'domain':
        return Domain.verify_if_domain_exist(correlation_id)
    elif object_type == 'paste' or object_type == 'item':
        return Item.exist_item(correlation_id)
    elif object_type == 'decoded':
        return Decoded.exist_decoded(correlation_id)
    elif object_type == 'pgp':
        return Pgp.pgp.exist_correlation(type_id, correlation_id)
    elif object_type == 'cryptocurrency':
        return Cryptocurrency.cryptocurrency.exist_correlation(type_id, correlation_id)
    elif object_type == 'screenshot' or object_type == 'image':
        return Screenshot.exist_screenshot(correlation_id)
    else:
        return False
Пример #26
0
    def list_domains(self):
        if self.__client_id == None or self.__api_key == None:
            return None
        request = api_url + "/domains/?client_id=" + \
                  self.__client_id + "&api_key=" + self.__api_key

        r = self.__get_request(request)
        if r == None:
            return None

        list_domains = []
        for current_domain in r.json()["droplets"]:
            list_domains.append(Domain.Domain(current_domain, \
                                self.__client_id, self.__api_key))
        return list_domains
Пример #27
0
def get_crawled_domain_list():
    data = request.get_json()
    res = get_mandatory_fields(data, ['date_from', 'date_to'])
    if res:
        return create_json_response(res[0], res[1])

    date_from = data.get('date_from', None)
    date_to = data.get('date_to', None)
    domain_type = data.get('domain_type', None)
    domain_status = 'UP'
    res = Domain.api_get_domains_by_status_daterange(date_from, date_to, domain_type)
    dict_res = res[0]
    dict_res['date_from'] = date_from
    dict_res['date_to'] = date_to
    dict_res['domain_status'] = domain_status
    dict_res['domain_type'] = domain_type
    return create_json_response(dict_res, res[1])
Пример #28
0
 def reloadconfig(self):
     """
     Reload all qpackage config data from disk
     """
     cfgpath = q.system.fs.joinPaths(q.dirs.cfgDir, 'qpackages4',
                                     'sources.cfg')
     if not q.system.fs.exists(cfgpath):
         q.system.fs.createDir(q.system.fs.getDirName(cfgpath))
     else:
         cfg = q.tools.inifile.open(cfgpath)
         domainDict = dict()
         for domains in self.domains:
             domainDict[domains.domainname] = domains
         for domain in cfg.getSections():
             if domain in domainDict.keys():
                 self.domains.remove(domainDict[domain])
             self.domains.append(Domain(domainname=domain))
Пример #29
0
def add_item_tag(tag, item_path, item_type="paste", tag_date=None):

    if item_type == "paste":
        item_date = int(Item.get_item_date(item_path))

        #add tag
        r_serv_metadata.sadd('tag:{}'.format(item_path), tag)
        r_serv_tags.sadd('{}:{}'.format(tag, item_date), item_path)

        if Item.is_crawled(item_path):
            domain = Item.get_item_domain(item_path)
            r_serv_metadata.sadd('tag:{}'.format(domain), tag)
            r_serv_tags.sadd('domain:{}:{}'.format(tag, item_date), domain)
    # domain item
    else:
        item_date = int(Domain.get_domain_last_check(item_path,
                                                     r_format="int"))
        add_domain_tag(tag, item_path, item_date)

    r_serv_tags.hincrby('daily_tags:{}'.format(item_date), tag, 1)

    tag_first_seen = r_serv_tags.hget('tag_metadata:{}'.format(tag),
                                      'last_seen')
    if tag_first_seen is None:
        tag_first_seen = 99999999
    else:
        tag_first_seen = int(tag_first_seen)
    tag_last_seen = r_serv_tags.hget('tag_metadata:{}'.format(tag),
                                     'last_seen')
    if tag_last_seen is None:
        tag_last_seen = 0
    else:
        tag_last_seen = int(tag_last_seen)

    #add new tag in list of all used tags
    r_serv_tags.sadd('list_tags', tag)

    # update fisrt_seen/last_seen
    if item_date < tag_first_seen:
        r_serv_tags.hset('tag_metadata:{}'.format(tag), 'first_seen',
                         item_date)

    # update metadata last_seen
    if item_date > tag_last_seen:
        r_serv_tags.hset('tag_metadata:{}'.format(tag), 'last_seen', item_date)
Пример #30
0
def get_card_metadata(object_type,
                      correlation_id,
                      type_id=None,
                      expand_card=False):
    card_dict = {}
    if object_type == 'cryptocurrency':
        card_dict[
            "sparkline"] = Cryptocurrency.cryptocurrency.get_list_nb_previous_correlation_object(
                type_id, correlation_id, 6)
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, type_id)
        if type_id == 'bitcoin' and expand_card:
            card_dict["related_btc"] = btc_ail.get_bitcoin_info(correlation_id)
    elif object_type == 'pgp':
        card_dict[
            "sparkline"] = Pgp.pgp.get_list_nb_previous_correlation_object(
                type_id, correlation_id, 6)
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, type_id)
    elif object_type == 'username':
        card_dict[
            "sparkline"] = telegram.correlation.get_list_nb_previous_correlation_object(
                type_id, correlation_id, 6)
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, type_id)
    elif object_type == 'decoded':
        card_dict["sparkline"] = Decoded.get_list_nb_previous_hash(
            correlation_id, 6)
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, value=correlation_id)
        card_dict["vt"] = Decoded.get_decoded_vt_report(correlation_id)
        card_dict["vt"]["status"] = vt_enabled
        card_dict["add_tags_modal"] = Tag.get_modal_add_tags(
            correlation_id, object_type='decoded')
    elif object_type == 'domain':
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, value=correlation_id)
        card_dict["tags"] = Domain.get_domain_tags(correlation_id)
    elif object_type == 'screenshot':
        card_dict["add_tags_modal"] = Tag.get_modal_add_tags(
            correlation_id, object_type='image')
    elif object_type == 'paste':
        card_dict["icon"] = Correlate_object.get_correlation_node_icon(
            object_type, value=correlation_id)
    return card_dict
Пример #31
0
fpsClock = pygame.time.Clock()

ticks_per_second = 25
skip_ticks = 1000/ticks_per_second
max_frameskip = 5

next_game_tick = pygame.time.get_ticks()
loops = 0
interpolation = 0

windowSurfaceObj = pygame.display.set_mode((SCRWIDTH, SCRHEIGHT))
pygame.display.set_caption('Game')

mousex, mousey = 0, 0

domain = Domain(100, (SCRWIDTH/2, SCRHEIGHT/2))
domain.v_scal = 10

for i in range(5):
    dyna = Dynamic(304, 224, homepath + 'bot.png')
    dyna.vx = randint(-1, 1)
    dyna.vy = randint(-1, 1)
    if dyna.vx == 0 and dyna.vy == 0:
        dyna.vx = 1
    dyna.normalize()
    #dyna.point_to_vel_vector()
    dyna.v_scal = randint(10, 15)
    domain.add_fish(dyna)

worldMap = WorldMap("map2_tiles_only.tmx")