Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Builds programmatic STRIDE threat models in Python with pytm, generating data flow diagrams and identifying threats across trust boundaries.
Use this skill ↓41% 91%+50 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 9 of 22 without it.
3 of 3 safety checks passed
19 agent runs
pytm is a Python library for programmatic threat modeling based on the STRIDE methodology. It enables security engineers to define system architecture as code, automatically generate data flow diagrams (DFDs), identify security threats across trust boundaries, and produce comprehensive threat reports. This approach integrates threat modeling into CI/CD pipelines, enabling shift-left security and continuous threat analysis.
Create a basic threat model:
#!/usr/bin/env python3
from pytm import TM, Server, Dataflow, Boundary, Actor
# Initialize threat model
tm = TM("Web Application Threat Model")
tm.description = "E-commerce web application"
# Define trust boundaries
internet = Boundary("Internet")
dmz = Boundary("DMZ")
internal = Boundary("Internal Network")
# Define actors and components
user = Actor("Customer")
user.inBoundary = internet
web = Server("Web Server")
web.inBoundary = dmz
db = Server("Database")
db.inBoundary = internal
# Define data flows
user_to_web = Dataflow(user, web, "HTTPS Request")
user_to_web.protocol = "HTTPS"
Next to this one in the catalogue, plus more from the same author.