lljz66 commited on
Commit
5b5da44
·
verified ·
1 Parent(s): f22634e

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +46 -9
server.js CHANGED
@@ -663,55 +663,91 @@ app.get('/api/scan', async (req, res) => {
663
  name: 'screenshot',
664
  fn: () => takeScreenshot(url),
665
  onStart: () => sendEvent('progress', { step: 'screenshot', status: 'started' }),
666
- onDone: (data) => { results.screenshot = data; sendEvent('progress', { step: 'screenshot', status: 'completed' }); }
 
 
 
 
667
  },
668
  {
669
  name: 'hidden_storage',
670
  fn: () => checkHiddenStorage(url),
671
  onStart: () => sendEvent('progress', { step: 'hidden_storage', status: 'started' }),
672
- onDone: (data) => { results.hiddenStorage = data; sendEvent('progress', { step: 'hidden_storage', status: 'completed' }); }
 
 
 
 
673
  },
674
  {
675
  name: 'cookie_consent',
676
  fn: () => analyzeCookieConsent(url),
677
  onStart: () => sendEvent('progress', { step: 'cookie_consent', status: 'started' }),
678
- onDone: (data) => { results.cookieConsent = data; sendEvent('progress', { step: 'cookie_consent', status: 'completed' }); }
 
 
 
 
679
  },
680
  {
681
  name: 'fingerprint_risks',
682
  fn: () => collectFingerprintRisks(url),
683
  onStart: () => sendEvent('progress', { step: 'fingerprint_risks', status: 'started' }),
684
- onDone: (data) => { results.fingerprint = data; sendEvent('progress', { step: 'fingerprint_risks', status: 'completed' }); }
 
 
 
 
685
  },
686
  {
687
  name: 'redirect_chain',
688
  fn: () => trackRedirectChain(url),
689
  onStart: () => sendEvent('progress', { step: 'redirect_chain', status: 'started' }),
690
- onDone: (data) => { results.redirectChain = data; sendEvent('progress', { step: 'redirect_chain', status: 'completed' }); }
 
 
 
 
691
  },
692
  {
693
  name: 'blacklight_scan',
694
  fn: () => performBlacklightScan(url),
695
  onStart: () => sendEvent('progress', { step: 'blacklight_scan', status: 'started' }),
696
- onDone: (data) => { results.blacklight = data; sendEvent('progress', { step: 'blacklight_scan', status: 'completed' }); }
 
 
 
 
697
  },
698
  {
699
  name: 'tosdr',
700
  fn: () => getTosdrGrade(url),
701
  onStart: () => sendEvent('progress', { step: 'tosdr', status: 'started' }),
702
- onDone: (data) => { results.tosdr = data; sendEvent('progress', { step: 'tosdr', status: 'completed' }); }
 
 
 
 
703
  },
704
  {
705
  name: 'security',
706
  fn: () => performSecurityCheck(url),
707
  onStart: () => sendEvent('progress', { step: 'security', status: 'started' }),
708
- onDone: (data) => { results.security = data; sendEvent('progress', { step: 'security', status: 'completed' }); }
 
 
 
 
709
  },
710
  {
711
  name: 'privacy_policy',
712
  fn: () => analyzePrivacyPolicy(url),
713
  onStart: () => sendEvent('progress', { step: 'privacy_policy', status: 'started' }),
714
- onDone: (data) => { results.privacyPolicy = data; sendEvent('progress', { step: 'privacy_policy', status: 'completed' }); }
 
 
 
 
715
  }
716
  ];
717
 
@@ -726,6 +762,7 @@ app.get('/api/scan', async (req, res) => {
726
  console.error(`${tool.name} failed:`, err.message);
727
  tool.onDone(null);
728
  sendEvent('progress', { step: tool.name, status: 'failed', error: err.message });
 
729
  return null;
730
  });
731
  });
 
663
  name: 'screenshot',
664
  fn: () => takeScreenshot(url),
665
  onStart: () => sendEvent('progress', { step: 'screenshot', status: 'started' }),
666
+ onDone: (data) => {
667
+ results.screenshot = data;
668
+ sendEvent('progress', { step: 'screenshot', status: 'completed' });
669
+ sendEvent('step_result', { step: 'screenshot', result: data });
670
+ }
671
  },
672
  {
673
  name: 'hidden_storage',
674
  fn: () => checkHiddenStorage(url),
675
  onStart: () => sendEvent('progress', { step: 'hidden_storage', status: 'started' }),
676
+ onDone: (data) => {
677
+ results.hiddenStorage = data;
678
+ sendEvent('progress', { step: 'hidden_storage', status: 'completed' });
679
+ sendEvent('step_result', { step: 'hidden_storage', result: data });
680
+ }
681
  },
682
  {
683
  name: 'cookie_consent',
684
  fn: () => analyzeCookieConsent(url),
685
  onStart: () => sendEvent('progress', { step: 'cookie_consent', status: 'started' }),
686
+ onDone: (data) => {
687
+ results.cookieConsent = data;
688
+ sendEvent('progress', { step: 'cookie_consent', status: 'completed' });
689
+ sendEvent('step_result', { step: 'cookie_consent', result: data });
690
+ }
691
  },
692
  {
693
  name: 'fingerprint_risks',
694
  fn: () => collectFingerprintRisks(url),
695
  onStart: () => sendEvent('progress', { step: 'fingerprint_risks', status: 'started' }),
696
+ onDone: (data) => {
697
+ results.fingerprint = data;
698
+ sendEvent('progress', { step: 'fingerprint_risks', status: 'completed' });
699
+ sendEvent('step_result', { step: 'fingerprint_risks', result: data });
700
+ }
701
  },
702
  {
703
  name: 'redirect_chain',
704
  fn: () => trackRedirectChain(url),
705
  onStart: () => sendEvent('progress', { step: 'redirect_chain', status: 'started' }),
706
+ onDone: (data) => {
707
+ results.redirectChain = data;
708
+ sendEvent('progress', { step: 'redirect_chain', status: 'completed' });
709
+ sendEvent('step_result', { step: 'redirect_chain', result: data });
710
+ }
711
  },
712
  {
713
  name: 'blacklight_scan',
714
  fn: () => performBlacklightScan(url),
715
  onStart: () => sendEvent('progress', { step: 'blacklight_scan', status: 'started' }),
716
+ onDone: (data) => {
717
+ results.blacklight = data;
718
+ sendEvent('progress', { step: 'blacklight_scan', status: 'completed' });
719
+ sendEvent('step_result', { step: 'blacklight_scan', result: data });
720
+ }
721
  },
722
  {
723
  name: 'tosdr',
724
  fn: () => getTosdrGrade(url),
725
  onStart: () => sendEvent('progress', { step: 'tosdr', status: 'started' }),
726
+ onDone: (data) => {
727
+ results.tosdr = data;
728
+ sendEvent('progress', { step: 'tosdr', status: 'completed' });
729
+ sendEvent('step_result', { step: 'tosdr', result: data });
730
+ }
731
  },
732
  {
733
  name: 'security',
734
  fn: () => performSecurityCheck(url),
735
  onStart: () => sendEvent('progress', { step: 'security', status: 'started' }),
736
+ onDone: (data) => {
737
+ results.security = data;
738
+ sendEvent('progress', { step: 'security', status: 'completed' });
739
+ sendEvent('step_result', { step: 'security', result: data });
740
+ }
741
  },
742
  {
743
  name: 'privacy_policy',
744
  fn: () => analyzePrivacyPolicy(url),
745
  onStart: () => sendEvent('progress', { step: 'privacy_policy', status: 'started' }),
746
+ onDone: (data) => {
747
+ results.privacyPolicy = data;
748
+ sendEvent('progress', { step: 'privacy_policy', status: 'completed' });
749
+ sendEvent('step_result', { step: 'privacy_policy', result: data });
750
+ }
751
  }
752
  ];
753
 
 
762
  console.error(`${tool.name} failed:`, err.message);
763
  tool.onDone(null);
764
  sendEvent('progress', { step: tool.name, status: 'failed', error: err.message });
765
+ sendEvent('step_result', { step: tool.name, error: err.message });
766
  return null;
767
  });
768
  });