博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python2计算cisco无线AP需要dhcp的option43
阅读量:4566 次
发布时间:2019-06-08

本文共 1538 字,大约阅读时间需要 5 分钟。

#/usr/bin/python2.7
# -*- coding=utf-8 -*-
import socket
from binascii import hexlify
import sys
def wlc_option43_hex():
  wlc_number = raw_input('Enter the wlc number:')
  if wlc_number == '1':
  put_number = raw_input('Enter the wlc ip:')
for ip_addr in [put_number]:
wlc_ip_addr = socket.inet_aton(ip_addr)
unpacked_ip_addr = socket.inet_ntoa(wlc_ip_addr)
hex_prefix = 'f104'
result=hex_prefix+hexlify(wlc_ip_addr)
print "IP Address: %s => option43 hex %s"\
%(unpacked_ip_addr,result[0:4]+'.'+result[4:8]+'.'+result[8:]) 
else:
put_number1 = raw_input('Enter the wlc ip:')
for ip_addr1 in [put_number1]:
wlc_ip_addr1  = socket.inet_aton(ip_addr1)
unpacked_ip_addr1 = socket.inet_ntoa(wlc_ip_addr1)
hex_prefix = 'f108'
result1=hexlify(wlc_ip_addr1)
put_number2 = raw_input('Enter the wlc ip:')
for ip_addr2 in [put_number2]:
wlc_ip_addr2=socket.inet_aton(ip_addr2)
unpacked_ip_addr2 = socket.inet_ntoa(wlc_ip_addr2)
result2=hexlify(wlc_ip_addr2)
result = hex_prefix+result1+result2
print "IP Address: %s %s => option43 hex %s"\
%(unpacked_ip_addr1,unpacked_ip_addr2,result[0:4]+'.'+result[4:8]+'.'+result[8:12]+'.'+result[12:16]+'.'+result[16:])
if __name__ == '__main__':
wlc_option43_hex()
#一台cisco无线控制器 
#Enter the wlc number:1
#Enter the wlc ip:10.10.9.245
#IP Address: 10.10.9.245 => option43 hex f104.0a0a.09f5
#两台cisco无线控制器
#Enter the wlc number:2
#Enter the wlc ip:10.10.1.123
#Enter the wlc ip:10.10.1.124
#IP Address: 10.10.1.123 10.10.1.124 => option43 hex f108.0a0a.017b.0a0a.017c

转载于:https://www.cnblogs.com/koalabear/p/6078435.html

你可能感兴趣的文章
gulp详细入门教程
查看>>
mysql数据导出
查看>>
OUTPUT 作用在INSERT,UPDATE,DELETE后
查看>>
深入学习:Windows下Git新手教程(上)
查看>>
【C++】随机重命名MP3文件
查看>>
CoolBlog开发笔记第1课:项目分析
查看>>
PeekMessage
查看>>
html中表格table的内容居中显示
查看>>
Ubuntu 中软件的安装、卸载以及查看的方法总结
查看>>
Visual Studio 2013 无法启动 IIS Express 的解决办法
查看>>
MVC Ajax.BeginForm 实例
查看>>
选择结构if
查看>>
手机版网页全屏
查看>>
SqlServer数据库大型应用解决方案总结
查看>>
windows service创建使用整合
查看>>
如何用js获取浏览器URL中查询字符串的参数
查看>>
Visual Studio VS如何重置所有设置
查看>>
倍福TwinCAT(贝福Beckhoff)基础教程 松下驱动器试运行提示过速度保护怎么办
查看>>
C#.NET常见问题(FAQ)-如何修改代码字体
查看>>
ajax跨域传输(jsonp格式)
查看>>