Commit Graph

79 Commits

Author SHA1 Message Date
Ana María Martínez Gómez
f9abbbe9ba hooks: change from post- to pre-commit
Avoid erroneous commits. The pre-commit can be skipped with the
`--no-verify` option, which is not available with the post-commit.
Note that `pre-commit` doesn't run when rebase while post-commit did.

This allows to have a single script which is run by both hooks. This
scripts can also be used independently to run the CI setup locally.
2020-07-29 20:25:03 +02:00
Ana María Martínez Gómez
8ff9e339f5 hooks: improve comment in setup-hooks.sh
Previously the `setup-hooks.sh` took care of more things. Consequently
the comments needed to be separated. This is not needed anymore and it
looks weird.
2020-07-29 20:16:58 +02:00
Ana María Martínez Gómez
6d00ae26ae hooks: do not repeat #!/usr/bin/env bash
The comment claims that:
> doesn't matter if `#!/usr/bin/env bash` gets repeated later on in a hooks file

However it is a convetion that there is only one comment like that and
the `setup-hooks.sh` script already takes care of adding it if the file
didn't exist.

Alternatively, we could leave the extra comment and remove the related
code in `setup-hooks.sh`. Currently two comments are added even if the
file didn't exist.
2020-07-29 20:16:56 +02:00
Ana María Martínez Gómez
22fd52ccb9 hooks: do not render git stash output
The `-q` options hides most of the output, but not everything.
2020-07-29 20:16:55 +02:00
Ana María Martínez Gómez
70dda980e8 hooks: update style checkers in hooks
Run `isort` and `black` in the hooks. Run them with the `--check` option
to not modify files which could be committed by accident.

Note that the changes in `.gitignore` are not needed as `.log` is
already excluded in the Django's section. We add those file to this
section in case `.log` is removed in the future.
2020-07-29 20:16:52 +02:00
William Ballenthin
b6c9540469 pep8 2020-07-25 10:29:21 -06:00
William Ballenthin
605ee00f0a scripts: bn: remove extra character 2020-07-25 10:28:11 -06:00
William Ballenthin
bf4d12e5b6 Merge branch 'master' into fix-197 2020-07-25 10:24:25 -06:00
Willi Ballenthin
14463de5e7 Merge pull request #207 from psifertex/master
adding BN script
2020-07-27 09:19:31 -06:00
Jordan Wiens
f547ca0fae updates for pull 205 2020-07-25 22:45:51 -04:00
Jordan Wiens
82b9514230 initial commit of BinaryNinja import script 2020-07-25 17:45:25 -04:00
William Ballenthin
308c78844d show-features: fix error when piping features to less 2020-07-25 00:59:32 -06:00
William Ballenthin
c91f9a375e ida: parse offsets as signed numbers
closes #197
2020-07-25 00:58:44 -06:00
William Ballenthin
e822a8a4d5 linter: warn on nursery rules with no changes needed 2020-07-23 17:31:27 -06:00
William Ballenthin
5197de3dbd lint: better handle rules with no examples
closes #188
2020-07-23 12:09:02 -06:00
William Ballenthin
dc6b61adf3 lint: fix recommendations via templating
closes #189
2020-07-23 11:53:56 -06:00
William Ballenthin
3f55864ce0 lint: ignore period in rule name
closes #190
2020-07-23 11:42:07 -06:00
William Ballenthin
baeea5b6ec *: update license header to reference Apache 2.0
closes #173
2020-07-22 15:05:24 -06:00
Ana María Martínez Gómez
ab1dc3b804 Fix rule linter
Prevent the linter to raise an exception if `examples` is `None`, as it
for example currently happens in:
`capa-rules/nursery/hash-data-using-murmur2.yml`

We could also remove the `examples` tag in those cases, but the linter
shouldn't break in any case.
2020-07-17 14:01:07 +02:00
Ana María Martínez Gómez
07764fb31f Use isort 5
Run `isort --profile black --length-sort --line-width 120 .`

Update documentation as well.
2020-07-16 22:02:53 +02:00
William Ballenthin
3faf175da7 *: add license header
closes #144
2020-07-15 14:14:53 -06:00
Willi Ballenthin
54cd456174 Merge pull request #143 from fireeye/remove-scripts-testbed
remove testbed scripts
2020-07-14 15:08:32 -06:00
Moritz Raabe
96feab7b4d remove testbed scripts 2020-07-14 23:06:32 +02:00
William Ballenthin
028b0c3734 pep8 2020-07-14 08:42:54 -06:00
Moritz Raabe
22c3475714 main: output updates 2020-07-09 22:42:34 +02:00
Willi Ballenthin
2c69f275a9 Merge pull request #124 from fireeye/ida-import
add import to IDA script
2020-07-07 19:59:17 -06:00
Moritz
8c7ed4f50c Merge pull request #126 from fireeye/fix-testbed
Fix testbed
2020-07-07 23:18:49 +02:00
William Ballenthin
e0ad071dd4 testbed: fix imports now that its standalone scripts
closes #125
2020-07-07 13:39:50 -06:00
William Ballenthin
780b145b59 pep8 2020-07-07 13:39:15 -06:00
William Ballenthin
4fa5bf1d93 pep8 2020-07-07 13:16:25 -06:00
William Ballenthin
a9b447dcbe add script import-to-ida.py
closes #120
2020-07-07 13:16:08 -06:00
William Ballenthin
56b9462d01 git hooks: fix references to tox config 2020-07-07 12:30:54 -06:00
William Ballenthin
091f1d0c41 render: show rules path
closes #111
2020-07-06 17:08:55 -06:00
William Ballenthin
ecba9986fc pep8 2020-07-06 14:07:02 -06:00
William Ballenthin
484179c042 render: move capabilities by function to its own standalone script 2020-07-06 14:06:06 -06:00
William Ballenthin
845938d4e6 scripts: show-features: add doc 2020-07-06 13:48:30 -06:00
William Ballenthin
9fe70dd19c Merge branch 'master' into output-feature-count 2020-07-03 20:49:39 -06:00
Moritz Raabe
9e0d2ffd7b account for Windows paths 2020-07-06 13:00:28 +02:00
William Ballenthin
867de57062 main: find_capabilities: extract feature counts per item, too
closes #95
closes #96
2020-07-03 10:12:03 -06:00
William Ballenthin
612eefe2e8 dos2unix 2020-07-02 11:08:21 -06:00
William Ballenthin
1188103d1c pep8: isort 2020-07-02 10:52:05 -06:00
William Ballenthin
c185e9ef09 pep8: black 2020-07-02 10:32:26 -06:00
William Ballenthin
db2b1caeae Merge branch 'master' into fmt-black 2020-07-02 10:25:24 -06:00
Ana María Martínez Gómez
a80f38ec75 Fix get_features rule linter
To support matching namespaces `get_features()` get an extra parameters
which was missing in the rule linter.
2020-07-02 09:24:51 +02:00
William Ballenthin
23e70b4e85 pep8: scripts 2020-07-01 12:42:33 -06:00
Ana María Martínez Gómez
24792cd160 Fix unrestored stashed changes in post-commit hook
If the style checker of the rule linter failed, the stashed changes were
not restored. There is no reason to exist with an error code in a post
hook. In pre hooks this causes the action to be aborted.
2020-07-01 13:59:06 +02:00
Moritz Raabe
cd77aa23db Merge branch 'master' into linter-lib-checks 2020-07-01 09:27:56 +02:00
Moritz Raabe
5cee0d9b80 add lint negative numbers and cleanup tests 2020-06-30 22:17:42 +02:00
William Ballenthin
325aa9574f linter: check that lib rules don't have a namespace
closes #35
2020-06-29 06:16:19 -06:00
William Ballenthin
7a5d2d025f linter: check that lib rules are in lib directory
closes #36
2020-06-29 06:09:18 -06:00