Compare commits
1 Commits
main
...
24-02-2025
Author | SHA1 | Date | |
---|---|---|---|
7881355f00 |
4
.idea/workspace.xml
generated
@ -350,7 +350,7 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1727379755537</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00055" summary="fix installer add .keys file">
|
||||
<task id="LOCAL-00055" summary="fix installer add keys file">
|
||||
<option name="closed" value="true" />
|
||||
<created>1727380793216</created>
|
||||
<option name="number" value="00055" />
|
||||
@ -579,7 +579,7 @@
|
||||
<MESSAGE value="info icon shadow fix end msg Export fix to" />
|
||||
<MESSAGE value="little fixes" />
|
||||
<MESSAGE value="fix msg_boxes when tunnel list = 0 a Start, Delete and Export" />
|
||||
<MESSAGE value="fix installer add .keys file" />
|
||||
<MESSAGE value="fix installer add keys file" />
|
||||
<MESSAGE value="Changelog create When exporting, the folder is now copied to /tmp and the non .conf files are deleted before the zip file is created. In main.py os import removed. Since os have been replaced by pathlib and shutil. Start with version number 1.4.7 Message window size corrected so text is displayed better" />
|
||||
<MESSAGE value="Fix msg_window and remove x , y argument Install further adapted and with colored text if user is not in group sudo or wheel. Added to install Opensuse for installation" />
|
||||
<MESSAGE value=" - Menu add - New Modern Dark and Light(default) Theme" />
|
||||
|
30
Changelog
@ -6,35 +6,7 @@ My standard System: Linux Mint 22 Cinnamon
|
||||
- os import in cls_mth_fc.py replaced by other methods
|
||||
- If Wire-Py already runs, prevent further start
|
||||
- for loops with lists replaced by List Comprehensions
|
||||
|
||||
|
||||
### 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
|
||||
|
||||
- Crypt and Decrypt Config Files in ~/.config/wire_py
|
||||
|
||||
### Added
|
||||
02-03-2025
|
||||
|
4
Wire-Py.desktop
Normal file → Executable file
@ -1,7 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Wire-Py
|
||||
Exec=/usr/local/bin/wirepy.py
|
||||
Exec=/usr/local/bin/wg_main.py
|
||||
Terminal=false
|
||||
Categories=Network;
|
||||
Icon=/usr/share/icons/lx-icons/128/wg_vpn.png
|
||||
Icon=/usr/share/icons/wp-icons/128/wg_vpn.png
|
||||
|
358
cls_mth_fc.py
@ -1,212 +1,123 @@
|
||||
""" Classes Method and Functions for lx Apps """
|
||||
""" Classes Method and functions for lx apps """
|
||||
|
||||
import gettext
|
||||
import locale
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from subprocess import check_call
|
||||
import tkinter as tk
|
||||
import zipfile
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from subprocess import check_call
|
||||
from tkinter import ttk
|
||||
|
||||
import requests
|
||||
|
||||
APP = "wirepy"
|
||||
APP = 'wirepy'
|
||||
LOCALE_DIR = "/usr/share/locale/"
|
||||
locale.bindtextdomain(APP, LOCALE_DIR)
|
||||
gettext.bindtextdomain(APP, LOCALE_DIR)
|
||||
gettext.textdomain(APP)
|
||||
_ = gettext.gettext
|
||||
|
||||
wg_set = Path(Path.home() / ".config/wire_py/settings")
|
||||
def dirs_and_files():
|
||||
|
||||
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'
|
||||
|
||||
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
|
||||
"""
|
||||
if sett.exists():
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def dir_and_files():
|
||||
"""
|
||||
check and create folders and files if not present
|
||||
"""
|
||||
else:
|
||||
sett.touch()
|
||||
sett.write_text('[UPDATES]\non\n[THEME]\nlight\n[TOOLTIP]\nTrue\n[AUTOSTART ON]\noff')
|
||||
|
||||
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 ks.exists():
|
||||
pass
|
||||
|
||||
if sett.exists():
|
||||
pass
|
||||
else:
|
||||
ks.touch()
|
||||
|
||||
else:
|
||||
sett.touch()
|
||||
sett.write_text(
|
||||
"[UPDATES]\non\n[THEME]\nlight\n[TOOLTIP]\nTrue\n[AUTOSTART ON]\noff\n"
|
||||
)
|
||||
def files_for_autostart():
|
||||
|
||||
if ks.exists():
|
||||
pass
|
||||
pth2 = Path.home() / '.config/systemd/user'
|
||||
pth2.mkdir(parents=True, exist_ok=True)
|
||||
wg_ser = Path.home() / '.config/systemd/user/wg_start.service'
|
||||
|
||||
else:
|
||||
ks.touch()
|
||||
if wg_ser.exists():
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def files_for_autostart():
|
||||
"""
|
||||
check and create file for auto start if not present and enable the service
|
||||
"""
|
||||
else:
|
||||
wg_ser.touch()
|
||||
sett.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])
|
||||
|
||||
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)
|
||||
wg_set = Path(Path.home() / '.config/wire_py/settings')
|
||||
|
||||
|
||||
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,
|
||||
the taskbar image for the “Download OK” window, the taskbar image for the
|
||||
“Download error” window and the variable res
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
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:
|
||||
response = requests.get(update_api_url, timeout=10)
|
||||
response = requests.get(update_api_url)
|
||||
response_dict = response.json()
|
||||
response_dict = response_dict[0]
|
||||
with open(wg_set, "r", encoding="utf-8") as set_file:
|
||||
with open(wg_set, 'r') as set_file:
|
||||
set_file = set_file.read()
|
||||
if "on\n" in set_file:
|
||||
if version[3:] != response_dict["tag_name"]:
|
||||
req = response_dict["tag_name"]
|
||||
if 'on\n' in set_file:
|
||||
if version[3:] != response_dict['tag_name']:
|
||||
return response_dict['tag_name']
|
||||
else:
|
||||
req = "No Updates"
|
||||
return 'No Updates'
|
||||
else:
|
||||
req = "False"
|
||||
return req
|
||||
except requests.exceptions.RequestException:
|
||||
req = "No Internet Connection!"
|
||||
return req
|
||||
return 'False'
|
||||
except requests.exceptions.ConnectionError:
|
||||
return 'No Internet Connection!'
|
||||
|
||||
@staticmethod
|
||||
def download(urld, down_ok_image, down_not_ok_image, res):
|
||||
"""
|
||||
this is for download new Version of wirepy
|
||||
"""
|
||||
try:
|
||||
to_down = "wget -qP " + str(Path.home()) + " " + urld
|
||||
to_down = 'wget -qP ' + str(Path.home()) + ' ' + urld
|
||||
result = subprocess.call(to_down, shell=True)
|
||||
if result == 0:
|
||||
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"
|
||||
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'
|
||||
ii = down_ok_image
|
||||
wt = _("Download Successful")
|
||||
msg_t = _("Your zip file is in home directory")
|
||||
wt = _('Download Successful')
|
||||
msg_t = _('Your zip file is in home directory')
|
||||
msg_window(iw, ii, wt, msg_t)
|
||||
|
||||
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
|
||||
wt = _("Download error")
|
||||
msg_t = _("Download failed! Please try again")
|
||||
wt = _('Download error')
|
||||
msg_t = _('Download failed! Please try again')
|
||||
msg_window(iw, ii, wt, msg_t)
|
||||
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
|
||||
wt = _("Download error")
|
||||
msg_t = _("Download failed! No internet connection!")
|
||||
wt = _('Download error')
|
||||
msg_t = _('Download failed! No internet connection!')
|
||||
msg_window(iw, ii, wt, msg_t)
|
||||
|
||||
|
||||
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.
|
||||
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'
|
||||
img_w = Image for Tk Window
|
||||
img_i = Image for Icon
|
||||
@ -227,17 +138,17 @@ def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
|
||||
label.grid(column=1, row=0)
|
||||
|
||||
if txt2 is not None and com is not None:
|
||||
label.config(font=("Ubuntu", 11), padx=15, justify="left")
|
||||
msg.i_window.grid(column=0, row=0, sticky="nw")
|
||||
button2 = ttk.Button(msg, text=f"{txt2}", command=com, padding=4)
|
||||
button2.grid(column=0, row=1, sticky="e", columnspan=2)
|
||||
button = ttk.Button(msg, text="OK", command=msg.destroy, padding=4)
|
||||
button.grid(column=0, row=1, sticky="w", columnspan=2)
|
||||
label.config(font=('Ubuntu', 11), padx=15, justify='left')
|
||||
msg.i_window.grid(column=0, row=0, sticky='nw')
|
||||
button2 = ttk.Button(msg, text=f'{txt2}', command=com, padding=4)
|
||||
button2.grid(column=0, row=1, sticky='e', columnspan=2)
|
||||
button = ttk.Button(msg, text='OK', command=msg.destroy, padding=4)
|
||||
button.grid(column=0, row=1, sticky='w', columnspan=2)
|
||||
|
||||
else:
|
||||
label.config(font=("Ubuntu", 11), padx=15)
|
||||
label.config(font=('Ubuntu', 11), padx=15)
|
||||
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)
|
||||
|
||||
img_i = tk.PhotoImage(file=img_i)
|
||||
@ -252,26 +163,26 @@ class Tunnel:
|
||||
Class of Methods for Wire-Py
|
||||
"""
|
||||
|
||||
"""
|
||||
The config file is packed into a dictionary,
|
||||
to display the values Address , DNS and Peer in the labels
|
||||
"""
|
||||
@classmethod
|
||||
def con_to_dict(cls, file):
|
||||
"""
|
||||
The config file is packed into a dictionary,
|
||||
to display the values Address , DNS and Peer in the labels
|
||||
"""
|
||||
|
||||
dictlist = []
|
||||
for lines in file.readlines():
|
||||
line_plit = lines.split()
|
||||
dictlist = dictlist + line_plit
|
||||
dictlist.remove("[Interface]")
|
||||
dictlist.remove("[Peer]")
|
||||
dictlist.remove('[Interface]')
|
||||
dictlist.remove('[Peer]')
|
||||
for items in dictlist:
|
||||
if items == "=":
|
||||
dictlist.remove(items)
|
||||
if items == "::/0":
|
||||
if items == '=':
|
||||
dictlist.remove(items)
|
||||
if items == '::/0':
|
||||
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:
|
||||
a = [dictlist[0], dictlist[1]]
|
||||
b = [dictlist[2], dictlist[3]]
|
||||
@ -286,105 +197,112 @@ class Tunnel:
|
||||
for elements in new_list:
|
||||
final_dict[elements[0]] = elements[1]
|
||||
|
||||
# end... result a Dictionary
|
||||
''' end... result a Dictionary '''
|
||||
|
||||
address = final_dict["Address"]
|
||||
dns = final_dict["DNS"]
|
||||
if "," in dns:
|
||||
address = final_dict['Address']
|
||||
dns = final_dict['DNS']
|
||||
if ',' in dns:
|
||||
dns = dns[:-1]
|
||||
endpoint = final_dict["Endpoint"]
|
||||
if "PresharedKey" in final_dict:
|
||||
pre_key = final_dict["PresharedKey"]
|
||||
endpoint = final_dict['Endpoint']
|
||||
if 'PresharedKey' in final_dict:
|
||||
pre_key = final_dict['PresharedKey']
|
||||
else:
|
||||
pre_key = final_dict["PreSharedKey"]
|
||||
pre_key = final_dict['PreSharedKey']
|
||||
return address, dns, endpoint, pre_key
|
||||
|
||||
"""
|
||||
Shows the Active Tunnel
|
||||
"""
|
||||
@staticmethod
|
||||
def active():
|
||||
"""
|
||||
Shows the Active Tunnel
|
||||
"""
|
||||
active = (
|
||||
os.popen('nmcli con show --active | grep -iPo "(.*)(wireguard)"')
|
||||
.read()
|
||||
.split()
|
||||
)
|
||||
|
||||
active = os.popen('nmcli con show --active | grep -iPo "(.*)(wireguard)"').read().split()
|
||||
if not active:
|
||||
active = ""
|
||||
active = ''
|
||||
else:
|
||||
active = active[0]
|
||||
|
||||
return active
|
||||
|
||||
"""
|
||||
Shows all existing Wireguard tunnels a login user
|
||||
"""
|
||||
@staticmethod
|
||||
def list():
|
||||
"""
|
||||
Shows all existing Wireguard tunnels a login user
|
||||
"""
|
||||
dirname = Path("/tmp/tlecdcwg/")
|
||||
dirname = Path.home() / '.config/wire_py/'
|
||||
wg_s = os.listdir(dirname)
|
||||
|
||||
wg_s.remove('keys')
|
||||
wg_s.remove('settings')
|
||||
|
||||
return wg_s
|
||||
|
||||
"""
|
||||
This will export the tunnels.
|
||||
A zipfile with current date and time is created
|
||||
in the user's home directory with correct right
|
||||
"""
|
||||
@staticmethod
|
||||
def export():
|
||||
"""
|
||||
This will export the tunnels.
|
||||
A zipfile with current date and time is created
|
||||
in the user's home directory with correct right
|
||||
"""
|
||||
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()
|
||||
|
||||
try:
|
||||
if len(tl) != 0:
|
||||
wg_tar = str(Path.home()) + "/" + now_datetime
|
||||
shutil.copytree("/tmp/tlecdcwg/", "/tmp/wire_py", dirs_exist_ok=True)
|
||||
source = Path("/tmp/wire_py")
|
||||
shutil.make_archive(wg_tar, "zip", source)
|
||||
# shutil.chown(wg_tar + '.zip', 1000, 1000)
|
||||
wg_tar = str(Path.home()) + '/' + now_datetime
|
||||
shutil.copytree(Path.home() / '.config/wire_py/', '/tmp/wire_py', dirs_exist_ok=True)
|
||||
source = Path('/tmp/wire_py')
|
||||
Path.unlink(Path(source) / 'wg_py', missing_ok=True)
|
||||
Path.unlink(Path(source) / 'keys', missing_ok=True)
|
||||
Path.unlink(Path(source) / 'settings', missing_ok=True)
|
||||
shutil.make_archive(wg_tar, 'zip', source)
|
||||
#shutil.chown(wg_tar + '.zip', 1000, 1000)
|
||||
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:
|
||||
|
||||
# img_w, img_i, w_title, w_txt hand over
|
||||
iw = r"/usr/share/icons/lx-icons/64/info.png"
|
||||
ii = r"/usr/share/icons/lx-icons/48/wg_vpn.png"
|
||||
wt = _("Export Successful")
|
||||
msg_t = _("Your zip file is in home directory")
|
||||
"""img_w, img_i, w_title, w_txt hand over"""
|
||||
iw = r'/usr/share/icons/lx-icons/64/info.png'
|
||||
ii = r'/usr/share/icons/wp-icons/48/wg_vpn.png'
|
||||
wt = _('Export Successful')
|
||||
msg_t = _('Your zip file is in home directory')
|
||||
msg_window(iw, ii, wt, msg_t)
|
||||
|
||||
else:
|
||||
|
||||
# img_w, img_i, w_title, w_txt hand over
|
||||
iw = r"/usr/share/icons/lx-icons/64/error.png"
|
||||
ii = r"/usr/share/icons/lx-icons/48/wg_msg.png"
|
||||
wt = _("Export error")
|
||||
msg_t = _("Export failed! Please try again")
|
||||
"""img_w, img_i, w_title, w_txt hand over"""
|
||||
iw = r'/usr/share/icons/lx-icons/64/error.png'
|
||||
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
|
||||
wt = _('Export error')
|
||||
msg_t = _('Export failed! Please try again')
|
||||
msg_window(iw, ii, wt, msg_t)
|
||||
|
||||
else:
|
||||
|
||||
# img_w, img_i, w_title, w_txt hand over
|
||||
iw = r"/usr/share/icons/lx-icons/64/info.png"
|
||||
ii = r"/usr/share/icons/lx-icons/48/wg_msg.png"
|
||||
wt = _("Select tunnel")
|
||||
msg_t = _("Please first import tunnel")
|
||||
"""img_w, img_i, w_title, w_txt hand over"""
|
||||
iw = r'/usr/share/icons/lx-icons/64/info.png'
|
||||
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
|
||||
wt = _('Select tunnel')
|
||||
msg_t = _('Please first import tunnel')
|
||||
msg_window(iw, ii, wt, msg_t)
|
||||
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
|
||||
def if_tip(path):
|
||||
class Tipi:
|
||||
"""
|
||||
method that writes in file whether tooltip is displayed or not
|
||||
Class for Tooltip setting write in File
|
||||
Calling request path to file
|
||||
"""
|
||||
with open(path, "r", encoding="utf-8") as set_file2:
|
||||
lines2 = set_file2.readlines()
|
||||
if "False\n" in lines2:
|
||||
tip = False
|
||||
else:
|
||||
tip = True
|
||||
return tip
|
||||
@staticmethod
|
||||
def if_tip(path):
|
||||
with open(path, 'r') as set_file2:
|
||||
lines2 = set_file2.readlines()
|
||||
if 'False\n' in lines2:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
wg_tips = Tipi.if_tip(wg_set)
|
||||
|
311
install
@ -8,221 +8,126 @@ install_file_with(){
|
||||
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 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 -fv Wire-Py.desktop /usr/share/applications/ && \
|
||||
sudo ln -sf /usr/local/bin/wirepy.py /usr/local/bin/wirepy
|
||||
sudo mkdir -p /usr/local/etc/ssl
|
||||
if [ ! -f /usr/local/etc/ssl/pwgk.pem ]
|
||||
then
|
||||
sudo openssl genrsa -out /usr/local/etc/ssl/pwgk.pem 4096
|
||||
fi
|
||||
fi
|
||||
systemctl --user enable wg_start.service
|
||||
sudo apt install python3-tk && \
|
||||
sudo cp -u wg_main.py start_wg.py cls_mth_fc.py /usr/local/bin/ && \
|
||||
sudo cp -uR wp-icons 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 ln -sf /usr/local/bin/wg_main.py /usr/local/bin/wirepy && \
|
||||
sudo cp -u Wire-Py.desktop /usr/share/applications/
|
||||
}
|
||||
|
||||
install_arch_d(){
|
||||
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 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 -fv Wire-Py.desktop /usr/share/applications/ && \
|
||||
sudo ln -sf /usr/local/bin/wirepy.py /usr/local/bin/wirepy
|
||||
sudo mkdir -p /usr/local/etc/ssl
|
||||
if [ ! -f /usr/local/etc/ssl/pwgk.pem ]
|
||||
then
|
||||
sudo openssl genrsa -out /usr/local/etc/ssl/pwgk.pem 4096
|
||||
fi
|
||||
|
||||
fi
|
||||
sudo pacman -S --noconfirm tk python3 python-requests && \
|
||||
sudo cp -u wg_main.py start_wg.py cls_mth_fc.py && \
|
||||
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/keys && sudo cp -u settings /etc/wire_py/ && \
|
||||
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 ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
|
||||
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
|
||||
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \
|
||||
sudo cp -u wg_start.service /lib/systemd/system/ && \
|
||||
sudo systemctl enable wg_start.service
|
||||
}
|
||||
|
||||
install(){
|
||||
if grep -i 'debian' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
groups > /tmp/isgroup
|
||||
if grep 'sudo' /tmp/isgroup
|
||||
then
|
||||
if grep -i 'debian' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
groups > /tmp/isgroup
|
||||
if grep 'sudo' /tmp/isgroup
|
||||
then
|
||||
install_file_with
|
||||
else
|
||||
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 "enter "$GREEN""usermod -aG sudo $USER.""$BLUE""
|
||||
echo -e ""after logging in from the system, they can then run Wire-Py install again." $NORMAL"
|
||||
read -n 1 -s -r -p $"Press Enter to exit"
|
||||
clear
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
elif grep -i 'mint\|ubuntu\|pop|' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
install_file_with
|
||||
|
||||
elif grep -i 'arch' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
groups > /tmp/isgroup
|
||||
clear
|
||||
if grep 'wheel' /tmp/isgroup
|
||||
then
|
||||
install_arch_d
|
||||
else
|
||||
echo "The installer found that they are not in the group sudo."
|
||||
echo "The sudoers file must be edited with"
|
||||
echo -e "$RED""su -""$NORMAL"
|
||||
echo -e "$GREEN"""EDITOR=nano visudo"""$NORMAL"
|
||||
echo "Find the line:"
|
||||
echo "## Uncomment to allow members of group wheel to execute any command"
|
||||
echo "remove '#' on # %wheel ALL=(ALL) ALL and save the file"
|
||||
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."
|
||||
read -n 1 -s -r -p $"Press Enter to exit"
|
||||
clear
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
elif grep -i '|manjaro\|garuda\|endeavour|' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
install_arch_d
|
||||
|
||||
elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
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 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 -fv Wire-Py.desktop /usr/share/applications/ && \
|
||||
sudo ln -sf /usr/local/bin/wirepy.py /usr/local/bin/wirepy
|
||||
sudo mkdir -p /usr/local/etc/ssl
|
||||
if [ ! -f /usr/local/etc/ssl/pwgk.pem ]
|
||||
then
|
||||
sudo openssl genrsa -out /usr/local/etc/ssl/pwgk.pem 4096
|
||||
fi
|
||||
|
||||
fi
|
||||
elif grep -i 'suse' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
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 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 -fv Wire-Py.desktop /usr/share/applications/ && \
|
||||
sudo ln -sf /usr/local/bin/wirepy.py /usr/local/bin/wirepy
|
||||
sudo mkdir -p /usr/local/etc/ssl
|
||||
if [ ! -f /usr/local/etc/ssl/pwgk.pem ]
|
||||
then
|
||||
sudo openssl genrsa -out /usr/local/etc/ssl/pwgk.pem 4096
|
||||
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
|
||||
clear
|
||||
echo $"Your System could not be determined."
|
||||
echo
|
||||
read -n 1 -s -r -p $"Press Enter to exit"
|
||||
clear
|
||||
exit 0
|
||||
|
||||
fi
|
||||
#clear
|
||||
read -n 1 -s -r -p $"Press Enter to exit"
|
||||
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..."
|
||||
else
|
||||
|
||||
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 "enter "$GREEN""usermod -aG sudo $USER.""$BLUE""
|
||||
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"
|
||||
clear
|
||||
exit 0
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
which wirepy >/dev/null
|
||||
if [ $? -eq 0 ]
|
||||
elif grep -i 'mint\|ubuntu\|pop|' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
install_file_with
|
||||
|
||||
|
||||
elif grep -i 'arch' /etc/os-release > /dev/null 2>&1
|
||||
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
|
||||
groups > /tmp/isgroup
|
||||
clear
|
||||
if grep 'wheel' /tmp/isgroup
|
||||
then
|
||||
install_arch_d
|
||||
else
|
||||
echo "The installer found that they are not in the group sudo."
|
||||
echo "The sudoers file must be edited with"
|
||||
echo -e "$RED""su -""$NORMAL"
|
||||
echo -e "$GREEN"""EDITOR=nano visudo"""$NORMAL"
|
||||
echo "Find the line:"
|
||||
echo "## Uncomment to allow members of group wheel to execute any command"
|
||||
echo "remove '#' on # %wheel ALL=(ALL) ALL and save the file"
|
||||
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."
|
||||
read -n 1 -s -r -p $"To close the Window press a button"
|
||||
clear
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
elif grep -i '|manjaro\|garuda\|endeavour|' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
install_arch_d
|
||||
|
||||
|
||||
elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
if ! which python3-tkinter &> /dev/null
|
||||
then sudo dnf install python3-tkinter -y
|
||||
|
||||
sudo cp -u wg_main.py start_wg.py cls_mth_fc.py && \
|
||||
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/keys && \
|
||||
sudo cp -u settings /etc/wire_py/ && \
|
||||
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 chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
|
||||
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
|
||||
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
|
||||
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \
|
||||
sudo cp -u wg_start.service /lib/systemd/system/ && \
|
||||
sudo systemctl enable wg_start.service
|
||||
|
||||
fi
|
||||
elif grep -i 'suse' /etc/os-release > /dev/null 2>&1
|
||||
then
|
||||
if ! which python311-tk &> /dev/null
|
||||
then sudo zypper install python311-tk
|
||||
sudo cp -u wg_main.py start_wg.py cls_mth_fc.py && \
|
||||
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/keys && \
|
||||
sudo cp -u settings /etc/wire_py/ && \
|
||||
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 chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
|
||||
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
|
||||
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
|
||||
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \
|
||||
sudo cp -u wg_start.service /lib/systemd/system/ && \
|
||||
sudo systemctl enable wg_start.service
|
||||
fi
|
||||
else
|
||||
install
|
||||
|
||||
fi
|
||||
clear
|
||||
echo $"Your System could not be determined."
|
||||
echo
|
||||
read -n 1 -s -r -p $"To close the window press a button"
|
||||
clear
|
||||
exit 0
|
||||
fi
|
||||
clear
|
||||
read -n 1 -s -r -p $"To close the Window press a button"
|
||||
clear
|
||||
|
||||
|
||||
|
@ -1,42 +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">
|
||||
|
||||
<!--
|
||||
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>
|
@ -1,59 +0,0 @@
|
||||
#!/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)
|
@ -1,83 +0,0 @@
|
||||
#!/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,
|
||||
]
|
||||
)
|
15
start_wg.py
@ -1,17 +1,14 @@
|
||||
#!/usr/bin/python3
|
||||
"""
|
||||
This script belongs to wirepy and is for the auto start of the tunnel
|
||||
"""
|
||||
from pathlib import Path
|
||||
from subprocess import check_call
|
||||
from pathlib import Path
|
||||
|
||||
path_to_file = Path(Path.home() / ".config/wire_py/settings")
|
||||
path_to_file = Path(Path.home() / '.config/wire_py/settings')
|
||||
|
||||
with open(path_to_file, "r", encoding="utf-8") as a_con:
|
||||
# This funtion is for the independent autostart of the previously selected tunnel
|
||||
with open(path_to_file, 'r') as a_con:
|
||||
lines = a_con.readlines()
|
||||
a_con = lines[7].strip()
|
||||
if a_con != "off":
|
||||
check_call(["nmcli", "connection", "up", a_con])
|
||||
if a_con != 'off':
|
||||
check_call(['nmcli', 'connection', 'up', a_con])
|
||||
else:
|
||||
pass
|
||||
|
||||
|
1162
wg_main.py
Executable file
BIN
wp-icons/128/error.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
wp-icons/128/info.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
BIN
wp-icons/256/error.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
wp-icons/256/info.png
Normal file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
BIN
wp-icons/32/error.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
wp-icons/32/info.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
BIN
wp-icons/48/error.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
wp-icons/48/info.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
BIN
wp-icons/64/error.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
wp-icons/64/info.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |