All I'm trying to do is have the program look for a specific string and if the file contains that string add to a variable and if not just print that it didn't work. But it keeps saying that the string was not found when i know it is in the file.
for line in open("/home/cp/Desktop/config"):
if "PermitRootLogin no" in line:
num_of_points1 = num_of_points1 + 4
num_of_vulns1 = num_of_vulns1 + 1
else:
print('sshd_config is still vulnerable')
break
This is the file its reading off of
This should work
Possibly
PermitRootLogin no
hmmmmmmmmmm
aaa
What i want it to do is find that "PermitRootLogin no" in the file but it just keeps acting like that string was never found. And printing the else statement. When i was looking for tutorials they all were trying to do something else so i'm open to any suggestions. Thank You in advanced im just really stuck.
Aucun commentaire:
Enregistrer un commentaire