httpx icon indicating copy to clipboard operation
httpx copied to clipboard

httpx unable to screenshot webservers on port 7

Open seeyarh opened this issue 3 years ago • 2 comments

httpx version:

main

Current Behavior:

When trying to screenshot a webserver running on port 7, the following error is shown

[WRN] Could not take screenshot 'https://x.x.x.x:7': navigation failed: net::ERR_UNSAFE_PORT

Expected Behavior:

An option is added to allow screenshotting on ports that chromium considers "unsafe."

Steps To Reproduce:

Find a host running http on port 7 using censys https://search.censys.io/search?resource=hosts&sort=RELEVANCE&per_page=25&virtual_hosts=EXCLUDE&q=services%3A%28port+%3D+7+and+service_name+%3D+%22HTTP%22%29 and attempt to scan it.

httpx -screenshot -u http://165.73.242.30:7 -verbose

Anything else:

Here is a link to the chrome source that lists unsafe ports https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/net/base/port_util.cc

seeyarh avatar Sep 01 '23 16:09 seeyarh

Setting the following option when creating the launcher in runner/headless.go seems to fix the issue:

		Set("explicitly-allowed-ports", "1,7,9,11,13,15,17,19,20,21,22,23,25,37,42,43,53,69,77,79,87,95,101,102,103,104,109,110,111,113,115,117,119,123,135,137,139,143,161,179,389,427,465,512,513,514,515,526,530,531,532,540,548,554,556,563,587,601,636,993,995,1719,1720,1723,2049,3659,4045,5060,5061,6000,6566,6665,6666,6667,6668,6669,6697,10080").

seeyarh avatar Sep 01 '23 17:09 seeyarh

Closing as completed as corresponding PR adding the option was merged

Mzack9999 avatar Feb 01 '24 23:02 Mzack9999