MCPcopy Index your code
hub / github.com/cea-sec/usbsas

github.com/cea-sec/usbsas @v0.3.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.3 ↗ · + Follow
1,664 symbols 5,198 edges 190 files 398 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

<a href="https://github.com/cea-sec/usbsas/actions/workflows/build_check_test.yml?branch=main">
  <img src="https://github.com/cea-sec/usbsas/actions/workflows/build_check_test.yml/badge.svg?branch=main" alt="Build and Test">
</a>
<a href="https://www.gnu.org/licenses/gpl-3.0">
  <img src="https://img.shields.io/badge/License-GPLv3-blue.svg">
</a>

usbsas is a free and open source (GPLv3) tool and framework for securely reading untrusted USB mass storage devices.

Overview

Following the concept of defense in depth and the principle of least privilege, usbsas's goal is to reduce the attack surface of the USB stack. To achieve this, most of the USB related tasks (parsing USB packets, SCSI commands, file systems etc.) usually executed in (privileged) kernel space has been moved to user space and separated in different processes (microkernel style), each being executed in its own restricted secure computing mode. It works on GNU/Linux and is written in Rust.

Use cases

  • kiosk / sheep dip station to securely transfer files from an untrusted USB device to a trusted one
  • forensic analysis of untrusted USB devices

Key features

  • read files from an untrusted USB device (without using kernel modules like uas, usb_storage and the file system ones)
  • analyze files with a remote antivirus platform
  • copy files on a new file system to a trusted USB device
  • upload files to a remote server
  • make an image of a USB device
  • wipe a USB device
  • mount (read-only) a USB device

Documentation

Contributing

Any contribution is welcome, be it code, bug report, packaging, documentation or translation.

License

Dependencies included in this project:

  • ntfs3g is GPLv2 (see usbsas-fsrw/ntfs3g/src/ntfs-3g/COPYING).
  • FatFs has a custom BSD-style license (see usbsas-fsrw/ff/src/ff/LICENSE.txt)

usbsas is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

usbsas is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with usbsas. If not, see the gnu.org web site.

Extension points exported contracts — how you extend this code

RunState (Interface)
Shared functions for states [11 implementers]
usbsas-usbsas/src/states.rs
FSRead (Interface)
(no doc) [4 implementers]
usbsas-fsrw/src/lib.rs
Ioctl (Interface)
ioctl() functions that will be called in ff extern callback functions [2 implementers]
usbsas-fsrw/ff/src/wrapper.rs
ProtoReqCommon (Interface)
Common function that requester processes must implement
usbsas-comm/src/lib.rs
ReadWriteSeek (Interface)
(no doc) [1 implementers]
usbsas-fsrw/ntfs3g/src/lib.rs
ChildMngt (Interface)
(no doc) [1 implementers]
usbsas-process/src/lib.rs
UsbsasClap (Interface)
(no doc) [1 implementers]
usbsas-utils/src/clap.rs
ArchiveWriter (Interface)
(no doc) [1 implementers]
usbsas-files2tar/src/lib.rs

Core symbols most depended-on inside this repo

ntfs_attr_put_search_ctx
called by 128
usbsas-fsrw/ntfs3g/src/ntfs-3g/attrib.c
ntfs_malloc
called by 126
usbsas-fsrw/ntfs3g/src/ntfs-3g/misc.c
ntfs_inode_close
called by 71
usbsas-fsrw/ntfs3g/src/ntfs-3g/inode.c
iter
called by 69
usbsas-usbsas/src/lib.rs
ntfs_attr_lookup
called by 68
usbsas-fsrw/ntfs3g/src/ntfs-3g/attrib.c
st_32
called by 66
usbsas-fsrw/ff/src/ff/ff.c
ntfs_attr_close
called by 63
usbsas-fsrw/ntfs3g/src/ntfs-3g/attrib.c
ntfs_attr_get_search_ctx
called by 62
usbsas-fsrw/ntfs3g/src/ntfs-3g/attrib.c

Shape

Function 974
Method 327
Class 297
Enum 50
Interface 16

Languages

C55%
Rust38%
C++6%
Python2%

Modules by API surface

usbsas-fsrw/ff/src/ff/ff.c107 symbols
usbsas-fsrw/ntfs3g/src/ntfs-3g/security.c94 symbols
usbsas-fsrw/ntfs3g/src/ntfs-3g/index.c76 symbols
usbsas-fsrw/ntfs3g/src/ntfs-3g/attrib.c72 symbols
usbsas-fsrw/ntfs3g/src/ntfs-3g/mkntfs.c65 symbols
usbsas-fsrw/ntfs3g/src/ntfs-3g/acls.c57 symbols
usbsas-fsrw/ntfs3g/src/ntfs-3g/dir.c37 symbols
usbsas-hid/src/hid-user.rs34 symbols
usbsas-fsrw/ntfs3g/src/ntfs-3g/runlist.c34 symbols
usbsas-fsrw/ntfs3g/src/ntfs-3g/volume.c31 symbols
usbsas-fsrw/ntfs3g/src/ntfs-3g/unistr.c29 symbols
usbsas-usbsas/src/states.rs28 symbols

For agents

$ claude mcp add usbsas \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact