Update to 1.3

This commit is contained in:
Git Kern3l 2020-04-27 21:50:08 +07:00 committed by GitHub
parent bdac1510de
commit 10cfcf7f0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ from time import sleep
from os import geteuid, system, path, name from os import geteuid, system, path, name
from subprocess import getoutput from subprocess import getoutput
def banner(): def banner():
print(the_banner) print(the_banner)
print(language.description) print(language.description)
@ -18,84 +19,80 @@ def check_windows_check_root():
if geteuid() != 0: if geteuid() != 0:
print(language.root_please) print(language.root_please)
exit() exit()
def check_lang(): def check_lang():
try: try:
if path.isfile('torngconf/langconf.txt') == True: if path.isfile('torngconf/langconf.txt') == True:
with open('torngconf/langconf.txt') as file_lang: with open('torngconf/langconf.txt') as file_lang:
lang = eval(file_lang.readline()) language = eval(file_lang.readline())
file_lang.close() file_lang.close()
print(lang.applying_language, end='', flush=True) print(language.applying_language, end='', flush=True)
print(lang.done) print(language.done)
return lang return language
else: else:
lang = choose_lang() language = choose_lang()
return lang return language
except KeyboardInterrupt: except KeyboardInterrupt:
print() print()
exit() exit()
except (NameError, SyntaxError): except (NameError, SyntaxError, AttributeError):
lang = choose_lang() language = choose_lang()
return lang return language
except FileNotFoundError: except FileNotFoundError:
print("TorghostNG is lacking its needed files. Reinstall TorghostNG pls") print("TorghostNG is lacking its needed files. Reinstall TorghostNG from Github pls")
exit() exit()
def choose_lang(language=English): def choose_lang(language=English):
try: try:
with open('torngconf/langconf.txt', mode="w") as file_lang: with open('torngconf/langconf.txt', mode="w") as file_lang:
file_lang.truncate(0)
print(language.language_list) print(language.language_list)
choice = int(input(language.choose_your_lang)) choice = int(input(language.choose_your_lang))
if choice == 1: if choice == 1:
print(English.applying_language, end='', flush=True) print(English.applying_language)
file_lang.write("English") file_lang.write("English")
language = English
print(English.done)
print(English.current_language + "English")
return English
if choice == 2: elif choice == 2:
print(Vietnamese.applying_language, end='', flush=True) print(Vietnamese.applying_language)
file_lang.write("Vietnamese") file_lang.write("Vietnamese")
language = Vietnamese
print(Vietnamese.done)
print(Vietnamese.current_language + "Vietnamese")
return Vietnamese
else: else:
print()
print(language.invalid_choice) print(language.invalid_choice)
choose_lang() choose_lang()
file_lang.close() file_lang.close()
return language
except KeyboardInterrupt: except KeyboardInterrupt:
print() print()
exit() exit()
def uninstall(): def uninstall():
try: try:
choice = str(input(language.wanna_uninstall)) choice = str(input(language.wanna_uninstall))
if choice[0].upper() == "Y": if choice[0].upper() == "Y":
print(language.uninstalling) print(language.uninstalling)
system('sudo rm -rf /usr/bin/torngconf') system('rm -rf /usr/bin/torngconf')
system('sudo rm /usr/bin/torghostng') system('rm /usr/bin/torghostng')
print(language.uninstalled) print(language.uninstalled)
exit()
else: else:
print(language.torghostng_tip.format('sudo torghostng') + color.END) print(language.torghostng_tip.format('torghostng') + color.END)
exit()
print(language.video_tutorials) print(language.video_tutorials)
exit()
except KeyboardInterrupt: except KeyboardInterrupt:
print() print()
@ -111,43 +108,29 @@ if path.isfile('/usr/bin/torghostng') == True:
print(language.already_installed.format('TorghostNG')) print(language.already_installed.format('TorghostNG'))
uninstall() uninstall()
if path.isfile('/usr/bin/pacman') == True: if path.isfile('/usr/bin/pacman') == True:
INSTALL_PACKAGES = "sudo pacman -S " INSTALL_PACKAGES = "pacman -S "
elif path.isfile('/usr/bin/apt') == True: elif path.isfile('/usr/bin/apt') == True:
INSTALL_PACKAGES = "sudo apt install " INSTALL_PACKAGES = "apt install "
elif path.isfile('/usr/bin/eopkg') == True:
INSTALL_PACKAGES = "sudo eopkg install "
elif path.isfile('/usr/bin/dnf') == True: elif path.isfile('/usr/bin/dnf') == True:
INSTALL_PACKAGES = "sudo dnf install " INSTALL_PACKAGES = "dnf install "
elif path.isfile('/usr/bin/yum') == True: elif path.isfile('/usr/bin/yum') == True:
INSTALL_PACKAGES = "sudo yum install " INSTALL_PACKAGES = "yum install "
elif path.isfile('/usr/bin/zypper') == True: elif path.isfile('/usr/bin/zypper') == True:
INSTALL_PACKAGES = "sudo zypper install " INSTALL_PACKAGES = "zypper install "
elif path.isfile('/usr/bin/apk') == True:
INSTALL_PACKAGES = "sudo apk add --upgrade "
elif path.isfile('/usr/bin/opkg') == True:
INSTALL_PACKAGES = "sudo opkg install "
elif path.isfile('/usr/bin/xbps-install') == True: elif path.isfile('/usr/bin/xbps-install') == True:
INSTALL_PACKAGES = "sudo xbps-install -S " INSTALL_PACKAGES = "xbps-install -S "
elif path.isfile('/usr/bin/upgradepkg') == True: elif path.isfile('/usr/bin/upgradepkg') == True:
UPDATE_REPOSITORY = "wget https://slack.conraid.net/repository/slackware64-current/{}" UPDATE_REPOSITORY = "wget https://slack.conraid.net/repository/slackware64-current"
INSTALL_PACKAGES = "sudo upgradepkg --install-new " INSTALL_PACKAGES = "upgradepkg --install-new "
elif (path.isfile('/usr/bin/pkg') == True) or (path.isfile('/usr/bin/pkg_add') == True): else:
print(language.sorry_bsd)
exit()
elif path.isfile('/usr/bin/swupd') == True:
print(language.sorry_some_os) print(language.sorry_some_os)
exit() exit()
@ -164,11 +147,11 @@ def install_package(package):
print(language.downloading.format(package)) print(language.downloading.format(package))
if package == 'tor': if package == 'tor':
system(UPDATE_REPOSITORY.format('tor/tor-0.4.2.7-x86_64-1cf.txz')) system(UPDATE_REPOSITORY + 'tor/tor-0.4.2.7-x86_64-1cf.txz')
system(INSTALL_PACKAGES + 'tor-0.4.2.7-x86_64-1cf.txz') system(INSTALL_PACKAGES + 'tor-0.4.2.7-x86_64-1cf.txz')
elif package == 'macchanger': elif package == 'macchanger':
system(UPDATE_REPOSITORY.format('macchanger/macchanger-1.7.0-x86_64-5cf.txz')) system(UPDATE_REPOSITORY + 'macchanger/macchanger-1.7.0-x86_64-5cf.txz')
system(INSTALL_PACKAGES + 'macchanger-1.7.0-x86_64-5cf.txz') system(INSTALL_PACKAGES + 'macchanger-1.7.0-x86_64-5cf.txz')
elif package == 'pip3': elif package == 'pip3':
@ -178,6 +161,9 @@ def install_package(package):
else: else:
if package == 'pip3': if package == 'pip3':
package = 'python3-pip' package = 'python3-pip'
if path.isfile('/usr/bin/pacman') == True:
package = 'python-pip'
system(INSTALL_PACKAGES + package) system(INSTALL_PACKAGES + package)
@ -186,7 +172,7 @@ def install_package(package):
print(language.installed.format(package)) print(language.installed.format(package))
if path.isfile('/usr/bin/upgradepkg') == True: if path.isfile('/usr/bin/upgradepkg') == True:
print(language.torghostng_tip.format('sudo python3 torghostng.py')) print(language.torghostng_tip.format('python3 torghostng.py'))
print(language.video_tutorials) print(language.video_tutorials)
exit() exit()
@ -197,35 +183,35 @@ def install_package(package):
def pyinstaller(): def pyinstaller():
try: try:
system('sudo pip2 uninstall pyinstaller') system('pip2 uninstall pyinstaller')
if path.isfile('/usr/bin/pyinstaller') == True: if path.isfile('/usr/bin/pyinstaller') == True:
print(language.already_installed.format('PyInstaller')) print(language.already_installed.format('PyInstaller'))
else: else:
print(language.installing.format('PyInstaller')) print(language.installing.format('PyInstaller'))
system('sudo pip3 install pyinstaller') system('pip3 install pyinstaller')
print(icon.success + language.done) print(icon.success + language.done)
print(language.installed.format('PyInstaller')) print(language.installed.format('PyInstaller'))
print(language.installing.format('TorghostNG')) print(language.installing.format('TorghostNG'))
system('pyinstaller --onefile torghostng.py') system('pyinstaller --onefile torghostng.py')
system('sudo cp -r dist/torghostng /usr/bin') system('cp -r dist/torghostng /usr/bin && cp -r torngconf /usr/bin')
system('sudo cp -r torngconf /usr/bin')
system('chmod +x /usr/bin/torghostng') system('chmod +x /usr/bin/torghostng')
print(icon.success + language.done) print(icon.success + language.done)
print(language.torghostng_tip.format('sudo torghostng') + color.END) print(language.torghostng_tip.format('torghostng') + color.END)
print(language.video_tutorials)
except KeyboardInterrupt: except KeyboardInterrupt:
print() print()
exit() exit()
packages = ['tor','macchanger','pip3'] packages = ['tor','macchanger','pip3']
for package in packages: for package in packages:
install_package(package) install_package(package)
pyinstaller() pyinstaller()
print(language.video_tutorials)
exit() exit()