Skip to content

Commit b43a08d

Browse files
committed
Version 0.1
1 parent 3942782 commit b43a08d

13 files changed

Lines changed: 1577 additions & 3 deletions

File tree

CodeBreak.py

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,60 @@
1-
# CodeBreak n'est pas encore disponible pour le moment
2-
# Rejoignez le discord pour plus d'information ou pour toute question
3-
# Vous retrouverez le liens du discord dans README.md
1+
# © 2024 CIPIX
2+
# All rights reserved.
3+
# Tous droits réservés.
4+
5+
try:
6+
from config.config import *
7+
from config.menu import *
8+
from menu.discordAnim import discordAnim
9+
import colorama, os
10+
except:
11+
print('Erreur import module in CodeBreak.py')
12+
13+
terminalTitle('MainMenu')
14+
colorama.init()
15+
checkUpdate()
16+
17+
while True:
18+
try:
19+
CLEAR()
20+
print(TITLE, LINK)
21+
MENU(MainOption)
22+
select = input(Prompt('Main Menu')).strip().lstrip('0')
23+
if select == '1':
24+
startProgram("info.py")
25+
elif select == '2':
26+
startMenu("setting.py")
27+
elif select == '3':
28+
discordAnim('nukeBot.py')
29+
elif select == '4':
30+
Soon()
31+
elif select == '5':
32+
Soon()
33+
elif select == '6':
34+
Soon()
35+
elif select == '7':
36+
Soon()
37+
elif select == '8':
38+
Soon()
39+
elif select == '9':
40+
Soon()
41+
elif select == '10':
42+
Soon()
43+
elif select == '11':
44+
Soon()
45+
elif select == '12':
46+
Soon()
47+
elif select == '13':
48+
Soon()
49+
elif select == '14':
50+
Soon()
51+
elif select == '15':
52+
Soon()
53+
else:
54+
print(f'\n{TIME_RED()} {ERROR} The choice is not recognized as a valid option !{reset}')
55+
Pause()
56+
except Exception as error:
57+
print(f'{ERROR} An error has occurred.\n{yellow}{error}{reset}')
58+
os.system("pause")
59+
60+

Start.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
echo CodeBreak startup...
3+
python CodeBreak.py

config/config.py

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# © 2024 CIPIX
2+
# All rights reserved.
3+
# Tous droits réservés.
4+
5+
try:
6+
import colorama, json, subprocess, os, sys, datetime, requests, webbrowser
7+
from config.info import *
8+
except Exception as error:
9+
import os
10+
print(f'Error in Module : {error}')
11+
os.system("pause")
12+
13+
colorama.init()
14+
color = colorama.Fore
15+
reset = color.RESET
16+
purple = '\033[38;2;131;0;255m'
17+
white = color.WHITE
18+
yellow = color.YELLOW
19+
blue = color.BLUE
20+
red = color.RED
21+
green = color.GREEN
22+
23+
parametreFichier = 'config/parametre.json'
24+
25+
def githubVersion():
26+
response = requests.get(linkUpdate)
27+
if response.status_code == 200:
28+
github_vars = {}
29+
exec(response.text, github_vars)
30+
return github_vars.get('versionCode')
31+
else:
32+
print(f"{TIME_RED()} {ERROR} Unable to retrieve the info.py file from the GitHub repository.")
33+
Pause()
34+
35+
def checkUpdate():
36+
github_version = githubVersion()
37+
38+
if versionCode != github_version:
39+
print(f"""
40+
{TIME_RED()} {ERROR} Update available !
41+
42+
Current version :{yellow} {versionCode} {red}
43+
New version :{green} {github_version} {red}
44+
Please update CodeBreak to get the latest improvements and fixes.
45+
Opening the update link in your browser... {reset}
46+
""")
47+
webbrowser.open(linkGithub)
48+
# if sys.platform.startswith("win"):
49+
# file = f'python update.py'
50+
# subprocess.run(file, shell=True)
51+
# elif sys.platform.startswith("linux"): Soon !
52+
# file = f'python3 update.py'
53+
# subprocess.run(file, shell=True)
54+
# else:
55+
# pass
56+
57+
def Sauvegarde() :
58+
try:
59+
with open(parametreFichier, 'w') as fichier:
60+
json.dump(data, fichier, indent=4)
61+
except FileNotFoundError:
62+
print(f'{red}[{white}x{red}] The file {parametreFichier} is not found. {reset}')
63+
os.system('pause')
64+
except Exception as error:
65+
print(f'{red}[{white}x{red}] An error occurred while saving the settings: {yellow}{error}{reset}')
66+
os.system('pause')
67+
68+
try:
69+
with open(parametreFichier, 'r') as fichier:
70+
data = json.load(fichier)
71+
except FileNotFoundError:
72+
print(f'{red}[{white}x{red}] The file {parametreFichier} is not found. {reset}')
73+
os.system('pause')
74+
except json.JSONDecodeError:
75+
print(f'{red}[{white}x{red}] JSON decoding error in the file {parametreFichier}. {reset}')
76+
os.system('pause')
77+
except Exception as error:
78+
print(f'{red}[{white}x{red}] An error occurred while loading the settings: {yellow}{error}{reset}')
79+
os.system('pause')
80+
81+
def setPromptColor(setting):
82+
global promptColor
83+
if setting['promptColor'] == 'white':
84+
promptColor = white
85+
elif setting['promptColor'] == 'yellow':
86+
promptColor = yellow
87+
elif setting['promptColor'] == 'blue':
88+
promptColor = blue
89+
elif setting['promptColor'] == 'red':
90+
promptColor = red
91+
elif setting['promptColor'] == 'green':
92+
promptColor = green
93+
elif setting['promptColor'] == 'purple':
94+
promptColor = purple
95+
else:
96+
promptColor = white
97+
print(f'{ERROR} Unknown prompt color: {data['promptColor']}. Using default white.')
98+
os.system('pause')
99+
100+
setPromptColor(data)
101+
102+
try:
103+
username = os.getlogin()
104+
except:
105+
username = 'user'
106+
107+
def TIME_H():
108+
return datetime.datetime.now().strftime('%H:%M:%S')
109+
110+
def CLEAR():
111+
if sys.platform.startswith("win"):
112+
os.system("cls")
113+
else :
114+
os.system("clear")
115+
116+
def terminalTitle(title):
117+
if sys.platform.startswith("win"):
118+
os.system(f'title CodeBreak - {title}')
119+
else:
120+
sys.stdout.write(f"\033]0;CodeBreak - {title}\007")
121+
sys.stdout.flush()
122+
123+
def mainMenu():
124+
print(f'{TIME_YELLOW()} {WAIT_YELLOW} Loading main menu...')
125+
if sys.platform.startswith("win"):
126+
file = 'python ./CodeBreak.py'
127+
subprocess.run(file, shell=True)
128+
elif sys.platform.startswith("linux"):
129+
file = 'python3 ./CodeBreak.py'
130+
subprocess.run(file, shell=True)
131+
132+
def startProgram(program):
133+
if sys.platform.startswith("win"):
134+
file = f'python Program/{program}'
135+
subprocess.run(file, shell=True)
136+
elif sys.platform.startswith("linux"):
137+
file = f'python3 Program/{program}'
138+
subprocess.run(file, shell=True)
139+
140+
def startMenu(program):
141+
if sys.platform.startswith("win"):
142+
file = f'python menu/{program}'
143+
subprocess.run(file, shell=True)
144+
elif sys.platform.startswith("linux"):
145+
file = f'python3 menu/{program}'
146+
subprocess.run(file, shell=True)
147+
148+
def Pause():
149+
input(f"{TIME()} {WAIT} Press to continue >>> {reset}")
150+
def Soon():
151+
print(f'{TIME_YELLOW()} {INFO_YELLOW} The chosen option will arrive soon. {reset}')
152+
Pause()
153+
154+
ERROR = f'{red}[{white}x{red}]'
155+
156+
ADD = f'{purple}[{white}+{purple}]'
157+
INFO = f'{purple}[{white}!{purple}]'
158+
INPUT = f'{purple}[{white}>{purple}]'
159+
WAIT = f'{purple}[{white}~{purple}]'
160+
def TIME():
161+
return f'{purple}[{white}{TIME_H()}{purple}]'
162+
163+
164+
ADD_RED = f'{red}[{white}+{red}]'
165+
INFO_RED = f'{red}[{white}!{red}]'
166+
INPUT_RED = f'{red}[{white}>{red}]'
167+
WAIT_RED = f'{red}[{white}~{red}]'
168+
def TIME_RED():
169+
return f'{red}[{white}{TIME_H()}{red}]'
170+
171+
ADD_GREEN = f'{green}[{white}+{green}]'
172+
INFO_GREEN = f'{green}[{white}!{green}]'
173+
INPUT_GREEN = f'{green}[{white}>{green}]'
174+
WAIT_GREEN = f'{green}[{white}~{green}]'
175+
def TIME_GREEN():
176+
return f'{green}[{white}{TIME_H()}{green}]'
177+
178+
ADD_YELLOW = f'{yellow}[{white}+{yellow}]'
179+
INFO_YELLOW = f'{yellow}[{white}!{yellow}]'
180+
INPUT_YELLOW = f'{yellow}[{white}>{yellow}]'
181+
WAIT_YELLOW = f'{yellow}[{white}~{yellow}]'
182+
def TIME_YELLOW():
183+
return f'{yellow}[{white}{TIME_H()}{yellow}]'
184+
185+
CHOICELANG = f'{purple}[{white}1{purple}] English | [{white}2{purple}] French'
186+
187+
MainOption = [
188+
{"num": 1, "titre": "Info"},
189+
{"num": 6, "titre": "Soon"},
190+
{"num": 11, "titre": "Soon"},
191+
{"num": 2, "titre": "Setting"},
192+
{"num": 7, "titre": "Soon"},
193+
{"num": 12, "titre": "Soon"},
194+
{"num": 3, "titre": "NukeBot Discord"},
195+
{"num": 8, "titre": "Soon"},
196+
{"num": 13, "titre": "Soon"},
197+
{"num": 4, "titre": "Soon"},
198+
{"num": 9, "titre": "Soon"},
199+
{"num": 14, "titre": "Soon"},
200+
{"num": 5, "titre": "Soon"},
201+
{"num": 10, "titre": "Soon"},
202+
{"num": 15, "titre": "Soon"},
203+
]

config/info.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# Link
99
linkDiscord = 'https://discord.gg/pZSVzVkXBR'
1010
linkGithub = 'https://github.com/CIPIX-off/CodeBreak'
11+
linkGithubSimple = 'github.com/CIPIX-off/CodeBreak'
1112
linkUpdate = 'https://raw.githubusercontent.com/CIPIX-off/CodeBreak/main/config/info.py'
1213
# Webhooks
1314
webhookName = 'CodeBreak'

config/menu.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# © 2024 CIPIX
2+
# All rights reserved.
3+
# Tous droits réservés.
4+
5+
import colorama
6+
from config.config import *
7+
from config.info import *
8+
9+
colorama.init()
10+
11+
TITLE = f"""{purple}
12+
▄████▄ ▒█████ ▓█████▄ ▓█████ ▄▄▄▄ ██▀███ ▓█████ ▄▄▄ ██ ▄█▀
13+
▒██▀ ▀█ ▒██▒ ██▒▒██▀ ██▌▓█ ▀ ▓█████▄ ▓██ ▒ ██▒▓█ ▀▒████▄ ██▄█▒
14+
▒▓█ ▄ ▒██░ ██▒░██ █▌▒███ ▒██▒ ▄██▓██ ░▄█ ▒▒███ ▒██ ▀█▄ ▓███▄░
15+
▒▓▓▄ ▄██▒▒██ ██░░▓█▄ ▌▒▓█ ▄ ▒██░█▀ ▒██▀▀█▄ ▒▓█ ▄░██▄▄▄▄██ ▓██ █▄
16+
▒ ▓███▀ ░░ ████▓▒░░▒████▓ ░▒████▒░▓█ ▀█▓░██▓ ▒██▒░▒████▒▓█ ▓██▒▒██▒ █▄
17+
░ ░▒ ▒ ░░ ▒░▒░▒░ ▒▒▓ ▒ ░░ ▒░ ░░▒▓███▀▒░ ▒▓ ░▒▓░░░ ▒░ ░▒▒ ▓▒█░▒ ▒▒ ▓▒
18+
░ ▒ ░ ▒ ▒░ ░ ▒ ▒ ░ ░ ░▒░▒ ░ ░▒ ░ ▒░ ░ ░ ░ ▒ ▒▒ ░░ ░▒ ▒░
19+
░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ▒ ░ ░░ ░
20+
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░
21+
░ ░ ░
22+
{reset}"""
23+
NukeBotTitle = f"""{purple}
24+
███▄ █ █ ██ ██ ▄█▀▓█████ ▄▄▄▄ ▒█████ ▄▄▄█████▓
25+
██ ▀█ █ ██ ▓██▒ ██▄█▒ ▓█ ▀ ▓█████▄ ▒██▒ ██▒▓ ██▒ ▓▒
26+
▓██ ▀█ ██▒▓██ ▒██░▓███▄░ ▒███ ▒██▒ ▄██▒██░ ██▒▒ ▓██░ ▒░
27+
▓██▒ ▐▌██▒▓▓█ ░██░▓██ █▄ ▒▓█ ▄ ▒██░█▀ ▒██ ██░░ ▓██▓ ░
28+
▒██░ ▓██░▒▒█████▓ ▒██▒ █▄░▒████▒ ░▓█ ▀█▓░ ████▓▒░ ▒██▒ ░
29+
░ ▒░ ▒ ▒ ░▒▓▒ ▒ ▒ ▒ ▒▒ ▓▒░░ ▒░ ░ ░▒▓███▀▒░ ▒░▒░▒░ ▒ ░░
30+
░ ░░ ░ ▒░░░▒░ ░ ░ ░ ░▒ ▒░ ░ ░ ░ ▒░▒ ░ ░ ▒ ▒░ ░
31+
░ ░ ░ ░░░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ▒ ░
32+
░ ░ ░ ░ ░ ░ ░ ░ ░
33+
34+
{reset}"""
35+
LINK = f"""
36+
{blue}{linkGithub}
37+
{linkDiscord}{reset}
38+
"""
39+
def MENU(options):
40+
colonnes = 3
41+
largeur_numero = 2
42+
largeur_colonne = 30
43+
nombre_options = len(options)
44+
marge_gauche = 15
45+
for i in range(0, nombre_options, colonnes):
46+
ligne = ""
47+
for j in range(colonnes):
48+
index = i + j
49+
if index < nombre_options:
50+
option = options[index]
51+
formatedNum = f"{option['num']:0{largeur_numero}}"
52+
ligne += f"{red}[{purple}{formatedNum}{red}] {option['titre']:<{largeur_colonne}}"
53+
else:
54+
ligne += " " * (largeur_numero + 3) + " " * (largeur_colonne - 3) # Ajuster l'espace pour les cases vides
55+
print((' ' * marge_gauche) + ligne + reset)
56+
print('')
57+
58+
def Prompt(place) :
59+
return f'{red}┌───({promptColor}{username}@CodeBreak{red})─[{promptColor}~/{place}{red}]\n└──$ {white}'
60+

install.bat

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@echo off
2+
setlocal
3+
4+
ver | find "Windows" > nul
5+
if %errorlevel% == 0 (
6+
call :windows
7+
) else (
8+
call :other
9+
)
10+
exit /b
11+
12+
:windows
13+
echo Installing Python dependencies for windows...
14+
python -m pip install -r requirements.txt
15+
if %errorlevel% neq 0 (
16+
echo -------------------------------------------------
17+
echo Failed to install Python dependencies. Pausing...
18+
pause
19+
)
20+
echo ----------------------------------------------
21+
echo Python dependencies are successfully installed
22+
pause
23+
echo CodeBreak startup...
24+
python CodeBreak.py
25+
exit /b
26+
27+
:other
28+
bash -c '
29+
echo "Installing Python dependencies for other operating systems..."
30+
python3 -m pip install -r requirements.txt
31+
if [ $? -ne 0 ]; then
32+
echo "-------------------------------------------------"
33+
echo "Failed to install Python dependencies. Pausing..."
34+
read -p "Press [Enter] key to continue..."
35+
fi
36+
echo "----------------------------------------------"
37+
echo "Python dependencies are successfully installed"
38+
read -p "Press [Enter] key to continue..."
39+
echo "CodeBreak startup..."
40+
python3 CodeBreak.py
41+
'
42+
exit /b

0 commit comments

Comments
 (0)