Skip to content

Commit

Permalink
Dev 3.2.6 (#16)
Browse files Browse the repository at this point in the history
updated:
- codeql workflow

added:
- compatibility mode (NO_COLOR)
- main/dev branch to updater.py
  • Loading branch information
SirDank authored Sep 1, 2024
1 parent 804e834 commit 1187cb3
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 70 deletions.
64 changes: 38 additions & 26 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,61 +19,73 @@ on:

jobs:
analyze:
name: Analyze
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

include:
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
9 changes: 4 additions & 5 deletions __src__/dank.tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def dank_tool_banner():

def palestine_banner():

cls()
#cls()
banner = '\n[red]###[black]###########################################\n[red]#####[black]#########################################\n[red]########[black]######################################\n[red]##########[black]####################################\n[red]############[white]##################################\n[red]##############[white]################################\n[red]################[white]##############################\n[red]##############[white]################################\n[red]############[white]##################################\n[red]##########[green]####################################\n[red]########[green]######################################\n[red]#####[green]#########################################\n[red]###[green]###########################################\n'
console = Console(highlight=False)
console.print(Align.center(banner), style="blink")
Expand Down Expand Up @@ -755,7 +755,7 @@ def dank_github_software(software):
if os.path.isfile(r"C:\Users\SirDank\AppData\Local\Discord\Update.exe"):
print(clr(f"\n - {_translate('Discord found!')}"))
else:
print(clr(f"\n - {_translate('Discord not found!')}\n\n - {_translate('Downloading Discord...')}"))
print(clr(f"\n - {_translate('Discord not found!')}\n\n - {_translate('Downloading Discord...')}\n"))
os.system("winget install --accept-source-agreements --interactive --id Discord.Discord")
input(clr(f"\n > {_translate('Press [ ENTER ] after installing Discord...')} "))
asset = [_ for _ in session.get("https://api.github.com/repos/Vencord/Installer/releases/latest").json()["assets"] if _["browser_download_url"].endswith("VencordInstaller.exe")][0]
Expand Down Expand Up @@ -883,7 +883,7 @@ def patch():
else:
print(clr(f"\n - {_translate('WinRAR not installed!')}"))
if ONLINE_MODE:
print(clr(f"\n - {_translate('Downloading WinRAR...')}"))
print(clr(f"\n - {_translate('Downloading WinRAR...')}\n"))
os.system("winget install --accept-source-agreements --interactive --id RARLab.WinRAR")
input(clr(f"\n > {_translate('Press [ENTER] after installing WinRAR to start patching...')} "))
patch()
Expand Down Expand Up @@ -930,7 +930,7 @@ def patch():
else:
print(clr(f"\n - {_translate('RevoUninstallerPro not installed!')}"))
if ONLINE_MODE:
print(clr(f"\n - {_translate('Downloading RevoUninstallerPro...')}"))
print(clr(f"\n - {_translate('Downloading RevoUninstallerPro...')}\n"))
os.system("winget install --accept-source-agreements --interactive --id RevoUninstaller.RevoUninstallerPro")
input(clr(f"\n > {_translate('Press [ENTER] after installing RevoUninstallerPro to start patching...')} "))
patch()
Expand All @@ -942,7 +942,6 @@ def patch():
set_globals_one()
_translator = Translator()
palestine_banner() # 🍉
time.sleep(2) # 🍉

# multithreaded requests responses, download modules / assets

Expand Down
116 changes: 87 additions & 29 deletions __src__/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import subprocess
import tkinter as tk
from locale import getlocale
from rich.align import Align
from psutil import process_iter
from playsound import playsound
from rich.console import Console
from translatepy import Translator
from gzip import compress, decompress
from dateutil.tz import tzlocal, tzutc
Expand Down Expand Up @@ -54,18 +56,6 @@
import winreg
from win11toast import notify

# variables

DANK_TOOL_VERSION = "3.2.5"
session = requests.Session()
_executor = ThreadPoolExecutor(10)
headers = {"User-Agent": f"dank.tool {DANK_TOOL_VERSION}"}
os.environ['DANK_TOOL_VERSION'] = DANK_TOOL_VERSION

os.chdir(os.path.dirname(__file__))
title("𝚍𝚊𝚗𝚔.𝚝𝚘𝚘𝚕 [ 𝚒𝚗𝚒𝚝𝚒𝚊𝚕𝚒𝚣𝚒𝚗𝚐 ]")
print(clr(f"\n - Version: {DANK_TOOL_VERSION}"))

# rediect stderr to a file
#if not os.path.exists('__logs__'): os.mkdir('__logs__')
#sys.stderr = open('__logs__/dank.tool.log', 'w', encoding='utf-8')
Expand All @@ -76,15 +66,16 @@ def settings_json():

overwrite = False
default_settings = {
"offline-src": "0",
"offline-mode": "0",
"dev-branch": "0",
"force-update": "0",
"force-translate": "0",
"disable-translate": "0",
"force-startup-audio": "0",
"disable-startup-audio": "0",
}
"offline-src": "0",
"offline-mode": "0",
"dev-branch": "0",
"force-update": "0",
"force-translate": "0",
"disable-translate": "0",
"compatibility-mode": "0",
"force-startup-audio": "0",
"disable-startup-audio": "0",
}

if not os.path.isfile('settings.json'):
overwrite = True
Expand All @@ -97,10 +88,11 @@ def settings_json():
else:
default_settings[key] = data[key]

default_settings["force-translate"] = ("0" if not os.path.isfile("force-translate") else "1")
default_settings["disable-translate"] = ("0" if not os.path.isfile("disable-translate") else "1")
default_settings["force-startup-audio"] = ("0" if not os.path.isfile("force-startup-audio") else "1")
default_settings["disable-startup-audio"] = ("0" if not os.path.isfile("disable-startup-audio") else "1")
default_settings["force-translate"] = ("1" if os.path.isfile("force-translate") else "0")
default_settings["disable-translate"] = ("1" if os.path.isfile("disable-translate") else "0")
default_settings["compatibility-mode"] = ("1" if os.path.isfile("compatibility-mode") else "0")
default_settings["force-startup-audio"] = ("1" if os.path.isfile("force-startup-audio") else "0")
default_settings["disable-startup-audio"] = ("1" if os.path.isfile("disable-startup-audio") else "0")

if not overwrite and default_settings != data:
overwrite = True
Expand All @@ -114,17 +106,75 @@ def settings_json():

with open('settings.json', 'r', encoding='utf-8') as _:
DANK_TOOL_SETTINGS = json.loads(_.read())
os.environ['DANK_TOOL_COMPATIBILITY_MODE'] = DANK_TOOL_SETTINGS['compatibility-mode']
os.environ['DANK_TOOL_OFFLINE_SRC'] = DANK_TOOL_SETTINGS['offline-src']
os.environ['DANK_TOOL_DEV_BRANCH'] = DANK_TOOL_SETTINGS['dev-branch']
OFFLINE_SRC = int(DANK_TOOL_SETTINGS['offline-src'])
DEV_BRANCH = int(DANK_TOOL_SETTINGS['dev-branch'])
BRANCH = ("main" if not DEV_BRANCH else "dev")

# compatability mode

if int(DANK_TOOL_SETTINGS['compatibility-mode']) or (os.getlogin() == 'xuser' and os.getenv("COMPUTERNAME") == 'LOCALHOST'):

# https://no-color.org/
os.environ['NO_COLOR'] = '1'
import dankware
dankware.reset = ''
dankware.black = ''
dankware.blue = ''
dankware.cyan = ''
dankware.green = ''
dankware.magenta = ''
dankware.red = ''
dankware.white = ''
dankware.yellow = ''
dankware.black_bright = ''
dankware.blue_bright = ''
dankware.cyan_bright = ''
dankware.green_bright = ''
dankware.magenta_bright = ''
dankware.red_bright = ''
dankware.white_bright = ''
dankware.yellow_bright = ''
dankware.black_normal = ''
dankware.blue_normal = ''
dankware.cyan_normal = ''
dankware.green_normal = ''
dankware.magenta_normal = ''
dankware.red_normal = ''
dankware.white_normal = ''
dankware.yellow_normal = ''
dankware.black_dim = ''
dankware.blue_dim = ''
dankware.cyan_dim = ''
dankware.green_dim = ''
dankware.magenta_dim = ''
dankware.red_dim = ''
dankware.white_dim = ''
dankware.yellow_dim = ''
dankware.clr = lambda *args: args[0]
from dankware import clr, reset, black, blue, cyan, green, magenta, red, white, yellow, black_bright, blue_bright, cyan_bright, green_bright, magenta_bright, red_bright, white_bright, yellow_bright, black_normal, blue_normal, cyan_normal, green_normal, magenta_normal, red_normal, white_normal, yellow_normal, black_dim, blue_dim, cyan_dim, green_dim, magenta_dim, red_dim, white_dim, yellow_dim # pylint: disable=reimported

# variables

DANK_TOOL_VERSION = "3.2.6"
session = requests.Session()
_executor = ThreadPoolExecutor(10)
headers = {"User-Agent": f"dank.tool {DANK_TOOL_VERSION}"}
os.environ['DANK_TOOL_VERSION'] = DANK_TOOL_VERSION

os.chdir(os.path.dirname(__file__))
title("𝚍𝚊𝚗𝚔.𝚝𝚘𝚘𝚕 [ 𝚒𝚗𝚒𝚝𝚒𝚊𝚕𝚒𝚣𝚒𝚗𝚐 ]")
print(clr(f"\n - Version: {DANK_TOOL_VERSION}"))

# handle KeyboardInterrupt

def print_warning_symbol():

cls(); print(align(f'\n\n{red} ██ \n{red} ██ ██ \n{red} ██ ██ \n{red} ██ ██ \n{red} ██ ██ \n{red} ██ ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red}██ {white_bright}██████{red_normal} ██\n{red}██ ██\n{red} ██████████████████████████████████████████ \n\n'))
cls()
banner = '\n\n[red] ██ \n[red] ██ ██ \n[red] ██ ██ \n[red] ██ ██ \n[red] ██ ██ \n[red] ██ ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red]██ [bright_white]██████[red] ██\n[red]██ ██\n[red] ██████████████████████████████████████████ \n\n'
Console().print(Align.center(banner), style="blink", highlight=False)

# get latest version number

Expand Down Expand Up @@ -206,6 +256,9 @@ def dank_tool_installer():
else: # LATEST VERSION IS LOWER THAN CURRENT VERSION
print(clr("\n - Development Version!"))

if OFFLINE_SRC:
print(clr("\n - Offline SRC!"))

# check windows language

def check_system_language():
Expand Down Expand Up @@ -352,11 +405,16 @@ def dank_tool_chatroom():
except:

cls()
err_message = err(sys.exc_info())
err_message = err(sys.exc_info(), 'mini')
print(clr(err_message, 2))
LATEST_VERSION = latest_dank_tool_version()

if "Error Type: KeyboardInterrupt" in err_message:
if "- SystemExit" in err_message:
os.system("taskkill /f /t /im dank.tool.exe")
elif "- EOFError" in err_message:
print_warning_symbol()
print(clr("\n - No input provided!"))
elif "- KeyboardInterrupt" in err_message:
print_warning_symbol()
print(clr("\n - Please select text first and then use [ CTRL + C ]!"))

Expand All @@ -367,7 +425,7 @@ def dank_tool_chatroom():
elif ONLINE_MODE:
while True:
try:
requests.post("https://dank-site.onrender.com/dank-tool-errors", headers=headers, timeout=3, data={"text": f"```<--- 🚨🚨🚨 ---> v{DANK_TOOL_VERSION} | OFFLINE_SRC: {bool(OFFLINE_SRC)} | BRANCH: {BRANCH}\n\n{err_message}```"})
requests.post("https://dank-site.onrender.com/dank-tool-errors", headers=headers, timeout=3, data={"text": f"```<--- 🚨🚨🚨 ---> v{DANK_TOOL_VERSION}{' OFFLINE_SRC' if OFFLINE_SRC else ''} BRANCH: {BRANCH}\n\n{err_message}```"})
break
except Exception as exc:
input(clr(f"\n > Failed to post error report! {exc} | Press [ENTER] to try again... ",2))
Expand Down
2 changes: 1 addition & 1 deletion __src__/executor_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.5
3.2.6
Loading

0 comments on commit 1187cb3

Please sign in to comment.