set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open
This commit is contained in:
		
							
								
								
									
										37
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										37
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							@@ -4,8 +4,13 @@
 | 
				
			|||||||
    <option name="autoReloadType" value="SELECTIVE" />
 | 
					    <option name="autoReloadType" value="SELECTIVE" />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="ChangeListManager">
 | 
					  <component name="ChangeListManager">
 | 
				
			||||||
    <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="fix checkbox disable and policy rename main.py to wg_main.py">
 | 
					    <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="fix rename in Messagebox warning to error">
 | 
				
			||||||
      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
 | 
					      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
 | 
				
			||||||
 | 
					      <change beforePath="$PROJECT_DIR$/Wire-Py.desktop" beforeDir="false" afterPath="$PROJECT_DIR$/Wire-Py.desktop" afterDir="false" />
 | 
				
			||||||
 | 
					      <change beforePath="$PROJECT_DIR$/install" beforeDir="false" afterPath="$PROJECT_DIR$/install" afterDir="false" />
 | 
				
			||||||
 | 
					      <change beforePath="$PROJECT_DIR$/org.wirepy.policy" beforeDir="false" afterPath="$PROJECT_DIR$/org.wirepy.policy" afterDir="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" />
 | 
				
			||||||
    </list>
 | 
					    </list>
 | 
				
			||||||
    <option name="SHOW_DIALOG" value="false" />
 | 
					    <option name="SHOW_DIALOG" value="false" />
 | 
				
			||||||
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
 | 
					    <option name="HIGHLIGHT_CONFLICTS" value="true" />
 | 
				
			||||||
@@ -404,7 +409,15 @@
 | 
				
			|||||||
      <option name="project" value="LOCAL" />
 | 
					      <option name="project" value="LOCAL" />
 | 
				
			||||||
      <updated>1726650691719</updated>
 | 
					      <updated>1726650691719</updated>
 | 
				
			||||||
    </task>
 | 
					    </task>
 | 
				
			||||||
    <option name="localTasksCounter" value="35" />
 | 
					    <task id="LOCAL-00035" summary="fix rename in Messagebox warning to error">
 | 
				
			||||||
 | 
					      <option name="closed" value="true" />
 | 
				
			||||||
 | 
					      <created>1726652747322</created>
 | 
				
			||||||
 | 
					      <option name="number" value="00035" />
 | 
				
			||||||
 | 
					      <option name="presentableId" value="LOCAL-00035" />
 | 
				
			||||||
 | 
					      <option name="project" value="LOCAL" />
 | 
				
			||||||
 | 
					      <updated>1726652747322</updated>
 | 
				
			||||||
 | 
					    </task>
 | 
				
			||||||
 | 
					    <option name="localTasksCounter" value="36" />
 | 
				
			||||||
    <servers />
 | 
					    <servers />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="UnknownFeatures">
 | 
					  <component name="UnknownFeatures">
 | 
				
			||||||
@@ -445,7 +458,6 @@
 | 
				
			|||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="VcsManagerConfiguration">
 | 
					  <component name="VcsManagerConfiguration">
 | 
				
			||||||
    <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
 | 
					    <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
 | 
				
			||||||
    <MESSAGE value="add Class StartStopBTN to wg_func.py" />
 | 
					 | 
				
			||||||
    <MESSAGE value="Set Style to Clam
Improved layout of widgets" />
 | 
					    <MESSAGE value="Set Style to Clam
Improved layout of widgets" />
 | 
				
			||||||
    <MESSAGE value="Remove open file function, add Show Address Labels with tk.StrVar when remove a not active Tunnel Labels of Active Tunnel removed!" />
 | 
					    <MESSAGE value="Remove open file function, add Show Address Labels with tk.StrVar when remove a not active Tunnel Labels of Active Tunnel removed!" />
 | 
				
			||||||
    <MESSAGE value="fixed error when active tunnel is deleted,
now also the Address Label is emptied" />
 | 
					    <MESSAGE value="fixed error when active tunnel is deleted,
now also the Address Label is emptied" />
 | 
				
			||||||
@@ -470,6 +482,23 @@
 | 
				
			|||||||
    <MESSAGE value="new format little fixes icons sort add policy add .desktop File install Part 2" />
 | 
					    <MESSAGE value="new format little fixes icons sort add policy add .desktop File install Part 2" />
 | 
				
			||||||
    <MESSAGE value="install fix for set dir right" />
 | 
					    <MESSAGE value="install fix for set dir right" />
 | 
				
			||||||
    <MESSAGE value="fix checkbox disable and policy rename main.py to wg_main.py" />
 | 
					    <MESSAGE value="fix checkbox disable and policy rename main.py to wg_main.py" />
 | 
				
			||||||
    <option name="LAST_COMMIT_MESSAGE" value="fix checkbox disable and policy rename main.py to wg_main.py" />
 | 
					    <MESSAGE value="fix rename in Messagebox warning to error" />
 | 
				
			||||||
 | 
					    <option name="LAST_COMMIT_MESSAGE" value="fix rename in Messagebox warning to error" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="XDebuggerManager">
 | 
				
			||||||
 | 
					    <breakpoint-manager>
 | 
				
			||||||
 | 
					      <breakpoints>
 | 
				
			||||||
 | 
					        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
 | 
				
			||||||
 | 
					          <url>file://$PROJECT_DIR$/wg_main.py</url>
 | 
				
			||||||
 | 
					          <line>1</line>
 | 
				
			||||||
 | 
					          <option name="timeStamp" value="1" />
 | 
				
			||||||
 | 
					        </line-breakpoint>
 | 
				
			||||||
 | 
					        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
 | 
				
			||||||
 | 
					          <url>file://$PROJECT_DIR$/wg_func.py</url>
 | 
				
			||||||
 | 
					          <line>11</line>
 | 
				
			||||||
 | 
					          <option name="timeStamp" value="2" />
 | 
				
			||||||
 | 
					        </line-breakpoint>
 | 
				
			||||||
 | 
					      </breakpoints>
 | 
				
			||||||
 | 
					    </breakpoint-manager>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
@@ -4,4 +4,4 @@ Name=Wire-Py
 | 
				
			|||||||
Exec=/usr/bin/wirepy
 | 
					Exec=/usr/bin/wirepy
 | 
				
			||||||
Terminal=false
 | 
					Terminal=false
 | 
				
			||||||
Categories=Network;
 | 
					Categories=Network;
 | 
				
			||||||
Icon=/usr/share/icons/wp-icons/128/wg-vpn.png
 | 
					Icon=/usr/share/icons/wp-icons/128/wg_vpn.png
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								install
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								install
									
									
									
									
									
								
							@@ -4,12 +4,13 @@ which sudo >/dev/null
 | 
				
			|||||||
if [ $? -ne 0 ]
 | 
					if [ $? -ne 0 ]
 | 
				
			||||||
  then
 | 
					  then
 | 
				
			||||||
      su -
 | 
					      su -
 | 
				
			||||||
      apt install python3-tk && apt install tcl-ttkthemes && \
 | 
					      apt install python3-tk -y && apt install tcl-ttkthemes -y && \
 | 
				
			||||||
      cp wg_main.py start_wg.py wg_func.py wirepy /usr/bin/ && \
 | 
					      cp wg_main.py start_wg.py wg_func.py wirepy /usr/bin/ && \
 | 
				
			||||||
      mkdir -p /etc/wire_py && cp -R wp-icons /usr/share/icons/ && \
 | 
					      mkdir -p /etc/wire_py && cp -R wp-icons /usr/share/icons/ && \
 | 
				
			||||||
      if [ ! -e /usr/local/bin/wirepy ]
 | 
					      chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
 | 
				
			||||||
 | 
					      if [ ! -f /usr/local/bin/wirepy ]
 | 
				
			||||||
        then
 | 
					        then
 | 
				
			||||||
            sudo ln -s /usr/bin/wirepy.py /usr/local/bin/wirepy
 | 
					            ln -s /usr/bin/wirepy.py /usr/local/bin/wirepy >/dev/null
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
      cp org.wirepy.policy /usr/share/polkit-1/actions/ && \
 | 
					      cp org.wirepy.policy /usr/share/polkit-1/actions/ && \
 | 
				
			||||||
      cp Wire-Py.desktop /usr/share/applications/ && \
 | 
					      cp Wire-Py.desktop /usr/share/applications/ && \
 | 
				
			||||||
@@ -20,7 +21,8 @@ else
 | 
				
			|||||||
    sudo apt install python3-tk && sudo apt install tcl-ttkthemes && \
 | 
					    sudo apt install python3-tk && sudo apt install tcl-ttkthemes && \
 | 
				
			||||||
    sudo cp wg_main.py start_wg.py wg_func.py wirepy /usr/bin/ && \
 | 
					    sudo cp wg_main.py start_wg.py wg_func.py wirepy /usr/bin/ && \
 | 
				
			||||||
    sudo mkdir -p /etc/wire_py && sudo cp -R wp-icons /usr/share/icons/ && \
 | 
					    sudo mkdir -p /etc/wire_py && sudo cp -R wp-icons /usr/share/icons/ && \
 | 
				
			||||||
    if [ ! -e /usr/local/bin/wirepy ]
 | 
					    sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
 | 
				
			||||||
 | 
					    if [ ! -f /usr/local/bin/wirepy ]
 | 
				
			||||||
      then
 | 
					      then
 | 
				
			||||||
          sudo ln -s /usr/bin/wirepy.py /usr/local/bin/wirepy
 | 
					          sudo ln -s /usr/bin/wirepy.py /usr/local/bin/wirepy
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
      <allow_inactive>auth_admin_keep</allow_inactive>
 | 
					      <allow_inactive>auth_admin_keep</allow_inactive>
 | 
				
			||||||
      <allow_active>yes</allow_active>
 | 
					      <allow_active>yes</allow_active>
 | 
				
			||||||
    </defaults>
 | 
					    </defaults>
 | 
				
			||||||
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/wire-py/wg_main.py</annotate>
 | 
					    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/wg_main.py</annotate>
 | 
				
			||||||
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
 | 
					    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
 | 
				
			||||||
  </action>
 | 
					  </action>
 | 
				
			||||||
</policyconfig>
 | 
					</policyconfig>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								wg_func.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								wg_func.py
									
									
									
									
									
								
							@@ -181,8 +181,10 @@ class ImportTunnel:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def wg_import_select(self):
 | 
					    def wg_import_select(self):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            filepath = filedialog.askopenfilename(initialdir=Path('/home/*/'), title='Select Wireguard config File',
 | 
					            filepath = filedialog.askopenfilename(initialdir=Path('/home/'), title='Select Wireguard config '
 | 
				
			||||||
 | 
					                                                                                   'File',
 | 
				
			||||||
                                                  filetypes=[('WG config files', '*.conf')], )
 | 
					                                                  filetypes=[('WG config files', '*.conf')], )
 | 
				
			||||||
 | 
					            os.chmod(filepath, 0o600)
 | 
				
			||||||
            with open(filepath, 'r') as file:
 | 
					            with open(filepath, 'r') as file:
 | 
				
			||||||
                read = file.read()
 | 
					                read = file.read()
 | 
				
			||||||
            path_split = filepath.split('/')
 | 
					            path_split = filepath.split('/')
 | 
				
			||||||
@@ -197,8 +199,9 @@ class ImportTunnel:
 | 
				
			|||||||
                    if self.a != '':
 | 
					                    if self.a != '':
 | 
				
			||||||
                        check_call(['nmcli', 'connection', 'down', TunnelActiv.active()])
 | 
					                        check_call(['nmcli', 'connection', 'down', TunnelActiv.active()])
 | 
				
			||||||
                        ShowAddress.label_empty(self)
 | 
					                        ShowAddress.label_empty(self)
 | 
				
			||||||
                    check_call(['nmcli', 'connection', 'import', 'type', 'wireguard', 'file', 'etc', '/wire_py',
 | 
					                    check_call(['nmcli', 'connection', 'import', 'type', 'wireguard', 'file', Path('/etc') / 'wire_py' /
 | 
				
			||||||
                                path_split])
 | 
					                                path_split])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    shutil.copy(filepath, Path('/etc/wire_py/'))
 | 
					                    shutil.copy(filepath, Path('/etc/wire_py/'))
 | 
				
			||||||
                    if self.a != '':
 | 
					                    if self.a != '':
 | 
				
			||||||
@@ -221,6 +224,7 @@ class ImportTunnel:
 | 
				
			|||||||
                ShowAddress.init_and_report(self, data)
 | 
					                ShowAddress.init_and_report(self, data)
 | 
				
			||||||
                ShowAddress.show_data(self)
 | 
					                ShowAddress.show_data(self)
 | 
				
			||||||
                check_call(['nmcli', 'con', 'mod', self.a, 'connection.autoconnect', 'no'])
 | 
					                check_call(['nmcli', 'con', 'mod', self.a, 'connection.autoconnect', 'no'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if 'PrivateKey = ' not in read:
 | 
					            if 'PrivateKey = ' not in read:
 | 
				
			||||||
                msg_window()
 | 
					                msg_window()
 | 
				
			||||||
        except EOFError:
 | 
					        except EOFError:
 | 
				
			||||||
@@ -295,7 +299,7 @@ class ExportTunnels:
 | 
				
			|||||||
        tl = ListTunnels.tl_list()
 | 
					        tl = ListTunnels.tl_list()
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            if len(tl) != 0:
 | 
					            if len(tl) != 0:
 | 
				
			||||||
                wg_tar = Path('/home/*/') / now_datetime
 | 
					                wg_tar = Path(f'/{home}/'), now_datetime
 | 
				
			||||||
                p_to_conf = Path('/etc/wire_py/')
 | 
					                p_to_conf = Path('/etc/wire_py/')
 | 
				
			||||||
                shutil.make_archive(wg_tar, 'zip', p_to_conf)
 | 
					                shutil.make_archive(wg_tar, 'zip', p_to_conf)
 | 
				
			||||||
                #if zip_full != 0:
 | 
					                #if zip_full != 0:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,7 +58,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
        self.imp_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_import.png')
 | 
					        self.imp_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_import.png')
 | 
				
			||||||
        self.tr_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_trash.png')
 | 
					        self.tr_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_trash.png')
 | 
				
			||||||
        self.exp_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_export.png')
 | 
					        self.exp_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_export.png')
 | 
				
			||||||
        self.warning_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/64/warning.png')
 | 
					        self.warning_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/64/error.png')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Show active Tunnel
 | 
					        # Show active Tunnel
 | 
				
			||||||
        self.a = TunnelActiv.active()
 | 
					        self.a = TunnelActiv.active()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user