/ Модель

Характеристики

Контекст
512 токенов
Параметры
59,7 млн
Лицензия
Apache 2.0
Архитектура
mobilebert · dense
Опубликована
31 авг 2023

mobilebert-sql-injection-detect

Классификация текстаТекст → label5 профессий

Компактная модель MobileBERT для классификации английских строк и выявления потенциальных SQL-инъекций.

158скачиваний за 30 дней11лайковвеса обновлены22 янв 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Модель cssupport/mobilebert-sql-injection-detect разработана cssupport и дообучена на основе google/mobilebert-uncased. Она классифицирует входные строки, чтобы выявлять SQL-инъекции, и может применяться как дополнительный фильтр в системах проверки пользовательского ввода. В карточке также упомянуто использование в приложениях, преобразующих естественный язык в SQL, но не приведены подробности такой возможности.

Модель основана на MobileBERT — компактной архитектуре с узкими слоями и сбалансированными механизмами внимания и прямого распространения. Она содержит около 59,7 млн параметров, принимает текст на английском языке и рассчитана на контекст до 512 токенов. Автор указывает на пригодность для периферийных устройств и использование набора данных SQL_Injection с Kaggle.

Модель распространяется по лицензии Apache 2.0. Автор рекомендует проверять её перед внедрением; в карточке не приведены метрики качества и подробный анализ ошибок, поэтому результаты классификации следует валидировать на данных целевого приложения.

Сценарии применения

  • проверка пользовательского ввода на SQL-инъекции
  • предварительная фильтрация строк в веб-приложении
  • классификация запросов перед передачей в систему обработки данных

Ограничения

В карточке нет метрик качества или подробного анализа ошибок; автор рекомендует тестировать модель перед внедрением. Её точность и устойчивость на данных целевого приложения не подтверждены.

Для каких профессий подходит5

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Model Card for Model ID

Based on google/mobilebert-uncased (MobileBERT is a thin version of BERT_LARGE, while equipped with bottleneck structures and a carefully designed balance between self-attentions and feed-forward networks). This model detects SQLInjection attacks in the input string (check How To Below). This is a very very light model (100mb) and can be used for edge computing use cases. Used dataset from Kaggle called SQl_Injection. Please test the model before deploying into any environment. Contact us for more info: support@cloudsummary.com

Code Repo

Here is the code repo https://github.com/cssupport23/AI-Model---SQL-Injection-Attack-Detector

Model Details

Model Description

Model Sources

Please refer google/mobilebert-uncased for Model Sources.

How to Get Started with the Model

Use the code below to get started with the model.

import torch
from transformers import MobileBertTokenizer, MobileBertForSequenceClassification


device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
tokenizer = MobileBertTokenizer.from_pretrained('google/mobilebert-uncased')
model = MobileBertForSequenceClassification.from_pretrained('cssupport/mobilebert-sql-injection-detect')
model.to(device)
model.eval()

def predict(text):
    inputs = tokenizer(text, padding=False, truncation=True, return_tensors='pt', max_length=512)
    input_ids = inputs['input_ids'].to(device)
    attention_mask = inputs['attention_mask'].to(device)

    with torch.no_grad():
        outputs = model(input_ids=input_ids, attention_mask=attention_mask)

    logits = outputs.logits
    probabilities = torch.softmax(logits, dim=1)
    predicted_class = torch.argmax(probabilities, dim=1).item()
    return predicted_class, probabilities[0][predicted_class].item()


#text = "SELECT * FROM users WHERE username = 'admin' AND password = 'password';"
#text = "select * from users where username = 'admin' and password = 'password';"
#text = "SELECT * from USERS where id  =  '1' or @ @1  =  1 union select 1,version  (    )   -- 1'"
#text = "select * from data where id  =  '1'  or @"
text ="select * from users where id  =  1 or 1#\"?  =  1 or 1  =  1 -- 1"
predicted_class, confidence = predict(text)

if predicted_class > 0.7:
    print("Prediction: SQL Injection Detected")
else:
    print("Prediction: No SQL Injection Detected")
    
print(f"Confidence: {confidence:.2f}")
# OUTPUT
# Prediction: SQL Injection Detected
# Confidence: 1.00

Uses

[More Information Needed]

Direct Use

Could used in application where natural language is to be converted into SQL queries. [More Information Needed]

Out-of-Scope Use

[More Information Needed]

Bias, Risks, and Limitations

[More Information Needed]

Recommendations

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.

Technical Specifications

Model Architecture and Objective

google/mobilebert-uncased

Compute Infrastructure

Hardware

one P6000 GPU

Software

Pytorch and HuggingFace

Disclaimer

Educational/Informational Use Only

This model is provided solely for educational or informational purposes. It is not intended to be used for malicious activities or any other unlawful behavior.

No Warranty

This model is provided on an "as is" basis, without warranties or conditions of any kind, whether express or implied. We make no guarantees regarding its accuracy, reliability, or performance. Use of this model is at your own risk.

Limitation of Liability

Under no circumstances shall the creators, maintainers, or contributors of this model be held liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including but not limited to procurement of substitute goods or services; loss of use, data, or profits; or business interruption) arising out of the use or inability to use this model, even if advised of the possibility of such damage.

No Responsibility for Outcomes

We are not responsible for any damages, security breaches, or other issues that may result from using this model. If the model fails to detect certain SQL injection attacks or produces false positives, we will not be held liable for any consequences arising from such outcomes.

User Responsibility

By using or downloading this model, you agree to be solely responsible for compliance with all applicable laws and regulations. Any misuse of this model, including using it to facilitate or commit malicious activities, remains the sole responsibility of the user.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · text-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
MobileBertForPreTraining
Ревизия весов
394b65e

0 моделей