Skip to content

Commit f446a67

Browse files
committed
Create Number-Editor.py
1 parent 57e463e commit f446a67

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Tools/Number-Editor.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import json
2+
3+
4+
def update_case_numbers(file_path):
5+
# Read the JSON file
6+
with open(file_path, "r", encoding="utf-8") as file:
7+
data = json.load(file)
8+
9+
# Sort accounts by their current case number (in case they are not in order)
10+
accounts = list(data.items())
11+
accounts.sort(key=lambda x: int(x[1]["CASE_NUMBER"]))
12+
13+
# Update case numbers and account keys
14+
updated_data = {}
15+
for index, (old_key, account) in enumerate(accounts, start=1):
16+
new_key = f"ACCOUNT_NUMBER_{index}"
17+
account["CASE_NUMBER"] = str(index)
18+
19+
# Ensure usernames remain in their original encoding
20+
if "USERNAME" in account:
21+
account["USERNAME"] = account["USERNAME"].encode("utf-8").decode("utf-8")
22+
23+
updated_data[new_key] = account
24+
25+
# Write the updated data back to the file
26+
with open(file_path, "w", encoding="utf-8") as file:
27+
json.dump(updated_data, file, indent=2, ensure_ascii=False)
28+
29+
30+
# Call the function with your file path
31+
update_case_numbers("Compromised-Discord-Accounts.json")

0 commit comments

Comments
 (0)