How can I cut off/block all traffic when I lock the screen (and resume when unlocking) in MacOS?
This is almost as fast as having a lock script. Basically, just turn your ethernet interface(s) off/on.


in a terminal run 'sudo -s' 
before locking run 'ifconfig en1 down'
after unlocking run  'ifconfig en1 up'
leave the terminal open but just minimize it for later use


if you don't know which is your active interface, run ifconfig and look for the entry with an IP Address. In the example above, my WiFi interface is en1.
** if you have multiple interfaces just concatenate the command:
'ifconfig en1 down &amp;&amp; ifconfig en2 down' …&amp;etc as needed.