pythonpython-3.xxmppxmpppydictionary-attack

Python xmpp brute force script not working


I have written a (very) simple python scrip using xmpppy to try and make an xmpp(jabber) account brute forcer but when I try to run it I get:

line 5 print "Syntax: xsend JID text" SyntaxError: invalid syntax.

Any Ideas what I am doing wrong?

#!/usr/bin/python
# -*- coding by unknown-error -*-
import sys,os,xmpp
if len(sys.argv) < 2:
    print "Syntax: xsend JID text"
    sys.exit(0)

tojid=sys.argv[1]
text=' '.join(sys.argv[2:])

jidparams={}
if os.access(os.environ['HOME']+'/.xsend',os.R_OK):
    for ln in open(os.environ['HOME']+'/.xsend').readlines():
        key,val=ln.strip().split('=',1)
        jidparams[key.lower()]=val
for mandatory in ['jid']:
    if mandatory not in jidparams.keys():
        open(os.environ['HOME']+'/.xsend','w').write('#JID=romeo@montague.net')
        print 'Please ensure the ~/.xsend file has valid JID for sending messages.'
        sys.exit(0)
jid=xmpp.protocol.JID(jidparams['jid'])
cl=xmpp.Client(jid.getDomain(),debug=[])

file_name=raw_input("passwords.txt")
f=open(file_name,"r")
a= for name in f
        a:
            cl.connect()
        cl.auth(jid.getNode(),jidparams['password' = a])
        except self._session_state=SESSION_NOT_AUTHED:
            continue
        else:
            print " - password ---->>> "+'password'
            break

Solution

  • Just to quote the manual on "what's new in Python 3".

    Print Is A Function The print statement has been replaced with a print() function, with keyword arguments to replace most of the special syntax of the old print statement (PEP 3105).

    So simply use print(...) wherever you've used print ....

    For more information consult the documentation

    Ps. asking on stackoverflow for brute forcers are likely to receive down votes on principle.