File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 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" )
You can’t perform that action at this time.
0 commit comments