33 Commits

Author SHA1 Message Date
7881355f00 Paths changed, Wirepy now runs as normal user, Required files and folders are now created. From now on suitable for multi-user system 2025-03-02 14:00:46 +01:00
e28235af4b Fix for allow ipv6 2025-02-24 18:51:14 +01:00
5fe6fd3f29 - Update Translate Files 2024-11-17 12:51:46 +01:00
48a48ffd4c - Update Translate Files 2024-11-17 12:49:41 +01:00
1278b02a95 - Update Translate Files 2024-11-17 12:28:05 +01:00
52f22beec6 - Update Translate Files 2024-11-17 12:11:55 +01:00
a6742a0c0e - Update Translate Files 2024-11-17 11:46:11 +01:00
762694aa94 - Update Translate Files 2024-11-17 11:42:58 +01:00
cc54f329fe - Update Translate Files 2024-11-17 11:41:13 +01:00
8c01c1b984 - Update Translate Files 2024-11-17 11:40:33 +01:00
ebafdbdcb3 - - Fix Checkbutton Autostart when first install Wire-Py 2024-11-17 10:48:47 +01:00
ce4f6c84dc - - Fix Checkbutton Autostart when first install Wire-Py 2024-11-15 18:09:21 +01:00
c4565ed169 - fix return 'no Updates' 2024-11-10 20:57:52 +01:00
485cfff457 - fix return 'no Updates' 2024-11-10 20:57:19 +01:00
1a0fc74a80 - fix return 'no Updates' 2024-11-10 20:55:33 +01:00
971c86c97f - Translate file de_De complete
- new FrameWidget for rename Entry and rename Button
2024-11-10 20:31:27 +01:00
cf71eae7d3 - Translate file de_De complete
- new FrameWidget for rename Entry and rename Button
2024-11-10 15:08:00 +01:00
1f80d5342c - Translate file de_De complete
- new FrameWidget for rename Entry and rename Button
2024-11-10 14:51:50 +01:00
e719a1f23f - Preparation for language translation part 5 2024-11-10 13:23:02 +01:00
a0da356cec - Preparation for language translation part 5 2024-11-10 13:17:11 +01:00
ac87e0a4a7 - Preparation for language translation part 4 2024-11-10 11:20:11 +01:00
6a3a982057 - Preparation for language translation part 4 2024-11-10 11:05:32 +01:00
aab90eec70 - Preparation for language translation part 3 2024-11-10 00:23:49 +01:00
511d5f72df - Preparation for language translation part 2 2024-11-09 22:09:23 +01:00
ed93e99026 - Preparation for language translation part 2 2024-11-09 22:08:39 +01:00
10c3b07053 - Preparation for language translation part 1
- separate folder for general icons
- install edit for new dir lx-icons
2024-11-09 19:01:53 +01:00
e9814f2b60 - Preparation for language translation part 1
- separate folder for general icons
- install edit for new dir lx-icons
2024-11-09 17:09:23 +01:00
c470783ff2 - methods from class MainWindow move to class FrameWidgets for active color_label when theme change
- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets
- add new Frame for Widgets on Bottom
- optimize from tkinter * to from tkinter import filedialog, ttk, TclError
2024-11-08 21:39:28 +01:00
2fac03a927 - methods from class MainWindow move to class FrameWidgets for active color_label when theme change
- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets
- add new Frame for Widgets on Bottom
- optimize from tkinter * to from tkinter import filedialog, ttk, TclError
2024-11-08 21:32:45 +01:00
8a32065676 - methods from class MainWindow move to class FrameWidgets for active color_label when theme change
- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets
- add new Frame for Widgets on Bottom
- optimize from tkinter * to from tkinter import filedialog, ttk, TclError
2024-11-08 21:21:43 +01:00
bc0d46d633 - methods from class MainWindow move to class FrameWidgets for active color_label when theme change
- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets
- add new Frame for Widgets on Bottom
- optimize from tkinter * to from tkinter import filedialog, ttk, TclError
2024-11-08 20:49:59 +01:00
80c63eaf78 rows adjusted 2024-11-07 19:49:35 +01:00
4bfc8c318e Version number adjusted 2024-11-07 19:24:16 +01:00
28 changed files with 566 additions and 513 deletions

242
.idea/workspace.xml generated
View File

@ -4,16 +4,9 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="- Optimize Class and Tooltip">
<change afterPath="$PROJECT_DIR$/run_as" afterDir="false" />
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment=" - Update Translate Files">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Changelog" beforeDir="false" afterPath="$PROJECT_DIR$/Changelog" afterDir="false" />
<change beforePath="$PROJECT_DIR$/install" beforeDir="false" afterPath="$PROJECT_DIR$/install" afterDir="false" />
<change beforePath="$PROJECT_DIR$/settings" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/start_wg.py" beforeDir="false" afterPath="$PROJECT_DIR$/start_wg.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/theme" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wg_main.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cls_mth_fc.py" beforeDir="false" afterPath="$PROJECT_DIR$/cls_mth_fc.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -30,7 +23,7 @@
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="main" />
<entry key="$PROJECT_DIR$" value="1.11.0824" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@ -65,13 +58,14 @@
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;Shell Script.install.executor&quot;: &quot;Run&quot;,
&quot;Shell Script.run_as.executor&quot;: &quot;Run&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;git-widget-placeholder&quot;: &quot;1.11.1024&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/punix/Pyapps/wire-py&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;reference.settingsdialog.IDE.editor.colors&quot;
}
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/lx-icons" />
<recent name="$PROJECT_DIR$" />
</key>
<key name="MoveFile.RECENT_KEYS">
@ -135,7 +129,7 @@
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-python-sdk-0e3be3396995-c546a90a8094-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-242.23339.19" />
<option value="bundled-python-sdk-8336bb23522e-31b6be0877a2-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-241.19072.16" />
</set>
</attachedChunks>
</component>
@ -148,102 +142,6 @@
<option name="presentableId" value="Default" />
<updated>1723279982210</updated>
</task>
<task id="LOCAL-00017" summary="remove a ',' in DNS Name">
<option name="closed" value="true" />
<created>1724576599289</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1724576599289</updated>
</task>
<task id="LOCAL-00018" summary="fix when Filname &gt; 17 first copy file after rename">
<option name="closed" value="true" />
<created>1724593165879</created>
<option name="number" value="00018" />
<option name="presentableId" value="LOCAL-00018" />
<option name="project" value="LOCAL" />
<updated>1724593165879</updated>
</task>
<task id="LOCAL-00019" summary="add export Tunnel as zip">
<option name="closed" value="true" />
<created>1724610514657</created>
<option name="number" value="00019" />
<option name="presentableId" value="LOCAL-00019" />
<option name="project" value="LOCAL" />
<updated>1724610514658</updated>
</task>
<task id="LOCAL-00020" summary="columnconfigure on all widgets set">
<option name="closed" value="true" />
<created>1724778892233</created>
<option name="number" value="00020" />
<option name="presentableId" value="LOCAL-00020" />
<option name="project" value="LOCAL" />
<updated>1724778892233</updated>
</task>
<task id="LOCAL-00021" summary="little fixes a &quot; &quot; to ' '">
<option name="closed" value="true" />
<created>1725119445803</created>
<option name="number" value="00021" />
<option name="presentableId" value="LOCAL-00021" />
<option name="project" value="LOCAL" />
<updated>1725119445803</updated>
</task>
<task id="LOCAL-00022" summary="add class FileHandle,&#10;add Label to show autoconnect Tunnel&#10;disable checkbox when Listbox is empty or no select Tunnel">
<option name="closed" value="true" />
<created>1725391658456</created>
<option name="number" value="00022" />
<option name="presentableId" value="LOCAL-00022" />
<option name="project" value="LOCAL" />
<updated>1725391658456</updated>
</task>
<task id="LOCAL-00023" summary="add if question and add autoconnect, autoconnect_var to class Filehandle in box_set no finish!">
<option name="closed" value="true" />
<created>1725434328731</created>
<option name="number" value="00023" />
<option name="presentableId" value="LOCAL-00023" />
<option name="project" value="LOCAL" />
<updated>1725434328731</updated>
</task>
<task id="LOCAL-00024" summary="fixes on empty Listbox now is disable and now works autoconnect label with read and write, delete works now with read and write">
<option name="closed" value="true" />
<created>1725475967338</created>
<option name="number" value="00024" />
<option name="presentableId" value="LOCAL-00024" />
<option name="project" value="LOCAL" />
<updated>1725475967338</updated>
</task>
<task id="LOCAL-00025" summary="add Frame widget 3&#10;for Buttons and Listbox with Scrollbar.&#10;all Widgets new format&#10;delete works now of disable checkbox when Listbox empty (part two)">
<option name="closed" value="true" />
<created>1725567453540</created>
<option name="number" value="00025" />
<option name="presentableId" value="LOCAL-00025" />
<option name="project" value="LOCAL" />
<updated>1725567453540</updated>
</task>
<task id="LOCAL-00026" summary="little fixes">
<option name="closed" value="true" />
<created>1725639633873</created>
<option name="number" value="00026" />
<option name="presentableId" value="LOCAL-00026" />
<option name="project" value="LOCAL" />
<updated>1725639633873</updated>
</task>
<task id="LOCAL-00027" summary="little fixes">
<option name="closed" value="true" />
<created>1725746027132</created>
<option name="number" value="00027" />
<option name="presentableId" value="LOCAL-00027" />
<option name="project" value="LOCAL" />
<updated>1725746027132</updated>
</task>
<task id="LOCAL-00028" summary="little fixes replace os.system with check_call&#10;first steps in install Script add wg_start.service file">
<option name="closed" value="true" />
<created>1725820337669</created>
<option name="number" value="00028" />
<option name="presentableId" value="LOCAL-00028" />
<option name="project" value="LOCAL" />
<updated>1725820337669</updated>
</task>
<task id="LOCAL-00029" summary="little fixes a labels when stop and start, installer first functions works">
<option name="closed" value="true" />
<created>1725991610908</created>
@ -452,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" />
@ -540,18 +438,109 @@
<option name="project" value="LOCAL" />
<updated>1729938941027</updated>
</task>
<option name="localTasksCounter" value="66" />
<task id="LOCAL-00066" summary="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change&#10;- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets&#10;- add new Frame for Widgets on Bottom&#10;- optimize from tkinter * to from tkinter import filedialog, ttk, TclError">
<option name="closed" value="true" />
<created>1731097309468</created>
<option name="number" value="00066" />
<option name="presentableId" value="LOCAL-00066" />
<option name="project" value="LOCAL" />
<updated>1731097309468</updated>
</task>
<task id="LOCAL-00067" summary="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change&#10;- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets&#10;- add new Frame for Widgets on Bottom&#10;- optimize from tkinter * to from tkinter import filedialog, ttk, TclError">
<option name="closed" value="true" />
<created>1731097969343</created>
<option name="number" value="00067" />
<option name="presentableId" value="LOCAL-00067" />
<option name="project" value="LOCAL" />
<updated>1731097969344</updated>
</task>
<task id="LOCAL-00068" summary="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change&#10;- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets&#10;- add new Frame for Widgets on Bottom&#10;- optimize from tkinter * to from tkinter import filedialog, ttk, TclError">
<option name="closed" value="true" />
<created>1731098372497</created>
<option name="number" value="00068" />
<option name="presentableId" value="LOCAL-00068" />
<option name="project" value="LOCAL" />
<updated>1731098372497</updated>
</task>
<task id="LOCAL-00069" summary=" - - Fix Checkbutton Autostart when first install Wire-Py">
<option name="closed" value="true" />
<created>1731690583059</created>
<option name="number" value="00069" />
<option name="presentableId" value="LOCAL-00069" />
<option name="project" value="LOCAL" />
<updated>1731690583060</updated>
</task>
<task id="LOCAL-00070" summary=" - - Fix Checkbutton Autostart when first install Wire-Py">
<option name="closed" value="true" />
<created>1731836942211</created>
<option name="number" value="00070" />
<option name="presentableId" value="LOCAL-00070" />
<option name="project" value="LOCAL" />
<updated>1731836942212</updated>
</task>
<task id="LOCAL-00071" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731840048762</created>
<option name="number" value="00071" />
<option name="presentableId" value="LOCAL-00071" />
<option name="project" value="LOCAL" />
<updated>1731840048763</updated>
</task>
<task id="LOCAL-00072" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731840089956</created>
<option name="number" value="00072" />
<option name="presentableId" value="LOCAL-00072" />
<option name="project" value="LOCAL" />
<updated>1731840089956</updated>
</task>
<task id="LOCAL-00073" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731840188277</created>
<option name="number" value="00073" />
<option name="presentableId" value="LOCAL-00073" />
<option name="project" value="LOCAL" />
<updated>1731840188278</updated>
</task>
<task id="LOCAL-00074" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731840383592</created>
<option name="number" value="00074" />
<option name="presentableId" value="LOCAL-00074" />
<option name="project" value="LOCAL" />
<updated>1731840383592</updated>
</task>
<task id="LOCAL-00075" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731841930614</created>
<option name="number" value="00075" />
<option name="presentableId" value="LOCAL-00075" />
<option name="project" value="LOCAL" />
<updated>1731841930615</updated>
</task>
<task id="LOCAL-00076" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731844213239</created>
<option name="number" value="00076" />
<option name="presentableId" value="LOCAL-00076" />
<option name="project" value="LOCAL" />
<updated>1731844213239</updated>
</task>
<task id="LOCAL-00077" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731844339039</created>
<option name="number" value="00077" />
<option name="presentableId" value="LOCAL-00077" />
<option name="project" value="LOCAL" />
<updated>1731844339039</updated>
</task>
<option name="localTasksCounter" value="78" />
<servers />
</component>
<component name="UnknownFeatures">
<option featureType="com.intellij.fileTypeFactory" implementationName="*.policy" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="OPEN_GENERIC_TABS">
<map>
<entry key="f9756e7d-0c5c-4b84-84e4-660314c46ea4" value="TOOL_WINDOW" />
</map>
</option>
<option name="TAB_STATES">
<map>
<entry key="MAIN">
@ -562,7 +551,7 @@
<entry key="branch">
<value>
<list>
<option value="origin/wire-py-reformat-14-08-2024" />
<option value="1.11.0824" />
</list>
</value>
</entry>
@ -571,19 +560,11 @@
</State>
</value>
</entry>
<entry key="f9756e7d-0c5c-4b84-84e4-660314c46ea4">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="fix a filedialog for hidden Files work&#10;install rollback to bash for start wirepy and wirepy rollback to bash" />
<MESSAGE value="install rollback bash to py wirepy and wirepy rollback to py" />
<MESSAGE value="fix install and .desktop File Tar works now for user home and filebrowser.askfilebrowser start now in user home" />
<MESSAGE value="replace tar with zip and Check if Zip file is empty" />
<MESSAGE value="Create your own message boxes for export" />
<MESSAGE value="chown Export File to 1000:1000" />
@ -598,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.&#10;Start with version number 1.4.7&#10;Message window size corrected so text is displayed better" />
<MESSAGE value="Fix msg_window and remove x , y argument&#10;Install further adapted and with colored&#10;text if user is not in group sudo or wheel.&#10;Added to install Opensuse for installation" />
<MESSAGE value=" - Menu add &#10; - New Modern Dark and Light(default) Theme" />
@ -606,15 +587,18 @@
<MESSAGE value=" - Add Options, Help, Update Label and Update Menubutton &#10; - Theme now separate Light and Dark" />
<MESSAGE value="- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip" />
<MESSAGE value="- Optimize Class and Tooltip" />
<option name="LAST_COMMIT_MESSAGE" value="- Optimize Class and Tooltip" />
<MESSAGE value="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change&#10;- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets&#10;- add new Frame for Widgets on Bottom&#10;- optimize from tkinter * to from tkinter import filedialog, ttk, TclError" />
<MESSAGE value=" - - Fix Checkbutton Autostart when first install Wire-Py" />
<MESSAGE value=" - Update Translate Files" />
<option name="LAST_COMMIT_MESSAGE" value=" - Update Translate Files" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/start_wg.py</url>
<line>1</line>
<option name="timeStamp" value="2" />
<url>file://$PROJECT_DIR$/wg_main.py</url>
<line>1128</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>

View File

@ -3,36 +3,90 @@ My standard System: Linux Mint 22 Cinnamon
## [Unreleased]
- os import in wg_func replaced by other methods
- 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
- Update search after start of Wire-Py
- Crypt and Decrypt Config Files in ~/.config/wire_py
### 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
10-11-2024
- Fix Checkbutton Autostart when first install Wire-Py
- Update Translate Files
### Added
10-11-2024
- Translate file de_De complete
- new FrameWidget for rename Entry and rename Button
### Added
09-11-2024
- Move Tips Method in separate class for Tooltips in another Apps
- Move Version Variable in main script
- Edit Class GiteaUpdate for requests in api_down and download
- Description on Class GiteaUpdate
### Added
08-11-2024
- Preparation for language translation part 1
- separate folder for general icons
- install edit for new dir lx-icons
### Added
08-11-2024
- methods from class MainWindow move to class FrameWidgets for active color_label when theme change
- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets
- add new Frame for Widgets on Bottom
- optimize from tkinter * to from tkinter import filedialog, ttk, TclError
### Added
07-11-2024
- remove classes and add methods to class FrameWidgets (removed self errors)
### Added
27-10-2024
- Add Autoconnect settings to settings.conf
- Add Autoconnect settings to settings
### Added
26-10-2024
- Add run_as Bash script and open_gitea.py python script
- Add Tooltip disable/enable
- Rename settings to settings.conf for theme, updates and tooltip enable in one file
- Add run_as Bash script and open_gitea.py python script
- Add Tooltip disable/enable
- Rename settings to settings for theme, updates and tooltip enable in one file
### Added
25-10-2024
- Optimize Class and Tooltip
- Optimize Class and Tooltip
### Added
21-10-2024
- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip
- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip
### Added

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,35 +1,78 @@
""" Wireguard Classes and Method for Wire-Py """
""" Classes Method and functions for lx apps """
import gettext
import locale
import os
import shutil
import subprocess
import time
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'
LOCALE_DIR = "/usr/share/locale/"
locale.bindtextdomain(APP, LOCALE_DIR)
gettext.bindtextdomain(APP, LOCALE_DIR)
gettext.textdomain(APP)
_ = gettext.gettext
''' 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year '''
version = 'v. 1.10.2124'
def dirs_and_files():
path_to_file2 = Path('/etc/wire_py/settings.conf')
_u = Path.read_text(Path('/tmp/_u'))
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'
UPDATE_API_URL = 'https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases'
if sett.exists():
pass
else:
sett.touch()
sett.write_text('[UPDATES]\non\n[THEME]\nlight\n[TOOLTIP]\nTrue\n[AUTOSTART ON]\noff')
if ks.exists():
pass
else:
ks.touch()
def files_for_autostart():
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()
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])
wg_set = Path(Path.home() / '.config/wire_py/settings')
class WirePyUpdate:
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():
def api_down(update_api_url, version):
try:
response = requests.get(UPDATE_API_URL)
response = requests.get(update_api_url)
response_dict = response.json()
response_dict = response_dict[0]
with open(path_to_file2, 'r') 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']:
@ -42,51 +85,47 @@ class WirePyUpdate:
return 'No Internet Connection!'
@staticmethod
def download():
def download(urld, down_ok_image, down_not_ok_image, res):
try:
url = f'https://git.ilunix.de/punix/Wire-Py/archive/{res}.zip'
to_down = 'wget -qP ' + str(_u) + ' ' + url
to_down = 'wget -qP ' + str(Path.home()) + ' ' + urld
result = subprocess.call(to_down, shell=True)
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/wp-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_vpn.png'
wt = 'Download Successful'
msg_t = 'Your zip file is in home directory'
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')
msg_window(iw, ii, wt, msg_t)
else:
"""img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/error.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Download error'
msg_t = 'Download failed! Please try again'
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')
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/wp-icons/64/error.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Download error'
msg_t = 'Download failed! No internet connection!'
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!')
msg_window(iw, ii, wt, msg_t)
res = WirePyUpdate.api_down()
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.
Paths to images must be specified: r'/usr/share/icons/wp-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_i = Image for Icon
w_title = Windows Title
w_txt = Text for Tk Window
txt2 = Text for Button two
com = function for Button command
"""
msg = tk.Toplevel()
msg.resizable(width=False, height=False)
msg.title(w_title)
@ -98,7 +137,7 @@ def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
label.grid(column=1, row=0)
if txt2 != None and com != None:
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)
@ -120,7 +159,6 @@ def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
class Tunnel:
"""
Class of Methods for Wire-Py
"""
@ -129,7 +167,6 @@ class Tunnel:
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):
@ -142,6 +179,8 @@ class Tunnel:
for items in dictlist:
if items == '=':
dictlist.remove(items)
if items == '::/0':
dictlist.remove(items)
''' Here is the beginning (Loop) of convert List to Dictionary '''
for _ in dictlist:
@ -171,11 +210,9 @@ class Tunnel:
pre_key = final_dict['PreSharedKey']
return address, dns, endpoint, pre_key
"""
Shows the Active Tunnel
"""
@staticmethod
def active():
@ -188,83 +225,84 @@ class Tunnel:
return active
"""
Shows all existing Wireguard tunnels
Shows all existing Wireguard tunnels a login user
"""
@staticmethod
def list():
wg_s = os.popen('nmcli con show | grep -iPo "(.*)(wireguard)"').read().split()
''' tl = Tunnel list # Show of 4.Element in list '''
tl = wg_s[::3]
return tl
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():
_u1 = str(_u[6:])
now_time = datetime.now()
now_datetime = now_time.strftime('wg-exp-' + '%m-%d-%Y' + '-' + '%H:%M')
tl = Tunnel.list()
try:
if len(tl) != 0:
wg_tar = str(_u) + '/' + now_datetime
shutil.copytree('/etc/wire_py', '/tmp/wire_py', dirs_exist_ok=True)
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.conf', 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.chown(wg_tar + '.zip', 1000, 1000)
shutil.rmtree(source)
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/wp-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'
wt = 'Export Successful'
msg_t = 'Your zip file is in home directory'
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/wp-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'
wt = 'Export error'
msg_t = 'Export failed! Please try again'
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/wp-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'
wt = 'Select tunnel'
msg_t = 'Please first import tunnel.'
wt = _('Select tunnel')
msg_t = _('Please first import tunnel')
msg_window(iw, ii, wt, msg_t)
except TypeError:
pass
class Tipi:
"""
Class for Tooltip setting write in File
Calling request path to file
"""
@staticmethod
def if_tip():
with open(path_to_file2, 'r') as set_file2:
lines2 = set_file2.readlines()
if 'False\n' in lines2:
return False
else:
return True
tips = Tunnel.if_tip()
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)

42
install
View File

@ -6,25 +6,25 @@ BLUE='\033[30;1;34m'
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
sudo apt install python3-tk && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-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
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
sudo pacman -S --noconfirm tk python3 python-requests && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
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/ && \
@ -89,10 +89,11 @@ elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1
if ! which python3-tkinter &> /dev/null
then sudo dnf install python3-tkinter -y
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \
sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
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/ && \
@ -105,10 +106,11 @@ 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 wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \
sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
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/ && \

BIN
languages/de/wirepy.mo Normal file

Binary file not shown.

BIN
lx-icons/128/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
lx-icons/128/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
lx-icons/256/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
lx-icons/256/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
lx-icons/32/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
lx-icons/32/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
lx-icons/48/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
lx-icons/48/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
lx-icons/64/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
lx-icons/64/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

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

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

View File

@ -2,7 +2,7 @@
from subprocess import check_call
from pathlib import Path
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:
lines = a_con.readlines()

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,6 +0,0 @@
#!/usr/bin/python3
from subprocess import check_call
from pathlib import Path
Path.write_text(Path('/tmp/_u'), str(Path.home()))
check_call(['pkexec', '/usr/bin/wg_main.py'])