Skip to content

Commit 2c7ccf9

Browse files
authored
Merge pull request #33 from maxDcb/develop
Develop
2 parents 3a4c4c1 + e39e3ab commit 2c7ccf9

35 files changed

+844
-359
lines changed

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
[submodule "thirdParty/donut"]
55
path = thirdParty/donut
66
url = https://github.com/maxDcb/donut.git
7-
[submodule "thirdParty/coffLoader/coffLoader"]
8-
path = thirdParty/coffLoader/coffLoader
9-
url = https://github.com/maxDcb/COFFLoader.git
10-
[submodule "thirdParty/coffLoader/coffPacker"]
11-
path = thirdParty/coffLoader/coffPacker
12-
url = https://github.com/maxDcb/COFFPacker.git
137
[submodule "core"]
148
path = core
159
url = https://github.com/maxDcb/C2Core.git

AGENT.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# 🧠 AGENT.md
2+
3+
## Agent Role
4+
5+
You are an **expert C++ and CMake assistant** dedicated to supporting the C2TeamServer codebase:
6+
7+
* ✅ Fluent with the **project’s existing C++ style, directory layout, and CMake syntax**.
8+
***Do not attempt to build or compile the project**—that process is resource-intensive and time-consuming.
9+
* 🎯 Your focus is on **code understanding, guidance, edits**.
10+
11+
---
12+
13+
## 📌 Responsibilities
14+
15+
### Code Review & Navigation
16+
17+
* Analyze and explain C++ classes, actions, and CMake configurations.
18+
* Help trace calls from gRPC definitions to implementation.
19+
* Locate where libraries and dependencies are imported and used.
20+
21+
### Style & Syntax Alignment
22+
23+
* Provide suggestions strictly following the project's CMake and C++ style conventions (e.g., variable naming, build targets, include directories).
24+
* Maintain consistency with existing module structure and naming.
25+
26+
### Documentation & Guidance
27+
28+
* Generate lightweight helper scripts (e.g. code snippets, CMake snippets, CLI usage).
29+
* Draft small additions to README, comments, or doc files to clarify behavior—without rebuilding.
30+
31+
### Troubleshooting and Q\&A
32+
33+
* Troubleshoot code logic, gRPC interactions, and CMake file references.
34+
* Answer developer questions about function behavior, build targets, or directory layout.
35+
* Provide suggestions for refactors, optimizations, or better code organization that aligns with the existing style.
36+
37+
---
38+
39+
## 🚫 What You Should Not Do
40+
41+
* 🛠 Attempt to build the TeamServer or its dependencies locally.
42+
* ⚠ Perform any heavy code generation or restructuring that would require a full build.
43+
* 🔁 Initiate or recommend large build automations or CI integrations.
44+
45+
---
46+
47+
## ✅ Summary
48+
49+
| Role | Description |
50+
| --------------------- | ---------------------------------------------------------------------------- |
51+
| **Expert Agent** | Deep knowledge of C++17 and CMake for command-and-control code |
52+
| **No Builds** | Don’t compile the project or port it to other systems; skip heavy operations |
53+
| **Style-Focused** | Always match project's existing syntax and modular layout |
54+
| **Lightweight Tasks** | Commentary, documentation, small code reviews, snippet generation |
55+
56+
---
57+
58+
You are effectively the **senior C++/CMake co-pilot** for the project—always aligned with the existing style, focused on clarity and precision, and avoiding resource-intensive operations.

C2Client/C2Client/AssistantPanel.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@
55
from datetime import datetime
66

77
from threading import Thread, Lock, Semaphore
8-
from PyQt5.QtWidgets import *
9-
from PyQt5.QtGui import *
10-
from PyQt5.QtCore import *
118

12-
from grpcClient import *
9+
from PyQt6.QtCore import Qt, QEvent, QTimer, pyqtSignal
10+
from PyQt6.QtGui import QFont, QTextCursor, QStandardItem, QStandardItemModel, QShortcut
11+
from PyQt6.QtWidgets import (
12+
QCompleter,
13+
QLineEdit,
14+
QPlainTextEdit,
15+
QVBoxLayout,
16+
QWidget,
17+
)
18+
19+
from .grpcClient import TeamServerApi_pb2
1320

1421
import openai
1522
from openai import OpenAI
@@ -35,7 +42,7 @@ def __init__(self, parent, grpcClient):
3542
# self.logFileName=LogFileName
3643

3744
self.editorOutput = QPlainTextEdit()
38-
self.editorOutput.setFont(QFont("Courier"));
45+
self.editorOutput.setFont(QFont("JetBrainsMono Nerd Font"))
3946
self.editorOutput.setReadOnly(True)
4047
self.layout.addWidget(self.editorOutput, 8)
4148

@@ -80,7 +87,7 @@ def nextCompletion(self):
8087

8188
def sessionAssistantMethod(self, action, beaconHash, listenerHash, hostname, username, arch, privilege, os, lastProofOfLife, killed):
8289
if action == "start":
83-
print("sessionAssistantMethod", action, beaconHash)
90+
# print("sessionAssistantMethod", action, beaconHash)
8491
self.messages.append({"role": "user", "content": "New session stared: beaconHash={}, listenerHash={}, hostname={}, username={}, privilege={}, os={}.".format(beaconHash, listenerHash, hostname, username, privilege, os) })
8592
elif action == "stop":
8693
toto = 1
@@ -89,7 +96,7 @@ def sessionAssistantMethod(self, action, beaconHash, listenerHash, hostname, use
8996

9097

9198
def listenerAssistantMethod(self, action, hash, str3, str4):
92-
print("listenerAssistantMethod", action, hash)
99+
# print("listenerAssistantMethod", action, hash)
93100
if action == "start":
94101
toto = 1
95102
elif action == "stop":
@@ -98,14 +105,14 @@ def listenerAssistantMethod(self, action, hash, str3, str4):
98105

99106
def consoleAssistantMethod(self, action, beaconHash, listenerHash, context, cmd, result):
100107
if action == "receive":
101-
print("consoleAssistantMethod", "-Context:\n" + context + "\n\n-Command sent:\n" + cmd + "\n\n-Response:\n" + result)
108+
# print("consoleAssistantMethod", "-Context:\n" + context + "\n\n-Command sent:\n" + cmd + "\n\n-Response:\n" + result)
102109
self.messages.append({"role": "user", "content": cmd + "\n" + result})
103110
elif action == "send":
104111
toto = 1
105112

106113

107114
def event(self, event):
108-
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Tab:
115+
if event.type() == QEvent.Type.KeyPress and event.key() == Qt.Key.Key_Tab:
109116
self.tabPressed.emit()
110117
return True
111118
return super().event(event)
@@ -279,13 +286,13 @@ def runCommand(self):
279286
self.printInTerminal("User:", commandLine)
280287

281288
message = response.choices[0].message
282-
print(message)
289+
# print(message)
283290

284291
function_call = message.function_call
285292
if function_call:
286293
name = function_call.name
287294
args = json.loads(function_call.arguments)
288-
print(f"Model wants to call `{name}` with arguments: {args}")
295+
# print(f"Model wants to call `{name}` with arguments: {args}")
289296

290297
self.printInTerminal("Analysis:", f"Model wants to call `{name}` with arguments: {args}")
291298

@@ -381,7 +388,7 @@ def executeCmd(self, cmd, args):
381388
# setCursorEditorAtEnd
382389
def setCursorEditorAtEnd(self):
383390
cursor = self.editorOutput.textCursor()
384-
cursor.movePosition(QTextCursor.End,)
391+
cursor.movePosition(QTextCursor.MoveOperation.End)
385392
self.editorOutput.setTextCursor(cursor)
386393

387394

@@ -393,8 +400,8 @@ class CommandEditor(QLineEdit):
393400
def __init__(self, parent=None):
394401
super().__init__(parent)
395402

396-
QShortcut(Qt.Key_Up, self, self.historyUp)
397-
QShortcut(Qt.Key_Down, self, self.historyDown)
403+
QShortcut(Qt.Key.Key_Up, self, self.historyUp)
404+
QShortcut(Qt.Key.Key_Down, self, self.historyDown)
398405

399406
# self.codeCompleter = CodeCompleter(completerData, self)
400407
# # needed to clear the completer after activation
@@ -410,7 +417,7 @@ def nextCompletion(self):
410417
self.codeCompleter.setCurrentRow(0)
411418

412419
def event(self, event):
413-
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Tab:
420+
if event.type() == QEvent.Type.KeyPress and event.key() == Qt.Key.Key_Tab:
414421
self.tabPressed.emit()
415422
return True
416423
return super().event(event)
@@ -441,7 +448,7 @@ def onActivated(self):
441448

442449

443450
class CodeCompleter(QCompleter):
444-
ConcatenationRole = Qt.UserRole + 1
451+
ConcatenationRole = Qt.ItemDataRole.UserRole + 1
445452

446453
def __init__(self, data, parent=None):
447454
super().__init__(parent)

0 commit comments

Comments
 (0)