From 6de4ee925f8ac66518c9d414a8e3856f23e49481 Mon Sep 17 00:00:00 2001 From: Marcelo Gimenes de Oliveira Date: Fri, 16 Nov 2018 13:56:26 -0200 Subject: [PATCH 1/7] Adding plugin for Slim Framework (PHP) --- plugins/php-slim.rb | 63 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 plugins/php-slim.rb diff --git a/plugins/php-slim.rb b/plugins/php-slim.rb new file mode 100644 index 000000000..375d9eea5 --- /dev/null +++ b/plugins/php-slim.rb @@ -0,0 +1,63 @@ +## +# This file is part of WhatWeb and may be subject to +# redistribution and commercial restrictions. Please see the WhatWeb +# web site for more information on licensing and terms of use. +# http://www.morningstarsecurity.com/research/whatweb +## +# Version 0.1 # 2018-11-16 # Marcelo Gimenes +## +Plugin.define "PHP-Slim" do + author "Marcelo Gimenes " # 2018-11-16 + version "0.1" + description "Slim Framework" + website "https://www.slimframework.com/" + + matches [ + { :status => 404, :text => "The page you are looking for could not be found. Check the address bar" }, + { :status => 404, :text => "to ensure your URL is spelled correctly. If all else fails, you can" }, + { :status => 404, :text => "visit our home page at the link below.", :certainty => 90 }, + { :status => 404, :text => "Visit the Home Page", :certainty => 90 }, + ] + + def random_string(length=32) + # should probably be moved somewhere else to be used in other plugins + (1..length).map{|i| ('a'..'z').to_a[rand(26)]}.join + end + + ## + # get a random page to check for default 404 slim page + ## + def from_404(target, redirections=0) + info = [] + begin + status, url, ip, body, headers = open_target(target) + + if status == 301 && redirections < 3 + info = from_404(headers['location'], redirections+1) + end + if status == 404 + texts = [ + { :text => "The page you are looking for could not be found. Check the address bar" }, + { :text => "to ensure your URL is spelled correctly. If all else fails, you can" }, + { :text => "visit our home page at the link below." }, + { :text => "Visit the Home Page", :certainty => 10 }, + ] + texts.each do |m| + s = body.scan(m[:text]) + unless s.empty? + info << { :certainty => m[:certainty] } + end + end + end + rescue + end + info + end + + def aggressive + target = @base_uri.dup + target.path = "/#{random_string}" + from_404 target.to_s + end +end + From 15f3899536c3cb2dbfde08001897b48285a88f57 Mon Sep 17 00:00:00 2001 From: Marcelo Gimenes de Oliveira Date: Sat, 4 Apr 2020 19:41:44 -0300 Subject: [PATCH 2/7] Changing how the PHP-Slim plugin works --- plugins/php-slim.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/php-slim.rb b/plugins/php-slim.rb index 375d9eea5..090e9361c 100644 --- a/plugins/php-slim.rb +++ b/plugins/php-slim.rb @@ -4,19 +4,21 @@ # web site for more information on licensing and terms of use. # http://www.morningstarsecurity.com/research/whatweb ## -# Version 0.1 # 2018-11-16 # Marcelo Gimenes +# Version 0.1 # 2020-04-04 # Marcelo Gimenes ## Plugin.define "PHP-Slim" do - author "Marcelo Gimenes " # 2018-11-16 + author "Marcelo Gimenes " # 2020-04-04 version "0.1" description "Slim Framework" website "https://www.slimframework.com/" matches [ - { :status => 404, :text => "The page you are looking for could not be found. Check the address bar" }, - { :status => 404, :text => "to ensure your URL is spelled correctly. If all else fails, you can" }, - { :status => 404, :text => "visit our home page at the link below.", :certainty => 90 }, - { :status => 404, :text => "Visit the Home Page", :certainty => 90 }, + { :name => 'Slim < 4.0', + :status => 404, + :text => "to ensure your URL is spelled correctly. If all else fails, you can" }, + { :name => 'Slim > 4.0', + :status => 404, + :text => "The requested resource could not be found. Please verify the URI and try again." } ] def random_string(length=32) @@ -37,10 +39,8 @@ def from_404(target, redirections=0) end if status == 404 texts = [ - { :text => "The page you are looking for could not be found. Check the address bar" }, - { :text => "to ensure your URL is spelled correctly. If all else fails, you can" }, - { :text => "visit our home page at the link below." }, - { :text => "Visit the Home Page", :certainty => 10 }, + { :text => "to ensure your URL is spelled correctly. If all else fails, you can" }, # Slim < 4.0 + { :text => "The requested resource could not be found. Please verify the URI and try again." } # Slim > 4.0 ] texts.each do |m| s = body.scan(m[:text]) From dc3adc9a0a05705d090976c5207f9e3cf53e6b65 Mon Sep 17 00:00:00 2001 From: Marcelo Gimenes de Oliveira Date: Sat, 4 Apr 2020 21:41:43 -0300 Subject: [PATCH 3/7] Updating PHP-Slim plugin --- plugins/php-slim.rb | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/plugins/php-slim.rb b/plugins/php-slim.rb index 090e9361c..d3ebda7a4 100644 --- a/plugins/php-slim.rb +++ b/plugins/php-slim.rb @@ -6,33 +6,32 @@ ## # Version 0.1 # 2020-04-04 # Marcelo Gimenes ## -Plugin.define "PHP-Slim" do - author "Marcelo Gimenes " # 2020-04-04 +Plugin.define do + name "PHP-Slim" + authors [ + "Marcelo Gimenes " + ] version "0.1" description "Slim Framework" website "https://www.slimframework.com/" matches [ { :name => 'Slim < 4.0', - :status => 404, :text => "to ensure your URL is spelled correctly. If all else fails, you can" }, { :name => 'Slim > 4.0', - :status => 404, :text => "The requested resource could not be found. Please verify the URI and try again." } ] - def random_string(length=32) - # should probably be moved somewhere else to be used in other plugins - (1..length).map{|i| ('a'..'z').to_a[rand(26)]}.join - end + aggressive do + random_string = (1..32).map{|i| ('a'..'z').to_a[rand(26)]}.join + + target = @base_uri.dup + target.path = "/#{random_string}" - ## - # get a random page to check for default 404 slim page - ## - def from_404(target, redirections=0) info = [] + redirections = 0 begin - status, url, ip, body, headers = open_target(target) + status, url, ip, body, headers = open_target(target.to_s) if status == 301 && redirections < 3 info = from_404(headers['location'], redirections+1) @@ -53,11 +52,5 @@ def from_404(target, redirections=0) end info end - - def aggressive - target = @base_uri.dup - target.path = "/#{random_string}" - from_404 target.to_s - end end From 3203b983de7bc84c6835b26f01caa34a764d44b1 Mon Sep 17 00:00:00 2001 From: Marcelo Gimenes de Oliveira Date: Sat, 4 Apr 2020 21:49:22 -0300 Subject: [PATCH 4/7] Adding Dockerfile --- Dockerfile | 9 +++++++++ README.md | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..4d3dae7c4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM ruby + +RUN mkdir WhatWeb + +COPY . WhatWeb + +RUN cd WhatWeb && bundle install + +ENTRYPOINT ["WhatWeb/whatweb"] diff --git a/README.md b/README.md index f0794a928..7e28e9938 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,12 @@ $ ./whatweb reddit.com http://reddit.com [301 Moved Permanently] Country[UNITED STATES][US], HTTPServer[snooserv], IP[151.101.65.140], RedirectLocation[https://www.reddit.com/], UncommonHeaders[retry-after,x-served-by,x-cache-hits,x-timer], Via-Proxy[1.1 varnish] https://www.reddit.com/ [200 OK] Cookies[edgebucket,eu_cookie_v2,loid,rabt,rseor3,session_tracker,token], Country[UNITED STATES][US], Email[banner@2x.png,snoo-home@2x.png], Frame, HTML5, HTTPServer[snooserv], HttpOnly[token], IP[151.101.37.140], Open-Graph-Protocol[website], Script[text/javascript], Strict-Transport-Security[max-age=15552000; includeSubDomains; preload], Title[reddit: the front page of the internet], UncommonHeaders[fastly-restarts,x-served-by,x-cache-hits,x-timer], Via-Proxy[1.1 varnish], X-Frame-Options[SAMEORIGIN] ``` +## Docker Usage +``` +docker build . -t whatweb +docker run --rm -it whatweb reddit.com +``` ## Usage ``` From 66a7f10ccd842b0abbf5985ad125476eb6b2fb45 Mon Sep 17 00:00:00 2001 From: Marcelo Gimenes de Oliveira Date: Tue, 21 Apr 2020 06:36:38 -0300 Subject: [PATCH 5/7] Updating PHP-Slim plugin --- plugins/php-slim.rb | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/plugins/php-slim.rb b/plugins/php-slim.rb index d3ebda7a4..09cdbbce3 100644 --- a/plugins/php-slim.rb +++ b/plugins/php-slim.rb @@ -5,52 +5,24 @@ # http://www.morningstarsecurity.com/research/whatweb ## # Version 0.1 # 2020-04-04 # Marcelo Gimenes +# Version 0.2 # 2020-04-21 # Marcelo Gimenes ## Plugin.define do name "PHP-Slim" authors [ "Marcelo Gimenes " ] - version "0.1" + version "0.2" description "Slim Framework" website "https://www.slimframework.com/" matches [ { :name => 'Slim < 4.0', - :text => "to ensure your URL is spelled correctly. If all else fails, you can" }, + :text => "to ensure your URL is spelled correctly. If all else fails, you can", + :url => randstr()}, { :name => 'Slim > 4.0', - :text => "The requested resource could not be found. Please verify the URI and try again." } + :text => "The requested resource could not be found. Please verify the URI and try again.", + :url => randstr()} ] - - aggressive do - random_string = (1..32).map{|i| ('a'..'z').to_a[rand(26)]}.join - - target = @base_uri.dup - target.path = "/#{random_string}" - - info = [] - redirections = 0 - begin - status, url, ip, body, headers = open_target(target.to_s) - - if status == 301 && redirections < 3 - info = from_404(headers['location'], redirections+1) - end - if status == 404 - texts = [ - { :text => "to ensure your URL is spelled correctly. If all else fails, you can" }, # Slim < 4.0 - { :text => "The requested resource could not be found. Please verify the URI and try again." } # Slim > 4.0 - ] - texts.each do |m| - s = body.scan(m[:text]) - unless s.empty? - info << { :certainty => m[:certainty] } - end - end - end - rescue - end - info - end end From e588156ba95225ce56009b41da82ae7777d195d3 Mon Sep 17 00:00:00 2001 From: Andrew Horton Date: Mon, 8 Jun 2020 12:10:50 +0400 Subject: [PATCH 6/7] Delete Dockerfile --- Dockerfile | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4d3dae7c4..000000000 --- a/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ruby - -RUN mkdir WhatWeb - -COPY . WhatWeb - -RUN cd WhatWeb && bundle install - -ENTRYPOINT ["WhatWeb/whatweb"] From c939701c900daa4c471d69549abbc48e7bca3763 Mon Sep 17 00:00:00 2001 From: Marcelo Gimenes de Oliveira Date: Mon, 8 Jun 2020 11:04:30 -0300 Subject: [PATCH 7/7] Delete Dockerfile --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 7e28e9938..cd96dbec7 100644 --- a/README.md +++ b/README.md @@ -66,12 +66,6 @@ $ ./whatweb reddit.com http://reddit.com [301 Moved Permanently] Country[UNITED STATES][US], HTTPServer[snooserv], IP[151.101.65.140], RedirectLocation[https://www.reddit.com/], UncommonHeaders[retry-after,x-served-by,x-cache-hits,x-timer], Via-Proxy[1.1 varnish] https://www.reddit.com/ [200 OK] Cookies[edgebucket,eu_cookie_v2,loid,rabt,rseor3,session_tracker,token], Country[UNITED STATES][US], Email[banner@2x.png,snoo-home@2x.png], Frame, HTML5, HTTPServer[snooserv], HttpOnly[token], IP[151.101.37.140], Open-Graph-Protocol[website], Script[text/javascript], Strict-Transport-Security[max-age=15552000; includeSubDomains; preload], Title[reddit: the front page of the internet], UncommonHeaders[fastly-restarts,x-served-by,x-cache-hits,x-timer], Via-Proxy[1.1 varnish], X-Frame-Options[SAMEORIGIN] ``` -## Docker Usage - -``` -docker build . -t whatweb -docker run --rm -it whatweb reddit.com -``` ## Usage ```