@fanboynz/network-scanner 1.0.70 → 1.0.71

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanboynz/network-scanner",
3
- "version": "1.0.70",
3
+ "version": "1.0.71",
4
4
  "description": "A Puppeteer-based network scanner for analyzing web traffic, generating adblock filter rules, and identifying third-party requests. Features include fingerprint spoofing, Cloudflare bypass, content analysis with curl/grep, and multiple output formats.",
5
5
  "main": "nwss.js",
6
6
  "scripts": {
@@ -291,16 +291,16 @@
291
291
  <body>
292
292
  <div class="container">
293
293
  <div class="header">
294
- <h1>🔄 Regex Tools</h1>
294
+ <h1>?? Regex Tools</h1>
295
295
  <p>Convert and Validate Regular Expressions with Ease</p>
296
296
  </div>
297
297
 
298
298
  <div class="tabs">
299
299
  <button class="tab active" data-tab="convert">
300
- 🔄 Convert to JSON
300
+ ?? Convert to JSON
301
301
  </button>
302
302
  <button class="tab" data-tab="validate">
303
- Validate Regex
303
+ ? Validate Regex
304
304
  </button>
305
305
  </div>
306
306
 
@@ -321,12 +321,12 @@
321
321
  <div id="validate" class="tab-content">
322
322
  <div class="checkbox-group" style="background: #f0f9ff; padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 2px solid #0ea5e9;">
323
323
  <input type="checkbox" id="useStandardRegex">
324
- <label for="useStandardRegex"><strong>📝 Check this box to validate Standard Regex</strong> (uncheck for JSON format)</label>
324
+ <label for="useStandardRegex"><strong>?? Check this box to validate Standard Regex</strong> (uncheck for JSON format)</label>
325
325
  </div>
326
326
 
327
327
  <div class="input-group">
328
328
  <label for="regexToValidate">Enter Regex Pattern:</label>
329
- <textarea id="regexToValidate" placeholder='⚠️ IMPORTANT: Check the box above if entering standard regex!&#10;&#10;For JSON (box unchecked): {"filterRegex": ["^https?:\\\\/\\\\/.*"]}&#10;For Standard (box checked): ^https?:\\/\\/.*'></textarea>
329
+ <textarea id="regexToValidate" placeholder='?? IMPORTANT: Check the box above if entering standard regex!&#10;&#10;For JSON (box unchecked): {"filterRegex": ["^https?:\\\\/\\\\/.*"]}&#10;For Standard (box checked): ^https?:\\/\\/.*'></textarea>
330
330
  </div>
331
331
 
332
332
  <button class="button" id="validateBtn">Validate Regex</button>
@@ -637,7 +637,7 @@
637
637
  try {
638
638
  regex.lastIndex = 0;
639
639
  return regex.test(ex);
640
- } catch {
640
+ } catch (e) {
641
641
  return false;
642
642
  }
643
643
  });
@@ -680,7 +680,56 @@
680
680
  const jsonOutput = {
681
681
  filterRegex: [cleanPattern]
682
682
  };
683
- rn = jsonRegex.pattern;
683
+
684
+ // Generate examples
685
+ const examples = generateExamples(testRegex);
686
+
687
+ outputDiv.innerHTML = `
688
+ <div class="output-section">
689
+ <h3>?? JSON Output:</h3>
690
+ <div class="output-box">${JSON.stringify(jsonOutput, null, 2)}</div>
691
+
692
+ <h3>? Example Matches:</h3>
693
+ <ul class="examples-list">
694
+ ${examples.map(ex => `<li>${escapeHtml(ex)}</li>`).join('')}
695
+ </ul>
696
+
697
+ <div class="success">? Regex successfully converted to JSON format!</div>
698
+ </div>
699
+ `;
700
+ } catch (error) {
701
+ outputDiv.innerHTML = `<div class="error">? Invalid regex pattern: ${escapeHtml(error.message)}</div>`;
702
+ }
703
+ }
704
+
705
+ function validateRegex() {
706
+ const useStandard = document.getElementById('useStandardRegex').checked;
707
+ const regexInput = document.getElementById('regexToValidate').value.trim();
708
+ const outputDiv = document.getElementById('validateOutput');
709
+
710
+ if (!regexInput) {
711
+ outputDiv.innerHTML = '<div class="error">Please enter a regex pattern to validate</div>';
712
+ return;
713
+ }
714
+
715
+ try {
716
+ let regex;
717
+ let pattern;
718
+
719
+ if (useStandard) {
720
+ // Use standard regex directly
721
+ pattern = regexInput;
722
+ regex = new RegExp(pattern);
723
+ } else {
724
+ // JSON mode - handle multiple formats
725
+ if (regexInput.startsWith('{')) {
726
+ // Full JSON format
727
+ const jsonRegex = JSON.parse(regexInput);
728
+
729
+ if (jsonRegex.filterRegex && Array.isArray(jsonRegex.filterRegex)) {
730
+ pattern = jsonRegex.filterRegex[0];
731
+ } else if (jsonRegex.pattern) {
732
+ pattern = jsonRegex.pattern;
684
733
  } else {
685
734
  throw new Error('Invalid JSON format. Expected {"filterRegex": ["pattern"]}');
686
735
  }
@@ -691,14 +740,14 @@
691
740
  // Raw pattern without quotes or JSON wrapper
692
741
  outputDiv.innerHTML = `
693
742
  <div class="error">
694
- Invalid format for JSON mode.<br><br>
743
+ ? Invalid format for JSON mode.<br><br>
695
744
  You can use one of these formats:<br>
696
745
  <div class="output-box" style="margin-top: 10px; background: #fef3c7;">
697
746
  1. Full JSON: {"filterRegex": ["${escapeHtml(regexInput)}"]}<br><br>
698
747
  2. Quoted string: "${escapeHtml(regexInput)}"
699
748
  </div>
700
749
  <br>
701
- 💡 <strong>Tip:</strong> Check the "Use Standard Regex" box above to validate regex patterns directly without quotes.
750
+ ?? <strong>Tip:</strong> Check the "Use Standard Regex" box above to validate regex patterns directly without quotes.
702
751
  </div>
703
752
  `;
704
753
  return;
@@ -712,25 +761,25 @@
712
761
 
713
762
  outputDiv.innerHTML = `
714
763
  <div class="output-section">
715
- <h3>🔍 Validation Result:</h3>
764
+ <h3>?? Validation Result:</h3>
716
765
  <div class="output-box">
717
766
  Pattern: ${escapeHtml(pattern)}<br>
718
767
  Type: ${useStandard ? 'Standard Regex' : 'JSON Regex'}
719
768
  </div>
720
769
 
721
- <h3>✅ Example Matches:</h3>
770
+ <h3>? Example Matches:</h3>
722
771
  <ul class="examples-list">
723
772
  ${examples.map(ex => `<li>${escapeHtml(ex)}</li>`).join('')}
724
773
  </ul>
725
774
 
726
- <div class="success">✅ Regex is valid!</div>
775
+ <div class="success">? Regex is valid!</div>
727
776
  </div>
728
777
  `;
729
778
  } catch (error) {
730
779
  if (error instanceof SyntaxError && !useStandard) {
731
- outputDiv.innerHTML = `<div class="error">❌ Invalid JSON syntax: ${escapeHtml(error.message)}<br><br>Expected format: {"filterRegex": ["your-regex-pattern"]} or "your-regex-pattern"</div>`;
780
+ outputDiv.innerHTML = `<div class="error">? Invalid JSON syntax: ${escapeHtml(error.message)}<br><br>Expected format: {"filterRegex": ["your-regex-pattern"]} or "your-regex-pattern"</div>`;
732
781
  } else {
733
- outputDiv.innerHTML = `<div class="error">❌ Invalid regex: ${escapeHtml(error.message)}</div>`;
782
+ outputDiv.innerHTML = `<div class="error">? Invalid regex: ${escapeHtml(error.message)}</div>`;
734
783
  }
735
784
  }
736
785
  }
@@ -742,4 +791,4 @@
742
791
  }
743
792
  </script>
744
793
  </body>
745
- </html>
794
+ </html>