Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
113 lines (98 loc) · 4.38 KB
/
Copy pathProgram.cs
File metadata and controls
113 lines (98 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System;
using Titanium.Web.Proxy;
using Titanium.Web.Proxy.EventArguments;
using Titanium.Web.Proxy.Models;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Threading.Tasks;
namespace PreziBypass
{
class Program
{
[DllImport("wininet.dll")]
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
private const int INTERNET_OPTION_SETTINGS_CHANGED = 39;
private const int INTERNET_OPTION_REFRESH = 37;
static void Main()
{
var proxyServer = InitializeProxy();
SetProxy("127.0.0.1:8000");
Console.WriteLine(@"
: .. :
. -. -- .- .
:. .=. == .=. .:
--. ==. .==. .== .--
.:. -=- -==.:==:.==- -=- .:.
.--: -==::===-==-===::==- :--.
.-=-:.-================-.:-=-.
.::.. :========================: ..::.
.:-==---======================---==-:.
:-==========================-:
.:::::::---========================---:::::::.
...::--==========================--::...
.:-==========================-:.
.:-====--========================--====-:.
.. .-========================-. ..
:===-:====================:-===:
.--:. .-==-==============-==-. .:--.
.. :==-.:===-======-===:.-==: ..
--: ==- :==::==: -== :--
.:. -=: :=- -=: :=- .:.
.=. :=. .=: .=.
- -- -- -
. - - .
. .
");
Console.WriteLine("Waiting...");
while (true) { }
}
private static ProxyServer InitializeProxy()
{
var proxyServer = new ProxyServer();
proxyServer.BeforeResponse += OnResponse;
var explicitEndPoint = new ExplicitProxyEndPoint(System.Net.IPAddress.Any, 8000, true);
proxyServer.AddEndPoint(explicitEndPoint);
proxyServer.Start();
return proxyServer;
}
private static async Task OnResponse(object sender, SessionEventArgs e)
{
if (e.HttpClient.Request.Url == "https://prezi.com/api/desktop/license/json/")
{
var bodyString = await e.GetResponseBodyAsString();
Console.WriteLine("Bypassing...");
if (bodyString.Contains("false"))
{
bodyString = bodyString.Replace("false", "true");
e.SetResponseBody(System.Text.Encoding.UTF8.GetBytes(bodyString));
Console.WriteLine("Done...");
DisableProxy();
}
}
}
private static void SetProxy(string proxyAddress)
{
UpdateRegistrySettings(1, proxyAddress);
NotifyOSSettingsChanged();
}
private static void DisableProxy()
{
UpdateRegistrySettings(0);
NotifyOSSettingsChanged();
}
private static void UpdateRegistrySettings(int enable, string proxyAddress = null)
{
using RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", writable: true);
registry.SetValue("ProxyEnable", enable);
if (proxyAddress != null)
{
registry.SetValue("ProxyServer", proxyAddress);
}
}
private static void NotifyOSSettingsChanged()
{
_ = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
_ = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);
}
}
}