From 7344333fae9454d28673ba2e56d03be1260312b8 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 3 May 2024 09:56:49 +0100 Subject: [PATCH 1/5] Auto build image in GitHub GitHub will now automatically build the image so I've updated the README to use this image rather than build it locally. --- README.md | 9 +++++---- compose.yml | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 compose.yml diff --git a/README.md b/README.md index 1152493..fa09c93 100644 --- a/README.md +++ b/README.md @@ -108,18 +108,19 @@ Usage: cewl [OPTIONS] ... ### Running CeWL in a Docker container To quickly use CeWL on your machine with Docker, you have to build it : -1. Build the container : + +1. Optionally build the image locally so it is ready to use: ```sh - docker build -t cewl . + docker compose build ``` 2. Container usage without interacting with local files : ```sh - docker run -it --rm cewl [OPTIONS] ... + docker run -it --rm ghcr.io/digininja/cewl http://dvwa.test ``` 3. Container usage with local files as input or output : ```sh # you have to mount the current directory when calling the container - docker run -it --rm -v "${PWD}:/host" cewl [OPTIONS] ... + docker run -it --rm -v "${PWD}:/host" ghcr.io/digininja/cewl [OPTIONS] ... ``` I am going to stress here, I am not going to be offering any support for this. The work was done by [@loris-intergalactique](https://github.com/loris-intergalactique) who has offered to field any questions on it and give support. I don't use or know Docker, so please, don't ask me for help. diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..17b2533 --- /dev/null +++ b/compose.yml @@ -0,0 +1,4 @@ +services: + cewl: + build: . + image: ghcr.io/digininja/cewl:latest From 18e890748d3ffa53ab6d0c2cac25bd01821af5fb Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 17 Jun 2024 10:28:06 +0100 Subject: [PATCH 2/5] Really find mailto links --- cewl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cewl.rb b/cewl.rb index 01f408c..18e933a 100755 --- a/cewl.rb +++ b/cewl.rb @@ -169,7 +169,7 @@ def start! #:nodoc: y = [] x.select do |a_url, parsed_url| - if (parsed_url.scheme == "http" or parsed_url.scheme == "https") then + if (parsed_url.scheme == "mailto" or parsed_url.scheme == "http" or parsed_url.scheme == "https") then y << [a_url, parsed_url] if allowable_url?(a_url, parsed_url) end end From ca11c315f2897b8a3b994a8182f40e9c0e1d319a Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 17 Jun 2024 10:38:39 +0100 Subject: [PATCH 3/5] don't check max depth for mailto links --- cewl.rb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/cewl.rb b/cewl.rb index 18e933a..1054abe 100755 --- a/cewl.rb +++ b/cewl.rb @@ -440,7 +440,7 @@ def pop # Push an item onto the tree def push(value) - puts "Pushing #{value}" if @debug + puts "Adding #{value} to the tree" if @debug key = value.keys.first value = value.values_at(key).first @@ -454,10 +454,21 @@ def push(value) @children << child else @children.each { |node| - if node.data.value == key && node.data.depth<@max_depth - child = Tree.new(key, value, node.data.depth + 1, @debug) - @children << child - end + # Ignore the max depth for mailto links. + # This is not a good way to do this, but it will work for now + # and we all know dirty hacks stay around forever so don't + # expect this to be fixed for a while. + if value =~ /^mailto:/ then + if node.data.value == key then + child = Tree.new(key, value, node.data.depth + 1, @debug) + @children << child + end + else + if node.data.value == key && node.data.depth<@max_depth then + child = Tree.new(key, value, node.data.depth + 1, @debug) + @children << child + end + end } end end From ddb7efb6150500be932b7dc9a0b31f42718c08bb Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 17 Jun 2024 10:40:05 +0100 Subject: [PATCH 4/5] updating gems --- Gemfile.lock | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ce9d2b8..8300a55 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,24 +4,26 @@ GEM mime (0.4.4) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0305) + mime-types-data (3.2024.0604) mini_exiftool (2.11.0) - nokogiri (1.16.4-aarch64-linux) + nokogiri (1.16.6-aarch64-linux) racc (~> 1.4) - nokogiri (1.16.4-arm-linux) + nokogiri (1.16.6-arm-linux) racc (~> 1.4) - nokogiri (1.16.4-arm64-darwin) + nokogiri (1.16.6-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86-linux) + nokogiri (1.16.6-x86-linux) racc (~> 1.4) - nokogiri (1.16.4-x86_64-darwin) + nokogiri (1.16.6-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86_64-linux) + nokogiri (1.16.6-x86_64-linux) racc (~> 1.4) - racc (1.7.3) - rexml (3.2.6) + racc (1.8.0) + rexml (3.3.0) + strscan rubyzip (2.3.2) spider (0.5.4) + strscan (3.1.0) PLATFORMS aarch64-linux From 436fd7259516a53b4233b0b82c03a1c06affc488 Mon Sep 17 00:00:00 2001 From: Robin Date: Wed, 19 Jun 2024 15:04:02 +0100 Subject: [PATCH 5/5] create meta file if meta selected --- cewl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cewl.rb b/cewl.rb index 1054abe..fc575fb 100755 --- a/cewl.rb +++ b/cewl.rb @@ -771,7 +771,7 @@ def usage email_outfile_file = outfile_file end -if meta_outfile && email +if meta_outfile && meta begin meta_outfile_file = File.new(meta_outfile, "w") rescue