Skip to content

Commit b681f97

Browse files
Merge pull request #70 from WhenLifeHandsYouLemons/v1.9.2
v1.9.2
2 parents 932d229 + 25b86ac commit b681f97

10 files changed

Lines changed: 180 additions & 154 deletions

Encryptext.pyw

Lines changed: 138 additions & 82 deletions
Large diffs are not rendered by default.

Original Files/build_number.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

builds/build_number.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4

builds/testing/encryptext_installer_v1.9.1.18_64bit.exe renamed to builds/release/encryptext_installer_v1.9.2_64bit.exe

21.3 MB
Binary file not shown.

builds/testing/encryptext_installer_v1.9.1.20_64bit_release.exe renamed to builds/testing/encryptext_installer_v1.9.2.1_64bit.exe

21.3 MB
Binary file not shown.
21.3 MB
Binary file not shown.

builds/testing/encryptext_installer_v1.9.1.19_64bit.exe renamed to builds/testing/encryptext_installer_v1.9.2.3_64bit.exe

21.3 MB
Binary file not shown.
21.3 MB
Binary file not shown.

encryptext_installer.py

Lines changed: 28 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/python'
22

3+
# Created by Sooraj S
4+
# https://encryptext.sooraj.dev
5+
# Free for everyone. Forever.
6+
37
from os import rename, remove, rmdir, makedirs, listdir, path, environ
48
from shutil import rmtree
59
import sys
@@ -118,18 +122,23 @@ def progress_bar(percent_done):
118122
update = input("\nAre you updating or installing Encryptext? [(u)pdating/(i)nstalling] ")
119123

120124
# Open the Encryptext.pyw file and read it into a variable
121-
file = open(getTrueFilename("Encryptext.pyw"), "r", encoding="utf8")
122-
file = file.read()
123-
text = file
125+
with open(getTrueFilename("Encryptext.pyw"), "r", encoding="utf8") as file:
126+
text = file.read()
127+
128+
# Add version number to the file
129+
file = text.split("VERSION NUMBER HERE")
130+
text = version.join(file)
131+
132+
# Change debug mode to False if it's True
133+
try:
134+
file = text.split("debug = True")
135+
text = "debug = False".join(file)
136+
except: pass
124137

125138
# Adds computed hash to file
126139
hash_str = "INSERT COMPUTED HASH HERE"
127-
file = text.split("# HASH STRING HERE")
128-
hash_line = file[1].split("'")
129-
hash_line[1] = hash_str
130-
file[1] = "'".join(hash_line)
131-
132-
text = "".join(file)
140+
file = text.split("HASH STRING HERE")
141+
text = hash_str.join(file)
133142

134143
# Communicate to old program
135144
return_attributes = ""
@@ -143,48 +152,29 @@ def progress_bar(percent_done):
143152
except:
144153
raise Exception("Something went wrong! Please try again or file a crash report on GitHub.")
145154

146-
# Find where the encryption key is stored in the file
147-
file = text.split("# ENCRYPTION KEY HERE")
148-
149155
if update == "i":
150156
# Create a key and remove the b'' from the string
151157
key = F.generate_key().decode()
152158
else:
153159
key = str(return_attributes[3].split("'")[1])
154160

155161
# Add the key to the file
156-
key_line = file[1]
157-
key_line = key_line.split("'")
158-
key_line[1] = key
159-
key_line = "'".join(key_line)
160-
file[1] = key_line
161-
162-
text = "".join(file)
162+
file = text.split("ENCRYPTION KEY HERE")
163+
text = key.join(file)
163164

164165
print("Encryption key set!")
165166

166167
possible_characters = ascii_letters + digits
167168

168-
# Find where the format item separator string is stored in the file
169-
file = text.split("# FORMAT ITEM SEPARATOR HERE")
170-
171169
if update == "i":
172170
# Create a format item separator string
173171
format_item_separator = "".join([choice(possible_characters) for i in range(randint(15, 45))])
174172
else:
175173
format_item_separator = str(return_attributes[0].split("'")[1])
176174

177175
# Add the format item separator string to the file
178-
key_line = file[1]
179-
key_line = key_line.split("'")
180-
key_line[1] = format_item_separator
181-
key_line = "'".join(key_line)
182-
file[1] = key_line
183-
184-
text = "".join(file)
185-
186-
# Find where the format separator string is stored in the file
187-
file = text.split("# FORMAT SEPARATOR HERE")
176+
file = text.split("FORMAT ITEM SEPARATOR HERE")
177+
text = format_item_separator.join(file)
188178

189179
if update == "i":
190180
# Create a format separator string
@@ -193,16 +183,8 @@ def progress_bar(percent_done):
193183
format_separator = str(return_attributes[1].split("'")[1])
194184

195185
# Add the format separator string to the file
196-
key_line = file[1]
197-
key_line = key_line.split("'")
198-
key_line[1] = format_separator
199-
key_line = "'".join(key_line)
200-
file[1] = key_line
201-
202-
text = "".join(file)
203-
204-
# Find where the format string is stored in the file
205-
file = text.split("# FORMAT STRING HERE")
186+
file = text.split("FORMAT SEPARATOR HERE")
187+
text = format_separator.join(file)
206188

207189
if update == "i":
208190
# Create a format string
@@ -211,13 +193,8 @@ def progress_bar(percent_done):
211193
format_string = str(return_attributes[2].split("'")[1])
212194

213195
# Add the format string to the file
214-
key_line = file[1]
215-
key_line = key_line.split("'")
216-
key_line[1] = format_string
217-
key_line = "'".join(key_line)
218-
file[1] = key_line
219-
220-
text = "".join(file)
196+
file = text.split("FORMAT STRING HERE")
197+
text = format_string.join(file)
221198

222199
print("Format strings set!")
223200

@@ -231,7 +208,6 @@ def progress_bar(percent_done):
231208
keep_settings = input("\nDo you want to load your settings from an old version?\nNOTE: If you don't have an older version, it will create new settings by default [(y)es/(n)o] ")
232209

233210
data = {
234-
"version": version,
235211
"recentFilePaths": [],
236212
"maxRecentFiles": 5,
237213
"otherSettings": {
@@ -256,7 +232,6 @@ def progress_bar(percent_done):
256232
file = json.load(file)
257233

258234
data = {
259-
"version": version,
260235
"recentFilePaths": file["recentFilePaths"],
261236
"maxRecentFiles": file["maxRecentFiles"],
262237
"otherSettings": {
@@ -318,7 +293,7 @@ def progress_bar(percent_done):
318293
# Moves the exe out of the dist folder
319294
rename(path.join(dir_path, "dist", "encryptext.exe"), path.join(dir_path, f"encryptext_v{version}.exe"))
320295

321-
# Create desktop shortcut
296+
# Create desktop shortcut for Windows
322297
# https://stackoverflow.com/a/69597224
323298
try:
324299
from win32com.client import Dispatch
@@ -333,7 +308,7 @@ def progress_bar(percent_done):
333308
except:
334309
print(f"Couldn't create Desktop shortcut!")
335310

336-
# Create Start Menu shortcut
311+
# Create Start Menu shortcut for Windows
337312
try:
338313
# Create Start Menu folder for Encryptext
339314
makedirs(path.join(home_dir, "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs", "Encryptext"), exist_ok=True)

installer_creator.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import hashlib
66
import PyInstaller.__main__
77

8-
version = "1.9.1"
8+
version = "1.9.2"
99
testing = False
1010

1111
def update_build_number():
12-
with open("Original Files/build_number.txt", "r") as file:
12+
with open("builds/build_number.txt", "r") as file:
1313
build_number = int(file.read().strip())
1414
build_number += 1
15-
with open("Original Files/build_number.txt", "w") as file:
15+
with open("builds/build_number.txt", "w") as file:
1616
file.write(str(build_number))
1717
return build_number
1818

@@ -27,30 +27,25 @@ def computeHash(input_string: str) -> str:
2727
return hash_object.hexdigest()
2828

2929
def modifyInstallerFile(add: bool) -> None:
30-
if add:
31-
# Add the computed hash and version number
32-
with open("encryptext_installer.py", "r+") as file:
33-
installer_file = file.read()
30+
with open("encryptext_installer.py", "r+") as file:
31+
installer_file = file.read()
32+
33+
if add:
34+
# Add the computed hash and version number
3435
installer_parts = installer_file.split("INSERT COMPUTED HASH HERE")
3536
installer_file = hash_str.join(installer_parts)
3637
installer_parts = installer_file.split("INSERT VERSION NUMBER HERE")
3738
installer_file = version.join(installer_parts)
38-
39-
file.seek(0)
40-
file.write(installer_file)
41-
file.truncate()
42-
else:
43-
# Remove the computed hash and version number
44-
with open("encryptext_installer.py", "r+") as file:
45-
installer_file = file.read()
39+
else:
40+
# Remove the computed hash and version number
4641
installer_parts = installer_file.split(hash_str)
4742
installer_file = "INSERT COMPUTED HASH HERE".join(installer_parts)
4843
installer_parts = installer_file.split(version)
4944
installer_file = "INSERT VERSION NUMBER HERE".join(installer_parts)
5045

51-
file.seek(0)
52-
file.write(installer_file)
53-
file.truncate()
46+
file.seek(0)
47+
file.write(installer_file)
48+
file.truncate()
5449

5550
# Open the key.txt file and read in the key
5651
with open("Original Files/key.txt", "r") as file:

0 commit comments

Comments
 (0)