iPurity is a simple NSFW (Not Safe For Work) detector for iOS devices.
It utilizes AFC (Apple File Conduit) to list and open each media file and OpenCV to detect nsfw images.
Note: Tested only on Apple Silicon Mac
- The program was created because one of my younger siblings accidentally encountered NSFW content.
- There is often no time to manually check all images on their phone before passing it to a younger sibling.
- This program aims to assist in identifying potentially inappropriate content.
- There may be many false negatives; however, it can help reduce the dataset to scan by approximately 90-95%.
- libimobiledevice
- OpenCV
- Make
You can install iPurity from our custom Homebrew tap:
brew tap Agent-Hellboy/homebrew-agent-hellboy-formula
brew install agent-hellboy/homebrew-agent-hellboy-formula/ipurity
./configure
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --build . --target install
./ipurity <threshold> //By default <threshold> is set to 0.6
export CFLAGS="-fsanitize=thread"
export LDFLAGS="-fsanitize=thread"
cmake -DCMAKE_CXX_FLAGS="-fsanitize=thread" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" ..
+----------------+
| main() |
+----------------+
│
▼
+-------------------------------+
| Create Device & AFC Client Pool |
+-------------------------------+
│
▼
+-----------------+
| scan_directory()|
+-----------------+
│
┌──────────────────┼──────────────────┐
│ │
▼ ▼
[Directory Entry] [File Entry]
(recursive call) (launch async task for file)
│
▼
+---------------------------+
| process_image_file() |
+---------------------------+
│
▼
+-------------------------------+
| [Thread X] |
| 1. Acquire AFC client from |
| pool |
| 2. download_file() |
| 3. naiveNSFWCheck() |
| 4. Release client back to pool|
| 5. Update ScanStats (mutex) |
+-------------------------------+
iPurity is released under the MIT License.