Modify Python script to block specified websites (Mac OS)

I need to modify Python script to redirect traffic for specified websites to the localhost address if we are not connected via a specified Public IP address. I'm going to launch this script on Mac OS (Big Sur or Catalina) and other Unix-based systems. It works well by I have two problems:

1) I need to modify /etc/hosts file. For example, when my script is run already and I'm going to visit a restricted website it's for an untrusted network - it's writing this domain name to /etc/hosts file with address [login to view URL], but when I'm switching my Public IP address to correct one - it's still doesn't work cause previous entry. So switching for the correct IP address should be fixed.

2) To write some kind of banner to remind the user to switch Public IP address to correct one when he is trying to connect in the wrong way.

Also I have working (almost) version of script for Ubuntu, but it doesn't work properly on Mac OS.

Навыки: Python, Bash Scripting, Mac OS

Показать больше: python script modify file content, python script modify html, python script modify program header, python script modify file data, modify python feedback script, python modify date script, modify file python script, mac os automator modify action, mac os client watch network traffic linux, mac os process activity network, modify python script, python script crawl websites, python script modify csv file, write script block websites, python script sync mac address book, python script scrape websites, modify python script while running, how to modify python script, python script to block websites

О работодателе:
( 1 отзыв ) Kyiv, Ukraine

ID проекта: #28313884

3 фрилансеров(-а) готовы выполнить эту работу в среднем за $193


Hi there, I have good experience in python and also have work experience with MacOS too. Message me and lets take this forward. Thanks

$200 USD за 1 день
(15 отзывов(-а))

Hi there, I'm Matt Sergei (you can call me as you wish) and can help you - yet I need to see your script first. I use MacBook Pro almost exclusively for last 10 years so will enhance the script on Mac and it will wo Больше

$190 USD за 3 дней(-я)
(4 отзывов(-а))

Hi, my name is Omar I am beginner in freelancing but I have 3 years of python experience and I have a java , JavaScript, html, c# and mac experience I can make your project in 1 day or less, I can start anytime you wan Больше

$190 USD за 1 день
(0 отзывов(-а))