|
23 | 23 | - scapy >= 2.6.1 (already a project dependency) |
24 | 24 | """ |
25 | 25 |
|
26 | | -from .mac import NativeMac |
27 | | -from .deauth import ScapyDeauth, ContinuousDeauth as NativeDeauth |
28 | | -from .handshake import ScapyHandshake |
29 | | -from .wps import ScapyWPS, WPSInfo |
30 | | -from .interface import NativeInterface, InterfaceInfo |
31 | | -from .pmkid import ScapyPMKID, PMKIDResult, PMKIDCapture |
32 | | -from .scanner import ChannelHopper, NativeScanner, AccessPoint, Client |
33 | | -from .beacon import BeaconGenerator, create_fake_ap as create_beacon |
| 26 | +try: |
| 27 | + from .mac import NativeMac |
| 28 | +except BaseException: |
| 29 | + NativeMac = None |
| 30 | + |
| 31 | +try: |
| 32 | + from .deauth import ScapyDeauth, ContinuousDeauth as NativeDeauth |
| 33 | +except BaseException: |
| 34 | + ScapyDeauth = None |
| 35 | + NativeDeauth = None |
| 36 | + |
| 37 | +try: |
| 38 | + from .handshake import ScapyHandshake |
| 39 | +except BaseException: |
| 40 | + ScapyHandshake = None |
| 41 | + |
| 42 | +try: |
| 43 | + from .wps import ScapyWPS, WPSInfo |
| 44 | +except BaseException: |
| 45 | + ScapyWPS = None |
| 46 | + WPSInfo = None |
| 47 | + |
| 48 | +try: |
| 49 | + from .interface import NativeInterface, InterfaceInfo |
| 50 | +except BaseException: |
| 51 | + NativeInterface = None |
| 52 | + InterfaceInfo = None |
| 53 | + |
| 54 | +try: |
| 55 | + from .pmkid import ScapyPMKID, PMKIDResult, PMKIDCapture |
| 56 | +except BaseException: |
| 57 | + ScapyPMKID = None |
| 58 | + PMKIDResult = None |
| 59 | + PMKIDCapture = None |
| 60 | + |
| 61 | +try: |
| 62 | + from .scanner import ChannelHopper, NativeScanner, AccessPoint, Client |
| 63 | +except BaseException: |
| 64 | + ChannelHopper = None |
| 65 | + NativeScanner = None |
| 66 | + AccessPoint = None |
| 67 | + Client = None |
| 68 | + |
| 69 | +try: |
| 70 | + from .beacon import BeaconGenerator, create_fake_ap as create_beacon |
| 71 | +except BaseException: |
| 72 | + BeaconGenerator = None |
| 73 | + create_beacon = None |
34 | 74 |
|
35 | 75 | __all__ = [ |
36 | 76 | # MAC manipulation |
@@ -80,49 +120,49 @@ def check_native_availability() -> dict: |
80 | 120 | try: |
81 | 121 | from .mac import NativeMac |
82 | 122 | status['mac'] = True |
83 | | - except ImportError: |
| 123 | + except BaseException: |
84 | 124 | status['mac'] = False |
85 | 125 |
|
86 | 126 | try: |
87 | 127 | from .deauth import SCAPY_AVAILABLE |
88 | 128 | status['deauth'] = SCAPY_AVAILABLE |
89 | | - except ImportError: |
| 129 | + except BaseException: |
90 | 130 | status['deauth'] = False |
91 | 131 |
|
92 | 132 | try: |
93 | 133 | from .handshake import SCAPY_AVAILABLE |
94 | 134 | status['handshake'] = SCAPY_AVAILABLE |
95 | | - except ImportError: |
| 135 | + except BaseException: |
96 | 136 | status['handshake'] = False |
97 | 137 |
|
98 | 138 | try: |
99 | 139 | from .wps import SCAPY_AVAILABLE |
100 | 140 | status['wps'] = SCAPY_AVAILABLE |
101 | | - except ImportError: |
| 141 | + except BaseException: |
102 | 142 | status['wps'] = False |
103 | 143 |
|
104 | 144 | try: |
105 | 145 | from .interface import NativeInterface |
106 | 146 | status['interface'] = True |
107 | | - except ImportError: |
| 147 | + except BaseException: |
108 | 148 | status['interface'] = False |
109 | 149 |
|
110 | 150 | try: |
111 | 151 | from .pmkid import SCAPY_AVAILABLE |
112 | 152 | status['pmkid'] = SCAPY_AVAILABLE |
113 | | - except ImportError: |
| 153 | + except BaseException: |
114 | 154 | status['pmkid'] = False |
115 | 155 |
|
116 | 156 | try: |
117 | 157 | from .scanner import SCAPY_AVAILABLE |
118 | 158 | status['scanner'] = SCAPY_AVAILABLE |
119 | | - except ImportError: |
| 159 | + except BaseException: |
120 | 160 | status['scanner'] = False |
121 | 161 |
|
122 | 162 | try: |
123 | 163 | from .beacon import SCAPY_AVAILABLE |
124 | 164 | status['beacon'] = SCAPY_AVAILABLE |
125 | | - except ImportError: |
| 165 | + except BaseException: |
126 | 166 | status['beacon'] = False |
127 | 167 |
|
128 | 168 | return status |
@@ -156,5 +196,5 @@ def print_native_status(): |
156 | 196 | import scapy |
157 | 197 | scapy_version = scapy.VERSION if hasattr(scapy, 'VERSION') else 'unknown' |
158 | 198 | print(f"\nScapy Version: {scapy_version}") |
159 | | - except ImportError: |
| 199 | + except BaseException: |
160 | 200 | print("\nScapy: Not Installed") |
0 commit comments