File tree Expand file tree Collapse file tree 4 files changed +23
-10
lines changed Expand file tree Collapse file tree 4 files changed +23
-10
lines changed Original file line number Diff line number Diff line change 1
1
[build-system ]
2
- requires = [ " setuptools>=62 .0.0" ]
2
+ requires = [ " setuptools>=77 .0.0" ]
3
3
build-backend = " setuptools.build_meta"
4
4
5
5
[project ]
Original file line number Diff line number Diff line change @@ -895,14 +895,14 @@ def arpcachepoison(
895
895
896
896
@conf .commands .register
897
897
def arp_mitm (
898
- ip1 , # type : str
899
- ip2 , # type : str
898
+ ip1 : str ,
899
+ ip2 : str ,
900
900
mac1 = None , # type: Optional[Union[str, List[str]]]
901
901
mac2 = None , # type: Optional[Union[str, List[str]]]
902
- broadcast = False , # type : bool
903
- target_mac = None , # type : Optional[str]
904
- iface = None , # type : Optional[_GlobInterfaceType]
905
- inter = 3 , # type : int
902
+ broadcast : bool = False ,
903
+ target_mac : Optional [str ] = None ,
904
+ iface : Optional [_GlobInterfaceType ] = None ,
905
+ inter : int = 3 ,
906
906
):
907
907
# type: (...) -> None
908
908
r"""ARP MitM: poison 2 target's ARP cache
Original file line number Diff line number Diff line change @@ -1126,7 +1126,7 @@ def __init__(
1126
1126
guest : bool = False ,
1127
1127
kerberos : bool = True ,
1128
1128
kerberos_required : bool = False ,
1129
- HashNt : str = None ,
1129
+ HashNt : bytes = None ,
1130
1130
port : int = 445 ,
1131
1131
timeout : int = 2 ,
1132
1132
debug : int = 0 ,
Original file line number Diff line number Diff line change @@ -3900,13 +3900,26 @@ def AutoArgparse(func: DecoratorCallable) -> None:
3900
3900
continue
3901
3901
parname = param .name
3902
3902
paramkwargs = {}
3903
- if param .annotation is bool :
3903
+ paramtype = param .annotation
3904
+ # Process types we don't know
3905
+ if paramtype not in [bool , str , int , float ]:
3906
+ try :
3907
+ if paramtype .__origin__ is Union :
3908
+ # Handles Optional[] and Union[]
3909
+ paramtype = next (
3910
+ x for x in paramtype .__args__
3911
+ if x in [bool , str , int , float ]
3912
+ )
3913
+ except Exception :
3914
+ pass
3915
+ # Process the types we know
3916
+ if paramtype is bool :
3904
3917
if param .default is True :
3905
3918
parname = "no-" + parname
3906
3919
paramkwargs ["action" ] = "store_false"
3907
3920
else :
3908
3921
paramkwargs ["action" ] = "store_true"
3909
- elif param . annotation in [str , int , float ]:
3922
+ elif paramtype in [str , int , float ]:
3910
3923
paramkwargs ["type" ] = param .annotation
3911
3924
else :
3912
3925
continue
You can’t perform that action at this time.
0 commit comments