Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic
C ccybersecurityhttp3httpproxylinuxlinux-proxymacosmacos-appmacos-proxyproxifierproxifier-alternativeproxyclienttcpthick-clientudpwindivertwindows
added process selection option with browse
Sourav Kalalc7a9c74c06c8
diff --git a/gui/ViewModels/MainWindowViewModel.cs b/gui/ViewModels/MainWindowViewModel.csindex dda80e5..3355d81 100644--- a/gui/ViewModels/MainWindowViewModel.cs+++ b/gui/ViewModels/MainWindowViewModel.cs@@ -302,6 +302,7 @@ public class MainWindowViewModel : ViewModelBase);window.DataContext = viewModel;+ viewModel.SetWindow(window);if (_mainWindow != null){diff --git a/gui/ViewModels/ProxyRulesViewModel.cs b/gui/ViewModels/ProxyRulesViewModel.csindex e44b36c..912c55b 100644--- a/gui/ViewModels/ProxyRulesViewModel.cs+++ b/gui/ViewModels/ProxyRulesViewModel.cs@@ -1,6 +1,7 @@using System;using System.Collections.ObjectModel;using System.Windows.Input;+using Avalonia.Controls;using ProxyBridge.GUI.Services;namespace ProxyBridge.GUI.ViewModels;@@ -17,6 +18,7 @@ public class ProxyRulesViewModel : ViewModelBaseprivate Action<ProxyRule>? _onAddRule;private Action? _onClose;private ProxyBridgeService? _proxyService;+ private Window? _window;public ObservableCollection<ProxyRule> ProxyRules { get; }@@ -70,6 +72,12 @@ public class ProxyRulesViewModel : ViewModelBasepublic ICommand SaveNewRuleCommand { get; }public ICommand CancelAddRuleCommand { get; }public ICommand CloseCommand { get; }+ public ICommand BrowseProcessCommand { get; }++ public void SetWindow(Window window)+ {+ _window = window;+ }public ProxyRulesViewModel(ObservableCollection<ProxyRule> proxyRules, Action<ProxyRule> onAddRule, Action onClose, ProxyBridgeService? proxyService = null){@@ -160,6 +168,49 @@ public class ProxyRulesViewModel : ViewModelBase{_onClose?.Invoke();});++ BrowseProcessCommand = new RelayCommand(async () =>+ {+ if (_window == null)+ return;++ var dialog = new Avalonia.Platform.Storage.FilePickerOpenOptions+ {+ Title = "Select Process Executable",+ AllowMultiple = false,+ FileTypeFilter = new[]+ {+ new Avalonia.Platform.Storage.FilePickerFileType("Executable Files")+ {+ Patterns = new[] { "*.exe" }+ },+ new Avalonia.Platform.Storage.FilePickerFileType("All Files")+ {+ Patterns = new[] { "*.*" }+ }+ }+ };++ var result = await _window.StorageProvider.OpenFilePickerAsync(dialog);++ if (result != null && result.Count > 0)+ {+ string filename = System.IO.Path.GetFileName(result[0].Path.LocalPath);+ if (string.IsNullOrWhiteSpace(NewProcessName) || NewProcessName == "*")+ {+ NewProcessName = filename;+ }+ else+ {+ if (!NewProcessName.EndsWith(";"))+ NewProcessName += "; ";+ else+ NewProcessName += " ";++ NewProcessName += filename;+ }+ }+ });}private void Rule_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)diff --git a/gui/Views/ProxyRulesWindow.axaml b/gui/Views/ProxyRulesWindow.axamlindex efc32ba..5e8f754 100644--- a/gui/Views/ProxyRulesWindow.axaml+++ b/gui/Views/ProxyRulesWindow.axaml@@ -229,8 +229,17 @@<!-- Applications Section --><StackPanel Spacing="6"><TextBlock Text="Applications" Classes="label"/>- <TextBox Text="{Binding NewProcessName}"- Watermark="Any"/>+ <Grid ColumnDefinitions="*,Auto">+ <TextBox Grid.Column="0"+ Text="{Binding NewProcessName}"+ Watermark="Any"+ Margin="0,0,8,0"/>+ <Button Grid.Column="1"+ Content="Browse..."+ Command="{Binding BrowseProcessCommand}"+ Padding="12,8"+ MinWidth="100"/>+ </Grid><TextBlock Text="Example: iexplore.exe; "C:\some app.exe"; fire*.exe; *.bin"FontSize="11"Foreground="#FF999999"