[tor-commits] [ooni-probe/master] improve hasRawSocketPermission.

art at torproject.org art at torproject.org
Wed Mar 12 21:49:22 UTC 2014


commit 38f8fd602a5e586ec2346917a770476b6d8c6b5b
Author: aagbsn <aagbsn at extc.org>
Date:   Mon Jan 20 12:21:12 2014 +0000

    improve hasRawSocketPermission.
---
 ooni/utils/txscapy.py |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ooni/utils/txscapy.py b/ooni/utils/txscapy.py
index 66a3f22..f9b7dfd 100644
--- a/ooni/utils/txscapy.py
+++ b/ooni/utils/txscapy.py
@@ -113,11 +113,10 @@ def getDefaultIface():
     raise IfaceError
 
 def hasRawSocketPermission():
-    from scapy.all import IP, send
     try:
-        send(IP(src="1.2.3.4", dst="127.0.0.1"))
+        socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW)
         return True
-    except Exception:
+    except socket.error:
         return False
 
 class ProtocolNotRegistered(Exception):





More information about the tor-commits mailing list