1

I'm in the process of creating a tool that can block, unblock, and reroute websites by manipulating the hosts file. It works as intended with the exception of the reroute part.

I'm able to get something like this saved in the hosts file:

98.139.183.24 www.facebook.com

(98.139.183.24 being IP for yahoo.com)

By using this batch command:

for /f "tokens=1,2 delims=[]" %%A in ('ping %UserInput2% ^| find "Pinging"') do set ipaddress=%%B echo %ipaddress% %UserInput1% >> %hostspath% echo ipconfig /flushdns

Now the problem is when the browser is restarted, and I browse to facebook.com, it gives back an error in every browser saying: "Unsecured connection" or something similar.

I have tried modifying the hosts entries using http:// https:// etc. to no avail.

I'd appreciate it if someone knew a hosts file entry, or batch file command to prevent this.

0 Answers0