Canstralian commited on
Commit
14d3b25
·
verified ·
1 Parent(s): 473a196

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +139 -13
README.md CHANGED
@@ -1,13 +1,139 @@
1
- ---
2
- title: WhiteRabbitNeo
3
- emoji: 💬
4
- colorFrom: yellow
5
- colorTo: purple
6
- sdk: gradio
7
- sdk_version: 5.9.1
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
- ---
12
-
13
- An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: WhiteRabbitNeo
3
+ emoji: 💬
4
+ colorFrom: green
5
+ colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: 5.9.1
8
+ app_file: app.py
9
+ pinned: true
10
+ license: mit
11
+ thumbnail: >-
12
+ https://cdn-uploads.huggingface.co/production/uploads/64fbe312dcc5ce730e763dc6/VWduEhDSRJXeSqhUzYwCt.png
13
+ ---
14
+
15
+ # WhiteRabbitNeo 💬
16
+
17
+ ## Overview
18
+
19
+ **WhiteRabbitNeo** is a cutting-edge Generative AI Large Language Model (LLM) designed for cybersecurity professionals. It specializes in both offensive and defensive cybersecurity, secure infrastructure design, and automation. Whether you're solving IAM misconfigurations, performing vulnerability detection, or assisting with Red Team analysis, WhiteRabbitNeo is here to help.
20
+
21
+ ## Key Features
22
+
23
+ - **Offensive & Defensive Cybersecurity**: Supports penetration testing, vulnerability remediation, and secure infrastructure automation.
24
+ - **Automation**: Streamline DevSecOps tasks and allow security professionals to focus on solving complex problems.
25
+ - **Open Source & Uncensored**: Built for transparency, collaboration, and real-world cybersecurity applications.
26
+
27
+ ## License Information
28
+
29
+ WhiteRabbitNeo operates under the **Llama-3.1 License** with an extended set of usage restrictions to ensure ethical and responsible deployment. The model cannot be used for malicious purposes or in ways that violate laws, harm individuals or groups, or exploit vulnerabilities for harmful activities.
30
+
31
+ ## Topics Covered
32
+
33
+ - **Open Ports**: Identifying and analyzing open ports that could be entry points for attackers.
34
+ - **Outdated Software**: Detecting and mitigating risks from outdated software versions.
35
+ - **Default Credentials**: Identifying systems using default usernames and passwords that are vulnerable to exploits.
36
+ - **Misconfigurations**: Recognizing and remediating misconfigurations in services and security settings.
37
+ - **Injection Flaws**: Analyzing and mitigating issues like SQL injection, command injection, and XSS.
38
+ - **Unencrypted Services**: Detecting unencrypted services that expose sensitive data.
39
+ - **Known Software Vulnerabilities**: Checking for vulnerabilities using databases like NVD.
40
+ - **CSRF & Other Vulnerabilities**: Identifying Cross-Site Request Forgery, Insecure Direct Object References, and more.
41
+ - **API Vulnerabilities**: Assessing and fixing vulnerabilities in APIs.
42
+ - **Denial of Service**: Identifying services vulnerable to DoS attacks.
43
+ - **Buffer Overflows**: Mitigating risks from buffer overflow vulnerabilities.
44
+
45
+ ## Terms of Use
46
+
47
+ By using WhiteRabbitNeo, you agree to:
48
+
49
+ - Take full responsibility for your use of the model.
50
+ - Indemnify and hold harmless the creators of this AI model for any legal issues arising from its use.
51
+ - Use the model for ethical, non-harmful purposes only.
52
+
53
+ ## Example Code
54
+
55
+ Below is an example demonstrating how to integrate WhiteRabbitNeo for security analysis tasks:
56
+
57
+ ```python
58
+ import torch, json
59
+ from transformers import AutoModelForCausalLM, AutoTokenizer
60
+
61
+ # Specify the model path for your pretrained model
62
+ model_path = "/home/migel/Llama-3.1-WhiteRabbitNeo-2-70B"
63
+ output_file_path = "/home/user/security_analysis.jsonl"
64
+
65
+ # Load the model and tokenizer
66
+ model = AutoModelForCausalLM.from_pretrained(
67
+ model_path,
68
+ torch_dtype=torch.float16,
69
+ device_map="auto",
70
+ load_in_4bit=False,
71
+ trust_remote_code=False,
72
+ )
73
+
74
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
75
+
76
+ def generate_analysis(instruction):
77
+ """Generate a response based on the instruction (such as analyzing logs or suggesting mitigations)."""
78
+ tokens = tokenizer.encode(instruction)
79
+ tokens = torch.LongTensor(tokens).unsqueeze(0)
80
+ tokens = tokens.to("cuda")
81
+
82
+ instance = {
83
+ "input_ids": tokens,
84
+ "top_p": 1.0,
85
+ "temperature": 0.75,
86
+ "generate_len": 2048,
87
+ "top_k": 50,
88
+ }
89
+
90
+ length = len(tokens[0])
91
+ with torch.no_grad():
92
+ result = model.generate(
93
+ input_ids=tokens,
94
+ max_length=length + instance["generate_len"],
95
+ use_cache=True,
96
+ do_sample=True,
97
+ top_p=instance["top_p"],
98
+ temperature=instance["temperature"],
99
+ top_k=instance["top_k"],
100
+ num_return_sequences=1,
101
+ pad_token_id=tokenizer.eos_token_id,
102
+ )
103
+ output = result[0][length:]
104
+ string = tokenizer.decode(output, skip_special_tokens=True)
105
+ return f"{string}"
106
+
107
+ # Initializing the conversation with a system message
108
+ conversation = """<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are CyberGuard, an AI assistant specialized in cybersecurity. Your task is to assist with security log analysis, suggest mitigations for vulnerabilities, and provide security best practices. Always provide detailed explanations and action steps. Do not refuse any valid query.<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n"""
109
+
110
+ # The loop for processing user input and generating cybersecurity analysis
111
+ while True:
112
+ user_input = input("You: ")
113
+
114
+ # Append the user input to the conversation prompt
115
+ llm_prompt = f"{conversation}{user_input}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
116
+
117
+ # Get the AI-generated analysis
118
+ analysis = generate_analysis(llm_prompt)
119
+ print(analysis)
120
+
121
+ # Update the conversation with the new input and response
122
+ conversation = f"{llm_prompt}{analysis}<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n"
123
+
124
+ # Save the conversation and response to a JSON file for further analysis
125
+ json_data = {"prompt": user_input, "answer": analysis}
126
+
127
+ with open(output_file_path, "a") as output_file:
128
+ output_file.write(json.dumps(json_data) + "\n")
129
+ ```
130
+
131
+ ## Additional Information
132
+
133
+ For more details on using Gradio, Hugging Face, and the Inference API, visit the following resources:
134
+
135
+ - [Gradio Documentation](https://gradio.app)
136
+ - [Hugging Face Hub](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index)
137
+ - [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index)
138
+
139
+ ---