Skip to main content

Scrape File System and output in different formats

Project description


Deploy Docs Pytest Publish Package


Sample Output


- [Notes](./Notes)
  - Tools
    - [Python](./Notes/Tools/
    - [nmap](./Notes/Tools/
    - [Netcat](./Notes/Tools/
    - [Metasploit](./Notes/Tools/
  - [common](./Notes/
  - [FileTransfer](./Notes/
  - [Service](./Notes/
  - [Bash](./Notes/

Render in MarkDown


└── Notes
    ├── Tools
    │   ├──
    │   ├──
    │   ├──
    │   └──

Sample Code

import sys
import pathlib2
from fmtree.core.scraper import Scraper
from fmtree.core.format import TreeCommandFormatter, GithubMarkdownContentFormatter
from fmtree.core.filter import MarkdownFilter
from fmtree.core.sorter import Sorter

path_ = pathlib2.Path('/OSCP')
scraper = Scraper(path_, scrape_now=False, keep_empty_dir=False)

# add filter

# run scraper

# GNU Tree Format
formatter = TreeCommandFormatter(scraper.get_tree())
stringio = formatter.generate()

# sort
sorter_ = Sorter()
tree = sorter_(scraper.get_tree())

# GitHub Content Format
formatter = GithubMarkdownContentFormatter(tree)
stringio = formatter.generate()



A command line one-liner to visualize a directory like gnu tree

python -m fmtree.visualizer.visualize -h                                                      
usage: fmtree visualizer argument parser [-h] [--debug] [-i INPUT] [--stdout] [--stderr]
                                         [-o OUTPUT] [--tree] [--markdown] [--html]
                                         [--ext EXT [EXT ...]] [-d DEPTH]

optional arguments:
  -h, --help            show this help message and exit
  --debug               debug mode
  -i INPUT, --input INPUT
                        input path (path to format)
  --stdout              output to stdout
  --stderr              output to stderr
  -o OUTPUT, --output OUTPUT
                        output file path
  --tree                nu tree style output
  --markdown            markdown style output
  --html                html list style output
  --ext EXT [EXT ...]
  -d DEPTH, --depth DEPTH
                        Directory depth to parse

Sample Usage

python -m fmtree.visualizer.visualize -i '/home/user/images' --depth 5 --ext .jpg .png --stdout --debug --html


A command line one-liner that produce a html for visualizing an image directory.

It produces a html file that display all images in a nested image directory.

Just open the html file in a browser.

python -m visualizer.image_dir --help          
usage: Fmtree Visualizer Parser [-h] [-o OUTPUT] [-q]
                                [-d DEPTH] [--cdn]

positional arguments:
  input                 input path

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        output directory to save html
  -q, --quiet           whether to print out the
  -d DEPTH, --depth DEPTH
                        Directory depth to parse
  --cdn                 Use CDN for libraries, requires
                        internet access, minimize html
  --show_all            Show All Images By Default

Sample Usage

python -m fmtree.visualizer.image_dir --cdn /home/user/images


This is a one-liner bash script that puts all images into an html, but with lots of limitations:

  • no styling (width problem)
  • doesn't support nested image directory
  • not interactive (cannot collapse image etc.)
for file in $(ls);do echo "<img src=\"./$file\"/>" >> index.html; done


Duplicate Image Search

This is a module used to detect duplicate images, and optionally export the data, remove duplicates or extract unique images.

The python script is in ./fmtree/image/


python -m fmtree.image.dup ~/Downloads/images --output_dir ./out --remove_inplace --output_json dup.json -m perceptual-hash

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fmtree-0.3.2.tar.gz (113.2 kB view hashes)

Uploaded Source

Built Distribution

fmtree-0.3.2-py3-none-any.whl (115.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page