build-cloudmounter-rules.ts 961 B

123456789101112131415161718192021222324252627282930313233
  1. import { DOMAINS, PROCESS_NAMES } from '../Source/non_ip/cloudmounter';
  2. import { SHARED_DESCRIPTION } from './lib/constants';
  3. import { createRuleset } from './lib/create-file';
  4. import { task } from './trace';
  5. import { output } from './lib/misc';
  6. export const buildCloudMounterRules = task(require.main === module, __filename)(async (span) => {
  7. // AND,((SRC-IP,192.168.1.110), (DOMAIN, example.com))
  8. const results = DOMAINS.flatMap(domain => {
  9. return PROCESS_NAMES.flatMap(process => [
  10. `AND,((${domain}),(PROCESS-NAME,${process}))`,
  11. ...[
  12. '10.0.0.0/8',
  13. '127.0.0.0/8',
  14. '172.16.0.0/12',
  15. '192.168.0.0/16'
  16. ].map(cidr => `AND,((${domain}),(SRC-IP,${cidr}))`)
  17. ]);
  18. });
  19. const description = SHARED_DESCRIPTION;
  20. return createRuleset(
  21. span,
  22. 'Sukka\'s Ruleset - CloudMounter / RaiDrive',
  23. description,
  24. new Date(),
  25. results,
  26. 'ruleset',
  27. output('cloudmounter', 'non_ip')
  28. );
  29. });