Repository navigation
Releases
FuzzDistillWeb v1.0
Core release. As discussed in the original paper.
FuzzDistill Web
Web Interface for FuzzDistill project.
The app includes both a web interface and several API endpoints for interacting with the models.
This module constitutes one-third of the FuzzDistill project. For further information on other
modules and the project paper, please refer to the GitHub repository
at FuzzDistill.
Features
- File Upload: Users can upload CSV files through the web interface or request via POST API
calls. - Model Selection: Choose between two models (
dnnfnanddnnbb) for analysis. - Results Visualization: Visualizations of prediction results.
- Caching: Efficient file processing using cached results to avoid redundant computations.
- REST APIs: Programmatic access to model predictions and cache management.
Models
dnnfn: Tensorflow DNN model trained on NIST Juliet1.3 Functions.dnnbb: Tensorflow DNN model trained on NIST Juliet1.3 Basic Blocks.
More model details in FuzzDistill Paper
Project Structure
../FuzzDistillWeb
├── README.md
├── app.py
├── includes
│ └── constants.py
├── models
│ ├── BBpredict_TF_21_32_68.keras
│ └── FNpredict_TF_30_32_86.keras
├── requirements.txt
├── templates
│ ├── index.html
│ └── results.html
├── test
│ ├── 100bbfeat.csv
│ ├── 200fndata.csv
│ └── xpdf3.02FNfeatures.csv
Installation
-
Clone the Repository:
git clone https://github.com/Saket-Upadhyay/FuzzDistillWeb.git cd FuzzDistillWeb -
Create a Virtual Environment:
python3 -m venv venv source venv/bin/activate -
Install Dependencies:
pip install -r requirements.txt
-
Set Environment Variables:
Create a.envfile with the following structure:FLASK_APP=app.py FLASK_ENV=development # Use 'production' for deployment SECRET_KEY=your_secret_key_here
-
Run the Application:
flask run
The application will be accessible at http://127.0.0.1:5000/.
API Endpoints
Below is a list of available API endpoints.
1. Prediction APIs
POST /api/high-conf-list
- Description: Returns a list of high-confidence predictions.
- Request: Upload a CSV file with the
fileparameter and specifymodelselect(dnnfnor
dnnbb). - Response:
[ "Function1", "Function2" ]
POST /api/sure-list
- Description: Returns a list of predictions with 100% confidence.
- Request: Upload a CSV file with the
fileparameter and specifymodelselect. - Response:
[ "Function1", "Function2" ]
POST /api/all-list
- Description: Returns all predictions with their confidence scores.
- Request: Upload a CSV file with the
fileparameter and specifymodelselect. - Response:
[ { "Function Name": "Function1", "confidence": 0.97 }, { "Function Name": "Function2", "confidence": 1.0 } ]
2. Cache Management APIs
GET /api/clear-cache-record
- Description: Clears the cache for a specific file.
- Query Parameter:
hash: The hash of the file to clear.
- Response:
{ "message": "Cache cleared for file hash: your_hash" }
POST /api/clear-cache
- Description: Clears the entire cache.
- Response:
{ "message": "Entire cache cleared" }
Example
- Get json list of 100% confident predictions for a file containing function features, using dnnfn
to use tensorflow function prediction model.
curl -L 'http://127.0.0.1:5000/api/sure-list' \
-F 'file=@"./test/xpdf3.02FNfeatures.csv"' \
-F 'modelselect="dnnfn"'Example output:
[
"FAnnot::Annot(XRef*, Dict*, Dict*, Ref*)",
"FAnnot::generateFieldAppearance(Dict*, Dict*, Dict*)",
"FJBIG2Stream::readTextRegion(int, int, int, int, unsigned int, unsigned int, int, JBIG2HuffmanTable*, unsigned int, JBIG2Bitmap**, unsigned int, unsigned int, unsigned int, unsigned int, int, JBIG2HuffmanTable*, JBIG2HuffmanTable*, JBIG2HuffmanTable*, JBIG2HuffmanTable*, JBIG2HuffmanTable*, JBIG2HuffmanTable*, JBIG2HuffmanTable*, JBIG2HuffmanTable*, unsigned int, int*, int*)",
"FJPXStream::inverseTransformLevel(JPXTileComp*, unsigned int, JPXResLevel*, unsigned int, unsigned int, unsigned int, unsigned int)",
"FOutputDev::beginType3Char(GfxState*, double, double, double, double, unsigned int, unsigned int*, int)",
"FOutputDev::beginTransparencyGroup(GfxState*, double*, GfxColorSpace*, int, int, int)",
"FOutputDev::setSoftMask(GfxState*, double*, int, Function*, GfxColor*)",
"FPage::displaySlice(OutputDev*, double, double, int, int, int, int, int, int, int, int, Catalog*, int (*)(void*), void*)",
"FPage::makeBox(double, double, int, int, int, double, double, double, double, PDFRectangle*, int*)",
"FParser::getObj(Object*, unsigned char*, CryptAlgorithm, int, int, int)",
"FPDFDoc::PDFDoc(GString*, GString*, GString*, void*)",
"FPDFDoc::displayPages(OutputDev*, int, int, double, double, int, int, int, int, int (*)(void*), void*)",
"FPDFDoc::displayPageSlice(OutputDev*, int, double, double, int, int, int, int, int, int, int, int, int (*)(void*), void*)",
"FPreScanOutputDev::drawSoftMaskedImage(GfxState*, Object*, Stream*, int, int, GfxImageColorMap*, Stream*, int, int, GfxImageColorMap*)",
"FOutputDev::drawChar(GfxState*, double, double, double, double, double, double, unsigned int, int, unsigned int*, int)"
]- Clear Cache using cURL
curl -L 'http://127.0.0.1:5000/api/clear-cache'output:
{
"message": "Entire cache cleared"
}Deployment
-
Configure a production WSGI server like Gunicorn:
gunicorn -w 4 -b 0.0.0.0:8000 app:app
-
Use a reverse proxy like Nginx for improved performance and security.
-
Update your
.envto use the production configuration.
License
This project is licensed under the MIT License.