reverse-engineering-assistant 2.9.1__tar.gz → 2.9.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/PKG-INFO +74 -35
  2. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/README.md +71 -34
  3. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/pyproject.toml +4 -2
  4. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/api_server_tools/llm_tools.py +54 -6
  5. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/api_server_tools/re_tools.py +208 -58
  6. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/assistant.py +94 -126
  7. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/assistant_api_server.py +63 -15
  8. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/chat_client.py +45 -19
  9. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/model.py +68 -0
  10. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaChat_pb2.py +31 -0
  11. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaChat_pb2.pyi +27 -0
  12. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaChat_pb2_grpc.py +190 -0
  13. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaComment_pb2.py +31 -0
  14. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaComment_pb2.pyi +17 -0
  15. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaComment_pb2_grpc.py +101 -0
  16. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaData_pb2.py +39 -0
  17. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaData_pb2.pyi +72 -0
  18. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaData_pb2_grpc.py +187 -0
  19. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetCursor_pb2.py +31 -0
  20. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetCursor_pb2.pyi +19 -0
  21. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetCursor_pb2_grpc.py +101 -0
  22. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetDecompilation_pb2.py +40 -0
  23. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetDecompilation_pb2.pyi +69 -0
  24. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetDecompilation_pb2_grpc.py +187 -0
  25. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetReferences_pb2.py +31 -0
  26. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetReferences_pb2.pyi +20 -0
  27. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetReferences_pb2_grpc.py +101 -0
  28. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetSymbols_pb2.py +47 -0
  29. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetSymbols_pb2.pyi +68 -0
  30. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaGetSymbols_pb2_grpc.py +258 -0
  31. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaHandshake_pb2.py +31 -0
  32. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaHandshake_pb2.pyi +21 -0
  33. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaHandshake_pb2_grpc.py +101 -0
  34. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaHeartbeat_pb2.py +31 -0
  35. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaHeartbeat_pb2.pyi +23 -0
  36. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaHeartbeat_pb2_grpc.py +101 -0
  37. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaVariable_pb2.py +27 -0
  38. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaVariable_pb2.pyi +17 -0
  39. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/RevaVariable_pb2_grpc.py +29 -0
  40. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant/protocol/__init__.py +0 -0
  41. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant.egg-info/PKG-INFO +74 -35
  42. reverse_engineering_assistant-2.9.2/reverse_engineering_assistant.egg-info/SOURCES.txt +52 -0
  43. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant.egg-info/requires.txt +2 -0
  44. reverse_engineering_assistant-2.9.1/reverse_engineering_assistant/configuration.py +0 -151
  45. reverse_engineering_assistant-2.9.1/reverse_engineering_assistant/model.py +0 -109
  46. reverse_engineering_assistant-2.9.1/reverse_engineering_assistant.egg-info/SOURCES.txt +0 -22
  47. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/.gitignore +0 -0
  48. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/__init__.py +0 -0
  49. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/api_server_tools/__init__.py +0 -0
  50. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/api_server_tools/connection.py +0 -0
  51. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/documents.py +0 -0
  52. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/reva_exceptions.py +0 -0
  53. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant/tool.py +0 -0
  54. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant.egg-info/dependency_links.txt +0 -0
  55. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant.egg-info/entry_points.txt +0 -0
  56. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/reverse_engineering_assistant.egg-info/top_level.txt +0 -0
  57. {reverse_engineering_assistant-2.9.1 → reverse_engineering_assistant-2.9.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reverse-engineering-assistant
3
- Version: 2.9.1
3
+ Version: 2.9.2
4
4
  Summary: An AI assistant for reverse engineering tasks
5
5
  Author: サイバーカイダ (cyberkaida)
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
11
11
  Requires-Dist: langchain
12
12
  Requires-Dist: langchain-core
13
13
  Requires-Dist: langchain-openai
14
+ Requires-Dist: langchain-community
14
15
  Requires-Dist: prompt_toolkit
15
16
  Requires-Dist: sentence_transformers
16
17
  Requires-Dist: PyYAML
@@ -18,6 +19,7 @@ Requires-Dist: pydantic
18
19
  Requires-Dist: rich
19
20
  Requires-Dist: grpcio
20
21
  Requires-Dist: protobuf
22
+ Requires-Dist: flask
21
23
 
22
24
  # ReVA - Reverse Engineering Assistant
23
25
 
@@ -46,13 +48,14 @@ information from the tools, but when there is no information it can still respon
46
48
  questions from its training.
47
49
 
48
50
  You can ask questions like:
51
+ - What are the interesting strings in this program?
49
52
  - Does this program use encryption? Write a markdown report on the encryption and where it is used.
50
53
  - Draw a class diagram using plantuml syntax.
51
54
  - Start from main, examine the program in detail. Rename variables as you go and provide a summary of the program.
52
55
  - Explain the purpose of the `__mod_init` segment.
53
56
  - What does `mmap` return?
54
57
  - What does the function at address 0x80000 do?
55
- - This is a CTF problem. Start at main, examine the program in detail and write a pwntools script to get the flag.
58
+ - This is a CTF problem. Write a pwntools script to get the flag.
56
59
 
57
60
  An important part of reverse engineering is the process. Many other tools simply ask a single question of the LLM,
58
61
  this means it is difficult to determine _why_ a thing happened. In ReVa we break all actions down into small parts
@@ -68,33 +71,40 @@ Built in support is provided for:
68
71
  - [OpenAI](https://platform.openai.com/overview) for online inference and easy setup (Needs an OpenAI API key)
69
72
  - [Ollama](https://ollama.ai) and any model it supports for local on-device inference or connecting to a self hosted remote inference server.
70
73
 
74
+ See [Configuration](#configuration) for more information about settings for the providers.
75
+
71
76
  Adding additional inference servers is easy if it is supported by langchain.
72
77
 
73
78
  ## Configuration
74
79
 
75
- > This is currently being moved to the Ghidra GUI
76
- > See Edit -> Tool Options -> ReVa in the Codebrowser Tool
80
+ Configuration for ReVa is in the CodeBrowser Tool options.
81
+ Open a program and go to Edit -> Tool Options -> ReVa.
82
+
83
+ There are options for:
84
+ - Selecting a provider (OpenAI or Ollama, others coming soon!)
85
+ - Enabling "Follow", this will move the Ghidra view to the location of
86
+ things ReVa is examining or changing.
87
+ - Enabling "Auto-allow", ReVa will log her actions for the user to accept
88
+ in the "ReVa Actions Log" window.
89
+
90
+ There are sections for the providers.
91
+
92
+ ### OpenAI
77
93
 
78
- Configuration for the reverse engineering assistant is stored at
79
- `~/.config/reverse-engineering-assistant/config.yaml`. If this
80
- is not present on first start, a default configuration using
81
- OpenAI for inference and the `OPENAI_API_TOKEN` environment
82
- variable will be used.
94
+ By default, the OpenAI key is loaded from the environment variable `OPENAI_API_KEY`. You can also set your key inside Ghidra. Setting the key back to the `OPENAI_API_KEY` value will clear the key from the Ghidra configuration and load it from the environment.
83
95
 
84
- The most important setting is the `type` top level setting.
85
- This controls what inference service you use. These are the
86
- same as the configuration keys, for example to use Ollama,
87
- set type to `ollama` and configure the settings in the `ollama:`
88
- section.
96
+ You can also select the model. By default `gpt-4o` is selected. This model works best with the tools and the prompt provided by ReVa.
89
97
 
90
- The configuration also contains the prompts used for the models.
91
- If you use Ollama or OpenAI these will be processed to fit the
92
- model specific prompt pattern (placing the system prompt in the
93
- correct tags, etc).
98
+ `gpt-4` also works well, but is slow and needs more prompting by the user to explore a binary.
94
99
 
95
- For `llama-cpp` and `text-generation-webui` these may need to be
96
- configured for your specific model. For this reason Ollama is
97
- preferred for self hosting.
100
+ ### Ollama
101
+
102
+ Ollama is a local inference server. The default server is set to localhost, with the default Ollama port. You can change this to a remote server if you want to perform inference on a remote machine. This is useful for organisations that self host.
103
+
104
+ You can also select a model. The model must alread be loaded on the server. Good performance has been seen with:
105
+ - `mixtral`
106
+ - `llama3`
107
+ - `phi`
98
108
 
99
109
  ## Workflow
100
110
 
@@ -112,24 +122,41 @@ If you have more than one Ghidra open, you can select the right one with
112
122
  `reva-chat --project ${project-name}`, if it is not set, `reva-chat` will
113
123
  ask you which project you want to connect to.
114
124
 
115
- ## Installation
125
+ ## Protocol Build
116
126
 
117
- First install the python component, I like to use `pipx`. It is best to make
118
- sure that `reva-server` and `reva-chat` are on your path.
119
- The Ghidra extension will need to start `reva-server`, and you will need to
120
- run `reva-chat`.
127
+ To communicate between `reva-server` and the extension, [gRPC](https://grpc.io) is used. You can read more about that (here)[./DEVELOPER.md]. Building the source files from those protocol definitions is driven from the [Makefile](/Makefile). To build the protocol source code files, run this command in the project's root:
121
128
 
122
- To install the particular extension for your disassembler see:
123
- - [Ghidra Support](#ghidra-support)
129
+ ```sh
130
+ make protocol
131
+ ```
124
132
 
125
- The chat can be started with:
133
+ ## Python Project (reva-server and reva-chat) Installation
134
+
135
+ First install the python component, I like to use `pipx`. Install it with something like:
126
136
 
127
137
  ```sh
128
- reva-chat
138
+ pip install pipx
129
139
  ```
130
140
 
131
- > You can also configure the path to `reva-server` in `Edit -> Tool Options -> ReVa`
132
- > if it is not on your path. But you really should put it on your path!
141
+ In the `reverse-engineering-assistant` folder, run:
142
+
143
+ ```sh
144
+ pipx install .
145
+ ```
146
+
147
+ After installing the python project, pipx may warn you that you need to add a folder to your PATH environment variable. Make sure that the folder (now containing `reva-server` and `reva-chat`) are in your PATH variable. pipx can do it for you with this command:
148
+
149
+ ```sh
150
+ pipx ensurepath
151
+ ```
152
+
153
+ The extension will need to start `reva-server`, and you will need to run `reva-chat`. In case you do not want to add them to your PATH, see the [Configuration](#configuration) section for how to set the path to the executables.
154
+
155
+ Once the `reva-server` has been started by the extension the chat can be started with:
156
+
157
+ ```sh
158
+ reva-chat
159
+ ```
133
160
 
134
161
  # Ghidra Support
135
162
 
@@ -139,12 +166,16 @@ reva-chat
139
166
 
140
167
  Follow the instructions in the [ghidra-assistant](ghidra-assistant/README.md) plugin.
141
168
 
142
- After installation, enable the `ReVaPlugin` extension in the CodeBrowser tool (Open a file and click: File -> Configure -> Miscellaneous).
169
+ After installation, enable the `ReVa Plugin` extension in the CodeBrowser tool (Open a file and click: File -> Configure -> Miscellaneous).
143
170
 
144
171
  If you want ReVa enabled by default, click File -> Save Tool to save the configuration.
145
172
 
146
173
  If everything is working correctly you will see a ReVa menu on your menu bar.
147
174
 
175
+ ## Configuration
176
+
177
+ You can modify the plugin configuration in `Edit -> Tool Options -> ReVa`.
178
+
148
179
  ## Undo
149
180
 
150
181
  Whenever ReVa performs an action it will create an undo point for each action. If ReVa renames 5 variables, this will be
@@ -152,9 +183,17 @@ one undo.
152
183
 
153
184
  ## Menus
154
185
 
155
- > These are being added in the next release
186
+ ReVa adds an option to the CodeBrowser Tool's Window menu.
187
+ Select Window -> ReVa Action Log to open the ReVa Action Log window.
188
+
189
+ This window shows actions ReVa has performed and would like to perform.
190
+ You can accept or reject a change by double clicking the ✅ or ❌ icon. You can also go to the location the action will be performed by double clicking the address.
191
+
192
+ If you reject an action, ReVa will be told and she will move on.
193
+
194
+ You can also enable "Auto-allow" in the ReVa options. This will automatically accept all actions ReVa wants to perform.
156
195
 
157
- ReVa adds some elements to the Ghidra UI. You can either ask ReVa to do something in the chat window,
196
+ ReVa also adds some elements to the Ghidra UI. You can either ask ReVa to do something in the chat window,
158
197
  "Examine the variable usage in `main` in detail, rename the variables with more descriptive names.",
159
198
  or use the menu system.
160
199
 
@@ -25,13 +25,14 @@ information from the tools, but when there is no information it can still respon
25
25
  questions from its training.
26
26
 
27
27
  You can ask questions like:
28
+ - What are the interesting strings in this program?
28
29
  - Does this program use encryption? Write a markdown report on the encryption and where it is used.
29
30
  - Draw a class diagram using plantuml syntax.
30
31
  - Start from main, examine the program in detail. Rename variables as you go and provide a summary of the program.
31
32
  - Explain the purpose of the `__mod_init` segment.
32
33
  - What does `mmap` return?
33
34
  - What does the function at address 0x80000 do?
34
- - This is a CTF problem. Start at main, examine the program in detail and write a pwntools script to get the flag.
35
+ - This is a CTF problem. Write a pwntools script to get the flag.
35
36
 
36
37
  An important part of reverse engineering is the process. Many other tools simply ask a single question of the LLM,
37
38
  this means it is difficult to determine _why_ a thing happened. In ReVa we break all actions down into small parts
@@ -47,33 +48,40 @@ Built in support is provided for:
47
48
  - [OpenAI](https://platform.openai.com/overview) for online inference and easy setup (Needs an OpenAI API key)
48
49
  - [Ollama](https://ollama.ai) and any model it supports for local on-device inference or connecting to a self hosted remote inference server.
49
50
 
51
+ See [Configuration](#configuration) for more information about settings for the providers.
52
+
50
53
  Adding additional inference servers is easy if it is supported by langchain.
51
54
 
52
55
  ## Configuration
53
56
 
54
- > This is currently being moved to the Ghidra GUI
55
- > See Edit -> Tool Options -> ReVa in the Codebrowser Tool
57
+ Configuration for ReVa is in the CodeBrowser Tool options.
58
+ Open a program and go to Edit -> Tool Options -> ReVa.
59
+
60
+ There are options for:
61
+ - Selecting a provider (OpenAI or Ollama, others coming soon!)
62
+ - Enabling "Follow", this will move the Ghidra view to the location of
63
+ things ReVa is examining or changing.
64
+ - Enabling "Auto-allow", ReVa will log her actions for the user to accept
65
+ in the "ReVa Actions Log" window.
66
+
67
+ There are sections for the providers.
68
+
69
+ ### OpenAI
56
70
 
57
- Configuration for the reverse engineering assistant is stored at
58
- `~/.config/reverse-engineering-assistant/config.yaml`. If this
59
- is not present on first start, a default configuration using
60
- OpenAI for inference and the `OPENAI_API_TOKEN` environment
61
- variable will be used.
71
+ By default, the OpenAI key is loaded from the environment variable `OPENAI_API_KEY`. You can also set your key inside Ghidra. Setting the key back to the `OPENAI_API_KEY` value will clear the key from the Ghidra configuration and load it from the environment.
62
72
 
63
- The most important setting is the `type` top level setting.
64
- This controls what inference service you use. These are the
65
- same as the configuration keys, for example to use Ollama,
66
- set type to `ollama` and configure the settings in the `ollama:`
67
- section.
73
+ You can also select the model. By default `gpt-4o` is selected. This model works best with the tools and the prompt provided by ReVa.
68
74
 
69
- The configuration also contains the prompts used for the models.
70
- If you use Ollama or OpenAI these will be processed to fit the
71
- model specific prompt pattern (placing the system prompt in the
72
- correct tags, etc).
75
+ `gpt-4` also works well, but is slow and needs more prompting by the user to explore a binary.
73
76
 
74
- For `llama-cpp` and `text-generation-webui` these may need to be
75
- configured for your specific model. For this reason Ollama is
76
- preferred for self hosting.
77
+ ### Ollama
78
+
79
+ Ollama is a local inference server. The default server is set to localhost, with the default Ollama port. You can change this to a remote server if you want to perform inference on a remote machine. This is useful for organisations that self host.
80
+
81
+ You can also select a model. The model must alread be loaded on the server. Good performance has been seen with:
82
+ - `mixtral`
83
+ - `llama3`
84
+ - `phi`
77
85
 
78
86
  ## Workflow
79
87
 
@@ -91,24 +99,41 @@ If you have more than one Ghidra open, you can select the right one with
91
99
  `reva-chat --project ${project-name}`, if it is not set, `reva-chat` will
92
100
  ask you which project you want to connect to.
93
101
 
94
- ## Installation
102
+ ## Protocol Build
95
103
 
96
- First install the python component, I like to use `pipx`. It is best to make
97
- sure that `reva-server` and `reva-chat` are on your path.
98
- The Ghidra extension will need to start `reva-server`, and you will need to
99
- run `reva-chat`.
104
+ To communicate between `reva-server` and the extension, [gRPC](https://grpc.io) is used. You can read more about that (here)[./DEVELOPER.md]. Building the source files from those protocol definitions is driven from the [Makefile](/Makefile). To build the protocol source code files, run this command in the project's root:
100
105
 
101
- To install the particular extension for your disassembler see:
102
- - [Ghidra Support](#ghidra-support)
106
+ ```sh
107
+ make protocol
108
+ ```
103
109
 
104
- The chat can be started with:
110
+ ## Python Project (reva-server and reva-chat) Installation
111
+
112
+ First install the python component, I like to use `pipx`. Install it with something like:
105
113
 
106
114
  ```sh
107
- reva-chat
115
+ pip install pipx
108
116
  ```
109
117
 
110
- > You can also configure the path to `reva-server` in `Edit -> Tool Options -> ReVa`
111
- > if it is not on your path. But you really should put it on your path!
118
+ In the `reverse-engineering-assistant` folder, run:
119
+
120
+ ```sh
121
+ pipx install .
122
+ ```
123
+
124
+ After installing the python project, pipx may warn you that you need to add a folder to your PATH environment variable. Make sure that the folder (now containing `reva-server` and `reva-chat`) are in your PATH variable. pipx can do it for you with this command:
125
+
126
+ ```sh
127
+ pipx ensurepath
128
+ ```
129
+
130
+ The extension will need to start `reva-server`, and you will need to run `reva-chat`. In case you do not want to add them to your PATH, see the [Configuration](#configuration) section for how to set the path to the executables.
131
+
132
+ Once the `reva-server` has been started by the extension the chat can be started with:
133
+
134
+ ```sh
135
+ reva-chat
136
+ ```
112
137
 
113
138
  # Ghidra Support
114
139
 
@@ -118,12 +143,16 @@ reva-chat
118
143
 
119
144
  Follow the instructions in the [ghidra-assistant](ghidra-assistant/README.md) plugin.
120
145
 
121
- After installation, enable the `ReVaPlugin` extension in the CodeBrowser tool (Open a file and click: File -> Configure -> Miscellaneous).
146
+ After installation, enable the `ReVa Plugin` extension in the CodeBrowser tool (Open a file and click: File -> Configure -> Miscellaneous).
122
147
 
123
148
  If you want ReVa enabled by default, click File -> Save Tool to save the configuration.
124
149
 
125
150
  If everything is working correctly you will see a ReVa menu on your menu bar.
126
151
 
152
+ ## Configuration
153
+
154
+ You can modify the plugin configuration in `Edit -> Tool Options -> ReVa`.
155
+
127
156
  ## Undo
128
157
 
129
158
  Whenever ReVa performs an action it will create an undo point for each action. If ReVa renames 5 variables, this will be
@@ -131,9 +160,17 @@ one undo.
131
160
 
132
161
  ## Menus
133
162
 
134
- > These are being added in the next release
163
+ ReVa adds an option to the CodeBrowser Tool's Window menu.
164
+ Select Window -> ReVa Action Log to open the ReVa Action Log window.
165
+
166
+ This window shows actions ReVa has performed and would like to perform.
167
+ You can accept or reject a change by double clicking the ✅ or ❌ icon. You can also go to the location the action will be performed by double clicking the address.
168
+
169
+ If you reject an action, ReVa will be told and she will move on.
170
+
171
+ You can also enable "Auto-allow" in the ReVa options. This will automatically accept all actions ReVa wants to perform.
135
172
 
136
- ReVa adds some elements to the Ghidra UI. You can either ask ReVa to do something in the chat window,
173
+ ReVa also adds some elements to the Ghidra UI. You can either ask ReVa to do something in the chat window,
137
174
  "Examine the variable usage in `main` in detail, rename the variables with more descriptive names.",
138
175
  or use the menu system.
139
176
 
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "reverse-engineering-assistant"
7
7
  readme = "README.md"
8
- version = "2.9.1"
8
+ version = "2.9.2"
9
9
  authors = [
10
10
  {name="サイバーカイダ (cyberkaida)"},
11
11
  ]
@@ -20,6 +20,7 @@ dependencies = [
20
20
  "langchain",
21
21
  "langchain-core",
22
22
  "langchain-openai",
23
+ "langchain-community",
23
24
  "prompt_toolkit",
24
25
  "sentence_transformers",
25
26
  "PyYAML",
@@ -27,8 +28,9 @@ dependencies = [
27
28
  "rich",
28
29
  "grpcio",
29
30
  "protobuf",
31
+ "flask",
30
32
  ]
31
33
 
32
34
  [project.scripts]
33
35
  reva-server = "reverse_engineering_assistant.assistant_api_server:main"
34
- reva-chat = "reverse_engineering_assistant.chat_client:main"
36
+ reva-chat = "reverse_engineering_assistant.chat_client:main"
@@ -3,7 +3,7 @@
3
3
  from ast import Call
4
4
  import queue
5
5
  import threading
6
- from typing import Callable
6
+ from typing import Callable, Dict, Optional
7
7
  from venv import logger
8
8
 
9
9
  from ..protocol.RevaChat_pb2_grpc import RevaChatServiceServicer
@@ -18,6 +18,9 @@ module_logger = logging.getLogger("reva-server")
18
18
  from langchain_core.callbacks.base import BaseCallbackHandler
19
19
  from langchain_core.agents import AgentAction, AgentFinish
20
20
 
21
+ from langchain_core.language_models.base import BaseLanguageModel
22
+ from langchain_core.language_models.chat_models import BaseChatModel
23
+
21
24
  class RevaActionCollector(BaseCallbackHandler):
22
25
  """
23
26
  A callback handler for logging agent actions in the reverse engineering assistant.
@@ -57,10 +60,17 @@ class RevaActionCollector(BaseCallbackHandler):
57
60
 
58
61
  class RevaChat(RevaChatServiceServicer):
59
62
  logger = logging.getLogger("reva-server.RevaChat")
63
+ llm: BaseLanguageModel | BaseChatModel
64
+
65
+ def __init__(self, llm: BaseLanguageModel | BaseChatModel) -> None:
66
+ self.llm = llm
60
67
 
61
68
  def chat(self, request, context):
62
69
  self.logger.info(f"Received request: {request}")
63
- assistant = ReverseEngineeringAssistant(request.project, langchain_callbacks=[RevaActionCollector(callback)])
70
+ assistant = ReverseEngineeringAssistant(
71
+ request.project,
72
+ model=self.llm
73
+ )
64
74
  self.logger.info(f"Assistant: {assistant}")
65
75
  llm_response = assistant.query(request.message)
66
76
  self.logger.info(f"LLM Response: {llm_response}")
@@ -83,7 +93,11 @@ class RevaChat(RevaChatServiceServicer):
83
93
  response.thought = message
84
94
  response_queue.put(response)
85
95
 
86
- assistant = ReverseEngineeringAssistant(request.project, langchain_callbacks=[RevaActionCollector(callback)])
96
+ assistant = ReverseEngineeringAssistant(
97
+ request.project,
98
+ model=self.llm,
99
+ langchain_callbacks=[RevaActionCollector(callback)]
100
+ )
87
101
  self.logger.info(f"Assistant: {assistant}")
88
102
 
89
103
  def run_query(query: str):
@@ -106,6 +120,40 @@ class RevaChat(RevaChatServiceServicer):
106
120
  t.join()
107
121
 
108
122
  def chatStream(self, request_iterator, context):
109
- # TODO: This needs to be re-written to use the new callback system
110
- # let's grab a reference to our assistant
111
- raise NotImplementedError("chatStream is not implemented yet")
123
+ assistant: Optional[ReverseEngineeringAssistant] = None
124
+ response_queue: queue.Queue = queue.Queue()
125
+
126
+ def callback(message: str):
127
+ # Called for intermediate thoughts
128
+ response = RevaChatMessageResponse()
129
+ response.thought = message
130
+ response_queue.put(response)
131
+
132
+ for request in request_iterator:
133
+ if not assistant:
134
+ assistant = ReverseEngineeringAssistant(
135
+ request.project,
136
+ model=self.llm,
137
+ langchain_callbacks=[RevaActionCollector(callback)]
138
+ )
139
+ self.logger.info(f"Received request: {request}")
140
+ def run_query(query: str):
141
+ assert assistant is not None
142
+ self.logger.info(f"Asking assistant: {query}")
143
+ llm_response = assistant.query(query)
144
+ self.logger.info(f"LLM Response: {llm_response}")
145
+ response = RevaChatMessageResponse()
146
+ response.message = llm_response
147
+ response_queue.put(response)
148
+
149
+ t = threading.Thread(target=run_query, args=[request.message])
150
+ t.start()
151
+
152
+ done = False
153
+ while not done:
154
+ response = response_queue.get()
155
+ # We stop when we get a message and not thoughts
156
+ if response.message and not response.thought:
157
+ done = True
158
+ yield response
159
+ t.join()