* updated big brother to allow multicast and LAN
parent
2732b2feea
commit
92c4109572
|
@ -33,14 +33,14 @@ def detect_socket_leaks(socket_event):
|
||||||
# validate is valid ip address (no hostname, etc)
|
# validate is valid ip address (no hostname, etc)
|
||||||
# raises NetworkLeak if not
|
# raises NetworkLeak if not
|
||||||
try:
|
try:
|
||||||
ipaddress.ip_address(ip_address)
|
ip_address = ipaddress.ip_address(ip_address)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.warn(f'Conn made to {ip_address} outside of Tor/similar')
|
logger.warn(f'Conn made to {ip_address} outside of Tor/similar')
|
||||||
raise \
|
raise \
|
||||||
NetworkLeak('Conn to host/non local IP, this is a privacy issue!')
|
NetworkLeak('Conn to host/non local IP, this is a privacy issue!')
|
||||||
|
|
||||||
# Validate that the IP is localhost ipv4
|
# Validate that the IP is localhost ipv4
|
||||||
|
if not ip_address.is_loopback and not ip_address.is_multicast \
|
||||||
if not ip_address.startswith('127'):
|
and not ip_address.is_private:
|
||||||
logger.warn(f'Conn made to {ip_address} outside of Tor/similar')
|
logger.warn(f'Conn made to {ip_address} outside of Tor/similar')
|
||||||
raise NetworkLeak('Conn to non local IP, this is a privacy concern!')
|
raise NetworkLeak('Conn to non local IP, this is a privacy concern!')
|
||||||
|
|
|
@ -22,6 +22,12 @@ class TestBigBrother(unittest.TestCase):
|
||||||
bigbrother.enable_ministries()
|
bigbrother.enable_ministries()
|
||||||
with self.assertRaises(onionrexceptions.NetworkLeak):
|
with self.assertRaises(onionrexceptions.NetworkLeak):
|
||||||
requests.get('https://example.com')
|
requests.get('https://example.com')
|
||||||
|
with self.assertRaises(onionrexceptions.NetworkLeak):
|
||||||
|
requests.get('https://1.1.1.1/')
|
||||||
|
try:
|
||||||
|
requests.get('http://192.168.1.1/')
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue