File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -44,19 +44,14 @@ def ip_analyze(ip: str) -> list[str]:
4444 if not mask .isdigit ():
4545 raise ValueError (f"Invalid subnet mask: { mask } " )
4646 mask = int (mask )
47- if mask < 0 or mask > 32 :
48- raise ValueError (f"Subnet mask out of range: { mask } " )
49- if mask < 16 :
50- raise ValueError (f"Subnet mask too small: { mask } " )
47+ if mask not in range (0 , 32 , 8 ):
48+ raise ValueError (f"Invalid subnet mask: { mask } " )
5149 case _:
5250 raise ValueError (f"Invalid IP address format: { ip } " )
5351 ip_tuple = ip_to_tuple (ip_addr )
5452 ip32 = ip_tuple [0 ] << 24 | ip_tuple [1 ] << 16 | ip_tuple [2 ] << 8 | ip_tuple [3 ]
55- ip32 &= (0xFFFFFFFF >> (32 - mask )) << (32 - mask )
56- return [
57- f"{ (i >> 24 ) & 0xFF } .{ (i >> 16 ) & 0xFF } .{ (i >> 8 ) & 0xFF } .{ i & 0xFF } "
58- for i in range (ip32 + 1 , ip32 | ((1 << (32 - mask )) - 1 ))
59- ]
53+ ip32 |= (1 << (32 - mask )) - 1
54+ return [f"{ (ip32 >> 24 ) & 0xFF } .{ (ip32 >> 16 ) & 0xFF } .{ (ip32 >> 8 ) & 0xFF } .{ ip32 & 0xFF } " ]
6055 if "-" in ip :
6156 ip_range_tuple = ip .split ("." )
6257 if len (ip_range_tuple ) != 4 :
Original file line number Diff line number Diff line change @@ -65,14 +65,19 @@ Attack Action:
6565Github Repositories: https://github.com/weilycoder/Jiyu_udp_attack/tree/main/
6666```
6767
68- 其中目标 ip 的指定使用了 [ ht0Ruial/Jiyu_udp_attack ] ( https://github.com/ht0Ruial/Jiyu_udp_attack/ ) 的创意 ,可以:
68+ 其中目标 ip 的指定 ,可以:
6969
7070+ 指定具体 ip,如 ` 192.168.3.103 ` ;
71- + 指定 ip 范围,如 ` 192.168.3.100-150 ` ;
72- + 指定 ip 段,如 ` 192.168.3.0/24 ` 。
71+ + 指定 ip 范围,如 ` 192.168.3.100-150 ` 。
7372
7473最多指定 65536 个不同 ip。
7574
75+ 但是,更推荐的行为是:
76+
77+ + 指定广播地址,如 ` 192.168.3.255 ` ;
78+ + 指定 ip 段,如 ` 192.168.3.0/24 ` ,这将被转换到广播地址 ` 192.168.3.255 ` ;
79+ + 使用极域的组播地址 ` 224.50.50.42 ` 。
80+
7681## Jiyu API
7782
7883记录抓包得到的极域 udp 包格式。
You can’t perform that action at this time.
0 commit comments