Question: I ' m still stuck on this script. It errors as: SyntaxError: expected 'except' or 'finally' block. While there is an except block in
Im still stuck on this script. It errors as: SyntaxError: expected 'except' or 'finally' block. While there is an except block in the script, not sure if I have everything indented properly.
#usrbinpython
from pwn import
import sys
import time
import paramiko
host
username dan
attem
#opens password list in read only mode:
with openpasswordstxtr as passwordlist:
for password in passwordlist:
password password.strip
#try clause:
try:
print Trying Password: formatattem password
response sshhosthost, userusername, passwordpassword, timeout
if response.connected:
print A Valid Password Was Found formatpassword
#open function creates text file in write mode:
logFile op XS enhomedanDocumentslogFiletxtw
#writes text to the text file:
logFilewriteThe host is:
The password is:
formathost password
#closes the text file:
logFileclose
response.close
break
response.close
except paramiko.sshexception.AuthenticationException:
printX Invalid Password!""
attem
for i in range :
time.sleep
sysstdout.writerformati#ii
# sysstdout.flush
# sysstdout.write
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
