Skip to content

MetaMask/menpo

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
db
September 21, 2023 03:43
September 21, 2023 04:21

Menpo

Overview

DeFi Incidents in STIX 2.1.

Menpo Research Whitepaper

Menpo Presentation at DeFi Security Summit - 15.JUL.2023

Using Python to generate STIX objects

Installing

cd python-scripts
python3 -m venv menpo_env
source menpo_env/bin/activate
pip3 install -r requirements.txt # If first time

Generate and store STIX objects from a script

cd python-scripts/data-input
python3 <stix2 python script>

Example

cd python-scripts/data-input
source menpo_env/bin/activate

python3 22.09.01.kyberswap.py

Accessing the database

Getting a list of all the reports in the DB

import json

from stix2 import FileSystemSource, Filter
from stix2.base import STIXJSONEncoder

fs = FileSystemSource("../../db")

# Do the query
filt = Filter('type', '=', 'report')
reports = fs.query([filt])

# Convert the Python objects to JSON and print them
json_str = json.dumps(reports, indent=4, cls=STIXJSONEncoder)
print(json_str)

# Or, if you don't like json, we can give you a more compact one
sorted_reports = sorted(reports, key=lambda x: x["published"])

print("Reports in the DB:", len(sorted_reports), "\n")

for report in sorted_reports:
  print("-", report.name)

Generate a json report and render it on the STIX visualizer

# TODO

About

DeFi Incident Database

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published