@fanboynz/network-scanner 1.0.69 → 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 +1 -1
- package/regex-tool/index.html +117 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fanboynz/network-scanner",
|
|
3
|
-
"version": "1.0.
|
|
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": {
|
package/regex-tool/index.html
CHANGED
|
@@ -291,16 +291,16 @@
|
|
|
291
291
|
<body>
|
|
292
292
|
<div class="container">
|
|
293
293
|
<div class="header">
|
|
294
|
-
<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"
|
|
300
|
-
|
|
299
|
+
<button class="tab active" data-tab="convert">
|
|
300
|
+
?? Convert to JSON
|
|
301
301
|
</button>
|
|
302
|
-
<button class="tab"
|
|
303
|
-
|
|
302
|
+
<button class="tab" data-tab="validate">
|
|
303
|
+
? Validate Regex
|
|
304
304
|
</button>
|
|
305
305
|
</div>
|
|
306
306
|
|
|
@@ -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"
|
|
315
|
+
<button class="button" id="convertBtn">Convert to JSON</button>
|
|
316
316
|
|
|
317
317
|
<div id="convertOutput"></div>
|
|
318
318
|
</div>
|
|
@@ -320,16 +320,16 @@
|
|
|
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"
|
|
324
|
-
<label for="useStandardRegex"><strong
|
|
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">
|
|
328
328
|
<label for="regexToValidate">Enter Regex Pattern:</label>
|
|
329
|
-
<textarea id="regexToValidate" placeholder='
|
|
329
|
+
<textarea id="regexToValidate" placeholder='?? IMPORTANT: Check the box above if entering standard regex! For JSON (box unchecked): {"filterRegex": ["^https?:\\\\/\\\\/.*"]} For Standard (box checked): ^https?:\\/\\/.*'></textarea>
|
|
330
330
|
</div>
|
|
331
331
|
|
|
332
|
-
<button class="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
|
-
|
|
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
|
-
|
|
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
|
|
@@ -606,7 +637,7 @@
|
|
|
606
637
|
try {
|
|
607
638
|
regex.lastIndex = 0;
|
|
608
639
|
return regex.test(ex);
|
|
609
|
-
} catch {
|
|
640
|
+
} catch (e) {
|
|
610
641
|
return false;
|
|
611
642
|
}
|
|
612
643
|
});
|
|
@@ -655,38 +686,100 @@
|
|
|
655
686
|
|
|
656
687
|
outputDiv.innerHTML = `
|
|
657
688
|
<div class="output-section">
|
|
658
|
-
<h3
|
|
689
|
+
<h3>?? JSON Output:</h3>
|
|
659
690
|
<div class="output-box">${JSON.stringify(jsonOutput, null, 2)}</div>
|
|
660
691
|
|
|
661
|
-
<h3
|
|
692
|
+
<h3>? Example Matches:</h3>
|
|
662
693
|
<ul class="examples-list">
|
|
663
694
|
${examples.map(ex => `<li>${escapeHtml(ex)}</li>`).join('')}
|
|
664
695
|
</ul>
|
|
665
696
|
|
|
666
|
-
<div class="success"
|
|
697
|
+
<div class="success">? Regex successfully converted to JSON format!</div>
|
|
667
698
|
</div>
|
|
668
699
|
`;
|
|
669
700
|
} catch (error) {
|
|
670
|
-
outputDiv.innerHTML = `<div class="error"
|
|
701
|
+
outputDiv.innerHTML = `<div class="error">? Invalid regex pattern: ${escapeHtml(error.message)}</div>`;
|
|
671
702
|
}
|
|
672
703
|
}
|
|
673
704
|
|
|
674
|
-
function
|
|
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;
|
|
733
|
+
} else {
|
|
734
|
+
throw new Error('Invalid JSON format. Expected {"filterRegex": ["pattern"]}');
|
|
735
|
+
}
|
|
736
|
+
} else if (regexInput.startsWith('"') && regexInput.endsWith('"')) {
|
|
737
|
+
// Just a quoted string - parse as JSON string
|
|
738
|
+
pattern = JSON.parse(regexInput);
|
|
739
|
+
} else {
|
|
740
|
+
// Raw pattern without quotes or JSON wrapper
|
|
741
|
+
outputDiv.innerHTML = `
|
|
742
|
+
<div class="error">
|
|
743
|
+
? Invalid format for JSON mode.<br><br>
|
|
744
|
+
You can use one of these formats:<br>
|
|
745
|
+
<div class="output-box" style="margin-top: 10px; background: #fef3c7;">
|
|
746
|
+
1. Full JSON: {"filterRegex": ["${escapeHtml(regexInput)}"]}<br><br>
|
|
747
|
+
2. Quoted string: "${escapeHtml(regexInput)}"
|
|
748
|
+
</div>
|
|
749
|
+
<br>
|
|
750
|
+
?? <strong>Tip:</strong> Check the "Use Standard Regex" box above to validate regex patterns directly without quotes.
|
|
751
|
+
</div>
|
|
752
|
+
`;
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
regex = new RegExp(pattern);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// Generate examples
|
|
760
|
+
const examples = generateExamples(regex);
|
|
761
|
+
|
|
762
|
+
outputDiv.innerHTML = `
|
|
763
|
+
<div class="output-section">
|
|
764
|
+
<h3>?? Validation Result:</h3>
|
|
765
|
+
<div class="output-box">
|
|
766
|
+
Pattern: ${escapeHtml(pattern)}<br>
|
|
767
|
+
Type: ${useStandard ? 'Standard Regex' : 'JSON Regex'}
|
|
675
768
|
</div>
|
|
676
769
|
|
|
677
|
-
<h3
|
|
770
|
+
<h3>? Example Matches:</h3>
|
|
678
771
|
<ul class="examples-list">
|
|
679
772
|
${examples.map(ex => `<li>${escapeHtml(ex)}</li>`).join('')}
|
|
680
773
|
</ul>
|
|
681
774
|
|
|
682
|
-
<div class="success"
|
|
775
|
+
<div class="success">? Regex is valid!</div>
|
|
683
776
|
</div>
|
|
684
777
|
`;
|
|
685
778
|
} catch (error) {
|
|
686
779
|
if (error instanceof SyntaxError && !useStandard) {
|
|
687
|
-
outputDiv.innerHTML = `<div class="error"
|
|
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>`;
|
|
688
781
|
} else {
|
|
689
|
-
outputDiv.innerHTML = `<div class="error"
|
|
782
|
+
outputDiv.innerHTML = `<div class="error">? Invalid regex: ${escapeHtml(error.message)}</div>`;
|
|
690
783
|
}
|
|
691
784
|
}
|
|
692
785
|
}
|
|
@@ -696,18 +789,6 @@
|
|
|
696
789
|
div.textContent = text;
|
|
697
790
|
return div.innerHTML;
|
|
698
791
|
}
|
|
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
792
|
</script>
|
|
712
793
|
</body>
|
|
713
|
-
</html>
|
|
794
|
+
</html>
|