#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    1
    Rep Power
    0

    Smile getting ip address from mac address


    Hi dear, can you explain to me in detail how to determine ip address from mac address?
    Thanks
    Chibuzo
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Boston MA
    Posts
    71
    Rep Power
    12
    @echo off
    :Start
    IF "%4"=="" GOTO Help
    SET thirdOctet=%1
    SET thirdlimit=%2
    SET fourthOctet=%3
    SET fourthlimit=%4
    IF "%5"=="" SET net1=131
    SET net1=%5
    IF "%6"=="" SET net2=162
    SET net2=%6
    IF "%7"=="" SET timeOut=100
    SET timeOut=%7
    GOTO IP

    :IP
    IF %fourthOctet% GEQ %fourthlimit% GOTO PART2
    SET ipadd=%net1%.%net2%.%thirdoctet%.%fourthOctet%
    ECHO Processing %ipadd%
    GOTO PART1

    :PART1
    ping -n 1 %ipadd% -w %timeOut% > junk.del
    GOTO Update

    :Update
    SET /A fourthOctet=%fourthOctet%+1
    GOTO IP

    :PART2
    IF %thirdOctet% GEQ %thirdlimit% GOTO END
    SET fourthOctet=1
    SET /A thirdOctet=%thirdOctet%+1
    SET ipadd=%net1%.%net2%.%thirdOctet%.%fourthOctet%
    ECHO Processing %ipadd%
    GOTO PART1

    :Help
    ECHO Usage :
    ECHO C_ARP 3rd_octet 3rd_limit 4th_octet 4th_limit [Optional 1st_octet] [Optional 2nd_octet] [Optional Timeout]
    ----------------
    ECHO Example Usage 1 :
    ECHO C_ARP 145 147 1 255
    ECHO will scan the ip ranges from 131.162.145.1 to 131.162.145.255
    ECHO and 131.162.146.1 to 131.162.146.255
    ECHO and 131.162.147.1 to 131.162.147.255
    ECHO C_ARP 145 147 1 255 156 230 10
    ECHO will do the same thing except that 131 will be replaced by 156
    ECHO and 162 will be replaced by 230
    ECHO the timeout will be 10 instead of 100
    ECHO NOTE :
    ECHO The parameters 1st_octet, 2nd_octet and Timeout should be
    ECHO entered in sequence if you use it.
    ECHO .....................................................................
    ECHO ABOUT THE BATCH FILE
    ECHO .....................................................................
    ECHO I created this as i needed a way to get the ip address
    ECHO from the mac address, since the hostname changes
    ECHO depending from where you are logged in (ex, Carnegie or Library)
    ECHO This batch script pings all the ip addresses of the range of
    ECHO 131.162.third_octet.fourth_octet to 131.162.third_limit.fourth_limit
    ECHO This in effect fills the cache tables of your ARP, which you can
    ECHO then use to determine the ip address from the mac address you have!!
    ECHO Use arp -a to display your arp table and Use arp -d * to clear your arp cache
    ---------------
    ECHO DEVELOPED BY KHALSA
    ECHO CONTACT : 050188s@acadiau.ca
    ECHO When one door closes, another opens
    GOTO LETGO

    :END
    del junk.del
    arp -a > results.arp
    ECHO ARP table saved in file results.arp, Good luck !!
    :LETGO
  4. #3
  5. Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Italy
    Posts
    8
    Rep Power
    0
    [ot]

    lol ... ctlaltdel ... you shred!!!!

    [/ot]
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    108
    Rep Power
    11
    I think this sequence:
    SET fourthlimit=%4
    IF "%5"=="" SET net1=131
    SET net1=%5
    IF "%6"=="" SET net2=162
    SET net2=%6
    IF "%7"=="" SET timeOut=100
    SET timeOut=%7

    needs to be:
    SET fourthlimit=%4
    SET net1=%5
    IF "%5"=="" SET net1=131
    SET net2=%6
    IF "%6"=="" SET net2=162
    SET timeOut=%7
    IF "%7"=="" SET timeOut=100

    to work.

IMN logo majestic logo threadwatch logo seochat tools logo