예제 #1
0
 def _parse(self):
     for line in self._raw_threat_intel.split("\n"):
         if line[:1] is "#":
             pass
         else:
             split_line = line.split(",")
             try:
                 intel = Intel(original=line,
                               event_type="indicator",
                               event_reference=self._feed_url,
                               event_module="Abuse.ch",
                               event_dataset="SSLBlackList",
                               threat_first_seen=split_line[0],
                               threat_last_seen=None,
                               threat_type="ssl_hash",
                               threat_description=split_line[2])
                 intel.intel["threat"]["server"] = {}
                 intel.intel["threat"]["server"]["hash"] = {}
                 intel.intel["threat"]["server"]["hash"][
                     "sha1"] = split_line[1]
                 if "C&C" in intel.intel["threat"]["description"]:
                     intel.add_mitre("TA0011")
                 elif "" in intel.intel["threat"]["description"]:
                     intel.add_mitre("TA0042", "T1588.001")
             except IndexError as err:
                 pass
             else:
                 intel._add_docid()
                 self.intel.append(intel)
예제 #2
0
 def _parse(self):
     for line in self._raw_threat_intel.split("\n"):
         if line[:1] is "#":
             pass
         else:
             try:
                 split_line = line.split('", "')
                 intel = Intel(original=line,
                               event_type="indicator",
                               event_reference=self._feed_url,
                               event_module="Abuse.ch",
                               event_dataset="MalwareBazaar",
                               threat_first_seen=split_line[0],
                               threat_last_seen=None,
                               threat_type="file_hash")
                 intel.intel["threat"]["file"] = {}
                 intel.intel["threat"]["file"]["hash"] = {}
                 intel.intel["threat"]["file"]["hash"]["sha1"] = split_line[
                     3]
                 intel.intel["threat"]["file"]["hash"][
                     "sha256"] = split_line[1]
                 intel.intel["threat"]["file"]["hash"]["md5"] = split_line[
                     2]
             except Exception as err:
                 print(err)
             else:
                 intel._add_docid()
                 self.intel.append(intel)
예제 #3
0
    def _parse(self):
        for line in self._raw_threat_intel.split("\n"):
            if line[:1] is "#" or len(line) < 2:
                pass
            else:
                try:
                    if "/" in line:
                        type = "ip_range"
                    else:
                        type = "ip_address"

                    intel = Intel(original=line,
                                  event_type="indicator",
                                  event_reference=self._feed_url,
                                  event_module="EmergingThreats",
                                  event_dataset="fwrules/emerging-Block-IPs",
                                  threat_first_seen=None,
                                  threat_last_seen=None,
                                  threat_type=type)
                    intel.intel["threat"]["ip"] = line
                except Exception:
                    pass
                else:
                    intel._add_docid()
                    self.intel.append(intel)
예제 #4
0
 def _parse(self):
     for obj in self._raw_threat_intel["data"]:
         try:
             intel = Intel(
                 original=json.dumps(obj),
                 event_type="indicator",
                 event_reference=self._feed_url,
                 event_module="AbuseIPdb",
                 event_dataset="blacklist",
                 threat_first_seen=None,
                 threat_last_seen=obj["lastReportedAt"],
                 threat_type="ip_address"
             )
             intel.intel["threat"]["ip"] = obj["ipAddress"]
         except Exception:
             pass
         else:
             intel._add_docid()
             self.intel.append(intel)
예제 #5
0
 def _parse(self):
     for line in self._raw_threat_intel.split("\n"):
         if line[:1] is "#":
             pass
         else:
             split_line = line.split(",")
             try:
                 intel = Intel(original=line,
                               event_type="indicator",
                               event_reference=self._feed_url,
                               event_module="Abuse.ch",
                               event_dataset="FeodoTracker",
                               threat_first_seen=split_line[0],
                               threat_last_seen=split_line[3],
                               threat_type="ip_address",
                               threat_description=split_line[4])
                 intel.intel["threat"]["ip"] = split_line[1]
             except IndexError as err:
                 pass
             else:
                 intel._add_docid()
                 self.intel.append(intel)
예제 #6
0
파일: eset.py 프로젝트: legly/elastic-tip
    def _parse(self):
        for root, dirs, files in walk("tip/githubclones/eset/malware-ioc"):
            for file in files:
                if ".git" in root:
                    continue
                elif "README" in file:
                    continue
                elif "samples" in file:
                    lines = ""
                    with open("{}/{}".format(root, file), "r") as iocfile:
                        lines = iocfile.read().split("\n")

                    for line in lines:
                        try:
                            intel = Intel(original=line,
                                          event_type="indicator",
                                          event_reference=self._feed_url,
                                          event_module="Eset",
                                          event_dataset="malware-ioc",
                                          threat_first_seen=None,
                                          threat_last_seen=None,
                                          threat_type="file_hash")
                            intel.intel["threat"]["file"] = {}
                            intel.intel["threat"]["file"]["hash"] = {}
                            if file == "samples.sha1":
                                intel.intel["threat"]["file"]["hash"][
                                    "sha1"] = line
                            elif file == "samples.sha256":
                                intel.intel["threat"]["file"]["hash"][
                                    "sha256"] = line
                            elif file == "samples.md5":
                                intel.intel["threat"]["file"]["hash"][
                                    "md5"] = line
                        except Exception as err:
                            print(err)
                        else:
                            intel._add_docid()
                            self.intel.append(intel)
예제 #7
0
 def _parse(self):
     for line in self._raw_threat_intel.split("\n"):
         if line[:1] is "#":
             pass
         else:
             split_line = line.split('","')
             try:
                 intel = Intel(original=line,
                               event_type="indicator",
                               event_reference=self._feed_url,
                               event_module="Abuse.ch",
                               event_dataset="URLhaus",
                               threat_first_seen=split_line[1],
                               threat_last_seen=None,
                               threat_type="domain",
                               threat_description=split_line[4])
                 intel.intel["threat"]["url"] = {}
                 intel.intel["threat"]["url"]["full"] = split_line[2]
             except IndexError:
                 pass
             else:
                 intel._add_docid()
                 self.intel.append(intel)