jaenster Posted September 24, 2007 Share Posted September 24, 2007 (edited) A udf to calucate the broadcastIP. Msgbox(0,"",_BroadcastIP()&@crlf&"Created by jaenster (Thanks to SmOke_N)") Func _SubnetMask($strIP = @IPAddress1) Local $strEnumKey, $nEnum Local $strKey = "HKLM\SYSTEM\CurrentControlSet\" & _ "Services\Tcpip\Parameters\Interfaces\" While 1 $nEnum += 1 $strEnumKey = RegEnumKey($strKey, $nEnum) If @error <> 0 Then ExitLoop If RegRead($strKey & $strEnumKey, "DhcpIPAddress") = $strIP Then Return RegRead($strKey & $strEnumKey, "DhcpSubnetMask") EndIf WEnd Return SetError(1, 0, 0) EndFunc func _BroadcastIP() $submask = _SubnetMask() $split_sub = stringsplit($submask,".") $split_ip = stringsplit(@IPAddress1,".") $Broadcast = "" for $i = 1 to 4 $Broadcast &= "."&bitOR((255-$split_sub[$i]),$split_ip[$i]) next $Broadcast = stringmid($Broadcast,2) return $Broadcast endfunc - Jaenster Edited September 24, 2007 by jaenster -jaenster Link to comment Share on other sites More sharing options...
jaenster Posted October 4, 2007 Author Share Posted October 4, 2007 77 views no replys :/ -jaenster Link to comment Share on other sites More sharing options...
jvanegmond Posted October 4, 2007 Share Posted October 4, 2007 Very nice! I am actually learning this now for school, I have a test in the way IP's are built up in a few hours. github.com/jvanegmond Link to comment Share on other sites More sharing options...
karman Posted October 4, 2007 Share Posted October 4, 2007 No reply because it sucks. Can you show me when one would need to calculate that address? Waiting.. Link to comment Share on other sites More sharing options...
jvanegmond Posted October 4, 2007 Share Posted October 4, 2007 No reply because it sucks.Can you show me when one would need to calculate that address? Waiting..It is useful for people who manage computer networks.. Like system admins. github.com/jvanegmond Link to comment Share on other sites More sharing options...
JRSmile Posted October 4, 2007 Share Posted October 4, 2007 No reply because it sucks.Can you show me when one would need to calculate that address? Waiting..it sucks in no way,its very usefull if you want to send a broadcastpacket to discover all dhcp servers in a net.Multicast is used to send files to more then one pc at the same time, which needs the broadcast address to be known.so in any way this function does not suck... ( and please be a bit smarter...) $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted October 4, 2007 Moderators Share Posted October 4, 2007 (edited) No reply because it sucks.Can you show me when one would need to calculate that address? Waiting..Are you waiting to be warned? Edited October 4, 2007 by big_daddy Handled matters privately. Link to comment Share on other sites More sharing options...
qwer85 Posted October 4, 2007 Share Posted October 4, 2007 (edited) Having error at line 23: +>16:48:42 Starting AutoIt3Wrapper v.1.9.3 >Running AU3Check (1.54.9.0) from:C:\Program Files\AutoIt3 +>16:48:42 AU3Check ended.rc:0 >Running:(3.2.8.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\User\Рабочий стол\AutoIt v3 Script.au3" C:\Documents and Settings\User\??????? ????\AutoIt v3 Script.au3 (23) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $Broadcast &= "."&bitOR((255-$split_sub[$i]),$split_ip[$i]) $Broadcast &= "."&bitOR((255-^ ERROR Edited October 4, 2007 by qwer85 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now