From 109d38f2ea5efa7ffbc7cc07e04f90ecfee2b348 Mon Sep 17 00:00:00 2001 From: epi Date: Fri, 9 Oct 2020 14:17:13 -0500 Subject: [PATCH] trying coveralls coverage reporting --- .coveralls.yml | 1 + .github/workflows/coverage.yml | 5 +++++ src/heuristics.rs | 14 +++++++++++++- src/scanner.rs | 4 +--- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 .coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 0000000..5e6d9d7 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1 @@ +repo_token: XyxRoyl77LZBeMVFP8GiM78qOqtXnQlXb diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3d906e1..a369dad 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -34,3 +34,8 @@ jobs: file: ./coverage.xml name: codecov-umbrella fail_ci_if_error: true + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ./lcov.info diff --git a/src/heuristics.rs b/src/heuristics.rs index 1ab06a0..b146753 100644 --- a/src/heuristics.rs +++ b/src/heuristics.rs @@ -21,7 +21,11 @@ const UUID_LENGTH: u64 = 32; /// configuration and any static wildcard lengths. #[derive(Default, Debug)] pub struct WildcardFilter { + /// size of the response that will later be combined with the length of the path of the url + /// requested pub dynamic: u64, + + /// size of the response that should be included with filters passed via runtime configuration pub size: u64, } @@ -280,9 +284,17 @@ mod tests { #[test] /// request a unique string of 32bytes * a value returns correct result - fn unique_string_returns_correct_length() { + fn heuristics_unique_string_returns_correct_length() { for i in 0..10 { assert_eq!(unique_string(i).len(), i * 32); } } + + #[test] + /// simply test the default values for wildcardfilter, expect 0, 0 + fn heuristics_wildcardfilter_dafaults() { + let wcf = WildcardFilter::default(); + assert_eq!(wcf.size, 0); + assert_eq!(wcf.dynamic, 0); + } } diff --git a/src/scanner.rs b/src/scanner.rs index cbaccbb..8ed7541 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -520,9 +520,7 @@ pub async fn scan_url(target_url: &str, wordlist: Arc>, base_dep ); let filter = match heuristics::wildcard_test(&target_url, wildcard_bar).await { - Some(f) => { - Arc::new(f) - } + Some(f) => Arc::new(f), None => Arc::new(WildcardFilter::default()), };