Skip to content

Commit 08cf8e1

Browse files
committed
refactor: Rename format_msg to format_data for clarity and update parameter usage
1 parent 57a7581 commit 08cf8e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Jiyu_attack.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ def ip_analyze(ip: str) -> list[str]:
151151
return [f"{ip_tuple[0]}.{ip_tuple[1]}.{ip_tuple[2]}.{ip_tuple[3]}"]
152152

153153

154-
def format_msg(
155-
msg: str,
154+
def format_data(
155+
data: str,
156156
max_length: int,
157157
*,
158158
errors: Literal["error", "warning", "ignore"] = "error",
@@ -169,7 +169,7 @@ def format_msg(
169169
bytes: The formatted byte array, padded with null bytes if necessary.
170170
"""
171171
ret = bytearray()
172-
for s in msg:
172+
for s in data:
173173
c = ord(s)
174174
if c > 0xFFFF:
175175
throw_error(f"Character {s} (0x{c:X}) is not supported.", errors=errors)
@@ -202,7 +202,7 @@ def pkg_message(
202202
Raises:
203203
ValueError: If the message length exceeds 800 bytes or if the header length is incorrect
204204
"""
205-
data = format_msg(msg, 800, errors=errors)
205+
data = format_data(msg, 800, errors=errors)
206206
head = (
207207
b"DMOC\x00\x00\x01\x00\x9e\x03\x00\x00"
208208
+ secrets.token_bytes(16)

0 commit comments

Comments
 (0)