From b40d845e3c5dbc0119af163ef8493bdfef28e92c Mon Sep 17 00:00:00 2001 From: Alexander Myasoedov Date: Tue, 28 Jan 2025 15:30:06 +0200 Subject: [PATCH] feat(add deepseek api spec): --- agentic_security/probe_data/stenography_fn.py | 45 +++++++++++++++++++ agentic_security/static/base.js | 17 ++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/agentic_security/probe_data/stenography_fn.py b/agentic_security/probe_data/stenography_fn.py index 301e143..a426d90 100644 --- a/agentic_security/probe_data/stenography_fn.py +++ b/agentic_security/probe_data/stenography_fn.py @@ -1,5 +1,6 @@ import base64 import random +import string def rot13(input_text): @@ -98,3 +99,47 @@ def zigzag_obfuscation(text): else: new_text += char return new_text + + +def caesar_cipher(text, shift=3): + """Encrypts text using Caesar cipher with specified shift.""" + result = [] + for char in text: + if char.isupper(): + result.append(chr((ord(char) + shift - 65) % 26 + 65)) + elif char.islower(): + result.append(chr((ord(char) + shift - 97) % 26 + 97)) + else: + result.append(char) + return "".join(result) + + +def substitution_cipher(text, key=None): + """Encrypts text using a substitution cipher with optional key.""" + if key is None: + key = list(string.ascii_lowercase) + random.shuffle(key) + key = "".join(key) + + # Create translation table + alphabet = string.ascii_lowercase + translation = str.maketrans(alphabet, key) + + # Apply translation + return text.lower().translate(translation) + + +def vigenere_cipher(text, key): + """Encrypts text using Vigenère cipher with provided key.""" + result = [] + key_length = len(key) + key_as_int = [ord(i) for i in key.lower()] + text = text.lower() + + for i, char in enumerate(text): + if char.isalpha(): + shift = key_as_int[i % key_length] - 97 + result.append(chr((ord(char) + shift - 97) % 26 + 97)) + else: + result.append(char) + return "".join(result) diff --git a/agentic_security/static/base.js b/agentic_security/static/base.js index 98f37ee..c3a513d 100644 --- a/agentic_security/static/base.js +++ b/agentic_security/static/base.js @@ -17,7 +17,7 @@ Content-Type: application/json `, `POST https://api.openai.com/v1/chat/completions -Authorization: Bearer sk-xxxxxxxxx +Authorization: Bearer $OPENAI_API_KEY Content-Type: application/json { @@ -25,6 +25,20 @@ Content-Type: application/json "messages": [{"role": "user", "content": "<>"}], "temperature": 0.7 } +`, + ` +POST https://api.deepseek.com/chat/completions +Authorization: Bearer $DEEPSEEK_API_KEY +Content-Type: application/json + +{ + "model": "deepseek-chat", + "messages": [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "<>"} + ], + "stream": false +} `, `POST https://api.replicate.com/v1/models/mistralai/mixtral-8x7b-instruct-v0.1/predictions Authorization: Bearer $APIKEY @@ -165,6 +179,7 @@ Content-Type: application/json let LLM_CONFIGS = [ { name: 'Custom API', prompts: 40000, customInstructions: 'Requires api spec' }, { name: 'Open AI', prompts: 24000 }, + { name: 'Deepseek v1', prompts: 24000 }, { name: 'Replicate', prompts: 40000 }, { name: 'Groq', prompts: 40000 }, { name: 'Together.ai', prompts: 40000 },