Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to detect the host IP in batch and generate the result into excel file table

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

How to batch test the host IP and generate the results into excel file table, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

This is an extension of the previous script, adding the generation of excel tables

# coding=gbk

Import os

Import sys

Import xlwt

Wk = xlwt.Workbook (encoding = 'utf-8')

Sheet1 = wk.add_sheet ("IP62", cell_overwrite_ok=True)

Style = xlwt.XFStyle ()

Sheet1.write (0,014 IP address', style)

Sheet1.write (0pen 1, 'status', style)

X = y = 0

For ip in range (1255):

Res = os.system ('ping-n 1-w 1' + sys.argv [1] + str (ip))

If res = = 0:

Print (sys.argv [1] + str (ip) + 'up')

Sheet1.write (ip,0,sys.argv [1] + str (ip))

Sheet1.write (ip,1,'up')

X + = 1

Else:

Print (sys.argv [1] + str (ip) + 'down')

Sheet1.write (ip,0,sys.argv [1] + str (ip))

Sheet1.write (ip,1,'down')

Y + = 1

Print ('total up ip is' + str (x))

Print ('total down ip is' + str (y))

Sheet1.write (ip+1,0,'total up ip is'+ str (x))

Sheet1.write (ip+2,0,'total down ip is'+ str (y))

Wk.save ('ip.xls')

After reading the above, do you know how to batch test the host IP and generate the results into an excel file table? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report