Skip to content

Commit 40ee29e

Browse files
committed
프로토콜별 상수를 만듬
1 parent 64e7429 commit 40ee29e

2 files changed

Lines changed: 60 additions & 16 deletions

File tree

HSProtocol/HSProtocol.go

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,55 @@ import (
55
"fmt"
66
)
77

8+
// Command 상수를 정의
9+
const (
10+
ACK = 0b0000000000 // Command: 0 (0b0000000000)
11+
// 제목: Ack
12+
// 설명: Identification에 대응되는 패킷을 잘 처리했음을 알림.
13+
14+
UPDATE_AGENT_PROTOCOL = 0b0000000001 // Command: 1 (0b0000000001)
15+
// 제목: updateAgentProtocol
16+
// 설명: Agent가 자신의 통신 프로토콜에 대한 설정 값을 ProtocolID 필드에 담아 전달합니다.
17+
// Code | 통신 프로토콜 | 보기
18+
// 0b0001 | TCP
19+
// 0b0010 | UDP --------
20+
// 0b0011 | HTTP --------
21+
// 0b0100 | HTTPS --------
22+
23+
UPDATE_AGENT_STATUS = 0b0000000010 // Command: 2 (0b0000000010)
24+
// 제목: updateAgentStatus
25+
// 설명: Agent가 자신의 통신 방법을 전달합니다.
26+
// 0b00: stopping
27+
// 0b01: waiting (새로 생성)
28+
// 0b10: running
29+
// 0b11: remove (삭제 요청)
30+
31+
SEND_AGENT_SYS_INFO = 0b0000000011 // Command: 3 (0b0000000011)
32+
// 제목: sendAgentSysInfo
33+
// 설명: Agent가 컴퓨터의 정보를 JSON 형태로 Data 필드에 직렬화하여 전송합니다.
34+
35+
RESERVED = 0b0000000100 // Command: 4 (0b0000000100)
36+
// 제목: 예약
37+
// 설명: 예약
38+
39+
SEND_AGENT_APP_INFO = 0b0000000101 // Command: 5 (0b0000000101)
40+
// 제목: sendAgentSysAppInfo
41+
// 설명: Agent가 ApplicationInfo 정보를 JSON 형태로 Data 필드에 직렬화하여 전송합니다.
42+
43+
FETCH_INSTRUCTION = 0b0000000110 // Command: 6 (0b0000000110)
44+
// 제목: fetchInstruction
45+
// 설명: Agent가 Server 측에 공격 시나리오 (YAML 파일)를 요청합니다. 이때 데이터는 Data 필드에 YAML 형태로 직렬화하여 전송됩니다.
46+
47+
SEND_PROCEDURE_LOG = 0b0000000111 // Command: 7 (0b0000000111)
48+
// 제목: sendProcedureLog
49+
// 설명: Agent가 Server 측에 공격 시나리오 로그를 JSON 형태로 Data 필드에 직렬화하여 전송합니다.
50+
)
51+
52+
// Command 상수를 정의
853
type HS struct {
9-
ProtocolID uint8
10-
HealthStatus uint8
11-
Command uint16
12-
//ProtocolID uint16
54+
ProtocolID uint8
55+
HealthStatus uint8
56+
Command uint16
1357
Identification uint16
1458
Checksum uint16
1559
TotalLength uint16

ReadMe.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,42 +116,42 @@ hsManager.PrintByte(data2)
116116
- **설명:** Identification에 대응되는 패킷을 잘 처리했음을 알림.
117117

118118
### Command: 1 (0b0000000001)
119-
- **제목:** updateProtocol
120-
- **설명:** Agent가 자신의 통신 프로토콜에 대한 설정 값을 Data 필드에 담아 전달합니다.
119+
- **제목:** updateAgentProtocol
120+
- **설명:** Agent가 자신의 통신 프로토콜에 대한 설정 값을 ProtocolID 필드에 담아 전달합니다.
121121

122-
| Code | 통신 프로토콜 | 보기 |
122+
| Code | 통신 프로토콜 | 보기 |
123123
|--------|---------|----------|
124-
| 0b0001 | TCP | |
125-
| 0b0010 | UDP | -------- |
126-
| 0b0011 | HTTP | -------- |
127-
| 0b0100 | HTTPS | -------- |
124+
| 0b0001 | TCP | |
125+
| 0b0010 | UDP | -------- |
126+
| 0b0011 | HTTP | -------- |
127+
| 0b0100 | HTTPS | -------- |
128128

129129
### Command: 2 (0b0000000010)
130-
- **제목:** updateStatus
130+
- **제목:** updateAgentStatus
131131
- **설명:** Agent가 자신의 통신 방법을 전달합니다.
132132
- 0b00: stopping
133133
- 0b01: waiting (새로 생성)
134134
- 0b10: running
135135
- 0b11: remove (삭제 요청)
136136

137137
### Command: 3 (0b0000000011)
138-
- **제목:** postSystemInfo 데이터
138+
- **제목:** sendAgentSysInfo 데이터
139139
- **설명:** Agent가 컴퓨터의 정보를 JSON 형태로 Data 필드에 직렬화하여 전송합니다.
140140

141141
### Command: 4 (0b0000000100)
142142
- **제목:** 예약
143143
- **설명:** 예약
144144

145145
### Command: 5 (0b0000000101)
146-
- **제목:** postApplicationInfo 데이터
146+
- **제목:** sendAgentSysAppInfo 데이터
147147
- **설명:** Agent가 ApplicationInfo 정보를 JSON 형태로 Data 필드에 직렬화하여 전송합니다.
148148

149149
### Command: 6 (0b0000000110)
150-
- **제목:** getProcedure
150+
- **제목:** fetchInstruction
151151
- **설명:** Agent가 Server 측에 공격 시나리오 (YAML 파일)를 요청합니다. 이때 데이터는 Data 필드에 YAML 형태로 직렬화하여 전송됩니다.
152152

153153
### Command: 7 (0b0000000111)
154-
- **제목:** postLogOfProcedure
154+
- **제목:** sendProcedureLog
155155
- **설명:** Agent가 Server 측에 공격 시나리오 로그를 JSON 형태로 Data 필드에 직렬화하여 전송합니다.
156156

157157
---

0 commit comments

Comments
 (0)