
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
A simple Python package that creates a directory and file structure from a given JSON or Python object.
You can install the package using pip
:
pip install easy-tree-maker
You can use the TreeMaker
class to create directories and files based on a JSON or Python structure.
from easy_tree_maker.core import TreeMaker
# Define the tree structure as a Python object
tree_structure = [
{
"type": "directory",
"name": "TestProject",
"contents": [
{"type": "file", "name": "README.md"},
{"type": "directory", "name": "src", "contents": [
{"type": "file", "name": "app.py"}
]}
]
}
]
# Create the tree with the Python object structure
tree_maker = TreeMaker(tree_structure, is_json=False)
tree_maker.create_tree(root_path="./TestDirectory")
import json
from easy_tree_maker.core import TreeMaker
# Define the tree structure as a JSON string
tree_structure_json = json.dumps([
{
"type": "directory",
"name": "TestProject",
"contents": [
{"type": "file", "name": "README.md"},
{"type": "directory", "name": "src", "contents": [
{"type": "file", "name": "app.py"}
]}
]
}
])
# Create the tree with the JSON string structure
tree_maker = TreeMaker(tree_structure_json, is_json=True)
tree_maker.create_tree(root_path="./TestDirectory")
If you have a JSON file containing the tree structure, you can use it as input:
from easy_tree_maker.core import TreeMaker
import json
# Load the tree structure from a JSON file
with open('tree_structure.json', 'r') as f:
tree_structure_json = f.read()
tree_maker = TreeMaker(tree_structure_json, is_json=True)
tree_maker.create_tree(root_path="./TestDirectory")
You can also use the command-line interface (CLI) to create the tree structure from a JSON file or string.
To use the CLI, run:
easy_tree_maker path_to_json_file_or_string --root /path/to/create/tree
easy_tree_maker tree_structure.json --root /tmp/test_tree
This will read the JSON file tree_structure.json
and create the directory and file structure in /tmp/test_tree
.
FAQs
A tool to create a directory and file structure from JSON or Python object
We found that easy-tree-maker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.