I have the netstat -nb output in a variable (netstat_output). I have the IP in a variable (ip) and the port in (port). I need to select the program that relates to my ip and port. the pattern I thought about is: (ip + ":" + str(port) + "\s*.+\s+[[.\s]+]?[?(.+).exe]?"). now I have 2 problems:
-
what happens if there are no '[' and ']' in the program?
-
what happens if there are several ips that relate to the program and my ip in the middle of it? I still need to get my program, and there are more irrelevant lines under the line that I wrote in my pattern...
Aucun commentaire:
Enregistrer un commentaire