Python自动转发exchange邮件(exchangelib)
摘要:自动转发邮件,不作为附件 #导入exchangelib库模块 from exchangelib import NTLM, IMPERSONATION, Account, Credentials, Configuration, DELEGATE, Mailbox, Folder, Message, H
阅读全文
posted @
2025-12-01 13:41
momingliu11
阅读(14)
推荐(0)
yum下载包到本地安装 yumdownloader
摘要:yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel无法安装成功,卡住不动,一直停留在“Running transaction check、Runn
阅读全文
posted @
2025-10-29 10:40
momingliu11
阅读(13)
推荐(0)
强制结束yum install进程报错解决办法
摘要:强制结束正在运行的yum进程后,再重新执行yum install命令出现如下报错:BDB0113 Thread/process ... failed: BDB1507 Thread died in Berkeley DB libraryDB_RUNRECOVERY: Fatal error, run
阅读全文
posted @
2025-10-29 10:31
momingliu11
阅读(15)
推荐(0)
通过watchdog模块监听文件修改,并实现断点续读
摘要:实现功能: 自动监听以当天日期为名的log文件,当修改时可以进行处理,并支持断点续读 #pip3 install watchdog import time,datetime,os,re from watchdog.observers import Observer from watchdog.eve
阅读全文
posted @
2025-05-20 16:44
momingliu11
阅读(23)
推荐(0)
将字符串转换为字典dict
摘要:log_str = """May 20 16:25:25 10.10.77.3 date=2025-05-20,time=16: 25:25.206,device_id=FE3,log_id=02091,type=statistics,pri=information, session_id="543
阅读全文
posted @
2025-05-20 16:42
momingliu11
阅读(31)
推荐(0)
pymsql连接到数据库并插入数据
摘要:#定义类,初始化连接到mysql数据库,失败重连 class MySQLOPS: def __init__(self, db_host, db_user, db_password, db_database): self.db_config = { "host": db_host, "user": d
阅读全文
posted @
2025-04-29 13:52
momingliu11
阅读(26)
推荐(0)
Python使用logging模块记录日志
摘要:import logging import sys #创建一个logger对象 logger = logging.getLogger('my_logger') #定义需要记录的日志等级ERROR,WARNING,INFO,DEBUG logger.setLevel(logging.ERROR) #定
阅读全文
posted @
2025-04-17 14:14
momingliu11
阅读(51)
推荐(0)
Python通过EWS订阅新邮件
摘要:Python通过EWS订阅方式进行监听,获取新邮件内容 from exchangelib import NTLM, IMPERSONATION, Account, Credentials, Configuration,DELEGATE,HTMLBody from exchangelib import
阅读全文
posted @
2025-03-06 16:58
momingliu11
阅读(109)
推荐(0)
Python OCR图形识别、二维码识别
摘要:1、 使用pytesseract 进行图形识别 #pytesseract依赖于tesseract,需要先按照tesseractyum -y install tesseract #安装完成后查看版本: tesseract -v#查询可用语言包: yum search tesseract-langpac
阅读全文
posted @
2025-02-27 15:51
momingliu11
阅读(146)
推荐(0)
Python下提示SSL证书错误
摘要:Python下,在pip安装包或执行脚本的时候,出现SSL证书错误,如下: ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local is
阅读全文
posted @
2025-02-27 14:07
momingliu11
阅读(102)
推荐(0)
Python执行Exchange PowerShell命令
摘要:#pip install pypsrp from pypsrp.powershell import PowerShell, RunspacePool from pypsrp.wsman import WSMan host = 'ex01.test19.com' username='test19\\u
阅读全文
posted @
2024-08-12 17:59
momingliu11
阅读(117)
推荐(0)
Python3禁用AD账号与重置AD账号密码ldap
摘要:Python3禁用AD账号 # LDAP服务器地址、端口号及连接参数 import ldap3 from ldap3 import Server, Connection,ALL import datetime print(datetime.datetime.now()) server = Serve
阅读全文
posted @
2024-07-16 16:29
momingliu11
阅读(275)
推荐(0)
Python调用Graylog APi 分析401错误登录日志
摘要:ret_lst处理完成后是一个list,内容如下: [{'c_ip': '10.10.202.139', 'uname': 'ee'}, {'c_ip': '10.10.202.139', 'uname': 'tt'}, {'c_ip': '192.168.195.131', 'uname': 'e
阅读全文
posted @
2024-04-30 16:07
momingliu11
阅读(141)
推荐(0)
Python发送企业微信消息
摘要:import requests #定义企微连接信息(通过IT服务给用户发送消息) wework_corpid = 'wx1234' wework_agentid = 'tgabcde' wework_secret = '101' #定义类,发送企微消息 class SendWeWorkMessage
阅读全文
posted @
2024-04-13 00:14
momingliu11
阅读(660)
推荐(0)
Python3.6升级到3.9和3.10
摘要:1.升级openssl到1.1.1n cd /data/softwares cd openssl-1.1.1n ./config make && make install ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1 ln
阅读全文
posted @
2023-08-24 17:40
momingliu11
阅读(1219)
推荐(0)
pip安装whl制定下载源
摘要:pip3 install click_house -i https://pypi.tuna.tsinghua.edu.cn/simple/
阅读全文
posted @
2023-08-03 15:07
momingliu11
阅读(39)
推荐(0)
Python3通过cookie登录
摘要:import json,urllib.request,urllib.parse,http.cookiejar url_base = 'https://spam.forti.com/api/v1' url_admin = 'AdminLogin' data = {'name' : 'admin', '
阅读全文
posted @
2022-03-09 17:25
momingliu11
阅读(471)
推荐(0)
Python2.7升级pip失败解决办法
摘要:CentOS下通过 pip install --upgrade pip 升级pip版本失败,解决方法如下: Python2.7自带pip版本为8.1, pip install --upgrade pip总是报错 wget wget https://bootstrap.pypa.io/get-pip.
阅读全文
posted @
2021-12-29 14:22
momingliu11
阅读(722)
推荐(0)
Python3 Post Get API
摘要:import sys,urllib.request,urllib.parse,json,string class GetDeviceDataAPI(): def __init__(self,name,password): #定义主url、获取token的url,获取设备信息的url self.url
阅读全文
posted @
2021-12-05 00:35
momingliu11
阅读(151)
推荐(0)
pip指定安装源
摘要:pip3 install exchangelib -i https://pypi.tuna.tsinghua.edu.cn/simple 安装指定的包,并指定安装源 RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.e
阅读全文
posted @
2021-09-21 16:34
momingliu11
阅读(656)
推荐(0)