karimaloulou commited on
Commit
88598e9
·
verified ·
1 Parent(s): ccb3c82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -17,6 +17,13 @@ techniques = mitre_attack_data.get_techniques(remove_revoked_deprecated=True)
17
  # Convert techniques to a readable string format
18
  techniques_str = "\n".join([f"{technique['name']} ({mitre_attack_data.get_attack_id(technique['id'])})" for technique in techniques])
19
 
 
 
 
 
 
 
 
20
  client = InferenceClient(model='mistralai/Mixtral-8x7B-Instruct-v0.1')
21
 
22
 
@@ -58,8 +65,16 @@ demo = gr.ChatInterface(
58
  respond,
59
  additional_inputs=[
60
  # gr.Textbox(value=f"""<s>[INST] Given these TTPs: {techniques_str}\n\n and here are {descriptions}\n\nfigure out which major techniques are used in these logs and respond in bullets points and nothing else[/INST]""", label="System message"),
61
- gr.Textbox(value=f"""<s>[INST] Given these TTPs: {techniques_str}\n\nfigure out which major techniques are used in these logs and respond in bullets points and nothing else[/INST]""", label="System message"),
62
- gr.Slider(minimum=1, maximum=2048, value=1024, step=1, label="Max new tokens"),
 
 
 
 
 
 
 
 
63
  gr.Slider(minimum=0.1, maximum=1.0, value=0.1, step=0.1, label="Temperature"),
64
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
65
  ],
 
17
  # Convert techniques to a readable string format
18
  techniques_str = "\n".join([f"{technique['name']} ({mitre_attack_data.get_attack_id(technique['id'])})" for technique in techniques])
19
 
20
+ def clean_string(input_string):
21
+
22
+ characters_to_remove = [',', '/', ':', '"',';','|','-','_']
23
+ cleaned_string = ''.join(char for char in input_string if char not in characters_to_remove)
24
+
25
+ return cleaned_string
26
+
27
  client = InferenceClient(model='mistralai/Mixtral-8x7B-Instruct-v0.1')
28
 
29
 
 
65
  respond,
66
  additional_inputs=[
67
  # gr.Textbox(value=f"""<s>[INST] Given these TTPs: {techniques_str}\n\n and here are {descriptions}\n\nfigure out which major techniques are used in these logs and respond in bullets points and nothing else[/INST]""", label="System message"),
68
+ # gr.Textbox(value=f"""<s>[INST] Given these TTPs: {techniques_str}\n\nfigure out which major techniques are used in these logs and respond in bullets points and nothing else[/INST]""", label="System message"),
69
+ gr.Textbox(value=f"""<s>[INST] In first step Given these TTPs: {techniques_str}\n\nfigure out which major techniques are used in these logs and respond in bullets points and nothing else\n\n
70
+ In second step next act like a cybersecurity analyst skilled in interpreting various types of logs resulting from different cyberattacks, including phishing, malware, advanced persistent threats, denial-of-service (DoS) and distributed denial-of-service (DDoS) attacks, man-in-the-middle (MitM) attacks, SQL injection attacks, and zero-day exploits. Using the following types of logs—login failures, event logs, firewall logs, and brute force logs—analyze the data and provide an interpretation of the analysis in English.
71
+ **Important:** Do not use any information outside of the input provided. Focus solely on the data and indicators given in this prompt.
72
+ Indicators to investigate: Multiple IP addresses signing in to the same account within a short period or Excessive login failures including failed MFA requests, failed username/password attempts, or failures due to geo-blocking
73
+ or Multiple sign-in attempts from different countries within a short period or Detection of malware on the device or Unusual activity by admin accounts, including excessive actions or Resetting passwords and changing MFA methods
74
+ or Sharing emails with attachments to personal accounts or Logins occurring after working hours or General unusual user account activity.
75
+ Response: Provide a detailed analysis and interpretation of the observed logs, focusing on identifying and explaining only potential security threats or breaches. Ensure that your analysis is based solely on the information and indicators provided in this prompt.
76
+ [/INST]""", label="System message"),
77
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
78
  gr.Slider(minimum=0.1, maximum=1.0, value=0.1, step=0.1, label="Temperature"),
79
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
80
  ],