Advertisement
Guest User

Cisco CDP Port-ID Identifier v1.0

a guest
Nov 18th, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. rem Requires WinDump @ http://www.winpcap.org/windump/install/
  4. rem        + WinPcap @ http://www.winpcap.org/install/default.htm
  5. rem   OR
  6. rem          TCPDUMP @ http://www.microolap.com/products/network/tcpdump/
  7. echo Cisco CDP Port-ID Identifier v1.0 by Giovanni Heward (g[@]utahfd.com)
  8. set app=windump
  9. set output=\\?\UNC\127.0.0.1\c$\PortID.txt
  10. rem Modify output to central share if desired (e.g. \\?\UNC\server.domain.local\share\path\PortID.txt )
  11. for /f "tokens=4" %%i in ('route print -4 0.*^|find "0.0.0.0"') do (
  12.     if not [%%i]==[Default] (
  13.         for /f "tokens=3 delims=," %%s in ('wmic nicconfig get IPAddress^,SettingID /format:csv^|findstr "%%i"') do (
  14.             for /f "delims=." %%i in ('!app! -D^|findstr "%%s"') do (  
  15.                 !app! -i %%i -nn -v -s 1500 -c 1 ether[20:2] == 0x2000 | findstr "Device-ID Address Port-ID Platform"
  16.             )>!output!
  17.         )
  18.     )
  19. )
  20. if exist !output! type !output!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement