From bb2a2e458b93d862022399a2cbbb082d14d4e1e9 Mon Sep 17 00:00:00 2001 From: Heyder Andrade Date: Tue, 1 Mar 2022 21:31:35 +0100 Subject: [PATCH] shodan_search default user-agent overwirte - fix #16189 and #16223 As the Shodan is checking the UserAgent to decide which content-type it will deliver, the default user-agent is causing it to reply a html page. This commit overwrite the default user-agent the the module shodan_search to 'Wget' that works in on the shodan API. --- modules/auxiliary/gather/shodan_search.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/auxiliary/gather/shodan_search.rb b/modules/auxiliary/gather/shodan_search.rb index bfed82ddbf..ceb05bb8ab 100644 --- a/modules/auxiliary/gather/shodan_search.rb +++ b/modules/auxiliary/gather/shodan_search.rb @@ -41,7 +41,15 @@ class MetasploitModule < Msf::Auxiliary OptInt.new('MAXPAGE', [true, 'Max amount of pages to collect', 1]), OptRegexp.new('REGEX', [true, 'Regex search for a specific IP/City/Country/Hostname', '.*']) - ]) + ] + ) + + # overwriting the default user-agent. Shodan is checking it and delivering a html response when using the default ua (see #16189 and #16223) + register_advanced_options( + [ + OptString.new('UserAgent', [false, 'The User-Agent header to use for all requests', 'Wget/1.21.2 (linux-gnu)' ]) + ] + ) deregister_http_client_options end