-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,506 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33020.496 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoAwayEdge", "GoAwayEdge\GoAwayEdge.csproj", "{95F3960E-372B-45F3-85D8-CD06F4D8B271}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{95F3960E-372B-45F3-85D8-CD06F4D8B271}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{95F3960E-372B-45F3-85D8-CD06F4D8B271}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{95F3960E-372B-45F3-85D8-CD06F4D8B271}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{95F3960E-372B-45F3-85D8-CD06F4D8B271}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {D20C3464-AF65-471C-BCB5-27DED57893FE} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Application x:Class="GoAwayEdge.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:GoAwayEdge" | ||
Startup="Application_Startup" | ||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ui:ThemesDictionary Theme="Dark" /> | ||
<ui:ControlsDictionary /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/* | ||
* Go away Edge - IFEO Method | ||
* by valnoxy (valnoxy.dev) | ||
* ---------------------------------- | ||
* HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe | ||
* > UseFilter (DWORD) = 1 | ||
* | ||
* HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\0 | ||
* > Debugger (REG_SZ) = "Path\To\GoAwayEdge.exe" | ||
* > FullFilterPath (REG_SZ) = C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe | ||
*/ | ||
|
||
using GoAwayEdge.Common; | ||
using System.Diagnostics; | ||
using System.Security.Principal; | ||
using System.Windows; | ||
|
||
namespace GoAwayEdge | ||
{ | ||
/// <summary> | ||
/// Interaktionslogik für App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
private static string? _url; | ||
private static SearchEngine _engine = SearchEngine.Google; // Fallback | ||
|
||
public void Application_Startup(object sender, StartupEventArgs e) | ||
{ | ||
if (e.Args.Length == 0) | ||
{ | ||
if (IsAdministrator() == false) | ||
{ | ||
// Restart program and run as admin | ||
var exeName = System.Diagnostics.Process.GetCurrentProcess().MainModule?.FileName; | ||
ProcessStartInfo startInfo = new ProcessStartInfo(exeName); | ||
startInfo.Verb = "runas"; | ||
startInfo.UseShellExecute = true; | ||
System.Diagnostics.Process.Start(startInfo); | ||
Application.Current.Shutdown(); | ||
return; | ||
} | ||
|
||
var installer = new Installer(); | ||
installer.ShowDialog(); | ||
Environment.Exit(0); | ||
} | ||
|
||
string[] args = e.Args; | ||
Output.WriteLine("Please go away Edge!"); | ||
Output.WriteLine("Hooked into process via IFEO successfully."); | ||
var argumentJoin = string.Join(",", args); | ||
Output.WriteLine("Command line args:\n\n" + argumentJoin + "\n", ConsoleColor.Gray); | ||
|
||
// Filter command line args | ||
foreach (var arg in args) | ||
{ | ||
if (arg.Contains("microsoft-edge:")) | ||
{ | ||
_url = arg; | ||
} | ||
|
||
if (arg.Contains("-se")) | ||
{ | ||
var argParsed = arg.Remove(0,3); | ||
_engine = argParsed switch | ||
{ | ||
"Google" => SearchEngine.Google, | ||
"Bing" => SearchEngine.Bing, | ||
"DuckDuckGo" => SearchEngine.DuckDuckGo, | ||
"Yahoo" => SearchEngine.Yahoo, | ||
"Yandex" => SearchEngine.Yandex, | ||
"Ecosia" => SearchEngine.Ecosia, | ||
"Ask" => SearchEngine.Ask, | ||
_ => SearchEngine.Google // Fallback search engine | ||
}; | ||
} | ||
} | ||
|
||
// Open URL in default browser | ||
if (_url != null) | ||
{ | ||
var parsed = ParsingUrl(_url); | ||
Output.WriteLine("Opening URL in default browser:\n\n" + parsed + "\n", ConsoleColor.Gray); | ||
|
||
Process p = new Process(); | ||
p.StartInfo.FileName = parsed; | ||
p.StartInfo.Arguments = ""; | ||
p.StartInfo.UseShellExecute = true; | ||
p.StartInfo.RedirectStandardOutput = false; | ||
p.Start(); | ||
} | ||
|
||
Environment.Exit(0); | ||
} | ||
|
||
private static string ParsingUrl(string encodedUrl) | ||
{ | ||
// Remove URI handler with url argument prefix | ||
encodedUrl = encodedUrl[encodedUrl.IndexOf("http", StringComparison.Ordinal)..]; | ||
|
||
// Remove junk after search term | ||
if (encodedUrl.Contains("https%3A%2F%2Fwww.bing.com%2Fsearch%3Fq%3D") && !encodedUrl.Contains("redirect")) | ||
encodedUrl = encodedUrl.Substring(encodedUrl.IndexOf("http", StringComparison.Ordinal), encodedUrl.IndexOf("%26", StringComparison.Ordinal)); | ||
|
||
// Alternative url form | ||
if (encodedUrl.Contains("https%3A%2F%2Fwww.bing.com%2Fsearch%3Fform%3D")) | ||
{ | ||
encodedUrl = encodedUrl.Substring(encodedUrl.IndexOf("26q%3D", StringComparison.Ordinal) + 6, encodedUrl.Length - (encodedUrl.IndexOf("26q%3D", StringComparison.Ordinal) + 6)); | ||
encodedUrl = "https://www.bing.com/search?q=" + encodedUrl; | ||
} | ||
|
||
// Decode Url | ||
encodedUrl = encodedUrl.Contains("redirect") ? DotSlash(encodedUrl) : DecodeUrlString(encodedUrl); | ||
|
||
// Replace Search Engine | ||
encodedUrl = encodedUrl.Replace("https://www.bing.com/search?q=", DefineEngine(_engine)); | ||
|
||
Uri uri = new(encodedUrl.ToString()); | ||
return uri.ToString(); | ||
} | ||
|
||
private static string DefineEngine(SearchEngine engine) | ||
{ | ||
return engine switch | ||
{ | ||
SearchEngine.Google => "https://www.google.com/search?q=", | ||
SearchEngine.Bing => "https://www.bing.com/search?q=", | ||
SearchEngine.DuckDuckGo => "https://duckduckgo.com/?q=", | ||
SearchEngine.Yahoo => "https://search.yahoo.com/search?p=", | ||
SearchEngine.Yandex => "https://yandex.com/search/?text=", | ||
SearchEngine.Ecosia => "https://www.ecosia.org/search?q=", | ||
SearchEngine.Ask => "https://www.ask.com/web?q=", | ||
_ => "https://www.google.com/search?q=" | ||
}; | ||
} | ||
|
||
private static string DecodeUrlString(string url) | ||
{ | ||
string newUrl; | ||
while ((newUrl = Uri.UnescapeDataString(url)) != url) | ||
url = newUrl; | ||
return newUrl; | ||
} | ||
|
||
private static string DotSlash(string url) | ||
{ | ||
url = url.Replace("%3A", ":"); | ||
url = url.Replace("%2F", "/"); | ||
return url; | ||
} | ||
|
||
private static bool IsAdministrator() | ||
{ | ||
WindowsIdentity identity = WindowsIdentity.GetCurrent(); | ||
WindowsPrincipal principal = new WindowsPrincipal(identity); | ||
return principal.IsInRole(WindowsBuiltInRole.Administrator); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace GoAwayEdge.Common | ||
{ | ||
internal enum SearchEngine | ||
{ | ||
Google, | ||
Bing, | ||
DuckDuckGo, | ||
Yahoo, | ||
Yandex, | ||
Ecosia, | ||
Ask | ||
} | ||
|
||
internal enum EdgeChannel | ||
{ | ||
Stable, | ||
Beta, | ||
Dev, | ||
Canary | ||
} | ||
|
||
internal class Configuration | ||
{ | ||
public static EdgeChannel Channel { get; set; } | ||
public static SearchEngine Search { get; set; } | ||
public static bool Uninstall { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace GoAwayEdge.Common | ||
{ | ||
public class Output | ||
{ | ||
public static void WriteLine(string message, ConsoleColor color = ConsoleColor.White) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.DarkGray; | ||
Console.Write("["); | ||
Console.ForegroundColor = ConsoleColor.White; | ||
Console.Write("*"); | ||
Console.ForegroundColor = ConsoleColor.DarkGray; | ||
Console.Write("] "); | ||
|
||
Console.ForegroundColor = color; | ||
Console.WriteLine(message); | ||
Console.ResetColor(); | ||
} | ||
|
||
public static void Write(string message, ConsoleColor color = ConsoleColor.White) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.DarkGray; | ||
Console.Write("["); | ||
Console.ForegroundColor = ConsoleColor.White; | ||
Console.Write("*"); | ||
Console.ForegroundColor = ConsoleColor.DarkGray; | ||
Console.Write("] "); | ||
|
||
Console.ForegroundColor = color; | ||
Console.Write(message); | ||
Console.ResetColor(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net7.0-windows</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
<SelfContained>false</SelfContained> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<PublishReadyToRun>true</PublishReadyToRun> | ||
<UseWPF>true</UseWPF> | ||
<AssemblyName>GoAwayEdge</AssemblyName> | ||
<Company>Exploitox</Company> | ||
<Authors>valnoxy</Authors> | ||
<Version>1.0.0.5</Version> | ||
<Copyright>Copyright (c) 2018 - 2022 Exploitox. All rights reserved.</Copyright> | ||
<PackageProjectUrl>https://github.com/valnoxy/GoAwayEdge</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/valnoxy/GoAwayEdge</RepositoryUrl> | ||
<StartupObject>GoAwayEdge.App</StartupObject> | ||
<ApplicationIcon>GoAwayEdge.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="GoAwayEdge.ico" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="WPF-UI" Version="2.0.3" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<_LastSelectedProfileId>C:\Users\jonas\source\repos\GoAwayEdge\GoAwayEdge\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Update="App.xaml.cs"> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
<Compile Update="Pages\Installation.xaml.cs"> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
<Compile Update="Pages\InstallationSuccess.xaml.cs"> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
<Compile Update="Installer.xaml.cs"> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
<Compile Update="Pages\License.xaml.cs"> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
<Compile Update="Pages\Settings.xaml.cs"> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Page Update="App.xaml"> | ||
<SubType>Designer</SubType> | ||
</Page> | ||
<Page Update="Pages\Installation.xaml"> | ||
<SubType>Designer</SubType> | ||
</Page> | ||
<Page Update="Pages\InstallationSuccess.xaml"> | ||
<SubType>Designer</SubType> | ||
</Page> | ||
<Page Update="Installer.xaml"> | ||
<SubType>Designer</SubType> | ||
</Page> | ||
<Page Update="Pages\License.xaml"> | ||
<SubType>Designer</SubType> | ||
</Page> | ||
<Page Update="Pages\Settings.xaml"> | ||
<SubType>Designer</SubType> | ||
</Page> | ||
</ItemGroup> | ||
</Project> |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.