* updated big brother to allow multicast and LAN
This commit is contained in:
		
							parent
							
								
									2732b2feea
								
							
						
					
					
						commit
						92c4109572
					
				
					 2 changed files with 9 additions and 3 deletions
				
			
		|  | @ -33,14 +33,14 @@ def detect_socket_leaks(socket_event): | |||
|     # validate is valid ip address (no hostname, etc) | ||||
|     # raises NetworkLeak if not | ||||
|     try: | ||||
|         ipaddress.ip_address(ip_address) | ||||
|         ip_address = ipaddress.ip_address(ip_address) | ||||
|     except ValueError: | ||||
|         logger.warn(f'Conn made to {ip_address} outside of Tor/similar') | ||||
|         raise \ | ||||
|             NetworkLeak('Conn to host/non local IP, this is a privacy issue!') | ||||
| 
 | ||||
|     # Validate that the IP is localhost ipv4 | ||||
| 
 | ||||
|     if not ip_address.startswith('127'): | ||||
|     if not ip_address.is_loopback and not ip_address.is_multicast \ | ||||
|             and not ip_address.is_private: | ||||
|         logger.warn(f'Conn made to {ip_address} outside of Tor/similar') | ||||
|         raise NetworkLeak('Conn to non local IP, this is a privacy concern!') | ||||
|  |  | |||
|  | @ -22,6 +22,12 @@ class TestBigBrother(unittest.TestCase): | |||
|         bigbrother.enable_ministries() | ||||
|         with self.assertRaises(onionrexceptions.NetworkLeak): | ||||
|             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() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue