diff --git a/cwe.l b/cwe.l new file mode 100644 index 0000000..8383dfd --- /dev/null +++ b/cwe.l @@ -0,0 +1,29 @@ +%{ + +/* cwe by David A. Wheeler (http://www.dwheeler.com). + This prints anything of the form CWE-# +*/ + +#include +#include +#include + +void out(char *text) { + fputs(text,stdout); +} + +void outchar(char c) { + fputc(c, stdout); +} + + +%} + + +%% +CWE-[1-9][0-9]* { out(yytext); outchar('\n'); } +. { } +\n { } + +%% + diff --git a/makefile b/makefile index 9e76193..ac9bb18 100644 --- a/makefile +++ b/makefile @@ -147,6 +147,13 @@ my_install: flawfinder.pdf flawfinder.ps test.c test2.c test-results.txt test-results.html \ /home/dwheeler/dwheeler.com/flawfinder +# This is intended to be a local capability to list CWEs +show-cwes: + flex -o cwe.c cwe.l + gcc -o cwe cwe.c -lfl + ./cwe < flawfinder | sort -u + + .PHONY: install clean test check profile test-is-correct rpm uninstall distribute