1.11.1024 #24
@ -1,16 +1,14 @@
|
||||
""" Wireguard Classes and Method for Wire-Py """
|
||||
|
||||
import gettext
|
||||
import locale
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
import tkinter as tk
|
||||
import zipfile
|
||||
import gettext
|
||||
import locale
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from subprocess import check_call
|
||||
from tkinter import ttk
|
||||
import requests
|
||||
|
||||
@ -27,12 +25,11 @@ path_to_file2 = Path('/etc/wire_py/settings.conf')
|
||||
_u = Path.read_text(Path('/tmp/_u'))
|
||||
|
||||
|
||||
|
||||
class GiteaUpdate:
|
||||
@staticmethod
|
||||
def api_down(UPDATE_API_URL):
|
||||
def api_down(update_api_url):
|
||||
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:
|
||||
@ -48,9 +45,9 @@ class GiteaUpdate:
|
||||
return 'No Internet Connection!'
|
||||
|
||||
@staticmethod
|
||||
def download(URLD):
|
||||
def download(urld):
|
||||
try:
|
||||
to_down = 'wget -qP ' + str(_u) + ' ' + URLD
|
||||
to_down = 'wget -qP ' + str(_u) + ' ' + urld
|
||||
result = subprocess.call(to_down, shell=True)
|
||||
if result == 0:
|
||||
shutil.chown(str(_u) + f'/{res}.zip', 1000, 1000)
|
||||
@ -80,7 +77,6 @@ class GiteaUpdate:
|
||||
res = GiteaUpdate.api_down('https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases')
|
||||
|
||||
|
||||
|
||||
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.
|
||||
@ -103,7 +99,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)
|
||||
@ -125,7 +121,6 @@ def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
|
||||
|
||||
|
||||
class Tunnel:
|
||||
|
||||
"""
|
||||
Class of Methods for Wire-Py
|
||||
"""
|
||||
@ -176,7 +171,6 @@ class Tunnel:
|
||||
pre_key = final_dict['PreSharedKey']
|
||||
return address, dns, endpoint, pre_key
|
||||
|
||||
|
||||
"""
|
||||
Shows the Active Tunnel
|
||||
"""
|
||||
@ -204,7 +198,6 @@ class Tunnel:
|
||||
tl = wg_s[::3]
|
||||
return tl
|
||||
|
||||
|
||||
"""
|
||||
This will export the tunnels.
|
||||
A zipfile with current date and time is created
|
||||
@ -269,4 +262,5 @@ class Tunnel:
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
tips = Tunnel.if_tip()
|
Loading…
Reference in New Issue
Block a user