Skip to content

Commit

Permalink
Merge pull request #10 from infinitel8p/Update-v1.5
Browse files Browse the repository at this point in the history
Update v1.5
  • Loading branch information
infinitel8p authored Mar 29, 2024
2 parents 289093a + a5f813c commit 880a730
Show file tree
Hide file tree
Showing 15 changed files with 1,065 additions and 205 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# Unnecessary folders
__pycache__/
.vscode
.vscode
output

# Certificates
*.pfx
*.cer

# .rc and manifest files
*.rc
*.manifest
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Quickly activate or deactivate your proxy without having to search in the windows settings.
Change the Proxy Server Address in a matter of seconds.
Connect, Disconnect and add new WiFi networks directly from the application.

## How to setup:

Expand All @@ -11,18 +12,18 @@ Change the Proxy Server Address in a matter of seconds.

## How to use Mobile VPN on PC:

| Steps | Description | Screenshots |
| :---: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| 1. | Activate the VPN service on you mobile phone<br>(in my case it's Kaspersky VPN) | ![Screenshot_20230125_115504_KasperskyVPN Secure Connection](https://user-images.githubusercontent.com/50703696/214552712-a21064e1-9cb1-46a7-b01c-84d92492b7ed.png) |
| 2. | Create a mobile hotspot in your mobile phones settings<br> (If you get a request to deactivate the VPN click on skip) | ![Screenshot_20230125_115945_KasperskyVPN Secure Connection](https://user-images.githubusercontent.com/50703696/214552724-2ad81e1c-1938-48a4-af53-ac12de42b175.png) |
| 3. | Open `Every Proxy` (install it here: [https://play.google.com/store/apps/details?id=com.gorillasoftware.everyproxy](https://play.google.com/store/apps/details?id=com.gorillasoftware.everyproxy&gl=US&pli=1)) | ![Screenshot_20230125_122114_Google Play Store](https://user-images.githubusercontent.com/50703696/214552728-af2b56ed-8353-43d8-af88-30a316832d84.png) |
| 4. | Click on the 3 dots in the top right corner and open the settings | ![Screenshot_20230125_122351_Every Proxy](https://user-images.githubusercontent.com/50703696/214552723-bf7f1f59-3c6c-4d68-8dc7-2cb36e0b6ac9.png) |
| 5. | Under HTTP/S Proxy click on IP Address and select your IP (usually it's the one at the bottom) | ![Screenshot_20230125_122412_Every Proxy](https://user-images.githubusercontent.com/50703696/214552717-f235daa0-5004-40dd-b3f8-6aab3c724060.png) |
| 6. | Exit the settings and enable the Switch for HTTP/HTTPS | ![Screenshot_20230125_122419_Every Proxy](https://user-images.githubusercontent.com/50703696/214552720-0fdad48e-ae6c-499f-9549-3adefcf21af1.png) |
| 7. | Connect to your mobile hotspot with your PC | ![image](https://user-images.githubusercontent.com/50703696/214553649-e2a3e1fb-f8fd-42bb-ac46-0f255d496492.png) |
| 8. | Start `Proxy Settings.exe` | ![image](https://user-images.githubusercontent.com/50703696/214554089-615c637f-d5da-4031-b24a-377b03bc9e33.png) |
| 9. | Type in the IP Address you selected in step 5 and click on apply | ![image](https://user-images.githubusercontent.com/50703696/214554255-774545e0-3efc-44c4-b36d-3b3a5cb57091.png) |
| 10. | Turn on the Proxy and that's it! | ![image](https://user-images.githubusercontent.com/50703696/214554402-5c27aceb-fdaa-48e1-b63a-2f7ce4351b81.png) |
| Steps | Description | Screenshots |
| :---: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| 1. | Activate the VPN service on you mobile phone<br>(in my case it's Kaspersky VPN) | ![Screenshot_20230125_115504_KasperskyVPN Secure Connection](https://user-images.githubusercontent.com/50703696/214552712-a21064e1-9cb1-46a7-b01c-84d92492b7ed.png) |
| 2. | Create a mobile hotspot in your mobile phones settings<br> (If you get a request to deactivate the VPN click on skip) | ![Screenshot_20230125_115945_KasperskyVPN Secure Connection](https://user-images.githubusercontent.com/50703696/214552724-2ad81e1c-1938-48a4-af53-ac12de42b175.png) |
| 3. | Open `Every Proxy` (install it from here: [https://play.google.com/store/apps/details?id=com.gorillasoftware.everyproxy](https://play.google.com/store/apps/details?id=com.gorillasoftware.everyproxy&gl=US&pli=1)) | ![Screenshot_20230125_122114_Google Play Store](https://user-images.githubusercontent.com/50703696/214552728-af2b56ed-8353-43d8-af88-30a316832d84.png) |
| 4. | Click on the 3 dots in the top right corner and open the settings | ![Screenshot_20230125_122351_Every Proxy](https://user-images.githubusercontent.com/50703696/214552723-bf7f1f59-3c6c-4d68-8dc7-2cb36e0b6ac9.png) |
| 5. | Under HTTP/S Proxy click on IP Address and select your IP (usually it's the one at the bottom) | ![Screenshot_20230125_122412_Every Proxy](https://user-images.githubusercontent.com/50703696/214552717-f235daa0-5004-40dd-b3f8-6aab3c724060.png) |
| 6. | Exit the settings and enable the Switch for HTTP/HTTPS | ![Screenshot_20230125_122419_Every Proxy](https://user-images.githubusercontent.com/50703696/214552720-0fdad48e-ae6c-499f-9549-3adefcf21af1.png) |
| 7. | Connect to your mobile hotspot with your PC | ![image](https://user-images.githubusercontent.com/50703696/214553649-e2a3e1fb-f8fd-42bb-ac46-0f255d496492.png) |
| 8. | Start `Proxy Settings.exe` | ![image](https://user-images.githubusercontent.com/50703696/214554089-615c637f-d5da-4031-b24a-377b03bc9e33.png) |
| 9. | Type in the IP Address you selected in step 5 and click on apply | ![image](https://user-images.githubusercontent.com/50703696/214554255-774545e0-3efc-44c4-b36d-3b3a5cb57091.png) |
| 10. | Turn on the Proxy and that's it! | ![image](https://user-images.githubusercontent.com/50703696/214554402-5c27aceb-fdaa-48e1-b63a-2f7ce4351b81.png) |

## Screenshots:

Expand Down
Binary file removed build/Proxy Settings.exe
Binary file not shown.
4 changes: 4 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"optionDest": "disable_windowed_traceback",
"value": false
},
{
"optionDest": "version_file",
"value": "C:/Users/Ludo/Desktop/proxy-settings/version.rc"
},
{
"optionDest": "embed_manifest",
"value": true
Expand Down
20 changes: 16 additions & 4 deletions main.pyw
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from packaging.version import Version
from modules.UpdateUi import UpdateUi
from modules.WifiUi import WifiUi
from modules.ProxyUi import ProxyUi
from modules.SettingsUi import SettingsUi
import platform
import customtkinter
import requests
import logging
import json
import os

version = "1.4"
version = "1.5"

# set image path
image_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "images")
Expand Down Expand Up @@ -39,12 +40,23 @@ class RootApp(customtkinter.CTk):
self.tabview.pack(fill="both", expand=True)
self.tabview.add("Proxy Settings")
self.tabview.add("Wifi Settings")
self.tabview.add("Settings")

self.proxy_ui = ProxyUi(self.tabview.tab("Proxy Settings"), version)
self.proxy_ui.pack(fill="both", expand=True)

self.wifi_ui = WifiUi(self.tabview.tab("Wifi Settings"))
self.wifi_ui.pack(fill="both", expand=True)
if platform.system() == "Windows":
from modules.WifiUi import WifiUi
self.wifi_ui = WifiUi(self.tabview.tab("Wifi Settings"))
self.wifi_ui.pack(fill="both", expand=True)
else:
# display label if not on windows
label = customtkinter.CTkLabel(
self.tabview.tab("Wifi Settings"), text="This feature is only available on Windows for now.")
label.pack(fill="both", expand=True)

self.settings_ui = SettingsUi(self.tabview.tab("Settings"), version)
self.settings_ui.pack(fill="both", expand=True)

# check for software update
self.check_update()
Expand Down
8 changes: 7 additions & 1 deletion modules/ProxyUi.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import customtkinter
import logging
from modules import proxy
import platform
from modules.loggingHandler import TkinterHandler

if platform.system() == "Darwin":
import modules.proxy_macOS as proxy
elif platform.system() == "Windows":
import modules.proxy as proxy


class ProxyUi(customtkinter.CTkFrame):
def __init__(self, parent, version):
Expand Down Expand Up @@ -61,6 +66,7 @@ def __init__(self, parent, version):
master=self.frame, text="Disabled", text_color="red")
self.label.grid(row=1, column=0, sticky="e", padx=15, pady=(10, 0))

# Version Label
self.version_label = customtkinter.CTkLabel(
self, text=f"version {version}", text_color="grey", font=("Arial", 10))
self.version_label.pack(side=customtkinter.BOTTOM)
Expand Down
68 changes: 68 additions & 0 deletions modules/SettingsUi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import os
import json
import logging
import tempfile
import customtkinter


class SettingsUi(customtkinter.CTkFrame):
def __init__(self, parent, version):

# Main Frame
super().__init__(master=parent)
self.configure(fg_color="transparent")
self.root = parent

# set log folder path or create it if it does not exist
temp_dir = tempfile.gettempdir()
self.log_path = os.path.join(os.path.join(
os.path.dirname(temp_dir), 'Proxy Settings'), "logs")
if not os.path.exists(self.log_path):
os.makedirs(self.log_path)

# default settings
settings_json = {"log_path": ""}

# open the settings.json and if FileNotFoundError then create it
try:
with open(os.path.join(self.log_path, "settings.json"), "r") as infile:
json_object = json.load(infile)
except FileNotFoundError:
with open(os.path.join(self.log_path, "settings.json"), "w+") as outfile:
json.dump(settings_json, outfile)
with open(os.path.join(self.log_path, "settings.json"), "r") as infile:
json_object = json.load(infile)

# Save Button
self.save_button = customtkinter.CTkButton(
self, text="Save", command=lambda: self.save_settings("log_path"))
self.save_button.pack()

# Version Label
self.version_label = customtkinter.CTkLabel(
self, text=f"version {version}", text_color="grey", font=("Arial", 10))
self.version_label.pack(side=customtkinter.BOTTOM)

def save_settings(self, new_value):
"""
Dumps changes into the `settings.json` file, located in os.path.join(log_path, "settings.json").
Args:
new_value (_type_): Specific value to save into the json file. This value represents the configuration, preference or setting that the user has selected or modified and should be saved.
"""

# create settings string
settings_json = {
"log_path": f"{self.log_path}",
}

# write settings to file
with open(os.path.join(self.log_path, "settings.json"), "r") as infile:
settings_data = json.load(infile)
# add missing key
settings_data[new_value] = settings_json[new_value]
with open(os.path.join(self.log_path, "settings.json"), "w") as outfile:
json.dump(settings_data, outfile)

logging.info(
f"Settings updated → {new_value} = {settings_json[new_value]}")
Loading

0 comments on commit 880a730

Please sign in to comment.