Skip to content

Commit

Permalink
0.36
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardLab committed Sep 23, 2022
1 parent 565feeb commit 790fe9a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 16 deletions.
60 changes: 44 additions & 16 deletions binpythonfull.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
####################################
#build configure

ver = "0.34-build-full"
ver = "0.36-build-full"

libs_warning = "1"
#1 is ture 0 is false.
Expand All @@ -19,8 +19,8 @@
buildversion = "plus" #plus version and standard version

releases_ver = "offical" + buildversion + "-building"
importlibs = "os" #Don't use "import xxx"
cloudrunver = "1.01"
importlibs = "os"
cloudrunver = "1.03"
#Imported library name, please use "importlibs="<library name>" instead of "import <library name>"
#Please note: The "importlibs" function does not support loading functions (such as from xxxx import xxxx, if necessary, please write it in the following location. However, please note that this operation may have the risk of error reporting, please report issues or solve it yourself
#xxxxxxxxxxxxxx
Expand All @@ -44,6 +44,7 @@ def releases_ver():

def build_importlibs():
print(importlibs)
import time
#get system info(windows or linux ...)
import platform
sys = platform.system()
Expand Down Expand Up @@ -80,22 +81,27 @@ def optreadfile():
sys.exit(0)
class cloudrun:
def get(pkgname):
try:
sources = open("cloudrun_config/sources.config", "r")
sources = str(sources.read()) + pkgname + ".py"
except:
sources = f"https://raw.githubusercontent.com/xingyujie/cloudrun-repository/main/{pkgname}.py"
try:
cloudrunenv = True
getcoderes = urllib.request.urlopen(f"https://raw.githubusercontent.com/xingyujie/cloudrun-repository/main/{pkgname}.py")
getcoderes = urllib.request.urlopen(sources)
except(Exception, BaseException) as error:
print("There is no network connection or the repository does not exist for this script")
print("Error details are in cloudrun_error.log in the run directory")
f = open("cloudrun_error.log", "a")
f.write(str(error))
f.write('Get Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
try:
exec(str(getcoderes.read().decode('utf-8')))
getcoderes.close()
except(Exception, BaseException) as error:
print("run failed")
print("Error details are in cloudrun_error.log in the run directory")
f = open("cloudrun_error.log", "a")
f.write(str(error))
f.write('Run Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
def load(url):
try:
cloudrunenv = True
Expand All @@ -104,15 +110,22 @@ def load(url):
print("There is no network connection or the repository does not exist for this script")
print("Error details are in cloudrun_error.log in the run directory")
f = open("cloudrun_error.log", "a")
f.write(str(error))
f.write('Get Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
try:
exec(getcoderes.read().decode('utf-8'))
getcoderes.close()
except(Exception, BaseException) as error:
print("run failed")
print("Error details are in cloudrun_error.log in the run directory")
f = open("cloudrun_error.log", "a")
f.write(str(error))
f.write('Run Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
def editsource(url):
try:
os.mkdir("cloudrun_config")
except:
pass
sources = open("cloudrun_config/sources.config", "w")
sources.write(url)
try:
#base import
import getopt
Expand Down Expand Up @@ -176,7 +189,7 @@ def importpygame():
print("")
#main BINPython
def binpython_welcome_text():
print("BINPython " + ver + "-" + releases_ver + " (Python Version:" + platform.python_version() + ")By:XINGYUJIE https://github.com/xingyujie/binpython[Running on " + platform.platform() + " " + platform.version() + "]")
print("BINPython " + ver + "-" + releases_ver + " (Python Version:" + platform.python_version() + ") By: Edward Hsing(Xing Yu Jie) https://github.com/xingyujie/binpython[Running on " + platform.platform() + " " + platform.version() + "]")
print('Type "about", "help", "copyright", "credits" or "license" for more information.')
def binpython_shell():
while True:
Expand All @@ -186,7 +199,7 @@ def binpython_shell():
print(globals()[pycmd])
continue
elif pycmd == 'about':
print("BINPython By:XINGYUJIE[https://github.com/xingyujie] AGPL-3.0 LICENSE Release")
print("BINPython By: Edward Hsing(Xing Yu Jie)[https://github.com/xingyujie] AGPL-3.0 LICENSE Release")
elif pycmd == 'help':
print("Type help() for interactive help, or help(object) for help about object.")
elif pycmd == 'copyright':
Expand Down Expand Up @@ -257,7 +270,7 @@ def outputfullhelp():
print("Additional options for the plus version")
print(helpinfoplus)
#set about info
about = "BINPython " + ver + "-" + releases_ver + " By:XINGYUJIE[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release"
about = "BINPython " + ver + "-" + releases_ver + " By: Edward Hsing(Xing Yu Jie)[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release"
#getopt
try:
#set options
Expand All @@ -282,7 +295,7 @@ def outputfullhelp():
exec(f.read())
print("Powered by: BINPython[https://github.com/xingyujie/binpython] AGPL 3.0")
except:
print("BINPython " + ver + "-" + releases_ver + " By:XINGYUJIE[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release")
print("BINPython " + ver + "-" + releases_ver + " By: Edward Hsing(Xing Yu Jie)[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release")
print("Python " + platform.python_version())
sys.exit()
if opt_name in ('-f','--file'):
Expand Down Expand Up @@ -606,22 +619,37 @@ def examplerequests():
CloudRun Help:
get -- Enter application/script name to get run from software repository
load -- Run scripts from custom URL
editsource -- Set up custom sources and save via configuration files
shell -- Go to BINPython Shell
version -- CloudRun Version
help -- run this help
help -- show this help
""")
if cloudruncli == 'get':
print("Get apps/scripts in software repository")
print("Under normal circumstances, we review the code of the software repositories and generally do not have any malware. But we will not take any legal responsibility")
print()
pkgname = input("packagename: ")
cloudrun.get(pkgname)
if pkgname == '':
pass
else:
cloudrun.get(pkgname)
if cloudruncli == 'load':
print("Let CloudRun run scripts through a custom server")
print("The format should be like this: http://domain.com/filename.py")
url = input("Python script URL: ")
cloudrun.load(url)
if url == '':
pass
else:
cloudrun.load(url)
if cloudruncli == 'editsource':
print('caution! The set software source must be in a standard format, otherwise it may not work, like http://127.0.0.1/, if you set http://127.0.0.1, it will not work properly, even if there is one less "/"!')
entersource = input("Please input sources server address: ")
cloudrun.editsource(entersource)
print("success!")
if cloudruncli == 'shell':
binpython_shell()
if cloudruncli == 'version':
print(f"CloudRun-{cloudrunver} BINPython version By:Edward Hsing(xingyujie) AGPL-3.0 LICENSE")
print(f"CloudRun-{cloudrunver} BINPython version By:Edward Hsing(Xing Yu Jie) AGPL-3.0 LICENSE")
if cloudruncli == '':
pass
else:
Expand Down
1 change: 1 addition & 0 deletions cloudrun_config/sources.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://raw.githubusercontent.com/xingyujie/cloudrun-repository/main/

0 comments on commit 790fe9a

Please sign in to comment.