复制
收藏
提问
全网
import subprocess def nmap_scan(target, port): cmd = ['nmap', '-p', port, target] process = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return process.stdout.decode('utf-8') # 使用示例 scan_result = nmap_scan('127.0.0.1', '80') print(scan_result)
3个月前
理解问题import subprocess def nmap_scan(target, port): cmd = ['nmap', '-p', port, target] process = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return process.stdout.decode('utf-8') # 使用示例 scan_result = nmap_scan('127.0.0.1', '80') print(scan_result)
已完成理解「import subprocess def nmap_scan(target, port): cmd = ['nmap', '-p', port, target] process = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return process.stdout.decode('utf-8') # 使用示例 scan_result = nmap_scan('127.0.0.1', '80') print(scan_result)」
展开阅读网页
更专业一些
转笔记
专业
import subprocess
def nmap_scan(target, port):
cmd = ['nmap', '-p', port, target]
process = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return process.stdout.decode('utf-8')
# 使用示例
scan_result = nmap_scan('127.0.0.1', '80')
print(scan_result)不在提醒