I have to create a python Brute-force for a school project. I have a shadow file and i have to brute force passwords.
On the list I have few passwords I don't need, so I want to remove them from my array.
So I have an array with all my passwords. I've wrote a if condition to check if password is different than "*" or "!".
for mdp in passwd:
if mdp != '*' or mdp != '!':
str(mdp)
list.append(mdp)
print(list)
But when I print my array password with "!" and "*" are still inside... I don't know why.
orshould have been anand. Think about it and see if you can work out why.if mdp not in ['*', '!']:mdp != '*'ormdp != '!'. Assume you encounter a*symbol. what happens to the conditional? It evalutes toFalse or Trueand becomes True, and the if block still executes. You need to ensure mdp is neither*nor!. That is, the condition should fail if "any one" of the 2 negation matches give a False. (The Not changes conditionals in strange ways, and it helps to think of it using pen and paper and actually working it out.)