- 博客(7)
- 收藏
- 关注
原创 通过ThreadPoolExecuto ProcessPoolExecutor处理并发(多进程/多线程)
# -*- coding: utf-8 -*-"""多线程编程ThreadPoolExecutor"""import threadingimport timefrom concurrent.futures.thread import ThreadPoolExecutorLink_status = {}def interface(intf_name): print('检查interface%s'%intf_name) time.sleep(5) print('检查
2021-03-15 18:53:35
307
原创 python logging的用法
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""logging module learningadvanced"""import logging# 编程的方法写一下高级的用法# 记录器logger = logging.getLogger('applog') # 先调用getLogger这个对对象, 相当于拿到了一只笔logger.setLevel(logging.DEBUG)# 处理器consoleHandle
2021-02-25 22:33:09
110
1
原创 python 处理IP地址固定增加步长,实现255进位
python 处理IP地址固定增加步长。思想为先将IP转化成10进制后,加上固定步长后再通过位运算和与运算,转成IP地址格式。代码为:#!/usr/bin/pythondef ipv4_to_int(ipv4): ipv4 = [int(x) for x in ipv4.split(".")] ipv4_int = (ipv4[0] << 24) + (ipv4[1] << 16) + (ipv4[2] << 8) + ipv4[3] pr
2020-12-31 16:43:56
812
原创 多线程ping扫描
代码为多线程ping扫描用法 LM-SHC-16507783:small_script_for_operation yzhu10$ python3 mp_ping.py --helpusage: mp_ping.py [-h] [-mc multiprocessing_count] [-n network]ping scan for the specific network via the multi-processing,list theactive/inactive hostsoptio
2020-12-23 17:30:47
221
原创 Lunix 命令循环执行器
import osimport timeimport sysprint('''mode 1 : repeat to execute the command specific timesmode 2 : repeat to execute the command every specific seconds''')mode=input('please input 1 0r 2 to select the mode:')if int(mode) == 1: command = input(
2020-10-30 20:40:46
83
原创 查询路由器交换机上ARP对应的DNS记录
<import osimport refile_name=input(‘the arp file name is:’)for i in open(file_name,‘r’).readlines():host=re.findall(’(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})’,i)# print(host)if not host:continueelse:ip=host.pop()command = ‘nslookup %s’%ipfor k in o
2020-10-15 17:08:18
383
原创 python 扫描端口是否打开
#python 扫描端口是否打开import reimport timewhile True: try: for line in os.popen('netstat -nat').read().split('\n'): # print(line) port_match=re.search('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\.(\d{1,6})',line) if por
2020-07-13 14:23:44
219
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人