求子网地址到广播地址的范围IP列表算法
$OBJWMISERVICE = OBJGET("WINMGMTS:\\LOCALHOST\ROOT\CIMV2")$COLITEMS = $OBJWMISERVICE.EXECQUERY("SELECT * FROM WIN32_NETWORKADAPTERCONFIGURATION WHERE
IPENABLED != 0", "WQL", 0X10 + 0X20)
IF ISOBJ($COLITEMS) THEN
FOR $OBJITEM IN $COLITEMS
DIM $BROADCASTINGADDRESS="",$SUBNETADDRESS=""
$IPSPLIT=STRINGSPLIT($OBJITEM.IPADDRESS(0),".")
$SUBNETSPLIT=STRINGSPLIT($OBJITEM.IPSUBNET(0),".")
NEXT
ENDIF
FOR $I=1 TO $IPSPLIT
IF $I=$IPSPLIT THEN
$BROADCASTINGADDRESS=$BROADCASTINGADDRESS&BITOR($IPSPLIT[$I],BITXOR($SUBNETSPLIT[$I],255))
$SUBNETADDRESS=$SUBNETADDRESS&BITAND($IPSPLIT[$I],$SUBNETSPLIT[$I])
ELSE
$BROADCASTINGADDRESS=$BROADCASTINGADDRESS&BITOR($IPSPLIT[$I],BITXOR($SUBNETSPLIT[$I],255))
&"."
$SUBNETADDRESS=$SUBNETADDRESS&BITAND($IPSPLIT[$I],$SUBNETSPLIT[$I])&"."
ENDIF
NEXT
$SUBNETADDRESS 是子网地址
$BROADCASTINGADDRESS 是广播地址
求解!! 一看到算法我就想起破帽和另外一个牛B坛友
忘记名字了
确实厉害
页:
[1]