python
Black:)
这个作者很懒,什么都没留下…
展开
-
单节点redis与redis集群之间的数据迁移(Python)
正常情况下数据迁移,redis作为缓存,数据不需要迁移。但公司把redis当数据库使用了。所有有了下面的需求。单节点redis数据导出到redis集群反之即可。下面是redis集群数据导出到单节点redis。原创 2023-10-26 15:40:43 · 281 阅读 · 0 评论 -
Python 执行cmd命令行
Python 执行cmd命令行import subprocessdef runcmd(command, cwd, timeout=5, shell=True, cancer_warp=False): try: p = subprocess.Popen(command, bufsize=-1, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.PIPE, enc原创 2022-04-21 15:44:16 · 970 阅读 · 0 评论 -
python创建文件并写入json
python创建文件并写入jsonimport jsonimport osimport uuidPATH = 'D:/SecurityData'if not os.path.exists(PATH): os.makedirs(PATH)fw = open('{}/Security.json'.format(PATH), 'a+')fr = open('{}/Security.json'.format(PATH), 'r')fw.write(json.dumps({ 'na原创 2022-04-21 15:25:26 · 3662 阅读 · 0 评论 -
Python 获取WindowsEvtx日志文件并解析
Python 获取WindowsEvtx日志文件并解析demo如下(随便写的):import htmlfrom xml.dom import minidomimport Evtx.Evtx as evtxpath = r"C:\Windows\Sysnative\winevt\Logs\Security.evtx"with evtx.Evtx(path) as log: for record in log.records(): timestamp = record.t原创 2022-04-21 14:43:09 · 3328 阅读 · 3 评论 -
OSError: Python library not found: libpython3.6.so.1.0, libpython3.6mu.so.1.0....
在CentOS中使用Pyinstaller把python项目编译成可执行文件。在python安装目录执行以下命令。把需要的.so复制到lib目录。原创 2022-03-02 13:33:03 · 2060 阅读 · 0 评论