@leeguoo/pwtk-network-debugger 1.2.10 → 1.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -6628,19 +6628,24 @@ function decrypt(encryptedData, keyStr) {
6628
6628
  }
6629
6629
  }
6630
6630
  if (window.decrypt && keyStr) {
6631
- console.log("[PWTK Decrypt] Trying WebAssembly decrypt with key:", keyStr);
6631
+ console.log("[PWTK Decrypt] Trying WebAssembly decrypt");
6632
+ console.log("[PWTK Decrypt] Input to window.decrypt:", {
6633
+ data: encryptedData.substring(0, 100) + "...",
6634
+ key: keyStr
6635
+ });
6632
6636
  try {
6633
6637
  const decrypted = window.decrypt(encryptedData, keyStr);
6634
- console.log("[PWTK Decrypt] WebAssembly decrypt result:", {
6635
- success: decrypted && decrypted !== encryptedData,
6636
- resultLength: decrypted?.length,
6637
- resultPreview: decrypted?.substring(0, 100),
6638
+ console.log("[PWTK Decrypt] window.decrypt returned:", {
6639
+ type: typeof decrypted,
6640
+ length: decrypted?.length,
6641
+ preview: decrypted ? decrypted.substring(0, 200) + (decrypted.length > 200 ? "..." : "") : null,
6642
+ sameAsInput: decrypted === encryptedData,
6638
6643
  hasInvalidChars: decrypted?.includes("�")
6639
6644
  });
6640
6645
  if (decrypted && decrypted !== encryptedData && !decrypted.includes("�")) {
6641
6646
  try {
6642
6647
  const parsed = JSON.parse(decrypted);
6643
- console.log("[PWTK Decrypt] ✅ WebAssembly decryption successful, parsed as JSON");
6648
+ console.log("[PWTK Decrypt] ✅ WebAssembly decryption successful, parsed as JSON:", parsed);
6644
6649
  return parsed;
6645
6650
  } catch {
6646
6651
  if (decrypted.length > 0) {
@@ -6648,6 +6653,8 @@ function decrypt(encryptedData, keyStr) {
6648
6653
  return decrypted;
6649
6654
  }
6650
6655
  }
6656
+ } else {
6657
+ console.log("[PWTK Decrypt] window.decrypt did not change the data or returned invalid result");
6651
6658
  }
6652
6659
  } catch (e) {
6653
6660
  console.log("[PWTK Decrypt] WebAssembly decrypt error:", e);
@@ -6655,7 +6662,8 @@ function decrypt(encryptedData, keyStr) {
6655
6662
  } else {
6656
6663
  console.log("[PWTK Decrypt] WebAssembly not available:", {
6657
6664
  hasWindowDecrypt: !!window.decrypt,
6658
- hasKey: !!keyStr
6665
+ hasKey: !!keyStr,
6666
+ windowDecryptType: typeof window.decrypt
6659
6667
  });
6660
6668
  }
6661
6669
  const keys = [
@@ -6816,17 +6824,39 @@ class NetworkInterceptor {
6816
6824
  const fullKey = key + slk;
6817
6825
  console.log("[PWTK Debug] Full decrypt key:", fullKey ? `"${fullKey}" (length: ${fullKey.length})` : "empty");
6818
6826
  if (fullKey) {
6819
- const dataStr = typeof data === "string" ? data : JSON.stringify(data);
6820
- console.log("[PWTK Debug] Calling decrypt with data length:", dataStr.length, "key:", fullKey);
6827
+ let dataToDecrypt = data;
6828
+ let isWrappedData = false;
6829
+ if (typeof data === "object" && data !== null && data.data && typeof data.data === "string") {
6830
+ console.log('[PWTK Debug] Data is wrapped in {"data": "..."} format, extracting inner data');
6831
+ dataToDecrypt = data.data;
6832
+ isWrappedData = true;
6833
+ } else if (typeof data === "string") {
6834
+ try {
6835
+ const parsed = JSON.parse(data);
6836
+ if (parsed.data && typeof parsed.data === "string") {
6837
+ console.log("[PWTK Debug] Data is JSON string with data field, extracting");
6838
+ dataToDecrypt = parsed.data;
6839
+ isWrappedData = true;
6840
+ }
6841
+ } catch {
6842
+ }
6843
+ }
6844
+ const dataStr = typeof dataToDecrypt === "string" ? dataToDecrypt : JSON.stringify(dataToDecrypt);
6845
+ console.log("[PWTK Debug] Calling decrypt with:", {
6846
+ dataLength: dataStr.length,
6847
+ dataPreview: dataStr.substring(0, 50),
6848
+ key: fullKey,
6849
+ isWrapped: isWrappedData
6850
+ });
6821
6851
  const decrypted = decrypt(dataStr, fullKey);
6822
6852
  console.log("[PWTK Debug] Decrypt result:", {
6823
- success: decrypted && decrypted !== dataStr && decrypted !== data,
6853
+ success: decrypted && decrypted !== dataStr,
6824
6854
  decryptedType: typeof decrypted,
6825
6855
  decryptedLength: decrypted ? typeof decrypted === "string" ? decrypted.length : JSON.stringify(decrypted).length : 0,
6826
- preview: decrypted ? JSON.stringify(decrypted).substring(0, 100) : null
6856
+ preview: decrypted ? typeof decrypted === "string" ? decrypted.substring(0, 100) : JSON.stringify(decrypted).substring(0, 100) : null
6827
6857
  });
6828
- if (decrypted && decrypted !== dataStr && decrypted !== data) {
6829
- console.log("[PWTK Debug] ✅ Decryption successful!");
6858
+ if (decrypted && decrypted !== dataStr) {
6859
+ console.log("[PWTK Debug] ✅ Decryption successful! Result:", decrypted);
6830
6860
  return decrypted;
6831
6861
  } else {
6832
6862
  console.log("[PWTK Debug] ❌ Decryption failed or returned same data");
@@ -6881,6 +6911,8 @@ class NetworkInterceptor {
6881
6911
  if (decrypted !== null) {
6882
6912
  requestData.decryptedRequest = decrypted;
6883
6913
  self2.requests.set(requestId, requestData);
6914
+ console.log("[PWTK Debug] Request decrypted, notifying UI");
6915
+ self2.notifyListeners(requestData);
6884
6916
  }
6885
6917
  }).catch((e) => console.warn("解密请求失败:", e));
6886
6918
  }
@@ -6919,6 +6951,7 @@ class NetworkInterceptor {
6919
6951
  if (decrypted !== null) {
6920
6952
  requestData.decryptedResponse = decrypted;
6921
6953
  self2.requests.set(requestId, requestData);
6954
+ console.log("[PWTK Debug] Response decrypted, notifying UI:", decrypted);
6922
6955
  self2.notifyListeners(requestData);
6923
6956
  }
6924
6957
  }).catch((e) => console.warn("解密响应失败:", e));
@@ -6982,6 +7015,8 @@ class NetworkInterceptor {
6982
7015
  if (decrypted !== null) {
6983
7016
  requestData.decryptedRequest = decrypted;
6984
7017
  self2.requests.set(requestId, requestData);
7018
+ console.log("[PWTK Debug] Fetch request decrypted, notifying UI");
7019
+ self2.notifyListeners(requestData);
6985
7020
  }
6986
7021
  }).catch((e) => console.warn("解密请求失败:", e));
6987
7022
  }
@@ -7018,6 +7053,7 @@ class NetworkInterceptor {
7018
7053
  if (decrypted !== null) {
7019
7054
  updatedRequestData.decryptedResponse = decrypted;
7020
7055
  self2.requests.set(requestId, updatedRequestData);
7056
+ console.log("[PWTK Debug] Fetch response decrypted, notifying UI:", decrypted);
7021
7057
  self2.notifyListeners(updatedRequestData);
7022
7058
  }
7023
7059
  }).catch((e) => console.warn("解密响应失败:", e));
@@ -7951,7 +7987,7 @@ class DebugPanel {
7951
7987
  <div class="about-panel" data-panel="about" style="display: none;">
7952
7988
  <div style="padding: 20px; color: #fff; text-align: center;">
7953
7989
  <h2 style="margin: 0 0 20px 0;">🔓 PWTK 解密小工具</h2>
7954
- <p style="margin: 10px 0;">Version: 1.2.10</p>
7990
+ <p style="margin: 10px 0;">Version: 1.2.12</p>
7955
7991
  <p style="margin: 10px 0;">👨‍💻 Created by <strong>Leo (@leeguoo)</strong></p>
7956
7992
  <p style="margin: 10px 0;">📧 技术支持:请联系 Leo</p>
7957
7993
  <p style="margin: 10px 0;">🌐 分享服务:curl.bwg.leeguoo.com</p>
@@ -8560,7 +8596,7 @@ class NetworkDebugger {
8560
8596
  this.initialized = true;
8561
8597
  console.log(`
8562
8598
  ╔════════════════════════════════════════╗
8563
- ║ 🔓 PWTK 解密小工具 v1.2.10
8599
+ ║ 🔓 PWTK 解密小工具 v1.2.12
8564
8600
  ║ Created by Leo (@leeguoo) ║
8565
8601
  ║ 技术支持: 请联系 Leo ║
8566
8602
  ║ 分享服务: curl.bwg.leeguoo.com ║