Sign in to follow this  
Followers 0
jaenster

_broadcastIP Udf

8 posts in this topic

#1 ·  Posted (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 by jaenster

-jaenster

Share this post


Link to post
Share on other sites



77 views no replys :/


-jaenster

Share this post


Link to post
Share on other sites

No reply because it sucks.

Can you show me when one would need to calculate that address? Waiting..

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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:-)

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by big_daddy
Handled matters privately.

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by qwer85

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0