Wanted to send logs to MISP #1763
Replies: 3 comments 7 replies
-
I'm doing something similar.. I'm querying tpot every 15 min, pulling all the data, then dumping it into OpenCTI (alternative to MISP) which makes a stix/taxii feed I can distribute to different network devices. here is my python code I'm using to query Elasticsearch: I run this script ON the tpot hive.. so I dont have to expose the Elasticsearch database. .. my code is kinda ugly.. but it'll give you an idea of an approach.. it works.. I just set a cron job to run the script every 15 min
|
Beta Was this translation helpful? Give feedback.
-
I'm sorry I can't debug your code for you. I gave you a snippet of my code that performs a query and returns the results as an example.. as a place to start. ChatGPT is really good and an amazing resource. I'll ask a few questions in hopes of helping:
print (f' Data: {extracted_data}') if that works, my code works.. and the error is not in the query method? |
Beta Was this translation helpful? Give feedback.
-
Cool so i managed to get it to work this is a basic example on how to send data from tpot to misp server from elasticsearch import Elasticsearch, helpers ─────────────── PARSE CLI ───────────────def args() -> argparse.Namespace: A = args() ─────────────── LOGGING ───────────────logging.basicConfig(level=logging.INFO, es_kw = dict(hosts=[A.es], verify_certs=VERIFY, timeout=30, misp = PyMISP(A.misp, A.key, ssl=VERIFY, timeout=30) def pull_docs() -> List[Dict[str, Any]]: def push_misp(hits: List[Dict[str, Any]]) -> None:
─────────────── MAIN ───────────────if name == "main":
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey i would like to send logs to MISP platform via curl but the only data i get is "Test" and i dont see the indices via curl

`
root@honeypotpetru:/home/petru/tpotce/data# curl -X GET "http://localhost:9200/_cat/indices?v"
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open 1cf0aa9d61f185b59f643939f862c01f89b21360 d_g1c8IASCGdhuFwcEh5WA 1 1 30 0 13.1kb 13.1kb
yellow open db18744ea5570fa9bf868df44fecd4b58332ff24 _W3iCnnaQKyKnJsF7HD7Eg 1 1 6 0 4kb 4kb
root@honeypotpetru:/home/petru/tpotce/data#
``
Code im using
from pymisp import PyMISP
import requests
import json
MISP_URL = 'http://192.168.189.132'
MISP_API_KEY = '4SRadEN0ml3QgVQTMk1ObFeNn1IAvRwhrJgttX5y'
VERIFY_CERT = False
misp = PyMISP(MISP_URL, MISP_API_KEY, VERIFY_CERT)
def get_tpot_logs():
elasticsearch_url = "http://localhost:9200/logstash-*/_search?size=1000"
response = requests.get(elasticsearch_url)
if response.status_code == 200:
return response.json()
else:
return None
def create_misp_event(data):
event = {
"info": "T-Pot Honeypot Attack Detected",
"distribution": 1,
"threat_level_id": 3,
"analysis": 0
}
event = misp.add_event(event)
logs = get_tpot_logs()
if logs:
create_misp_event(logs['hits']['hits'])
Beta Was this translation helpful? Give feedback.
All reactions