56 Commits

Author SHA1 Message Date
2a3bf2bbcb add new class for tooltip 2025-04-21 13:29:36 +02:00
8896f59efd fix in converter and fix in import for no valid files 2025-04-21 09:39:35 +02:00
c58a630e25 format fixes 2025-04-20 00:43:01 +02:00
dc6f8cb094 format fixes 2025-04-20 00:09:04 +02:00
dcda647e90 format fixes 2025-04-19 23:29:06 +02:00
2a995eabd5 in cont_to_dict if replaced by get 2025-04-19 19:29:46 +02:00
ea750b0cfc fix tooltip "True" and "False" back to True and False 2025-04-19 14:40:37 +02:00
980ce3c7a7 Gitea response improved 2025-04-19 14:28:34 +02:00
28cc423138 class to functions and check=True to subprocess.run 2025-04-18 22:12:18 +02:00
39550b392d format with blank and pylint 2025-04-18 20:50:32 +02:00
582ef21042 reformat files 2025-04-18 15:04:22 +02:00
ca58ac86a4 fix ssldecrypt 2025-04-17 16:25:24 +02:00
177fa1cc34 fix installer 2025-04-13 20:44:28 +02:00
ca1a7a6b94 - Installer update for Open Suse Tumbleweed and Leap
- add symbolic link wirepy.py
2025-04-13 20:38:02 +02:00
a49c5b00e1 - Installer update python311 to python313 for Open Suse
- add symbolic link wirepy.py
2025-04-13 13:04:51 +02:00
75a247797d add install >/dev/null 2>&1 2025-04-09 08:51:18 +02:00
4b019b0c1f fix2 install 2025-04-09 08:27:21 +02:00
ab78eb4f59 fix installer 2025-04-09 08:16:25 +02:00
9f3f0246b4 Installer now with query and remove
icons merged
2025-04-09 08:08:48 +02:00
5302aae807 Installers will support other systems again
Installer is now finished clean with wrong password
Rename wg_main to wirepy
2025-04-07 12:46:45 +02:00
13832d916f ssl encrypt and decrypt works now 2025-03-19 21:24:33 +01:00
1667682c9d ssl part one 2025-03-08 22:13:22 +01:00
8771be760d Fixes a new user files create 2025-03-03 18:27:49 +01:00
97bf9df041 replace-old-files-with-new-files-and-remove-no longer needed 2025-03-02 15:33:42 +01:00
1bba45a6c1 add-new-install 2025-03-02 15:29:38 +01:00
a5eb6293c6 add-new-cls-mth-fc-file 2025-03-02 15:27:37 +01:00
6e54529c0f Merge pull request 'Fix for allow ipv6' (#31) from 24-02-2025 into main
Reviewed-on: #31
2025-02-24 18:59:04 +01:00
862cc91fa1 Merge pull request '1.11.2124' (#30) from 1.11.2124 into main
Reviewed-on: #30
2024-11-17 13:04:26 +01:00
22abe9f8b9 Merge pull request '- Update Translate Files' (#29) from 1.11.1924 into main
Reviewed-on: #29
2024-11-17 12:13:23 +01:00
8754e7ecda Merge pull request '- Update Translate Files' (#28) from 1.11.1824 into main
Reviewed-on: #28
2024-11-17 11:48:24 +01:00
6b75713121 Merge pull request '1.11.1824' (#27) from 1.11.1824 into main
Reviewed-on: #27
2024-11-17 11:45:10 +01:00
b68908eaef Merge pull request '1.11.1124' (#25) from 1.11.1124 into main
Reviewed-on: #25
2024-11-13 17:51:07 +01:00
66dd27cc64 Merge pull request '1.11.1024' (#24) from 1.11.1024 into main
Reviewed-on: #24
2024-11-10 17:57:57 +01:00
03a7e48018 Merge pull request '1.11.0824' (#23) from 1.11.0824 into main
Reviewed-on: #23
2024-11-08 21:24:31 +01:00
090842ab28 wg_func.py aktualisiert 2024-11-08 21:23:59 +01:00
9eb99f0859 Changelog aktualisiert
Changelog  updated
2024-11-07 19:30:08 +01:00
feb6217637 wg_func.py aktualisiert
Version number adjusted
2024-11-07 19:27:57 +01:00
5f6aaa6cf1 Merge pull request '1.11.0724' (#22) from 1.11.0724 into main
Reviewed-on: #22
2024-11-07 19:16:22 +01:00
63ed0abc98 testtheme.py gelöscht 2024-10-26 12:31:53 +02:00
3102c685fd Merge pull request '1.10.2124' (#21) from 1.10.2124 into main
Reviewed-on: #21
2024-10-22 12:41:47 +02:00
ec10f912ea Merge pull request '- Fix a ConToDict Class when Endpoint not in Wireguard config file' (#20) from 1.10.2024 into main
Reviewed-on: #20
2024-10-20 12:20:41 +02:00
96164eb132 Merge pull request '- Add Options, Help, Update Label and Update Menubutton' (#19) from 1.10.2024 into main
Reviewed-on: #19
2024-10-20 02:15:23 +02:00
a19f889950 Merge pull request '1.10.1924' (#18) from 1.10.1924 into main
Reviewed-on: #18
2024-10-19 18:06:55 +02:00
de2929896d Merge pull request '- Create file for settings (Autoupdate)' (#17) from 1.10.1224 into main
Reviewed-on: #17
2024-10-12 13:39:04 +02:00
f9d4256679 Merge pull request 'Fix msg_window and remove x , y argument' (#16) from 1.10.0424 into main
Reviewed-on: #16
2024-10-04 21:01:26 +02:00
a0b895438c Merge pull request '28-09-2024' (#15) from 28-09-2024 into main
Reviewed-on: #15
2024-09-28 14:17:38 +02:00
4c89488950 Merge pull request 'wire-py-reformat-14-09-2024' (#14) from wire-py-reformat-14-09-2024 into main
Reviewed-on: #14
2024-09-14 23:31:00 +02:00
c0ae2d2b75 Merge pull request 'wire-py-reformat-14-08-2024' (#13) from wire-py-reformat-14-08-2024 into main
Reviewed-on: #13
2024-09-05 22:22:00 +02:00
e4774abf19 Merge pull request 'fixes on empty Listbox now is disable and now works autoconnect label with read and write, delete works now with read and write' (#12) from wire-py-reformat-14-08-2024 into main
Reviewed-on: #12
2024-09-04 20:55:51 +02:00
7b1e543428 Merge pull request 'add if question and add autoconnect, autoconnect_var to class Filehandle in box_set no finish!' (#11) from wire-py-reformat-14-08-2024 into main
Reviewed-on: #11
2024-09-04 09:20:05 +02:00
6f83fc7162 Merge pull request 'wire-py-reformat-14-08-2024' (#10) from wire-py-reformat-14-08-2024 into main
Reviewed-on: #10
2024-09-04 06:26:30 +02:00
b70400b456 Merge pull request 'wire-py-reformat-14-08-2024' (#9) from wire-py-reformat-14-08-2024 into main
Reviewed-on: #9
2024-08-25 20:32:05 +02:00
e25bc154ea Merge pull request 'wire-py-reformat-14-08-2024' (#8) from wire-py-reformat-14-08-2024 into main
Reviewed-on: #8
2024-08-23 18:00:19 +02:00
7aa3cd75fe Merge pull request 'Set Style to Clam' (#7) from wire-py-reformat-14-08-2024 into main
Reviewed-on: #7
2024-08-21 22:52:27 +02:00
0b9eec8d1d Merge pull request 'add Class StartStopBTN to wg_func.py' (#6) from wire-py-reformat-14-08-2024 into main
Reviewed-on: #6
2024-08-21 12:52:51 +02:00
b9083d4698 Merge pull request 'add file dict_to_address for' (#5) from wire-py-reformat-14-08-2024 into main
Reviewed-on: #5
2024-08-21 12:00:18 +02:00
62 changed files with 2323 additions and 1424 deletions

View File

@ -6,9 +6,46 @@ My standard System: Linux Mint 22 Cinnamon
- os import in cls_mth_fc.py replaced by other methods - os import in cls_mth_fc.py replaced by other methods
- If Wire-Py already runs, prevent further start - If Wire-Py already runs, prevent further start
- for loops with lists replaced by List Comprehensions - for loops with lists replaced by List Comprehensions
- Update search after start of Wire-Py
### Added
13-04-0725
- Installer update for Open Suse Tumbleweed and Leap
- add symbolic link wirepy.py
### Added
09-04-0725
- Installer now with query and remove
- Icons merged
### Added
07-04-0725
- Installers will support other systems again
- Installer is now finished clean with wrong password
- Rename wg_main to wirepy
### Added
03-03-2025
- Fixes a new user files create
### Added
02-03-2025
- Fix ipv6 in Config File on import
- Wirepy run now as user
- settings, keys and Config Files now in ~/.config/wire_py
- For new users, the required files are created and autostart service is started.
- Tunnels are now read from the directory to view them in the list.
To display only own tunnels, and read errors are minimized.
### Added ### Added
10-11-2024 10-11-2024
@ -57,7 +94,7 @@ My standard System: Linux Mint 22 Cinnamon
### Added ### Added
27-10-2024 27-10-2024
- Add Autoconnect settings to settings.conf - Add Autoconnect settings to settings
### Added ### Added
@ -65,7 +102,7 @@ My standard System: Linux Mint 22 Cinnamon
- Add run_as Bash script and open_gitea.py python script - Add run_as Bash script and open_gitea.py python script
- Add Tooltip disable/enable - Add Tooltip disable/enable
- Rename settings to settings.conf for theme, updates and tooltip enable in one file - Rename settings to settings for theme, updates and tooltip enable in one file
### Added ### Added

4
Wire-Py.desktop Executable file → Normal file
View File

@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Name=Wire-Py Name=Wire-Py
Exec=/usr/bin/wirepy.py Exec=/usr/local/bin/wirepy.py
Terminal=false Terminal=false
Categories=Network; Categories=Network;
Icon=/usr/share/icons/wp-icons/128/wg_vpn.png Icon=/usr/share/icons/lx-icons/128/wg_vpn.png

Binary file not shown.

View File

@ -1,4 +1,4 @@
""" Classes Method and functions for lx apps """ """ Classes Method and Functions for lx Apps """
import gettext import gettext
import locale import locale
@ -9,81 +9,207 @@ import tkinter as tk
import zipfile import zipfile
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
from subprocess import check_call
from tkinter import ttk from tkinter import ttk
import requests import requests
APP = 'wirepy' APP = "wirepy"
LOCALE_DIR = "/usr/share/locale/" LOCALE_DIR = "/usr/share/locale/"
locale.bindtextdomain(APP, LOCALE_DIR) locale.bindtextdomain(APP, LOCALE_DIR)
gettext.bindtextdomain(APP, LOCALE_DIR) gettext.bindtextdomain(APP, LOCALE_DIR)
gettext.textdomain(APP) gettext.textdomain(APP)
_ = gettext.gettext _ = gettext.gettext
wg_set = Path('/etc/wire_py/settings.conf') wg_set = Path(Path.home() / ".config/wire_py/settings")
_u = Path.read_text(Path('/tmp/_u'))
class Create:
"""
This class is for the creation of the folders and files
required by Wire-Py, as well as for decryption
the tunnel from the user's home directory
"""
@staticmethod
def dir_and_files():
"""
check and create folders and files if not present
"""
pth = Path.home() / ".config/wire_py"
pth.mkdir(parents=True, exist_ok=True)
sett = Path.home() / ".config/wire_py/settings"
ks = Path.home() / ".config/wire_py/keys"
if sett.exists():
pass
else:
sett.touch()
sett.write_text(
"[UPDATES]\non\n[THEME]\nlight\n[TOOLTIP]\nTrue\n[AUTOSTART ON]\noff\n"
)
if ks.exists():
pass
else:
ks.touch()
@staticmethod
def files_for_autostart():
"""
check and create file for auto start if not present and enable the service
"""
pth2 = Path.home() / ".config/systemd/user"
pth2.mkdir(parents=True, exist_ok=True)
wg_ser = Path.home() / ".config/systemd/user/wg_start.service"
if wg_ser.exists():
pass
else:
wg_ser.touch()
wg_ser.write_text(
"[Unit]\nDescription=Automatic Tunnel Start\nAfter=network-online.target"
"\n\n[Service]\nType=oneshot\nExecStartPre=/bin/sleep 5\nExecStart=/usr/"
"local/bin/start_wg.py\n[Install]\nWantedBy=default.target"
)
check_call(["systemctl", "--user", "enable", "wg_start.service"])
@staticmethod
def make_dir():
"""Dirname "tlecdewg" = Tunnel Encrypt Decrypt Wireguard"""
dirname = Path("/tmp/tlecdcwg/")
if dirname.exists():
pass
else:
dirname.mkdir()
@staticmethod
def decrypt():
"""
This start ssl_decrypt file
"""
process = subprocess.run(
["pkexec", "/usr/local/bin/ssl_decrypt.py"],
stdout=subprocess.PIPE,
text=True,
check=True,
)
# print(process.stdout)
if process.returncode == 0:
print("File successfully decrypted...")
else:
print(f"Error with the following code... {process.returncode}")
@staticmethod
def encrypt():
"""
this start ssl_encrypt file
"""
process = subprocess.run(
["pkexec", "/usr/local/bin/ssl_encrypt.py"],
stdout=subprocess.PIPE,
text=True,
check=True,
)
print(process.stdout)
if process.returncode == 0:
print("All Files successfully encrypted...")
else:
print(f"Error with the following code... {process.returncode}")
def uos():
"""
uos = LOGIN USERNAME
This method displays the user name of the logged-in user,
even if you are rooted in a shell
"""
logname = str(Path.home())[6:]
file = Path.home() / "/tmp/.loguser"
with open(file, "w", encoding="utf-8") as f:
f.write(logname)
class GiteaUpdate: class GiteaUpdate:
""" """
Calling api_down requests the URL and the version of the running script.
Example: version = 'v. 1.1.1.1' GiteaUpdate.api_down(http://example.de, version)
Calling download requests the download URL of the running script, Calling download requests the download URL of the running script,
the taskbar image for the “Download OK” window, the taskbar image for the the taskbar image for the “Download OK” window, the taskbar image for the
“Download error” window and the variable res “Download error” window and the variable res
""" """
@staticmethod @staticmethod
def api_down(update_api_url, version): def api_down(update_api_url, version):
"""
Calling api_down requests the URL and the version of the running script.
Example: version = 'v. 1.1.1.1' GiteaUpdate.api_down(http://example.de, version)
"""
try: try:
response = requests.get(update_api_url) response = requests.get(update_api_url, timeout=10)
response_dict = response.json() response_dict = response.json()
response_dict = response_dict[0] response_dict = response_dict[0]
with open(wg_set, 'r') as set_file: with open(wg_set, "r", encoding="utf-8") as set_file:
set_file = set_file.read() set_file = set_file.read()
if 'on\n' in set_file: if "on\n" in set_file:
if version[3:] != response_dict['tag_name']: if version[3:] != response_dict["tag_name"]:
return response_dict['tag_name'] req = response_dict["tag_name"]
else: else:
return 'No Updates' req = "No Updates"
else: else:
return 'False' req = "False"
except requests.exceptions.ConnectionError: return req
return 'No Internet Connection!' except requests.exceptions.RequestException:
req = "No Internet Connection!"
return req
@staticmethod @staticmethod
def download(urld, down_ok_image, down_not_ok_image, res): def download(urld, down_ok_image, down_not_ok_image, res):
"""
this is for download new Version of wirepy
"""
try: try:
to_down = 'wget -qP ' + str(_u) + ' ' + urld to_down = "wget -qP " + str(Path.home()) + " " + urld
result = subprocess.call(to_down, shell=True) result = subprocess.call(to_down, shell=True)
if result == 0: if result == 0:
shutil.chown(str(_u) + f'/{res}.zip', 1000, 1000) shutil.chown(str(Path.home()) + f"/{res}.zip", 1000, 1000)
"""img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/lx-icons/64/info.png' # img_w, img_i, w_title, w_txt hand over
iw = r"/usr/share/icons/lx-icons/64/info.png"
ii = down_ok_image ii = down_ok_image
wt = _('Download Successful') wt = _("Download Successful")
msg_t = _('Your zip file is in home directory') msg_t = _("Your zip file is in home directory")
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
"""img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/lx-icons/64/error.png' # img_w, img_i, w_title, w_txt hand over
iw = r"/usr/share/icons/lx-icons/64/error.png"
ii = down_not_ok_image ii = down_not_ok_image
wt = _('Download error') wt = _("Download error")
msg_t = _('Download failed! Please try again') msg_t = _("Download failed! Please try again")
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
"""img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/lx-icons/64/error.png' # img_w, img_i, w_title, w_txt hand over
iw = r"/usr/share/icons/lx-icons/64/error.png"
ii = down_not_ok_image ii = down_not_ok_image
wt = _('Download error') wt = _("Download error")
msg_t = _('Download failed! No internet connection!') msg_t = _("Download failed! No internet connection!")
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None): def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
""" """
Function for different message windows for the user. with 4 arguments to be passed. Function for different message windows for the user. with 4 arguments to be passed.
To create messages with your own images, icons, and titles. As an alternative to Python Messagebox. To create messages with your own images, icons, and titles.
As an alternative to Python Messagebox.
Paths to images must be specified: r'/usr/share/icons/lx-icons/64/info.png' Paths to images must be specified: r'/usr/share/icons/lx-icons/64/info.png'
img_w = Image for Tk Window img_w = Image for Tk Window
img_i = Image for Icon img_i = Image for Icon
@ -104,17 +230,17 @@ def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
label.grid(column=1, row=0) label.grid(column=1, row=0)
if txt2 is not None and com is not None: if txt2 is not None and com is not None:
label.config(font=('Ubuntu', 11), padx=15, justify='left') label.config(font=("Ubuntu", 11), padx=15, justify="left")
msg.i_window.grid(column=0, row=0, sticky='nw') msg.i_window.grid(column=0, row=0, sticky="nw")
button2 = ttk.Button(msg, text=f'{txt2}', command=com, padding=4) button2 = ttk.Button(msg, text=f"{txt2}", command=com, padding=4)
button2.grid(column=0, row=1, sticky='e', columnspan=2) button2.grid(column=0, row=1, sticky="e", columnspan=2)
button = ttk.Button(msg, text='OK', command=msg.destroy, padding=4) button = ttk.Button(msg, text="OK", command=msg.destroy, padding=4)
button.grid(column=0, row=1, sticky='w', columnspan=2) button.grid(column=0, row=1, sticky="w", columnspan=2)
else: else:
label.config(font=('Ubuntu', 11), padx=15) label.config(font=("Ubuntu", 11), padx=15)
msg.i_window.grid(column=0, row=0) msg.i_window.grid(column=0, row=0)
button = ttk.Button(msg, text='OK', command=msg.destroy, padding=4) button = ttk.Button(msg, text="OK", command=msg.destroy, padding=4)
button.grid(column=0, columnspan=2, row=1) button.grid(column=0, columnspan=2, row=1)
img_i = tk.PhotoImage(file=img_i) img_i = tk.PhotoImage(file=img_i)
@ -129,24 +255,26 @@ class Tunnel:
Class of Methods for Wire-Py Class of Methods for Wire-Py
""" """
@classmethod
def con_to_dict(cls, file):
""" """
The config file is packed into a dictionary, The config file is packed into a dictionary,
to display the values Address , DNS and Peer in the labels to display the values Address , DNS and Peer in the labels
""" """
@classmethod
def con_to_dict(cls, file):
dictlist = [] dictlist = []
for lines in file.readlines(): for lines in file.readlines():
line_plit = lines.split() line_plit = lines.split()
dictlist = dictlist + line_plit dictlist = dictlist + line_plit
dictlist.remove('[Interface]') dictlist.remove("[Interface]")
dictlist.remove('[Peer]') dictlist.remove("[Peer]")
for items in dictlist: for items in dictlist:
if items == '=': if items == "=":
dictlist.remove(items)
if items == "::/0":
dictlist.remove(items) dictlist.remove(items)
''' Here is the beginning (Loop) of convert List to Dictionary ''' # Here is the beginning (Loop) of convert List to Dictionary
for _ in dictlist: for _ in dictlist:
a = [dictlist[0], dictlist[1]] a = [dictlist[0], dictlist[1]]
b = [dictlist[2], dictlist[3]] b = [dictlist[2], dictlist[3]]
@ -161,112 +289,141 @@ class Tunnel:
for elements in new_list: for elements in new_list:
final_dict[elements[0]] = elements[1] final_dict[elements[0]] = elements[1]
''' end... result a Dictionary ''' # end... result a Dictionary
address = final_dict['Address'] address = final_dict["Address"]
dns = final_dict['DNS'] dns = final_dict["DNS"]
if ',' in dns: if "," in dns:
dns = dns[:-1] dns = dns[:-1]
endpoint = final_dict['Endpoint'] endpoint = final_dict["Endpoint"]
if 'PresharedKey' in final_dict: pre_key = final_dict.get("PresharedKey")
pre_key = final_dict['PresharedKey'] if pre_key is None:
else: pre_key = final_dict.get("PreSharedKey")
pre_key = final_dict['PreSharedKey']
return address, dns, endpoint, pre_key return address, dns, endpoint, pre_key
@staticmethod
def active():
""" """
Shows the Active Tunnel Shows the Active Tunnel
""" """
@staticmethod active = (
def active(): os.popen('nmcli con show --active | grep -iPo "(.*)(wireguard)"')
.read()
active = os.popen('nmcli con show --active | grep -iPo "(.*)(wireguard)"').read().split() .split()
)
if not active: if not active:
active = '' active = ""
else: else:
active = active[0] active = active[0]
return active return active
"""
Shows all existing Wireguard tunnels
"""
@staticmethod @staticmethod
def list(): def list():
wg_s = os.popen('nmcli con show | grep -iPo "(.*)(wireguard)"').read().split() """
Shows all existing Wireguard tunnels a login user
"""
dirname = Path("/tmp/tlecdcwg/")
wg_s = os.listdir(dirname)
''' tl = Tunnel list # Show of 4.Element in list ''' return wg_s
tl = wg_s[::3]
return tl
@staticmethod
def export():
""" """
This will export the tunnels. This will export the tunnels.
A zipfile with current date and time is created A zipfile with current date and time is created
in the user's home directory with correct right in the user's home directory with correct right
""" """
@staticmethod
def export():
_u1 = str(_u[6:])
now_time = datetime.now() now_time = datetime.now()
now_datetime = now_time.strftime('wg-exp-' + '%m-%d-%Y' + '-' + '%H:%M') now_datetime = now_time.strftime("wg-exp-" + "%m-%d-%Y" + "-" + "%H:%M")
tl = Tunnel.list() tl = Tunnel.list()
try: try:
if len(tl) != 0: if len(tl) != 0:
wg_tar = str(_u) + '/' + now_datetime wg_tar = str(Path.home()) + "/" + now_datetime
shutil.copytree('/etc/wire_py', '/tmp/wire_py', dirs_exist_ok=True) shutil.copytree("/tmp/tlecdcwg/", "/tmp/wire_py", dirs_exist_ok=True)
source = Path('/tmp/wire_py') source = Path("/tmp/wire_py")
Path.unlink(Path(source) / 'wg_py', missing_ok=True) shutil.make_archive(wg_tar, "zip", source)
Path.unlink(Path(source) / '.keys', missing_ok=True)
Path.unlink(Path(source) / 'settings.conf', missing_ok=True)
shutil.make_archive(wg_tar, 'zip', source)
shutil.chown(wg_tar + '.zip', 1000, 1000)
shutil.rmtree(source) shutil.rmtree(source)
with zipfile.ZipFile((wg_tar + '.zip'), 'r') as zf: with zipfile.ZipFile((wg_tar + ".zip"), "r") as zf:
if len(zf.namelist()) != 0: if len(zf.namelist()) != 0:
"""img_w, img_i, w_title, w_txt hand over""" # img_w, img_i, w_title, w_txt hand over
iw = r'/usr/share/icons/lx-icons/64/info.png' iw = r"/usr/share/icons/lx-icons/64/info.png"
ii = r'/usr/share/icons/wp-icons/48/wg_vpn.png' ii = r"/usr/share/icons/lx-icons/48/wg_vpn.png"
wt = _('Export Successful') wt = _("Export Successful")
msg_t = _('Your zip file is in home directory') msg_t = _("Your zip file is in home directory")
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
"""img_w, img_i, w_title, w_txt hand over""" # img_w, img_i, w_title, w_txt hand over
iw = r'/usr/share/icons/lx-icons/64/error.png' iw = r"/usr/share/icons/lx-icons/64/error.png"
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r"/usr/share/icons/lx-icons/48/wg_msg.png"
wt = _('Export error') wt = _("Export error")
msg_t = _('Export failed! Please try again') msg_t = _("Export failed! Please try again")
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
"""img_w, img_i, w_title, w_txt hand over""" # img_w, img_i, w_title, w_txt hand over
iw = r'/usr/share/icons/lx-icons/64/info.png' iw = r"/usr/share/icons/lx-icons/64/info.png"
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r"/usr/share/icons/lx-icons/48/wg_msg.png"
wt = _('Select tunnel') wt = _("Select tunnel")
msg_t = _('Please first import tunnel') msg_t = _("Please first import tunnel")
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
except TypeError: except TypeError:
pass pass
class Tipi:
"""
Class for Tooltip setting write in File
Calling request path to file
"""
@staticmethod
def if_tip(path): def if_tip(path):
with open(path, 'r') as set_file2: """
method that writes in file whether tooltip is displayed or not
"""
with open(path, "r", encoding="utf-8") as set_file2:
lines2 = set_file2.readlines() lines2 = set_file2.readlines()
if 'False\n' in lines2: if "False\n" in lines2:
return False tip = False
else: else:
return True tip = True
return tip
class Tooltip:
"""
class for Tooltip
imoprt Tooltip
example: Tooltip(label, "Show tooltip on label")
examble: Tooltip(button, "Show tooltip on button")
info: label and button is parrent.
"""
def __init__(self, widget, text):
self.widget = widget
self.text = text
self.tooltip_window = None
self.widget.bind("<Enter>", self.show_tooltip)
self.widget.bind("<Leave>", self.hide_tooltip)
def show_tooltip(self, event=None):
if self.tooltip_window or not self.text:
return
x, y, _, _ = self.widget.bbox("insert")
x += self.widget.winfo_rootx() + 25
y += self.widget.winfo_rooty() + 20
self.tooltip_window = tw = tk.Toplevel(self.widget)
tw.wm_overrideredirect(True)
tw.wm_geometry(f"+{x}+{y}")
label = tk.Label(tw, text=self.text, relief="solid", borderwidth=1, padx=5, pady=5)
label.grid()
def hide_tooltip(self, event=None):
if self.tooltip_window:
self.tooltip_window.destroy()
self.tooltip_window = None
wg_tips = Tipi.if_tip(wg_set)

199
install
View File

@ -6,58 +6,79 @@ BLUE='\033[30;1;34m'
install_file_with(){ install_file_with(){
clear clear
mkdir -p ~/.config/wire_py && touch ~/.config/wire_py/keys && cp -u settings ~/.config/wire_py/ && \
mkdir -p ~/.config/systemd/user && cp -u wg_start.service ~/.config/systemd/user/ && \
systemctl --user enable wg_start.service >/dev/null 2>&1
sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/
if [ $? -ne 0 ]
then
systemctl --user disable wg_start.service
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
exit 0
else
sudo apt install python3-tk && \ sudo apt install python3-tk && \
sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \ sudo cp -fv wirepy.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \ sudo cp -uR lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \ sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ sudo cp -fv Wire-Py.desktop /usr/share/applications/ && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ sudo ln -sf /usr/local/bin/wirepy.py /usr/local/bin/wirepy
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \ sudo mkdir -p /usr/local/etc/ssl
sudo cp -u wg_start.service /lib/systemd/system/ && \ if [ ! -f /usr/local/etc/ssl/pwgk.pem ]
sudo systemctl enable wg_start.service then
sudo openssl genrsa -out /usr/local/etc/ssl/pwgk.pem 4096
fi
fi
} }
install_arch_d(){ install_arch_d(){
clear clear
mkdir -p ~/.config/wire_py && touch ~/.config/wire_py/keys && cp -u settings ~/.config/wire_py/ && \
mkdir -p ~/.config/systemd/user && cp -u wg_start.service ~/.config/systemd/user/ && \
systemctl --user enable wg_start.service >/dev/null 2>&1
sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/
if [ $? -ne 0 ]
then
systemctl --user disable wg_start.service
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
exit 0
else
sudo pacman -S --noconfirm tk python3 python-requests && \ sudo pacman -S --noconfirm tk python3 python-requests && \
sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \ sudo cp -fv wirepy.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \ sudo cp -uR lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \ sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ sudo cp -fv Wire-Py.desktop /usr/share/applications/ && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ sudo ln -sf /usr/local/bin/wirepy.py /usr/local/bin/wirepy
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \ sudo mkdir -p /usr/local/etc/ssl
sudo cp -u wg_start.service /lib/systemd/system/ && \ if [ ! -f /usr/local/etc/ssl/pwgk.pem ]
sudo systemctl enable wg_start.service then
sudo openssl genrsa -out /usr/local/etc/ssl/pwgk.pem 4096
fi
fi
} }
install(){
if grep -i 'debian' /etc/os-release > /dev/null 2>&1 if grep -i 'debian' /etc/os-release > /dev/null 2>&1
then then
groups > /tmp/isgroup groups > /tmp/isgroup
if grep 'sudo' /tmp/isgroup if grep 'sudo' /tmp/isgroup
then then
install_file_with install_file_with
else else
echo -e "$BLUE"The installer found that they are not in the group sudo."" echo -e "$BLUE"The installer found that they are not in the group sudo.""
echo -e "with "$RED"su -"$BLUE" "they can enter the root shell in which they then"" echo -e "with "$RED"su -"$BLUE" "they can enter the root shell in which they then""
echo -e "enter "$GREEN""usermod -aG sudo $USER.""$BLUE"" echo -e "enter "$GREEN""usermod -aG sudo $USER.""$BLUE""
echo -e ""after logging in from the system, they can then run Wire-Py install again." $NORMAL" echo -e ""after logging in from the system, they can then run Wire-Py install again." $NORMAL"
read -n 1 -s -r -p $"To close the Window press a button" read -n 1 -s -r -p $"Press Enter to exit"
clear clear
exit 0 exit 0
fi
fi
elif grep -i 'mint\|ubuntu\|pop|' /etc/os-release > /dev/null 2>&1 elif grep -i 'mint\|ubuntu\|pop|' /etc/os-release > /dev/null 2>&1
then then
install_file_with install_file_with
elif grep -i 'arch' /etc/os-release > /dev/null 2>&1 elif grep -i 'arch' /etc/os-release > /dev/null 2>&1
then then
groups > /tmp/isgroup groups > /tmp/isgroup
@ -75,7 +96,7 @@ elif grep -i 'arch' /etc/os-release > /dev/null 2>&1
echo "remove '#' on # %wheel ALL=(ALL) ALL and save the file" echo "remove '#' on # %wheel ALL=(ALL) ALL and save the file"
echo -e "then enter "$GREEN"gpasswd -a $USER wheel.""$NORMAL" echo -e "then enter "$GREEN"gpasswd -a $USER wheel.""$NORMAL"
echo "after logging in from the system, they can then run Wire-Py install again." echo "after logging in from the system, they can then run Wire-Py install again."
read -n 1 -s -r -p $"To close the Window press a button" read -n 1 -s -r -p $"Press Enter to exit"
clear clear
exit 0 exit 0
@ -85,51 +106,123 @@ elif grep -i '|manjaro\|garuda\|endeavour|' /etc/os-release > /dev/null 2>&1
then then
install_arch_d install_arch_d
elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1 elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1
then then
if ! which python3-tkinter &> /dev/null clear
then sudo dnf install python3-tkinter -y mkdir -p ~/.config/wire_py && touch ~/.config/wire_py/keys && cp -u settings ~/.config/wire_py/ && \
mkdir -p ~/.config/systemd/user && cp -u wg_start.service ~/.config/systemd/user/ && \
sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \ systemctl --user enable wg_start.service >/dev/null 2>&1
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \ sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/
sudo cp -u settings.conf /etc/wire_py/ && \ if [ $? -ne 0 ]
then
systemctl --user disable wg_start.service
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
exit 0
else
sudo dnf install python3-tkinter -y
sudo cp -fv wirepy.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
sudo cp -uR lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \ sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \ sudo cp -fv Wire-Py.desktop /usr/share/applications/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ sudo ln -sf /usr/local/bin/wirepy.py /usr/local/bin/wirepy
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ sudo mkdir -p /usr/local/etc/ssl
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ if [ ! -f /usr/local/etc/ssl/pwgk.pem ]
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \ then
sudo cp -u wg_start.service /lib/systemd/system/ && \ sudo openssl genrsa -out /usr/local/etc/ssl/pwgk.pem 4096
sudo systemctl enable wg_start.service fi
fi fi
elif grep -i 'suse' /etc/os-release > /dev/null 2>&1 elif grep -i 'suse' /etc/os-release > /dev/null 2>&1
then then
if ! which python311-tk &> /dev/null clear
then sudo zypper install python311-tk mkdir -p ~/.config/wire_py && touch ~/.config/wire_py/keys && cp -u settings ~/.config/wire_py/ && \
sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \ mkdir -p ~/.config/systemd/user && cp -u wg_start.service ~/.config/systemd/user/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \ systemctl --user enable wg_start.service >/dev/null 2>&1
sudo cp -u settings.conf /etc/wire_py/ && \ sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/
if [ $? -ne 0 ]
then
systemctl --user disable wg_start.service
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
exit 0
else
sudo cp -fv wirepy.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
sudo cp -uR lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \ sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \ sudo cp -fv Wire-Py.desktop /usr/share/applications/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ sudo ln -sf /usr/local/bin/wirepy.py /usr/local/bin/wirepy
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ sudo mkdir -p /usr/local/etc/ssl
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ if [ ! -f /usr/local/etc/ssl/pwgk.pem ]
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \ then
sudo cp -u wg_start.service /lib/systemd/system/ && \ sudo openssl genrsa -out /usr/local/etc/ssl/pwgk.pem 4096
sudo systemctl enable wg_start.service
fi fi
if grep -i 'Tumbleweed' /etc/os-release > /dev/null 2>&1
then
sudo zypper install python313-tk
else
sudo zypper install python36-tk
fi
fi
else else
clear clear
echo $"Your System could not be determined." echo $"Your System could not be determined."
echo echo
read -n 1 -s -r -p $"To close the window press a button" read -n 1 -s -r -p $"Press Enter to exit"
clear clear
exit 0 exit 0
fi fi
clear #clear
read -n 1 -s -r -p $"To close the Window press a button" read -n 1 -s -r -p $"Press Enter to exit"
clear clear
}
remove(){
sudo rm -f /usr/local/bin/wirepy /usr/local/bin/wirepy.py /usr/local/bin/start_wg.py \
/usr/local/bin/cls_mth_fc.py /usr/local/bin/ssl_encrypt.py /usr/local/bin/ssl_decrypt.py
if [ $? -ne 0 ]
then
exit 0
else
systemctl --user disable wg_start.service
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
sudo rm /usr/share/applications/Wire-Py.desktop
sudo rm /usr/share/locale/de/LC_MESSAGES/languages/de/wirepy.mo
sudo rm -r /usr/local/etc/ssl
which syncpy >/dev/null
if [ $? -ne 0 ]
then
sudo rm -r /usr/share/icons/lx-icons && sudo rm -r /usr/share/TK-Themes
fi
echo
read -p "Press Enter to exit..."
fi
}
which wirepy >/dev/null
if [ $? -eq 0 ]
then
echo "Do you want to update/reinstall or uninstall wirepy?"
echo
echo "Update/reinstall: press y, uninstall press r"
echo
read -n 1 -s -r -p "Cancel with any other key..." result
case $result in
[y]* ) clear; install; exit;;
[Y]* ) clear; install; exit;;
[j]* ) clear; install; exit;;
[J]* ) clear; install; exit;;
[r]* ) clear; remove; exit;;
[R]* ) clear; remove; exit;;
esac
clear
else
install
fi

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -1,5 +0,0 @@
#!/usr/bin/python3
import webbrowser
webbrowser.open('https://git.ilunix.de/punix/Wire-Py')

42
org.sslcrypt.policy Normal file
View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<!--
Policy definitions for ssl_encrypt and ssl_decrypt
Copyright (C) 2025 Désiré Werner Menrath <polunga40@unity-mail.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see
<http://www.gnu.org/licenses/>.
-->
<policyconfig>
<action id="org.ssl_encrypt">
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/ssl_encrypt.py</annotate>
</action>
<action id="org.ssl_decrypt">
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/ssl_decrypt.py</annotate>
</action>
</policyconfig>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>Project Wire-Py</vendor>
<vendor_url>https://git.ilunix.de/punix/Wire-Py</vendor_url>
<icon_name>wg-vpn</icon_name>
<action id="org.wirepy">
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/wg_main.py</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

2
run_as
View File

@ -1,2 +0,0 @@
#!/bin/bash
/usr/bin/./open_gitea.py

59
ssl_decrypt.py Executable file
View File

@ -0,0 +1,59 @@
#!/usr/bin/python3
""" This Script decrypt Wireguardfiles for Wirepy users """
import os
import shutil
from pathlib import Path
from subprocess import check_call
uname = Path("/tmp/.loguser")
with open(uname, "r", encoding="utf-8") as f:
logname = f.readline()
# Dirname "tlecdewg" = Tunnel Encrypt Decrypt Wireguard
dirname = Path("/tmp/tlecdcwg/")
keyfile = Path(f"/home/{logname}/.config/wire_py/pbwgk.pem")
PKEYFILE = "/usr/local/etc/ssl/pwgk.pem"
if not keyfile.is_file():
check_call(
[
"openssl",
"rsa",
"-in",
PKEYFILE,
"-out",
keyfile,
"-outform",
"PEM",
"-pubout",
]
)
shutil.chown(keyfile, 1000, 1000)
dirname2 = "/home/" + logname + "/.config/wire_py/"
detl = os.listdir(dirname2)
os.chdir(dirname2)
detl.remove("keys")
detl.remove("settings")
if os.path.exists(dirname2 + "pbwgk.pem"):
detl.remove("pbwgk.pem")
for detunnels in detl:
tlname2 = detunnels[:-4] + ".conf"
extpath = str(dirname) + "/" + tlname2
check_call(
[
"openssl",
"pkeyutl",
"-decrypt",
"-inkey",
PKEYFILE,
"-in",
detunnels,
"-out",
extpath,
]
)
shutil.chown(extpath, 1000, 1000)

83
ssl_encrypt.py Executable file
View File

@ -0,0 +1,83 @@
#!/usr/bin/python3
""" This Script encrypt Wireguardfiles for Wirepy users for more Security """
import os
import shutil
from pathlib import Path
from subprocess import check_call
uname = Path("/tmp/.loguser")
with open(uname, "r", encoding="utf-8") as f:
logname = f.readline()
keyfile = Path(f"/home/{logname}/.config/wire_py/pbwgk.pem")
dirname = Path("/tmp/tlecdcwg/")
PKEYFILE = "/usr/local/etc/ssl/pwgk.pem"
if not keyfile.is_file():
check_call(
[
"openssl",
"rsa",
"-in",
PKEYFILE,
"-out",
keyfile,
"-outform",
"PEM",
"-pubout",
]
)
shutil.chown(keyfile, 1000, 1000)
if dirname.exists():
tl = os.listdir(str(dirname))
CPTH = str(keyfile)
CRYPTFILES = CPTH[:-9]
if keyfile.exists() and len(tl) != 0:
for tunnels in tl:
sourcetl = str(dirname) + "/" + tunnels
tlname = CRYPTFILES + tunnels[:-5] + ".dat"
check_call(
[
"openssl",
"pkeyutl",
"-encrypt",
"-inkey",
keyfile,
"-pubin",
"-in",
sourcetl,
"-out",
tlname,
]
)
else:
if dirname.exists():
tl = os.listdir(str(dirname))
CPTH = str(keyfile)
CRYPTFILES = CPTH[:-9]
if keyfile.exists() and len(tl) != 0:
for tunnels in tl:
sourcetl = str(dirname) + "/" + tunnels
tlname = CRYPTFILES + tunnels[:-5] + ".dat"
check_call(
[
"openssl",
"pkeyutl",
"-encrypt",
"-inkey",
keyfile,
"-pubin",
"-in",
sourcetl,
"-out",
tlname,
]
)

View File

@ -1,14 +1,18 @@
#!/usr/bin/python3 #!/usr/bin/python3
from subprocess import check_call """
This script belongs to wirepy and is for the auto start of the tunnel
"""
from pathlib import Path from pathlib import Path
from subprocess import check_call
path_to_file = Path('/etc/wire_py/settings.conf') path_to_file = Path(Path.home() / ".config/wire_py/settings")
with open(path_to_file, 'r') as a_con: with open(path_to_file, "r", encoding="utf-8") as a_con:
# This funtion is for the independent autostart of the previously selected tunnel
lines = a_con.readlines() lines = a_con.readlines()
a_con = lines[7].strip() a_con = lines[7].strip()
if a_con != 'off': if a_con != "off":
check_call(['nmcli', 'connection', 'up', a_con]) check_call(["nmcli", "connection", "up", a_con])
else: else:
pass pass

1161
wg_main.py

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,6 @@ After=network-online.target
[Service] [Service]
Type=oneshot Type=oneshot
ExecStartPre=/bin/sleep 5 ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/start_wg.py ExecStart=/usr/local/bin/start_wg.py
[Install] [Install]
WantedBy=multi-user.target WantedBy=default.target

1614
wirepy.py

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB