Skip to content

Commit

Permalink
Update prediction scores after retraining the model
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa committed Mar 14, 2024
1 parent 65973e2 commit 1f29aaa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions training/test_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def model(request):
@pytest.mark.parametrize(
"sample",
[
("select * from users where id=1 or 1=1;", [99.99, 62.90]),
("select * from users where id='1' or 1=1--", [92.02, 62.90]),
("select * from users", [0.077, 0.011]),
("select * from users where id=10000", [14.83, 1.319]),
("select * from users where id=1 or 1=1;", [99.99, 0.11]),
("select * from users where id='1' or 1=1--", [92.02, 0.11]),
("select * from users", [0.077, 0.0044]),
("select * from users where id=10000", [14.83, 0.10]),
("select '1' union select 'a'; -- -'", [99.99, 99.99]),
(
"select '' union select 'malicious php code' \g /var/www/test.php; -- -';",
Expand All @@ -71,6 +71,7 @@ def test_sqli_model(model, sample):
predictions = model["sqli_model"].predict(sample_vec)

# Scale up to 100
print(predictions * 100) # Debugging purposes (prints on error)
assert predictions * 100 == pytest.approx(
np.array([[sample[1][model["index"]]]]), 0.1
)

0 comments on commit 1f29aaa

Please sign in to comment.