以下是一个获取系统版本、安全软件和IP地址的Python脚本:
```python
import platform
import subprocess
# 获取操作系统版本信息
os_version = platform.platform()
# 获取安装的安全软件列表
security_software = []
try:
process = subprocess.Popen(['wmic', 'product', 'get', 'name'], stdout=subprocess.PIPE)
output, error = process.communicate()
for line in output.splitlines():
if line.strip() and not line.startswith(b'Name'):
security_software.append(line.strip().decode('utf-8'))
except Exception as e:
print("Error: ", e)
# 获取本机IP地址
ip_address = ''
try:
process = subprocess.Popen(['ipconfig'], stdout=subprocess.PIPE)
output, error = process.communicate()
for line in output.splitlines():
if b'IPv4 Address' in line:
ip_address = line.strip().split(b':')[-1].strip().decode('utf-8')
break
except Exception as e:
print("Error: ", e)
# 打印结果
print("操作系统版本:", os_version)
print("安全软件列表:", security_software)
print("IP地址:", ip_address)
```
这个脚本使用了platform和subprocess模块来获取系统版本和安全软件列表,以及使用ipconfig命令获取本机IP地址。