Skip to content

Commit

Permalink
Generate linted .ts in package (#49)
Browse files Browse the repository at this point in the history
* Generate linted .ts in package
* (Lin|ni)t changes

Co-authored-by: Justin Ibarra <brokensound77@users.noreply.github.com>
  • Loading branch information
rw-access and brokensound77 authored Jul 9, 2020
1 parent c28795c commit e96eaba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Copyright 2020 Elasticsearch B.V.
This product bundles rules based on https://github.com/BlueTeamLabs/sentinel-attack
which is available under a "MIT" license. The files based on this license are:

- defense_evasion_via_filter_manager.toml
- discovery_process_discovery_via_tasklist_command.toml
- persistence_priv_escalation_via_accessibility_features.toml
- persistence_via_application_shimming.toml
- defense_evasion_execution_via_trusted_developer_utilities.toml
- defense_evasion_via_filter_manager
- discovery_process_discovery_via_tasklist_command
- persistence_priv_escalation_via_accessibility_features
- persistence_via_application_shimming
- defense_evasion_execution_via_trusted_developer_utilities

MIT License

Expand Down
5 changes: 3 additions & 2 deletions detection_rules/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _package_notice_file(save_dir):
notice_txt = f.read()

with open(os.path.join(save_dir, 'notice.ts'), 'wt') as f:
commented_notice = [' * ' + line for line in notice_txt.splitlines()]
commented_notice = [f' * {line}'.rstrip() for line in notice_txt.splitlines()]
lines = ['/* eslint-disable @kbn/eslint/require-license-header */', '', '/* @notice']
lines = lines + commented_notice + [' */', '']
f.write('\n'.join(lines))
Expand All @@ -150,14 +150,15 @@ def _package_index_file(self, save_dir):
const_exports = ['export const rawRules = [']
const_exports.extend(f" rule{i}," for i, _ in enumerate(sorted_rules, 1))
const_exports.append("];")
const_exports.append(" ")
const_exports.append("")

index_ts = [JS_LICENSE, ""]
index_ts.extend(comments)
index_ts.append("")
index_ts.extend(rule_imports)
index_ts.append("")
index_ts.extend(const_exports)

with open(os.path.join(save_dir, 'index.ts'), 'wt') as f:
f.write('\n'.join(index_ts))

Expand Down

0 comments on commit e96eaba

Please sign in to comment.