(String[] args)
| 145 | } |
| 146 | |
| 147 | public static void main(String[] args) { |
| 148 | System.out.println("=== CookieCloud Fixed IV Decryption - Java Simple ===\n"); |
| 149 | |
| 150 | // Test parameters |
| 151 | String uuid = "jNp1T2qZ6shwVW9VmjLvp1"; |
| 152 | String password = "iZ4PCqzfJcHyiwAQcCuupD"; |
| 153 | String dataFile = "../jNp1T2qZ6shwVW9VmjLvp1_iZ4PCqzfJcHyiwAQcCuupD.json"; |
| 154 | |
| 155 | System.out.println("📋 Test Parameters:"); |
| 156 | System.out.println("UUID: " + uuid); |
| 157 | System.out.println("Password: " + password); |
| 158 | System.out.println("Data File: " + dataFile.substring(dataFile.lastIndexOf('/') + 1)); |
| 159 | |
| 160 | try { |
| 161 | // Read encrypted data |
| 162 | String rawData = Files.readString(Paths.get(dataFile), StandardCharsets.UTF_8); |
| 163 | String encryptedData = extractJsonValue(rawData, "encrypted"); |
| 164 | |
| 165 | if (encryptedData == null) { |
| 166 | throw new Exception("Could not extract encrypted data from JSON"); |
| 167 | } |
| 168 | |
| 169 | System.out.println("\n🔐 Encrypted Data Length: " + encryptedData.length() + " characters"); |
| 170 | System.out.println("Encrypted Data (first 50 chars): " + |
| 171 | encryptedData.substring(0, Math.min(50, encryptedData.length())) + "..."); |
| 172 | |
| 173 | // Decrypt |
| 174 | System.out.println("\n🔓 Decrypting..."); |
| 175 | String decryptedJson = decrypt(uuid, encryptedData, password); |
| 176 | |
| 177 | System.out.println("✅ Decryption successful!"); |
| 178 | System.out.println("\n📊 Decrypted Data Summary:"); |
| 179 | |
| 180 | // Extract and analyze data without external JSON library |
| 181 | String cookieData = extractJsonValue(decryptedJson, "cookie_data"); |
| 182 | String localStorageData = extractJsonValue(decryptedJson, "local_storage_data"); |
| 183 | String updateTime = extractJsonValue(decryptedJson, "update_time"); |
| 184 | |
| 185 | int cookieDomains = countJsonKeys(cookieData); |
| 186 | int localStorageDomains = countJsonKeys(localStorageData); |
| 187 | |
| 188 | System.out.println("- Cookie domains: " + cookieDomains); |
| 189 | System.out.println("- Local storage domains: " + localStorageDomains); |
| 190 | System.out.println("- Update time: " + updateTime); |
| 191 | |
| 192 | // Show first 200 characters of decrypted data |
| 193 | System.out.println("\n📄 Decrypted Data Preview:"); |
| 194 | String preview = decryptedJson.length() > 200 ? |
| 195 | decryptedJson.substring(0, 200) + "..." : decryptedJson; |
| 196 | System.out.println(preview); |
| 197 | |
| 198 | System.out.println("\n🎉 Java Simple decryption completed successfully!"); |
| 199 | System.out.println("\n💡 This implementation uses only standard JDK libraries!"); |
| 200 | System.out.println(" No external dependencies like Jackson required."); |
| 201 | |
| 202 | } catch (Exception e) { |
| 203 | System.err.println("❌ Decryption failed: " + e.getMessage()); |
| 204 | e.printStackTrace(); |
nothing calls this directly
no test coverage detected