@fanboynz/network-scanner 1.0.69 → 1.0.70

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.69",
3
+ "version": "1.0.70",
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,15 +291,15 @@
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
- <button class="tab active" onclick="switchTab('convert')">
300
- 📝 Convert to JSON
299
+ <button class="tab active" data-tab="convert">
300
+ 🔄 Convert to JSON
301
301
  </button>
302
- <button class="tab" onclick="switchTab('validate')">
302
+ <button class="tab" data-tab="validate">
303
303
  ✅ Validate Regex
304
304
  </button>
305
305
  </div>
@@ -312,7 +312,7 @@
312
312
  <input type="text" id="standardRegex" placeholder="e.g., ^https?://.*\.example\.com/.*$">
313
313
  </div>
314
314
 
315
- <button class="button" onclick="convertToJSON()">Convert to JSON</button>
315
+ <button class="button" id="convertBtn">Convert to JSON</button>
316
316
 
317
317
  <div id="convertOutput"></div>
318
318
  </div>
@@ -320,8 +320,8 @@
320
320
  <!-- Validate Tab -->
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
- <input type="checkbox" id="useStandardRegex" onchange="toggleRegexInput()">
324
- <label for="useStandardRegex"><strong>✓ Check this box to validate Standard Regex</strong> (uncheck for JSON format)</label>
323
+ <input type="checkbox" id="useStandardRegex">
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">
@@ -329,7 +329,7 @@
329
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
- <button class="button" onclick="validateRegex()">Validate Regex</button>
332
+ <button class="button" id="validateBtn">Validate Regex</button>
333
333
 
334
334
  <div id="validateOutput"></div>
335
335
  </div>
@@ -337,12 +337,41 @@
337
337
  </div>
338
338
 
339
339
  <script>
340
- function switchTab(tabName) {
340
+ // Use DOMContentLoaded to ensure all elements are loaded
341
+ document.addEventListener('DOMContentLoaded', function() {
342
+ // Tab switching with event delegation
343
+ const tabs = document.querySelectorAll('.tab');
344
+ tabs.forEach(tab => {
345
+ tab.addEventListener('click', function() {
346
+ const tabName = this.getAttribute('data-tab');
347
+ switchTab(tabName, this);
348
+ });
349
+ });
350
+
351
+ // Button event listeners
352
+ document.getElementById('convertBtn').addEventListener('click', convertToJSON);
353
+ document.getElementById('validateBtn').addEventListener('click', validateRegex);
354
+ document.getElementById('useStandardRegex').addEventListener('change', toggleRegexInput);
355
+
356
+ // Enter key support
357
+ document.getElementById('standardRegex').addEventListener('keypress', function(e) {
358
+ if (e.key === 'Enter') convertToJSON();
359
+ });
360
+
361
+ document.getElementById('regexToValidate').addEventListener('keypress', function(e) {
362
+ if (e.key === 'Enter' && !e.shiftKey) {
363
+ e.preventDefault();
364
+ validateRegex();
365
+ }
366
+ });
367
+ });
368
+
369
+ function switchTab(tabName, clickedTab) {
341
370
  // Update tabs
342
371
  document.querySelectorAll('.tab').forEach(tab => {
343
372
  tab.classList.remove('active');
344
373
  });
345
- event.target.classList.add('active');
374
+ clickedTab.classList.add('active');
346
375
 
347
376
  // Update content
348
377
  document.querySelectorAll('.tab-content').forEach(content => {
@@ -578,7 +607,9 @@
578
607
  'HelloWorld',
579
608
  'user_name_123',
580
609
  'CamelCaseExample',
581
- );
610
+ 'snake_case_text',
611
+ 'MixedContent2024'
612
+ );
582
613
  }
583
614
  } else {
584
615
  // Check for any length requirements in the pattern
@@ -649,32 +680,45 @@
649
680
  const jsonOutput = {
650
681
  filterRegex: [cleanPattern]
651
682
  };
683
+ rn = jsonRegex.pattern;
684
+ } else {
685
+ throw new Error('Invalid JSON format. Expected {"filterRegex": ["pattern"]}');
686
+ }
687
+ } else if (regexInput.startsWith('"') && regexInput.endsWith('"')) {
688
+ // Just a quoted string - parse as JSON string
689
+ pattern = JSON.parse(regexInput);
690
+ } else {
691
+ // Raw pattern without quotes or JSON wrapper
692
+ outputDiv.innerHTML = `
693
+ <div class="error">
694
+ ❌ Invalid format for JSON mode.<br><br>
695
+ You can use one of these formats:<br>
696
+ <div class="output-box" style="margin-top: 10px; background: #fef3c7;">
697
+ 1. Full JSON: {"filterRegex": ["${escapeHtml(regexInput)}"]}<br><br>
698
+ 2. Quoted string: "${escapeHtml(regexInput)}"
699
+ </div>
700
+ <br>
701
+ 💡 <strong>Tip:</strong> Check the "Use Standard Regex" box above to validate regex patterns directly without quotes.
702
+ </div>
703
+ `;
704
+ return;
705
+ }
706
+
707
+ regex = new RegExp(pattern);
708
+ }
652
709
 
653
710
  // Generate examples
654
- const examples = generateExamples(testRegex);
711
+ const examples = generateExamples(regex);
655
712
 
656
713
  outputDiv.innerHTML = `
657
714
  <div class="output-section">
658
- <h3>📋 JSON Output:</h3>
659
- <div class="output-box">${JSON.stringify(jsonOutput, null, 2)}</div>
660
-
661
- <h3>✨ Example Matches:</h3>
662
- <ul class="examples-list">
663
- ${examples.map(ex => `<li>${escapeHtml(ex)}</li>`).join('')}
664
- </ul>
665
-
666
- <div class="success">✅ Regex successfully converted to JSON format!</div>
667
- </div>
668
- `;
669
- } catch (error) {
670
- outputDiv.innerHTML = `<div class="error">❌ Invalid regex pattern: ${escapeHtml(error.message)}</div>`;
671
- }
672
- }
673
-
674
- function validatandard ? 'Standard Regex' : 'JSON Regex'}
715
+ <h3>🔍 Validation Result:</h3>
716
+ <div class="output-box">
717
+ Pattern: ${escapeHtml(pattern)}<br>
718
+ Type: ${useStandard ? 'Standard Regex' : 'JSON Regex'}
675
719
  </div>
676
720
 
677
- <h3>✨ Example Matches:</h3>
721
+ <h3>✅ Example Matches:</h3>
678
722
  <ul class="examples-list">
679
723
  ${examples.map(ex => `<li>${escapeHtml(ex)}</li>`).join('')}
680
724
  </ul>
@@ -696,18 +740,6 @@
696
740
  div.textContent = text;
697
741
  return div.innerHTML;
698
742
  }
699
-
700
- // Add enter key support
701
- document.getElementById('standardRegex').addEventListener('keypress', function(e) {
702
- if (e.key === 'Enter') convertToJSON();
703
- });
704
-
705
- document.getElementById('regexToValidate').addEventListener('keypress', function(e) {
706
- if (e.key === 'Enter' && !e.shiftKey) {
707
- e.preventDefault();
708
- validateRegex();
709
- }
710
- });
711
743
  </script>
712
744
  </body>
713
745
  </html>