├── .github └── workflows │ └── pr_notification.yml ├── .gitignore ├── Console ├── App.config ├── Ed25519.cs ├── KeyAuth.cs ├── Loader.csproj ├── Loader.sln ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── Form ├── App.config ├── Drag.cs ├── Ed25519.cs ├── KeyAuth.cs ├── Loader.csproj ├── Loader.sln ├── Login.Designer.cs ├── Login.cs ├── Login.resx ├── Main.Designer.cs ├── Main.cs ├── Main.resx ├── Program.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── LICENSE └── README.md /.github/workflows/pr_notification.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Notification 2 | 3 | on: 4 | pull_request_target: 5 | types: 6 | - opened 7 | 8 | jobs: 9 | notify: 10 | uses: KeyAuth/.github/.github/workflows/pr_notification_global.yml@main 11 | secrets: 12 | DISCORD_PR: ${{ secrets.DISCORD_PR }} 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /Console/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Console/Ed25519.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Numerics; 6 | using System.Security.Cryptography; 7 | 8 | namespace Cryptographic 9 | { 10 | /* Ported and refactored from Java to C# by Hans Wolff, 10/10/2013 11 | * Released to the public domain 12 | * / 13 | 14 | /* Java code written by k3d3 15 | * Source: https://github.com/k3d3/ed25519-java/blob/master/ed25519.java 16 | * Released to the public domain 17 | */ 18 | 19 | public class Ed25519 20 | { 21 | private static byte[] ComputeHash(byte[] m) 22 | { 23 | using (var sha512 = SHA512.Create()) // System.Security.Cryptography 24 | { 25 | return sha512.ComputeHash(m); 26 | } 27 | } 28 | 29 | private static BigInteger ExpMod(BigInteger number, BigInteger exponent, BigInteger modulo) 30 | { 31 | BigInteger result = BigInteger.One; 32 | BigInteger baseVal = number.Mod(modulo); 33 | 34 | while (exponent > 0) 35 | { 36 | if (!exponent.IsEven) 37 | { 38 | result = (result * baseVal).Mod(modulo); 39 | } 40 | baseVal = (baseVal * baseVal).Mod(modulo); 41 | exponent /= 2; 42 | } 43 | 44 | return result; 45 | } 46 | 47 | 48 | private static readonly Dictionary InverseCache = new Dictionary(); 49 | 50 | private static BigInteger Inv(BigInteger x) 51 | { 52 | if (!InverseCache.ContainsKey(x)) 53 | { 54 | InverseCache[x] = ExpMod(x, Qm2, Q); 55 | } 56 | return InverseCache[x]; 57 | } 58 | 59 | private static BigInteger RecoverX(BigInteger y) 60 | { 61 | BigInteger y2 = y * y; 62 | BigInteger xx = (y2 - 1) * Inv(D * y2 + 1); 63 | BigInteger x = ExpMod(xx, Qp3 / Eight, Q); 64 | if (!(x * x - xx).Mod(Q).Equals(BigInteger.Zero)) 65 | { 66 | x = (x * I).Mod(Q); 67 | } 68 | if (!x.IsEven) 69 | { 70 | x = Q - x; 71 | } 72 | return x; 73 | } 74 | 75 | private static Tuple Edwards(BigInteger px, BigInteger py, BigInteger qx, BigInteger qy) 76 | { 77 | BigInteger xx12 = px * qx; 78 | BigInteger yy12 = py * qy; 79 | BigInteger dtemp = D * xx12 * yy12; 80 | BigInteger x3 = (px * qy + qx * py) * (Inv(1 + dtemp)); 81 | BigInteger y3 = (py * qy + xx12) * (Inv(1 - dtemp)); 82 | return new Tuple(x3.Mod(Q), y3.Mod(Q)); 83 | } 84 | 85 | private static Tuple EdwardsSquare(BigInteger x, BigInteger y) 86 | { 87 | BigInteger xx = x * x; 88 | BigInteger yy = y * y; 89 | BigInteger dtemp = D * xx * yy; 90 | BigInteger x3 = (2 * x * y) * (Inv(1 + dtemp)); 91 | BigInteger y3 = (yy + xx) * (Inv(1 - dtemp)); 92 | return new Tuple(x3.Mod(Q), y3.Mod(Q)); 93 | } 94 | private static Tuple ScalarMul(Tuple point, BigInteger scalar) 95 | { 96 | var result = new Tuple(BigInteger.Zero, BigInteger.One); // Neutral element 97 | var basePoint = point; 98 | 99 | while (scalar > 0) 100 | { 101 | if (!scalar.IsEven) // If the current bit is set, add the base point to the result 102 | { 103 | result = Edwards(result.Item1, result.Item2, basePoint.Item1, basePoint.Item2); 104 | } 105 | 106 | basePoint = EdwardsSquare(basePoint.Item1, basePoint.Item2); // Double the point 107 | scalar >>= 1; // Move to the next bit in the scalar 108 | } 109 | 110 | return result; 111 | } 112 | 113 | public static byte[] EncodeInt(BigInteger y) 114 | { 115 | byte[] nin = y.ToByteArray(); 116 | var nout = new byte[Math.Max(nin.Length, 32)]; 117 | Array.Copy(nin, nout, nin.Length); 118 | return nout; 119 | } 120 | 121 | public static byte[] EncodePoint(BigInteger x, BigInteger y) 122 | { 123 | byte[] nout = EncodeInt(y); 124 | nout[nout.Length - 1] |= (x.IsEven ? (byte)0 : (byte)0x80); 125 | return nout; 126 | } 127 | 128 | private static int GetBit(byte[] h, int i) 129 | { 130 | return h[i / 8] >> (i % 8) & 1; 131 | } 132 | 133 | public static byte[] PublicKey(byte[] signingKey) 134 | { 135 | byte[] h = ComputeHash(signingKey); 136 | BigInteger a = TwoPowBitLengthMinusTwo; 137 | for (int i = 3; i < (BitLength - 2); i++) 138 | { 139 | var bit = GetBit(h, i); 140 | if (bit != 0) 141 | { 142 | a += TwoPowCache[i]; 143 | } 144 | } 145 | var bigA = ScalarMul(B, a); 146 | return EncodePoint(bigA.Item1, bigA.Item2); 147 | } 148 | 149 | private static BigInteger HashInt(byte[] m) 150 | { 151 | byte[] h = ComputeHash(m); 152 | BigInteger hsum = BigInteger.Zero; 153 | for (int i = 0; i < 2 * BitLength; i++) 154 | { 155 | var bit = GetBit(h, i); 156 | if (bit != 0) 157 | { 158 | hsum += TwoPowCache[i]; 159 | } 160 | } 161 | return hsum; 162 | } 163 | 164 | public static byte[] Signature(byte[] message, byte[] signingKey, byte[] publicKey) 165 | { 166 | byte[] h = ComputeHash(signingKey); 167 | BigInteger a = TwoPowBitLengthMinusTwo; 168 | for (int i = 3; i < (BitLength - 2); i++) 169 | { 170 | var bit = GetBit(h, i); 171 | if (bit != 0) 172 | { 173 | a += TwoPowCache[i]; 174 | } 175 | } 176 | 177 | BigInteger r; 178 | using (var rsub = new MemoryStream((BitLength / 8) + message.Length)) 179 | { 180 | rsub.Write(h, BitLength / 8, BitLength / 4 - BitLength / 8); 181 | rsub.Write(message, 0, message.Length); 182 | r = HashInt(rsub.ToArray()); 183 | } 184 | var bigR = ScalarMul(B, r); 185 | BigInteger s; 186 | var encodedBigR = EncodePoint(bigR.Item1, bigR.Item2); 187 | using (var stemp = new MemoryStream(32 + publicKey.Length + message.Length)) 188 | { 189 | stemp.Write(encodedBigR, 0, encodedBigR.Length); 190 | stemp.Write(publicKey, 0, publicKey.Length); 191 | stemp.Write(message, 0, message.Length); 192 | s = (r+ HashInt(stemp.ToArray()) * a).Mod(L); 193 | } 194 | 195 | using (var nout = new MemoryStream(64)) 196 | { 197 | nout.Write(encodedBigR, 0, encodedBigR.Length); 198 | var encodeInt = EncodeInt(s); 199 | nout.Write(encodeInt, 0, encodeInt.Length); 200 | return nout.ToArray(); 201 | } 202 | } 203 | 204 | private static bool IsOnCurve(BigInteger x, BigInteger y) 205 | { 206 | BigInteger xx = x * x; 207 | BigInteger yy = y * y; 208 | BigInteger dxxyy = D * yy * xx; 209 | return (yy - xx - dxxyy - 1).Mod(Q).Equals(BigInteger.Zero); 210 | } 211 | 212 | private static BigInteger DecodeInt(byte[] s) 213 | { 214 | return new BigInteger(s) & Un; 215 | } 216 | 217 | private static Tuple DecodePoint(byte[] pointBytes) 218 | { 219 | BigInteger y = new BigInteger(pointBytes) & Un; 220 | BigInteger x = RecoverX(y); 221 | if ((x.IsEven ? 0 : 1) != GetBit(pointBytes, BitLength - 1)) 222 | { 223 | x = Q - x; 224 | } 225 | var point = new Tuple(x, y); 226 | if (!IsOnCurve(x, y)) throw new ArgumentException("Decoding point that is not on curve"); 227 | return point; 228 | } 229 | 230 | public static bool CheckValid(byte[] signature, byte[] message, byte[] publicKey) 231 | { 232 | Console.Write("."); // ... dots in console 233 | if (signature.Length != BitLength / 4) throw new ArgumentException("Signature length is wrong"); 234 | if (publicKey.Length != BitLength / 8) throw new ArgumentException("Public key length is wrong"); 235 | 236 | byte[] rByte = Arrays.CopyOfRange(signature, 0, BitLength / 8); 237 | 238 | var r = DecodePoint(rByte); 239 | var a = DecodePoint(publicKey); 240 | 241 | byte[] sByte = Arrays.CopyOfRange(signature, BitLength / 8, BitLength / 4); 242 | 243 | BigInteger s = DecodeInt(sByte); 244 | BigInteger h; 245 | 246 | using (var stemp = new MemoryStream(32 + publicKey.Length + message.Length)) 247 | { 248 | var encodePoint = EncodePoint(r.Item1, r.Item2); 249 | stemp.Write(encodePoint, 0, encodePoint.Length); 250 | stemp.Write(publicKey, 0, publicKey.Length); 251 | stemp.Write(message, 0, message.Length); 252 | h = HashInt(stemp.ToArray()); 253 | } 254 | 255 | Console.Write("."); // ... dots in console 256 | var ra = ScalarMul(B, s); 257 | Console.Write("."); // ... dots in console 258 | var ah = ScalarMul(a, h); 259 | var rb = Edwards(r.Item1, r.Item2, ah.Item1, ah.Item2); 260 | if (!ra.Item1.Equals(rb.Item1) || !ra.Item2.Equals(rb.Item2)) 261 | return false; 262 | return true; 263 | } 264 | 265 | private const int BitLength = 256; 266 | 267 | private static readonly BigInteger TwoPowBitLengthMinusTwo = BigInteger.Pow(2, BitLength - 2); 268 | private static readonly BigInteger[] TwoPowCache = Enumerable.Range(0, 2 * BitLength).Select(i => BigInteger.Pow(2, i)).ToArray(); 269 | 270 | private static readonly BigInteger Q = 271 | BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819949"); 272 | 273 | private static readonly BigInteger Qm2 = 274 | BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819947"); 275 | 276 | private static readonly BigInteger Qp3 = 277 | BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819952"); 278 | 279 | private static readonly BigInteger L = 280 | BigInteger.Parse("7237005577332262213973186563042994240857116359379907606001950938285454250989"); 281 | 282 | private static readonly BigInteger D = 283 | BigInteger.Parse("-4513249062541557337682894930092624173785641285191125241628941591882900924598840740"); 284 | 285 | private static readonly BigInteger I = 286 | BigInteger.Parse("19681161376707505956807079304988542015446066515923890162744021073123829784752"); 287 | 288 | private static readonly BigInteger By = 289 | BigInteger.Parse("46316835694926478169428394003475163141307993866256225615783033603165251855960"); 290 | 291 | private static readonly BigInteger Bx = 292 | BigInteger.Parse("15112221349535400772501151409588531511454012693041857206046113283949847762202"); 293 | 294 | private static readonly Tuple B = new Tuple(Bx.Mod(Q), By.Mod(Q)); 295 | 296 | private static readonly BigInteger Un = 297 | BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819967"); 298 | 299 | private static readonly BigInteger Two = new BigInteger(2); 300 | private static readonly BigInteger Eight = new BigInteger(8); 301 | } 302 | 303 | internal static class Arrays 304 | { 305 | public static byte[] CopyOfRange(byte[] original, int from, int to) 306 | { 307 | int length = to - from; 308 | var result = new byte[length]; 309 | Array.Copy(original, from, result, 0, length); 310 | return result; 311 | } 312 | } 313 | 314 | internal static class BigIntegerHelpers 315 | { 316 | public static BigInteger Mod(this BigInteger num, BigInteger modulo) 317 | { 318 | var result = num % modulo; 319 | return result < 0 ? result + modulo : result; 320 | } 321 | } 322 | } -------------------------------------------------------------------------------- /Console/Loader.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {31F3AC92-CD6F-4F65-A93C-0162FAD41FA6} 8 | Exe 9 | Loader 10 | Loader 11 | v4.8 12 | 512 13 | true 14 | true 15 | publish\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | 0 26 | 1.0.0.%2a 27 | false 28 | false 29 | true 30 | 31 | 32 | 33 | AnyCPU 34 | false 35 | none 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | none 40 | 4 41 | 42 | 43 | AnyCPU 44 | none 45 | true 46 | bin\Release\ 47 | TRACE 48 | none 49 | 4 50 | 51 | 52 | 53 | 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | False 75 | Microsoft .NET Framework 4.7.2 %28x86 and x64%29 76 | true 77 | 78 | 79 | False 80 | .NET Framework 3.5 SP1 81 | false 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /Console/Loader.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29709.97 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Loader", "Loader.csproj", "{31F3AC92-CD6F-4F65-A93C-0162FAD41FA6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {31F3AC92-CD6F-4F65-A93C-0162FAD41FA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {31F3AC92-CD6F-4F65-A93C-0162FAD41FA6}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {31F3AC92-CD6F-4F65-A93C-0162FAD41FA6}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {31F3AC92-CD6F-4F65-A93C-0162FAD41FA6}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {860AB0D3-FAA1-41DE-8E92-43275EEEB66F} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Console/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Reflection; 6 | using System.Runtime.InteropServices; 7 | using System.Security.Cryptography; 8 | using System.Text; 9 | using System.Threading; 10 | using System.Windows.Forms; 11 | 12 | namespace KeyAuth 13 | { 14 | class Program 15 | { 16 | 17 | /* 18 | * 19 | * WATCH THIS VIDEO TO SETUP APPLICATION: https://youtube.com/watch?v=RfDTdiBq4_o 20 | * 21 | * READ HERE TO LEARN ABOUT KEYAUTH FUNCTIONS https://github.com/KeyAuth/KeyAuth-CSHARP-Example#keyauthapp-instance-definition 22 | * 23 | */ 24 | 25 | public static api KeyAuthApp = new api( 26 | name: "", // Application Name 27 | ownerid: "", // Account ID 28 | version: "" // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs 29 | //path: @"Your_Path_Here" // (OPTIONAL) see tutorial here https://www.youtube.com/watch?v=I9rxt821gMk&t=1s 30 | ); 31 | 32 | [DllImport("kernel32.dll", SetLastError = true)] 33 | private static extern bool TerminateProcess(IntPtr hProcess, uint uExitCode); 34 | 35 | [DllImport("kernel32.dll", SetLastError = true)] 36 | private static extern IntPtr GetCurrentProcess(); 37 | 38 | [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] 39 | private static extern ushort GlobalFindAtom(string lpString); 40 | 41 | static void Main(string[] args) 42 | { 43 | 44 | securityChecks(); 45 | 46 | Console.Title = "Loader"; 47 | Console.WriteLine("\n\n Connecting.."); 48 | KeyAuthApp.init(); 49 | 50 | autoUpdate(); 51 | 52 | if (!KeyAuthApp.response.success) 53 | { 54 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 55 | Thread.Sleep(1500); 56 | TerminateProcess(GetCurrentProcess(), 1); 57 | } 58 | 59 | Console.Write("\n [1] Login\n [2] Register\n [3] Upgrade\n [4] License key only\n [5] Forgot password\n\n Choose option: "); 60 | 61 | string username, password, key, email, code; 62 | 63 | int option = int.Parse(Console.ReadLine()); 64 | switch (option) 65 | { 66 | case 1: 67 | Console.Write("\n\n Enter username: "); 68 | username = Console.ReadLine(); 69 | Console.Write("\n\n Enter password: "); 70 | password = Console.ReadLine(); 71 | Console.Write("\n\n Enter 2fa code: (not using 2fa? Just press enter) "); 72 | code = Console.ReadLine(); 73 | KeyAuthApp.login(username, password, code); 74 | break; 75 | case 2: 76 | Console.Write("\n\n Enter username: "); 77 | username = Console.ReadLine(); 78 | Console.Write("\n\n Enter password: "); 79 | password = Console.ReadLine(); 80 | Console.Write("\n\n Enter license: "); 81 | key = Console.ReadLine(); 82 | Console.Write("\n\n Enter email (just press enter if none): "); 83 | email = Console.ReadLine(); 84 | KeyAuthApp.register(username, password, key, email); 85 | break; 86 | case 3: 87 | Console.Write("\n\n Enter username: "); 88 | username = Console.ReadLine(); 89 | Console.Write("\n\n Enter license: "); 90 | key = Console.ReadLine(); 91 | KeyAuthApp.upgrade(username, key); 92 | // don't proceed to app, user hasn't authenticated yet. 93 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 94 | Thread.Sleep(2500); 95 | TerminateProcess(GetCurrentProcess(), 1); 96 | break; 97 | case 4: 98 | Console.Write("\n\n Enter license: "); 99 | key = Console.ReadLine(); 100 | Console.Write("\n\n Enter 2fa code: (not using 2fa? Just press enter"); 101 | code = Console.ReadLine(); 102 | KeyAuthApp.license(key, code); 103 | break; 104 | case 5: 105 | Console.Write("\n\n Enter username: "); 106 | username = Console.ReadLine(); 107 | Console.Write("\n\n Enter email: "); 108 | email = Console.ReadLine(); 109 | KeyAuthApp.forgot(username, email); 110 | // don't proceed to app, user hasn't authenticated yet. 111 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 112 | Thread.Sleep(2500); 113 | TerminateProcess(GetCurrentProcess(), 1); 114 | break; 115 | default: 116 | Console.WriteLine("\n\n Invalid Selection"); 117 | Thread.Sleep(2500); 118 | TerminateProcess(GetCurrentProcess(), 1); 119 | break; // no point in this other than to not get error from IDE 120 | } 121 | 122 | if (!KeyAuthApp.response.success) 123 | { 124 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 125 | Thread.Sleep(2500); 126 | TerminateProcess(GetCurrentProcess(), 1); 127 | } 128 | 129 | Console.WriteLine("\n Logged In!"); // at this point, the client has been authenticated. Put the code you want to run after here 130 | 131 | if(string.IsNullOrEmpty(KeyAuthApp.response.message)) TerminateProcess(GetCurrentProcess(), 1); 132 | 133 | // user data 134 | Console.WriteLine("\n User data:"); 135 | Console.WriteLine(" Username: " + KeyAuthApp.user_data.username); 136 | Console.WriteLine(" License: " + KeyAuthApp.user_data.subscriptions[0].key); // this can be used if the user used a license, username, and password for register. It'll display the license assigned to the user 137 | Console.WriteLine(" IP address: " + KeyAuthApp.user_data.ip); 138 | Console.WriteLine(" Hardware-Id: " + KeyAuthApp.user_data.hwid); 139 | Console.WriteLine(" Created at: " + UnixTimeToDateTime(long.Parse(KeyAuthApp.user_data.createdate))); 140 | if (!string.IsNullOrEmpty(KeyAuthApp.user_data.lastlogin)) // don't show last login on register since there is no last login at that point 141 | Console.WriteLine(" Last login at: " + UnixTimeToDateTime(long.Parse(KeyAuthApp.user_data.lastlogin))); 142 | Console.WriteLine(" Your subscription(s):"); 143 | for (var i = 0; i < KeyAuthApp.user_data.subscriptions.Count; i++) 144 | { 145 | Console.WriteLine(" Subscription name: " + KeyAuthApp.user_data.subscriptions[i].subscription + " - Expires at: " + UnixTimeToDateTime(long.Parse(KeyAuthApp.user_data.subscriptions[i].expiry)) + " - Time left in seconds: " + KeyAuthApp.user_data.subscriptions[i].timeleft); 146 | } 147 | 148 | Console.Write("\n [1] Enable 2FA\n [2] Disable 2FA\n Choose option: "); 149 | int tfaOptions = int.Parse(Console.ReadLine()); 150 | switch (tfaOptions) 151 | { 152 | case 1: 153 | KeyAuthApp.enable2fa(); 154 | break; 155 | case 2: 156 | Console.Write("Enter your 6 digit authorization code: "); 157 | code = Console.ReadLine(); 158 | KeyAuthApp.disable2fa(code); 159 | break; 160 | default: 161 | Console.WriteLine("\n\n Invalid Selection"); 162 | Thread.Sleep(2500); 163 | TerminateProcess(GetCurrentProcess(), 1); 164 | break; // no point in this other than to not get error from IDE 165 | } 166 | 167 | Console.WriteLine("\n Closing in five seconds..."); 168 | Thread.Sleep(-1); 169 | Environment.Exit(0); 170 | } 171 | 172 | public static bool SubExist(string name) 173 | { 174 | if(KeyAuthApp.user_data.subscriptions.Exists(x => x.subscription == name)) 175 | return true; 176 | return false; 177 | } 178 | 179 | public static DateTime UnixTimeToDateTime(long unixtime) 180 | { 181 | DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Local); 182 | try 183 | { 184 | dtDateTime = dtDateTime.AddSeconds(unixtime).ToLocalTime(); 185 | } 186 | catch 187 | { 188 | dtDateTime = DateTime.MaxValue; 189 | } 190 | return dtDateTime; 191 | } 192 | 193 | static void checkAtom() 194 | { 195 | Thread atomCheckThread = new Thread(() => 196 | { 197 | while (true) 198 | { 199 | Thread.Sleep(60000); // give people 1 minute to login 200 | 201 | ushort foundAtom = GlobalFindAtom(KeyAuthApp.ownerid); 202 | if (foundAtom == 0) 203 | { 204 | TerminateProcess(GetCurrentProcess(), 1); 205 | } 206 | } 207 | }); 208 | 209 | atomCheckThread.IsBackground = true; // Ensure the thread does not block program exit 210 | atomCheckThread.Start(); 211 | } 212 | 213 | static void securityChecks() 214 | { 215 | // check if the Loader was executed by a different program 216 | var frames = new StackTrace().GetFrames(); 217 | foreach (var frame in frames) 218 | { 219 | MethodBase method = frame.GetMethod(); 220 | if (method != null && method.DeclaringType?.Assembly != Assembly.GetExecutingAssembly()) 221 | { 222 | TerminateProcess(GetCurrentProcess(), 1); 223 | } 224 | } 225 | 226 | // check if HarmonyLib is attempting to poison our program 227 | var harmonyAssembly = AppDomain.CurrentDomain 228 | .GetAssemblies() 229 | .FirstOrDefault(a => a.GetName().Name == "0Harmony"); 230 | 231 | if (harmonyAssembly != null) 232 | { 233 | TerminateProcess(GetCurrentProcess(), 1); 234 | } 235 | 236 | checkAtom(); 237 | } 238 | 239 | static void autoUpdate() 240 | { 241 | if (KeyAuthApp.response.message == "invalidver") 242 | { 243 | if (!string.IsNullOrEmpty(KeyAuthApp.app_data.downloadLink)) 244 | { 245 | Console.WriteLine("\n Auto update avaliable!"); 246 | Console.WriteLine(" Choose how you'd like to auto update:"); 247 | Console.WriteLine(" [1] Open file in browser"); 248 | Console.WriteLine(" [2] Download file directly"); 249 | int choice = int.Parse(Console.ReadLine()); 250 | switch (choice) 251 | { 252 | case 1: 253 | Process.Start(KeyAuthApp.app_data.downloadLink); 254 | Environment.Exit(0); 255 | break; 256 | case 2: 257 | Console.WriteLine(" Downloading file directly.."); 258 | Console.WriteLine(" New file will be opened shortly.."); 259 | 260 | WebClient webClient = new WebClient(); 261 | string destFile = Application.ExecutablePath; 262 | 263 | string rand = random_string(); 264 | 265 | destFile = destFile.Replace(".exe", $"-{rand}.exe"); 266 | webClient.DownloadFile(KeyAuthApp.app_data.downloadLink, destFile); 267 | 268 | Process.Start(destFile); 269 | Process.Start(new ProcessStartInfo() 270 | { 271 | Arguments = "/C choice /C Y /N /D Y /T 3 & Del \"" + Application.ExecutablePath + "\"", 272 | WindowStyle = ProcessWindowStyle.Hidden, 273 | CreateNoWindow = true, 274 | FileName = "cmd.exe" 275 | }); 276 | Environment.Exit(0); 277 | 278 | break; 279 | default: 280 | Console.WriteLine(" Invalid selection, terminating program.."); 281 | Thread.Sleep(1500); 282 | Environment.Exit(0); 283 | break; 284 | } 285 | } 286 | Console.WriteLine("\n Status: Version of this program does not match the one online. Furthermore, the download link online isn't set. You will need to manually obtain the download link from the developer."); 287 | Thread.Sleep(2500); 288 | Environment.Exit(0); 289 | } 290 | } 291 | 292 | static string random_string() 293 | { 294 | string str = null; 295 | 296 | Random random = new Random(); 297 | for (int i = 0; i < 5; i++) 298 | { 299 | str += Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))).ToString(); 300 | } 301 | return str; 302 | } 303 | } 304 | } 305 | -------------------------------------------------------------------------------- /Console/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.InteropServices; 4 | using System; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Loader")] 10 | [assembly: AssemblyDescription("KeyAuth Loader Example")] 11 | [assembly: AssemblyConfiguration("retail")] 12 | [assembly: AssemblyCompany("KeyAuth LLC")] 13 | [assembly: AssemblyProduct("Loader")] 14 | [assembly: AssemblyCopyright("Copyright © KeyAuth.cc")] 15 | [assembly: AssemblyTrademark("KeyAuth")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("31f3ac92-cd6f-4f65-a93c-0162fad41fa6")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | [assembly: NeutralResourcesLanguage("en-US")] 39 | -------------------------------------------------------------------------------- /Form/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Form/Drag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Windows.Forms; 4 | 5 | namespace Loader 6 | { 7 | public class Drag 8 | { 9 | public const int WM_NCLBUTTONDOWN = 0xA1; 10 | public const int HT_CAPTION = 0x2; 11 | 12 | [DllImport("User32.dll")] 13 | public static extern bool ReleaseCapture(); 14 | 15 | [DllImport("User32.dll")] 16 | public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); 17 | 18 | public static void MakeDraggable(Form form) 19 | { 20 | form.MouseDown += (sender, e) => 21 | { 22 | if (e.Button == MouseButtons.Left) 23 | { 24 | ReleaseCapture(); 25 | SendMessage(form.Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); 26 | } 27 | }; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Form/Ed25519.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Numerics; 6 | using System.Security.Cryptography; 7 | 8 | namespace Cryptographic 9 | { 10 | /* Ported and refactored from Java to C# by Hans Wolff, 10/10/2013 11 | * Released to the public domain 12 | * / 13 | 14 | /* Java code written by k3d3 15 | * Source: https://github.com/k3d3/ed25519-java/blob/master/ed25519.java 16 | * Released to the public domain 17 | */ 18 | 19 | public class Ed25519 20 | { 21 | private static byte[] ComputeHash(byte[] m) 22 | { 23 | using (var sha512 = SHA512.Create()) // System.Security.Cryptography 24 | { 25 | return sha512.ComputeHash(m); 26 | } 27 | } 28 | 29 | private static BigInteger ExpMod(BigInteger number, BigInteger exponent, BigInteger modulo) 30 | { 31 | BigInteger result = BigInteger.One; 32 | BigInteger baseVal = number.Mod(modulo); 33 | 34 | while (exponent > 0) 35 | { 36 | if (!exponent.IsEven) 37 | { 38 | result = (result * baseVal).Mod(modulo); 39 | } 40 | baseVal = (baseVal * baseVal).Mod(modulo); 41 | exponent /= 2; 42 | } 43 | 44 | return result; 45 | } 46 | 47 | 48 | private static readonly Dictionary InverseCache = new Dictionary(); 49 | 50 | private static BigInteger Inv(BigInteger x) 51 | { 52 | if (!InverseCache.ContainsKey(x)) 53 | { 54 | InverseCache[x] = ExpMod(x, Qm2, Q); 55 | } 56 | return InverseCache[x]; 57 | } 58 | 59 | private static BigInteger RecoverX(BigInteger y) 60 | { 61 | BigInteger y2 = y * y; 62 | BigInteger xx = (y2 - 1) * Inv(D * y2 + 1); 63 | BigInteger x = ExpMod(xx, Qp3 / Eight, Q); 64 | if (!(x * x - xx).Mod(Q).Equals(BigInteger.Zero)) 65 | { 66 | x = (x * I).Mod(Q); 67 | } 68 | if (!x.IsEven) 69 | { 70 | x = Q - x; 71 | } 72 | return x; 73 | } 74 | 75 | private static Tuple Edwards(BigInteger px, BigInteger py, BigInteger qx, BigInteger qy) 76 | { 77 | BigInteger xx12 = px * qx; 78 | BigInteger yy12 = py * qy; 79 | BigInteger dtemp = D * xx12 * yy12; 80 | BigInteger x3 = (px * qy + qx * py) * (Inv(1 + dtemp)); 81 | BigInteger y3 = (py * qy + xx12) * (Inv(1 - dtemp)); 82 | return new Tuple(x3.Mod(Q), y3.Mod(Q)); 83 | } 84 | 85 | private static Tuple EdwardsSquare(BigInteger x, BigInteger y) 86 | { 87 | BigInteger xx = x * x; 88 | BigInteger yy = y * y; 89 | BigInteger dtemp = D * xx * yy; 90 | BigInteger x3 = (2 * x * y) * (Inv(1 + dtemp)); 91 | BigInteger y3 = (yy + xx) * (Inv(1 - dtemp)); 92 | return new Tuple(x3.Mod(Q), y3.Mod(Q)); 93 | } 94 | private static Tuple ScalarMul(Tuple point, BigInteger scalar) 95 | { 96 | var result = new Tuple(BigInteger.Zero, BigInteger.One); // Neutral element 97 | var basePoint = point; 98 | 99 | while (scalar > 0) 100 | { 101 | if (!scalar.IsEven) // If the current bit is set, add the base point to the result 102 | { 103 | result = Edwards(result.Item1, result.Item2, basePoint.Item1, basePoint.Item2); 104 | } 105 | 106 | basePoint = EdwardsSquare(basePoint.Item1, basePoint.Item2); // Double the point 107 | scalar >>= 1; // Move to the next bit in the scalar 108 | } 109 | 110 | return result; 111 | } 112 | 113 | public static byte[] EncodeInt(BigInteger y) 114 | { 115 | byte[] nin = y.ToByteArray(); 116 | var nout = new byte[Math.Max(nin.Length, 32)]; 117 | Array.Copy(nin, nout, nin.Length); 118 | return nout; 119 | } 120 | 121 | public static byte[] EncodePoint(BigInteger x, BigInteger y) 122 | { 123 | byte[] nout = EncodeInt(y); 124 | nout[nout.Length - 1] |= (x.IsEven ? (byte)0 : (byte)0x80); 125 | return nout; 126 | } 127 | 128 | private static int GetBit(byte[] h, int i) 129 | { 130 | return h[i / 8] >> (i % 8) & 1; 131 | } 132 | 133 | public static byte[] PublicKey(byte[] signingKey) 134 | { 135 | byte[] h = ComputeHash(signingKey); 136 | BigInteger a = TwoPowBitLengthMinusTwo; 137 | for (int i = 3; i < (BitLength - 2); i++) 138 | { 139 | var bit = GetBit(h, i); 140 | if (bit != 0) 141 | { 142 | a += TwoPowCache[i]; 143 | } 144 | } 145 | var bigA = ScalarMul(B, a); 146 | return EncodePoint(bigA.Item1, bigA.Item2); 147 | } 148 | 149 | private static BigInteger HashInt(byte[] m) 150 | { 151 | byte[] h = ComputeHash(m); 152 | BigInteger hsum = BigInteger.Zero; 153 | for (int i = 0; i < 2 * BitLength; i++) 154 | { 155 | var bit = GetBit(h, i); 156 | if (bit != 0) 157 | { 158 | hsum += TwoPowCache[i]; 159 | } 160 | } 161 | return hsum; 162 | } 163 | 164 | public static byte[] Signature(byte[] message, byte[] signingKey, byte[] publicKey) 165 | { 166 | byte[] h = ComputeHash(signingKey); 167 | BigInteger a = TwoPowBitLengthMinusTwo; 168 | for (int i = 3; i < (BitLength - 2); i++) 169 | { 170 | var bit = GetBit(h, i); 171 | if (bit != 0) 172 | { 173 | a += TwoPowCache[i]; 174 | } 175 | } 176 | 177 | BigInteger r; 178 | using (var rsub = new MemoryStream((BitLength / 8) + message.Length)) 179 | { 180 | rsub.Write(h, BitLength / 8, BitLength / 4 - BitLength / 8); 181 | rsub.Write(message, 0, message.Length); 182 | r = HashInt(rsub.ToArray()); 183 | } 184 | var bigR = ScalarMul(B, r); 185 | BigInteger s; 186 | var encodedBigR = EncodePoint(bigR.Item1, bigR.Item2); 187 | using (var stemp = new MemoryStream(32 + publicKey.Length + message.Length)) 188 | { 189 | stemp.Write(encodedBigR, 0, encodedBigR.Length); 190 | stemp.Write(publicKey, 0, publicKey.Length); 191 | stemp.Write(message, 0, message.Length); 192 | s = (r+ HashInt(stemp.ToArray()) * a).Mod(L); 193 | } 194 | 195 | using (var nout = new MemoryStream(64)) 196 | { 197 | nout.Write(encodedBigR, 0, encodedBigR.Length); 198 | var encodeInt = EncodeInt(s); 199 | nout.Write(encodeInt, 0, encodeInt.Length); 200 | return nout.ToArray(); 201 | } 202 | } 203 | 204 | private static bool IsOnCurve(BigInteger x, BigInteger y) 205 | { 206 | BigInteger xx = x * x; 207 | BigInteger yy = y * y; 208 | BigInteger dxxyy = D * yy * xx; 209 | return (yy - xx - dxxyy - 1).Mod(Q).Equals(BigInteger.Zero); 210 | } 211 | 212 | private static BigInteger DecodeInt(byte[] s) 213 | { 214 | return new BigInteger(s) & Un; 215 | } 216 | 217 | private static Tuple DecodePoint(byte[] pointBytes) 218 | { 219 | BigInteger y = new BigInteger(pointBytes) & Un; 220 | BigInteger x = RecoverX(y); 221 | if ((x.IsEven ? 0 : 1) != GetBit(pointBytes, BitLength - 1)) 222 | { 223 | x = Q - x; 224 | } 225 | var point = new Tuple(x, y); 226 | if (!IsOnCurve(x, y)) throw new ArgumentException("Decoding point that is not on curve"); 227 | return point; 228 | } 229 | 230 | public static bool CheckValid(byte[] signature, byte[] message, byte[] publicKey) 231 | { 232 | Console.Write("."); // ... dots in console 233 | if (signature.Length != BitLength / 4) throw new ArgumentException("Signature length is wrong"); 234 | if (publicKey.Length != BitLength / 8) throw new ArgumentException("Public key length is wrong"); 235 | 236 | byte[] rByte = Arrays.CopyOfRange(signature, 0, BitLength / 8); 237 | 238 | var r = DecodePoint(rByte); 239 | var a = DecodePoint(publicKey); 240 | 241 | byte[] sByte = Arrays.CopyOfRange(signature, BitLength / 8, BitLength / 4); 242 | 243 | BigInteger s = DecodeInt(sByte); 244 | BigInteger h; 245 | 246 | using (var stemp = new MemoryStream(32 + publicKey.Length + message.Length)) 247 | { 248 | var encodePoint = EncodePoint(r.Item1, r.Item2); 249 | stemp.Write(encodePoint, 0, encodePoint.Length); 250 | stemp.Write(publicKey, 0, publicKey.Length); 251 | stemp.Write(message, 0, message.Length); 252 | h = HashInt(stemp.ToArray()); 253 | } 254 | 255 | Console.Write("."); // ... dots in console 256 | var ra = ScalarMul(B, s); 257 | Console.Write("."); // ... dots in console 258 | var ah = ScalarMul(a, h); 259 | var rb = Edwards(r.Item1, r.Item2, ah.Item1, ah.Item2); 260 | if (!ra.Item1.Equals(rb.Item1) || !ra.Item2.Equals(rb.Item2)) 261 | return false; 262 | return true; 263 | } 264 | 265 | private const int BitLength = 256; 266 | 267 | private static readonly BigInteger TwoPowBitLengthMinusTwo = BigInteger.Pow(2, BitLength - 2); 268 | private static readonly BigInteger[] TwoPowCache = Enumerable.Range(0, 2 * BitLength).Select(i => BigInteger.Pow(2, i)).ToArray(); 269 | 270 | private static readonly BigInteger Q = 271 | BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819949"); 272 | 273 | private static readonly BigInteger Qm2 = 274 | BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819947"); 275 | 276 | private static readonly BigInteger Qp3 = 277 | BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819952"); 278 | 279 | private static readonly BigInteger L = 280 | BigInteger.Parse("7237005577332262213973186563042994240857116359379907606001950938285454250989"); 281 | 282 | private static readonly BigInteger D = 283 | BigInteger.Parse("-4513249062541557337682894930092624173785641285191125241628941591882900924598840740"); 284 | 285 | private static readonly BigInteger I = 286 | BigInteger.Parse("19681161376707505956807079304988542015446066515923890162744021073123829784752"); 287 | 288 | private static readonly BigInteger By = 289 | BigInteger.Parse("46316835694926478169428394003475163141307993866256225615783033603165251855960"); 290 | 291 | private static readonly BigInteger Bx = 292 | BigInteger.Parse("15112221349535400772501151409588531511454012693041857206046113283949847762202"); 293 | 294 | private static readonly Tuple B = new Tuple(Bx.Mod(Q), By.Mod(Q)); 295 | 296 | private static readonly BigInteger Un = 297 | BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819967"); 298 | 299 | private static readonly BigInteger Two = new BigInteger(2); 300 | private static readonly BigInteger Eight = new BigInteger(8); 301 | } 302 | 303 | internal static class Arrays 304 | { 305 | public static byte[] CopyOfRange(byte[] original, int from, int to) 306 | { 307 | int length = to - from; 308 | var result = new byte[length]; 309 | Array.Copy(original, from, result, 0, length); 310 | return result; 311 | } 312 | } 313 | 314 | internal static class BigIntegerHelpers 315 | { 316 | public static BigInteger Mod(this BigInteger num, BigInteger modulo) 317 | { 318 | var result = num % modulo; 319 | return result < 0 ? result + modulo : result; 320 | } 321 | } 322 | } -------------------------------------------------------------------------------- /Form/Loader.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C3F887E6-EBEB-4049-9627-B16958D2E50C} 8 | WinExe 9 | Loader 10 | Loader 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | false 19 | none 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | none 24 | 4 25 | 26 | 27 | AnyCPU 28 | none 29 | true 30 | bin\Release\ 31 | TRACE 32 | none 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | Form 56 | 57 | 58 | Main.cs 59 | 60 | 61 | Form 62 | 63 | 64 | Login.cs 65 | 66 | 67 | 68 | 69 | Main.cs 70 | 71 | 72 | Login.cs 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Form/Loader.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29806.167 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Loader", "Loader.csproj", "{C3F887E6-EBEB-4049-9627-B16958D2E50C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C3F887E6-EBEB-4049-9627-B16958D2E50C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {C3F887E6-EBEB-4049-9627-B16958D2E50C}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {C3F887E6-EBEB-4049-9627-B16958D2E50C}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {C3F887E6-EBEB-4049-9627-B16958D2E50C}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {8C3296CD-0D93-4B7C-8850-3CFA62C2DDD3} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Form/Login.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace KeyAuth 2 | { 3 | // Token: 0x02000002 RID: 2 4 | public partial class Login : global::System.Windows.Forms.Form 5 | { 6 | // Token: 0x06000011 RID: 17 RVA: 0x0000215C File Offset: 0x0000035C 7 | protected override void Dispose(bool disposing) 8 | { 9 | bool flag = disposing && this.components != null; 10 | if (flag) 11 | { 12 | this.components.Dispose(); 13 | } 14 | base.Dispose(disposing); 15 | } 16 | 17 | // Token: 0x06000012 RID: 18 RVA: 0x00002194 File Offset: 0x00000394 18 | private void InitializeComponent() 19 | { 20 | this.label1 = new System.Windows.Forms.Label(); 21 | this.label2 = new System.Windows.Forms.Label(); 22 | this.label3 = new System.Windows.Forms.Label(); 23 | this.linkLabel1 = new System.Windows.Forms.LinkLabel(); 24 | this.linkLabel2 = new System.Windows.Forms.LinkLabel(); 25 | this.usernameField = new System.Windows.Forms.TextBox(); 26 | this.passwordField = new System.Windows.Forms.TextBox(); 27 | this.keyField = new System.Windows.Forms.TextBox(); 28 | this.emailField = new System.Windows.Forms.TextBox(); 29 | this.label4 = new System.Windows.Forms.Label(); 30 | this.label5 = new System.Windows.Forms.Label(); 31 | this.label6 = new System.Windows.Forms.Label(); 32 | this.label7 = new System.Windows.Forms.Label(); 33 | this.loginBtn = new System.Windows.Forms.Button(); 34 | this.registerBtn = new System.Windows.Forms.Button(); 35 | this.licenseBtn = new System.Windows.Forms.Button(); 36 | this.minBtn = new System.Windows.Forms.Button(); 37 | this.closeBtn = new System.Windows.Forms.Button(); 38 | this.label8 = new System.Windows.Forms.Label(); 39 | this.tfaField = new System.Windows.Forms.TextBox(); 40 | this.SuspendLayout(); 41 | // 42 | // label1 43 | // 44 | this.label1.AutoSize = true; 45 | this.label1.Font = new System.Drawing.Font("Segoe UI Light", 10F); 46 | this.label1.ForeColor = System.Drawing.Color.White; 47 | this.label1.Location = new System.Drawing.Point(-1, 136); 48 | this.label1.Name = "label1"; 49 | this.label1.Size = new System.Drawing.Size(0, 19); 50 | this.label1.TabIndex = 22; 51 | // 52 | // label2 53 | // 54 | this.label2.AutoSize = true; 55 | this.label2.Font = new System.Drawing.Font("Segoe UI Semibold", 26F, System.Drawing.FontStyle.Bold); 56 | this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 57 | this.label2.Location = new System.Drawing.Point(42, 133); 58 | this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 59 | this.label2.Name = "label2"; 60 | this.label2.Size = new System.Drawing.Size(155, 47); 61 | this.label2.TabIndex = 27; 62 | this.label2.Text = "KeyAuth"; 63 | // 64 | // label3 65 | // 66 | this.label3.AutoSize = true; 67 | this.label3.Font = new System.Drawing.Font("Segoe UI Semibold", 26F, System.Drawing.FontStyle.Bold); 68 | this.label3.ForeColor = System.Drawing.SystemColors.ButtonFace; 69 | this.label3.Location = new System.Drawing.Point(42, 180); 70 | this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 71 | this.label3.Name = "label3"; 72 | this.label3.Size = new System.Drawing.Size(328, 47); 73 | this.label3.TabIndex = 41; 74 | this.label3.Text = "Official C# Example"; 75 | // 76 | // linkLabel1 77 | // 78 | this.linkLabel1.AutoSize = true; 79 | this.linkLabel1.LinkColor = System.Drawing.Color.DodgerBlue; 80 | this.linkLabel1.Location = new System.Drawing.Point(481, 420); 81 | this.linkLabel1.Name = "linkLabel1"; 82 | this.linkLabel1.Size = new System.Drawing.Size(92, 13); 83 | this.linkLabel1.TabIndex = 42; 84 | this.linkLabel1.TabStop = true; 85 | this.linkLabel1.Text = "Forgot Password?"; 86 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); 87 | // 88 | // linkLabel2 89 | // 90 | this.linkLabel2.AutoSize = true; 91 | this.linkLabel2.LinkColor = System.Drawing.Color.DodgerBlue; 92 | this.linkLabel2.Location = new System.Drawing.Point(716, 420); 93 | this.linkLabel2.Name = "linkLabel2"; 94 | this.linkLabel2.Size = new System.Drawing.Size(54, 13); 95 | this.linkLabel2.TabIndex = 50; 96 | this.linkLabel2.TabStop = true; 97 | this.linkLabel2.Text = "Upgrade?"; 98 | this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); 99 | // 100 | // usernameField 101 | // 102 | this.usernameField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 103 | this.usernameField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 104 | this.usernameField.ForeColor = System.Drawing.Color.White; 105 | this.usernameField.Location = new System.Drawing.Point(484, 95); 106 | this.usernameField.Name = "usernameField"; 107 | this.usernameField.Size = new System.Drawing.Size(286, 20); 108 | this.usernameField.TabIndex = 54; 109 | // 110 | // passwordField 111 | // 112 | this.passwordField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 113 | this.passwordField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 114 | this.passwordField.ForeColor = System.Drawing.Color.White; 115 | this.passwordField.Location = new System.Drawing.Point(484, 140); 116 | this.passwordField.Name = "passwordField"; 117 | this.passwordField.Size = new System.Drawing.Size(286, 20); 118 | this.passwordField.TabIndex = 55; 119 | // 120 | // keyField 121 | // 122 | this.keyField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 123 | this.keyField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 124 | this.keyField.ForeColor = System.Drawing.Color.White; 125 | this.keyField.Location = new System.Drawing.Point(481, 185); 126 | this.keyField.Name = "keyField"; 127 | this.keyField.Size = new System.Drawing.Size(286, 20); 128 | this.keyField.TabIndex = 56; 129 | // 130 | // emailField 131 | // 132 | this.emailField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 133 | this.emailField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 134 | this.emailField.ForeColor = System.Drawing.Color.White; 135 | this.emailField.Location = new System.Drawing.Point(481, 230); 136 | this.emailField.Name = "emailField"; 137 | this.emailField.Size = new System.Drawing.Size(286, 20); 138 | this.emailField.TabIndex = 57; 139 | // 140 | // label4 141 | // 142 | this.label4.AutoSize = true; 143 | this.label4.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 144 | this.label4.ForeColor = System.Drawing.SystemColors.ButtonFace; 145 | this.label4.Location = new System.Drawing.Point(481, 77); 146 | this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 147 | this.label4.Name = "label4"; 148 | this.label4.Size = new System.Drawing.Size(65, 15); 149 | this.label4.TabIndex = 58; 150 | this.label4.Text = "Username:"; 151 | // 152 | // label5 153 | // 154 | this.label5.AutoSize = true; 155 | this.label5.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 156 | this.label5.ForeColor = System.Drawing.SystemColors.ButtonFace; 157 | this.label5.Location = new System.Drawing.Point(481, 122); 158 | this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 159 | this.label5.Name = "label5"; 160 | this.label5.Size = new System.Drawing.Size(62, 15); 161 | this.label5.TabIndex = 59; 162 | this.label5.Text = "Password:"; 163 | // 164 | // label6 165 | // 166 | this.label6.AutoSize = true; 167 | this.label6.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 168 | this.label6.ForeColor = System.Drawing.SystemColors.ButtonFace; 169 | this.label6.Location = new System.Drawing.Point(481, 167); 170 | this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 171 | this.label6.Name = "label6"; 172 | this.label6.Size = new System.Drawing.Size(48, 15); 173 | this.label6.TabIndex = 60; 174 | this.label6.Text = "License:"; 175 | // 176 | // label7 177 | // 178 | this.label7.AutoSize = true; 179 | this.label7.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 180 | this.label7.ForeColor = System.Drawing.SystemColors.ButtonFace; 181 | this.label7.Location = new System.Drawing.Point(478, 212); 182 | this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 183 | this.label7.Name = "label7"; 184 | this.label7.Size = new System.Drawing.Size(40, 15); 185 | this.label7.TabIndex = 61; 186 | this.label7.Text = "Email:"; 187 | // 188 | // loginBtn 189 | // 190 | this.loginBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 191 | this.loginBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 192 | this.loginBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 193 | this.loginBtn.ForeColor = System.Drawing.Color.White; 194 | this.loginBtn.Location = new System.Drawing.Point(481, 316); 195 | this.loginBtn.Name = "loginBtn"; 196 | this.loginBtn.Size = new System.Drawing.Size(286, 23); 197 | this.loginBtn.TabIndex = 62; 198 | this.loginBtn.Text = "Log In"; 199 | this.loginBtn.UseVisualStyleBackColor = false; 200 | this.loginBtn.Click += new System.EventHandler(this.loginBtn_Click_1); 201 | // 202 | // registerBtn 203 | // 204 | this.registerBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 205 | this.registerBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 206 | this.registerBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 207 | this.registerBtn.ForeColor = System.Drawing.Color.White; 208 | this.registerBtn.Location = new System.Drawing.Point(481, 345); 209 | this.registerBtn.Name = "registerBtn"; 210 | this.registerBtn.Size = new System.Drawing.Size(286, 23); 211 | this.registerBtn.TabIndex = 63; 212 | this.registerBtn.Text = "Register"; 213 | this.registerBtn.UseVisualStyleBackColor = false; 214 | this.registerBtn.Click += new System.EventHandler(this.registerBtn_Click); 215 | // 216 | // licenseBtn 217 | // 218 | this.licenseBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 219 | this.licenseBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 220 | this.licenseBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 221 | this.licenseBtn.ForeColor = System.Drawing.Color.White; 222 | this.licenseBtn.Location = new System.Drawing.Point(481, 374); 223 | this.licenseBtn.Name = "licenseBtn"; 224 | this.licenseBtn.Size = new System.Drawing.Size(286, 23); 225 | this.licenseBtn.TabIndex = 64; 226 | this.licenseBtn.Text = "License Log In/Register"; 227 | this.licenseBtn.UseVisualStyleBackColor = false; 228 | this.licenseBtn.Click += new System.EventHandler(this.licenseBtn_Click); 229 | // 230 | // minBtn 231 | // 232 | this.minBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 233 | this.minBtn.ForeColor = System.Drawing.Color.White; 234 | this.minBtn.Location = new System.Drawing.Point(716, 12); 235 | this.minBtn.Name = "minBtn"; 236 | this.minBtn.Size = new System.Drawing.Size(43, 23); 237 | this.minBtn.TabIndex = 94; 238 | this.minBtn.Text = "-"; 239 | this.minBtn.UseVisualStyleBackColor = true; 240 | this.minBtn.Click += new System.EventHandler(this.minBtn_Click); 241 | // 242 | // closeBtn 243 | // 244 | this.closeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 245 | this.closeBtn.ForeColor = System.Drawing.Color.White; 246 | this.closeBtn.Location = new System.Drawing.Point(765, 12); 247 | this.closeBtn.Name = "closeBtn"; 248 | this.closeBtn.Size = new System.Drawing.Size(43, 23); 249 | this.closeBtn.TabIndex = 93; 250 | this.closeBtn.Text = "X"; 251 | this.closeBtn.UseVisualStyleBackColor = true; 252 | this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); 253 | // 254 | // label8 255 | // 256 | this.label8.AutoSize = true; 257 | this.label8.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 258 | this.label8.ForeColor = System.Drawing.SystemColors.ButtonFace; 259 | this.label8.Location = new System.Drawing.Point(478, 260); 260 | this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 261 | this.label8.Name = "label8"; 262 | this.label8.Size = new System.Drawing.Size(180, 15); 263 | this.label8.TabIndex = 96; 264 | this.label8.Text = "2FA (Two Factor Authentication)"; 265 | // 266 | // tfaField 267 | // 268 | this.tfaField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 269 | this.tfaField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 270 | this.tfaField.ForeColor = System.Drawing.Color.White; 271 | this.tfaField.Location = new System.Drawing.Point(481, 278); 272 | this.tfaField.Name = "tfaField"; 273 | this.tfaField.Size = new System.Drawing.Size(286, 20); 274 | this.tfaField.TabIndex = 95; 275 | // 276 | // Login 277 | // 278 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 279 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 280 | this.AutoValidate = System.Windows.Forms.AutoValidate.Disable; 281 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(24)))), ((int)(((byte)(32))))); 282 | this.ClientSize = new System.Drawing.Size(820, 463); 283 | this.Controls.Add(this.label8); 284 | this.Controls.Add(this.tfaField); 285 | this.Controls.Add(this.minBtn); 286 | this.Controls.Add(this.closeBtn); 287 | this.Controls.Add(this.licenseBtn); 288 | this.Controls.Add(this.registerBtn); 289 | this.Controls.Add(this.loginBtn); 290 | this.Controls.Add(this.label7); 291 | this.Controls.Add(this.label6); 292 | this.Controls.Add(this.label5); 293 | this.Controls.Add(this.label4); 294 | this.Controls.Add(this.emailField); 295 | this.Controls.Add(this.keyField); 296 | this.Controls.Add(this.passwordField); 297 | this.Controls.Add(this.usernameField); 298 | this.Controls.Add(this.linkLabel2); 299 | this.Controls.Add(this.linkLabel1); 300 | this.Controls.Add(this.label3); 301 | this.Controls.Add(this.label2); 302 | this.Controls.Add(this.label1); 303 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 304 | this.Name = "Login"; 305 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 306 | this.Text = "Loader"; 307 | this.TransparencyKey = System.Drawing.Color.Maroon; 308 | this.Load += new System.EventHandler(this.Login_Load); 309 | this.ResumeLayout(false); 310 | this.PerformLayout(); 311 | 312 | } 313 | 314 | // Token: 0x04000001 RID: 1 315 | private global::System.ComponentModel.IContainer components = null; 316 | 317 | // Token: 0x0400000A RID: 10 318 | private global::System.Windows.Forms.Label label1; 319 | private System.Windows.Forms.Label label2; 320 | private System.Windows.Forms.LinkLabel linkLabel1; 321 | private System.Windows.Forms.Label label3; 322 | private System.Windows.Forms.LinkLabel linkLabel2; 323 | private System.Windows.Forms.TextBox usernameField; 324 | private System.Windows.Forms.TextBox passwordField; 325 | private System.Windows.Forms.TextBox keyField; 326 | private System.Windows.Forms.TextBox emailField; 327 | private System.Windows.Forms.Label label4; 328 | private System.Windows.Forms.Label label5; 329 | private System.Windows.Forms.Label label6; 330 | private System.Windows.Forms.Label label7; 331 | private System.Windows.Forms.Button loginBtn; 332 | private System.Windows.Forms.Button registerBtn; 333 | private System.Windows.Forms.Button licenseBtn; 334 | private System.Windows.Forms.Button minBtn; 335 | private System.Windows.Forms.Button closeBtn; 336 | private System.Windows.Forms.Label label8; 337 | private System.Windows.Forms.TextBox tfaField; 338 | } 339 | } 340 | -------------------------------------------------------------------------------- /Form/Login.cs: -------------------------------------------------------------------------------- 1 | using Loader; 2 | using System; 3 | using System.Diagnostics; 4 | using System.Net; 5 | using System.Windows.Forms; 6 | 7 | namespace KeyAuth 8 | { 9 | public partial class Login : Form 10 | { 11 | 12 | /* 13 | * 14 | * WATCH THIS VIDEO TO SETUP APPLICATION: https://youtube.com/watch?v=RfDTdiBq4_o 15 | * 16 | * READ HERE TO LEARN ABOUT KEYAUTH FUNCTIONS https://github.com/KeyAuth/KeyAuth-CSHARP-Example#keyauthapp-instance-definition 17 | * 18 | */ 19 | 20 | public static api KeyAuthApp = new api( 21 | name: "", // App name 22 | ownerid: "", // Account ID 23 | version: "1" // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs 24 | //path: @"Your_Path_Here" // (OPTIONAL) see tutorial here https://www.youtube.com/watch?v=I9rxt821gMk&t=1s 25 | ); 26 | 27 | public Login() 28 | { 29 | InitializeComponent(); 30 | Drag.MakeDraggable(this); 31 | } 32 | 33 | #region Misc References 34 | public static bool SubExist(string name) 35 | { 36 | if(KeyAuthApp.user_data.subscriptions.Exists(x => x.subscription == name)) 37 | return true; 38 | return false; 39 | } 40 | 41 | static string random_string() 42 | { 43 | string str = null; 44 | 45 | Random random = new Random(); 46 | for (int i = 0; i < 5; i++) 47 | { 48 | str += Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))).ToString(); 49 | } 50 | return str; 51 | 52 | } 53 | #endregion 54 | 55 | private async void Login_Load(object sender, EventArgs e) 56 | { 57 | await KeyAuthApp.init(); 58 | 59 | #region Auto Update 60 | if (KeyAuthApp.response.message == "invalidver") 61 | { 62 | if (!string.IsNullOrEmpty(KeyAuthApp.app_data.downloadLink)) 63 | { 64 | DialogResult dialogResult = MessageBox.Show("Yes to open file in browser\nNo to download file automatically", "Auto update", MessageBoxButtons.YesNo); 65 | switch (dialogResult) 66 | { 67 | case DialogResult.Yes: 68 | Process.Start(KeyAuthApp.app_data.downloadLink); 69 | Environment.Exit(0); 70 | break; 71 | case DialogResult.No: 72 | WebClient webClient = new WebClient(); 73 | string destFile = Application.ExecutablePath; 74 | 75 | string rand = random_string(); 76 | 77 | destFile = destFile.Replace(".exe", $"-{rand}.exe"); 78 | webClient.DownloadFile(KeyAuthApp.app_data.downloadLink, destFile); 79 | 80 | Process.Start(destFile); 81 | Process.Start(new ProcessStartInfo() 82 | { 83 | Arguments = "/C choice /C Y /N /D Y /T 3 & Del \"" + Application.ExecutablePath + "\"", 84 | WindowStyle = ProcessWindowStyle.Hidden, 85 | CreateNoWindow = true, 86 | FileName = "cmd.exe" 87 | }); 88 | Environment.Exit(0); 89 | 90 | break; 91 | default: 92 | MessageBox.Show("Invalid option"); 93 | Environment.Exit(0); 94 | break; 95 | } 96 | } 97 | MessageBox.Show("Version of this program does not match the one online. Furthermore, the download link online isn't set. You will need to manually obtain the download link from the developer"); 98 | Environment.Exit(0); 99 | } 100 | #endregion 101 | 102 | if (!KeyAuthApp.response.success) 103 | { 104 | MessageBox.Show(KeyAuthApp.response.message); 105 | Environment.Exit(0); 106 | } 107 | } 108 | 109 | private async void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 110 | { 111 | await KeyAuthApp.forgot(usernameField.Text, emailField.Text); 112 | MessageBox.Show("Status: " + KeyAuthApp.response.message); 113 | } 114 | 115 | private async void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 116 | { 117 | await KeyAuthApp.upgrade(usernameField.Text, keyField.Text); // success is set to false so people can't press upgrade then press login and skip logging in. it doesn't matter, since you shouldn't take any action on succesfull upgrade anyways. the only thing that needs to be done is the user needs to see the message from upgrade function 118 | MessageBox.Show("Status: " + KeyAuthApp.response.message); 119 | // don't login, because they haven't authenticated. this is just to extend expiry of user with new key. 120 | } 121 | 122 | private async void loginBtn_Click_1(object sender, EventArgs e) 123 | { 124 | await KeyAuthApp.login(usernameField.Text, passwordField.Text, tfaField.Text); 125 | if (KeyAuthApp.response.success) 126 | { 127 | Main main = new Main(); 128 | main.Show(); 129 | this.Hide(); 130 | } 131 | else 132 | MessageBox.Show("Status: " + KeyAuthApp.response.message); 133 | } 134 | 135 | private async void registerBtn_Click(object sender, EventArgs e) 136 | { 137 | string email = this.emailField.Text; 138 | if (email == "Email (leave blank if none)") 139 | { // default value 140 | email = null; 141 | } 142 | 143 | await KeyAuthApp.register(usernameField.Text, passwordField.Text, keyField.Text, email); 144 | if (KeyAuthApp.response.success) 145 | { 146 | Main main = new Main(); 147 | main.Show(); 148 | this.Hide(); 149 | } 150 | else 151 | MessageBox.Show("Status: " + KeyAuthApp.response.message); 152 | } 153 | 154 | private async void licenseBtn_Click(object sender, EventArgs e) 155 | { 156 | await KeyAuthApp.license(keyField.Text, tfaField.Text); 157 | if (KeyAuthApp.response.success) 158 | { 159 | Main main = new Main(); 160 | main.Show(); 161 | this.Hide(); 162 | } 163 | else 164 | MessageBox.Show("Status: " + KeyAuthApp.response.message); 165 | } 166 | 167 | private void closeBtn_Click(object sender, EventArgs e) 168 | { 169 | Environment.Exit(0); 170 | } 171 | 172 | private void minBtn_Click(object sender, EventArgs e) 173 | { 174 | this.WindowState = FormWindowState.Minimized; 175 | } 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /Form/Login.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 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 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 38 122 | 123 | -------------------------------------------------------------------------------- /Form/Main.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace KeyAuth 2 | { 3 | public partial class Main : global::System.Windows.Forms.Form 4 | { 5 | protected override void Dispose(bool disposing) 6 | { 7 | bool flag = disposing && this.components != null; 8 | if (flag) 9 | { 10 | this.components.Dispose(); 11 | } 12 | base.Dispose(disposing); 13 | } 14 | private void InitializeComponent() 15 | { 16 | this.components = new System.ComponentModel.Container(); 17 | this.label1 = new System.Windows.Forms.Label(); 18 | this.label2 = new System.Windows.Forms.Label(); 19 | this.timer1 = new System.Windows.Forms.Timer(this.components); 20 | this.userDataField = new System.Windows.Forms.ListBox(); 21 | this.onlineUsersField = new System.Windows.Forms.ListBox(); 22 | this.chatroomGrid = new System.Windows.Forms.DataGridView(); 23 | this.Sender = new System.Windows.Forms.DataGridViewTextBoxColumn(); 24 | this.Message = new System.Windows.Forms.DataGridViewTextBoxColumn(); 25 | this.Time = new System.Windows.Forms.DataGridViewTextBoxColumn(); 26 | this.chatMsgField = new System.Windows.Forms.TextBox(); 27 | this.sendMsgBtn = new System.Windows.Forms.Button(); 28 | this.logDataField = new System.Windows.Forms.TextBox(); 29 | this.sendLogDataBtn = new System.Windows.Forms.Button(); 30 | this.checkSessionBtn = new System.Windows.Forms.Button(); 31 | this.fetchGlobalVariableBtn = new System.Windows.Forms.Button(); 32 | this.globalVariableField = new System.Windows.Forms.TextBox(); 33 | this.setUserVarBtn = new System.Windows.Forms.Button(); 34 | this.fetchUserVarBtn = new System.Windows.Forms.Button(); 35 | this.varField = new System.Windows.Forms.TextBox(); 36 | this.varDataField = new System.Windows.Forms.TextBox(); 37 | this.label4 = new System.Windows.Forms.Label(); 38 | this.label3 = new System.Windows.Forms.Label(); 39 | this.label5 = new System.Windows.Forms.Label(); 40 | this.label6 = new System.Windows.Forms.Label(); 41 | this.sendWebhookBtn = new System.Windows.Forms.Button(); 42 | this.webhookID = new System.Windows.Forms.TextBox(); 43 | this.webhookBaseURL = new System.Windows.Forms.TextBox(); 44 | this.label7 = new System.Windows.Forms.Label(); 45 | this.label8 = new System.Windows.Forms.Label(); 46 | this.closeBtn = new System.Windows.Forms.Button(); 47 | this.minBtn = new System.Windows.Forms.Button(); 48 | this.label9 = new System.Windows.Forms.Label(); 49 | this.filePathField = new System.Windows.Forms.TextBox(); 50 | this.downloadFileBtn = new System.Windows.Forms.Button(); 51 | this.label10 = new System.Windows.Forms.Label(); 52 | this.fileExtensionField = new System.Windows.Forms.TextBox(); 53 | this.label11 = new System.Windows.Forms.Label(); 54 | this.tfaField = new System.Windows.Forms.TextBox(); 55 | this.enableTfaBtn = new System.Windows.Forms.Button(); 56 | this.disableTfaBtn = new System.Windows.Forms.Button(); 57 | this.banBtn = new System.Windows.Forms.Button(); 58 | ((System.ComponentModel.ISupportInitialize)(this.chatroomGrid)).BeginInit(); 59 | this.SuspendLayout(); 60 | // 61 | // label1 62 | // 63 | this.label1.AutoSize = true; 64 | this.label1.Font = new System.Drawing.Font("Segoe UI Light", 10F); 65 | this.label1.ForeColor = System.Drawing.Color.White; 66 | this.label1.Location = new System.Drawing.Point(-1, 136); 67 | this.label1.Name = "label1"; 68 | this.label1.Size = new System.Drawing.Size(0, 19); 69 | this.label1.TabIndex = 22; 70 | // 71 | // label2 72 | // 73 | this.label2.AutoSize = true; 74 | this.label2.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 75 | this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 76 | this.label2.Location = new System.Drawing.Point(10, 11); 77 | this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 78 | this.label2.Name = "label2"; 79 | this.label2.Size = new System.Drawing.Size(190, 19); 80 | this.label2.TabIndex = 27; 81 | this.label2.Text = "KeyAuth Official C# Example"; 82 | // 83 | // timer1 84 | // 85 | this.timer1.Interval = 1; 86 | this.timer1.Tick += new System.EventHandler(this.timer1_Tick); 87 | // 88 | // userDataField 89 | // 90 | this.userDataField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 91 | this.userDataField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 92 | this.userDataField.ForeColor = System.Drawing.Color.White; 93 | this.userDataField.FormattingEnabled = true; 94 | this.userDataField.Location = new System.Drawing.Point(390, 478); 95 | this.userDataField.Name = "userDataField"; 96 | this.userDataField.Size = new System.Drawing.Size(323, 106); 97 | this.userDataField.TabIndex = 62; 98 | // 99 | // onlineUsersField 100 | // 101 | this.onlineUsersField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 102 | this.onlineUsersField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 103 | this.onlineUsersField.ForeColor = System.Drawing.Color.White; 104 | this.onlineUsersField.FormattingEnabled = true; 105 | this.onlineUsersField.Items.AddRange(new object[] { 106 | "Online Users:", 107 | ""}); 108 | this.onlineUsersField.Location = new System.Drawing.Point(14, 478); 109 | this.onlineUsersField.Name = "onlineUsersField"; 110 | this.onlineUsersField.Size = new System.Drawing.Size(329, 106); 111 | this.onlineUsersField.TabIndex = 64; 112 | // 113 | // chatroomGrid 114 | // 115 | this.chatroomGrid.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 116 | this.chatroomGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 117 | this.chatroomGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 118 | this.Sender, 119 | this.Message, 120 | this.Time}); 121 | this.chatroomGrid.GridColor = System.Drawing.Color.DodgerBlue; 122 | this.chatroomGrid.Location = new System.Drawing.Point(755, 39); 123 | this.chatroomGrid.Name = "chatroomGrid"; 124 | this.chatroomGrid.ReadOnly = true; 125 | this.chatroomGrid.Size = new System.Drawing.Size(452, 509); 126 | this.chatroomGrid.TabIndex = 70; 127 | // 128 | // Sender 129 | // 130 | this.Sender.HeaderText = "Sender"; 131 | this.Sender.Name = "Sender"; 132 | this.Sender.ReadOnly = true; 133 | // 134 | // Message 135 | // 136 | this.Message.HeaderText = "Message"; 137 | this.Message.Name = "Message"; 138 | this.Message.ReadOnly = true; 139 | this.Message.Width = 200; 140 | // 141 | // Time 142 | // 143 | this.Time.HeaderText = "Time"; 144 | this.Time.Name = "Time"; 145 | this.Time.ReadOnly = true; 146 | // 147 | // chatMsgField 148 | // 149 | this.chatMsgField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 150 | this.chatMsgField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 151 | this.chatMsgField.Location = new System.Drawing.Point(755, 564); 152 | this.chatMsgField.Name = "chatMsgField"; 153 | this.chatMsgField.Size = new System.Drawing.Size(352, 20); 154 | this.chatMsgField.TabIndex = 71; 155 | // 156 | // sendMsgBtn 157 | // 158 | this.sendMsgBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 159 | this.sendMsgBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 160 | this.sendMsgBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 161 | this.sendMsgBtn.ForeColor = System.Drawing.Color.White; 162 | this.sendMsgBtn.Location = new System.Drawing.Point(1113, 554); 163 | this.sendMsgBtn.Name = "sendMsgBtn"; 164 | this.sendMsgBtn.Size = new System.Drawing.Size(94, 36); 165 | this.sendMsgBtn.TabIndex = 72; 166 | this.sendMsgBtn.Text = "Send"; 167 | this.sendMsgBtn.UseVisualStyleBackColor = false; 168 | this.sendMsgBtn.Click += new System.EventHandler(this.sendMsgBtn_Click_1); 169 | // 170 | // logDataField 171 | // 172 | this.logDataField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 173 | this.logDataField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 174 | this.logDataField.ForeColor = System.Drawing.Color.White; 175 | this.logDataField.Location = new System.Drawing.Point(14, 321); 176 | this.logDataField.Name = "logDataField"; 177 | this.logDataField.Size = new System.Drawing.Size(323, 20); 178 | this.logDataField.TabIndex = 73; 179 | // 180 | // sendLogDataBtn 181 | // 182 | this.sendLogDataBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 183 | this.sendLogDataBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 184 | this.sendLogDataBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 185 | this.sendLogDataBtn.ForeColor = System.Drawing.Color.White; 186 | this.sendLogDataBtn.Location = new System.Drawing.Point(14, 347); 187 | this.sendLogDataBtn.Name = "sendLogDataBtn"; 188 | this.sendLogDataBtn.Size = new System.Drawing.Size(323, 30); 189 | this.sendLogDataBtn.TabIndex = 74; 190 | this.sendLogDataBtn.Text = "Send Log"; 191 | this.sendLogDataBtn.UseVisualStyleBackColor = false; 192 | this.sendLogDataBtn.Click += new System.EventHandler(this.sendLogDataBtn_Click); 193 | // 194 | // checkSessionBtn 195 | // 196 | this.checkSessionBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 197 | this.checkSessionBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 198 | this.checkSessionBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 199 | this.checkSessionBtn.ForeColor = System.Drawing.Color.White; 200 | this.checkSessionBtn.Location = new System.Drawing.Point(14, 414); 201 | this.checkSessionBtn.Name = "checkSessionBtn"; 202 | this.checkSessionBtn.Size = new System.Drawing.Size(323, 30); 203 | this.checkSessionBtn.TabIndex = 75; 204 | this.checkSessionBtn.Text = "Check Session"; 205 | this.checkSessionBtn.UseVisualStyleBackColor = false; 206 | this.checkSessionBtn.Click += new System.EventHandler(this.checkSessionBtn_Click_1); 207 | // 208 | // fetchGlobalVariableBtn 209 | // 210 | this.fetchGlobalVariableBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 211 | this.fetchGlobalVariableBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 212 | this.fetchGlobalVariableBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 213 | this.fetchGlobalVariableBtn.ForeColor = System.Drawing.Color.White; 214 | this.fetchGlobalVariableBtn.Location = new System.Drawing.Point(390, 81); 215 | this.fetchGlobalVariableBtn.Name = "fetchGlobalVariableBtn"; 216 | this.fetchGlobalVariableBtn.Size = new System.Drawing.Size(323, 30); 217 | this.fetchGlobalVariableBtn.TabIndex = 76; 218 | this.fetchGlobalVariableBtn.Text = "Fetch Global Variable"; 219 | this.fetchGlobalVariableBtn.UseVisualStyleBackColor = false; 220 | this.fetchGlobalVariableBtn.Click += new System.EventHandler(this.fetchGlobalVariableBtn_Click_1); 221 | // 222 | // globalVariableField 223 | // 224 | this.globalVariableField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 225 | this.globalVariableField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 226 | this.globalVariableField.ForeColor = System.Drawing.Color.White; 227 | this.globalVariableField.Location = new System.Drawing.Point(390, 55); 228 | this.globalVariableField.Name = "globalVariableField"; 229 | this.globalVariableField.Size = new System.Drawing.Size(323, 20); 230 | this.globalVariableField.TabIndex = 77; 231 | // 232 | // setUserVarBtn 233 | // 234 | this.setUserVarBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 235 | this.setUserVarBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 236 | this.setUserVarBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 237 | this.setUserVarBtn.ForeColor = System.Drawing.Color.White; 238 | this.setUserVarBtn.Location = new System.Drawing.Point(20, 234); 239 | this.setUserVarBtn.Name = "setUserVarBtn"; 240 | this.setUserVarBtn.Size = new System.Drawing.Size(155, 30); 241 | this.setUserVarBtn.TabIndex = 78; 242 | this.setUserVarBtn.Text = "Set User Variable"; 243 | this.setUserVarBtn.UseVisualStyleBackColor = false; 244 | this.setUserVarBtn.Click += new System.EventHandler(this.setUserVarBtn_Click_1); 245 | // 246 | // fetchUserVarBtn 247 | // 248 | this.fetchUserVarBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 249 | this.fetchUserVarBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 250 | this.fetchUserVarBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 251 | this.fetchUserVarBtn.ForeColor = System.Drawing.Color.White; 252 | this.fetchUserVarBtn.Location = new System.Drawing.Point(188, 234); 253 | this.fetchUserVarBtn.Name = "fetchUserVarBtn"; 254 | this.fetchUserVarBtn.Size = new System.Drawing.Size(155, 30); 255 | this.fetchUserVarBtn.TabIndex = 79; 256 | this.fetchUserVarBtn.Text = "Fetch User Variable"; 257 | this.fetchUserVarBtn.UseVisualStyleBackColor = false; 258 | this.fetchUserVarBtn.Click += new System.EventHandler(this.fetchUserVarBtn_Click_1); 259 | // 260 | // varField 261 | // 262 | this.varField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 263 | this.varField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 264 | this.varField.ForeColor = System.Drawing.Color.White; 265 | this.varField.Location = new System.Drawing.Point(20, 159); 266 | this.varField.Name = "varField"; 267 | this.varField.Size = new System.Drawing.Size(323, 20); 268 | this.varField.TabIndex = 80; 269 | // 270 | // varDataField 271 | // 272 | this.varDataField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 273 | this.varDataField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 274 | this.varDataField.ForeColor = System.Drawing.Color.White; 275 | this.varDataField.Location = new System.Drawing.Point(20, 208); 276 | this.varDataField.Name = "varDataField"; 277 | this.varDataField.Size = new System.Drawing.Size(323, 20); 278 | this.varDataField.TabIndex = 81; 279 | // 280 | // label4 281 | // 282 | this.label4.AutoSize = true; 283 | this.label4.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 284 | this.label4.ForeColor = System.Drawing.SystemColors.ButtonFace; 285 | this.label4.Location = new System.Drawing.Point(17, 141); 286 | this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 287 | this.label4.Name = "label4"; 288 | this.label4.Size = new System.Drawing.Size(119, 15); 289 | this.label4.TabIndex = 82; 290 | this.label4.Text = "User Variable Name:"; 291 | // 292 | // label3 293 | // 294 | this.label3.AutoSize = true; 295 | this.label3.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 296 | this.label3.ForeColor = System.Drawing.SystemColors.ButtonFace; 297 | this.label3.Location = new System.Drawing.Point(17, 190); 298 | this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 299 | this.label3.Name = "label3"; 300 | this.label3.Size = new System.Drawing.Size(210, 15); 301 | this.label3.TabIndex = 83; 302 | this.label3.Text = "User Variable Data: (For Setting Only)"; 303 | // 304 | // label5 305 | // 306 | this.label5.AutoSize = true; 307 | this.label5.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 308 | this.label5.ForeColor = System.Drawing.SystemColors.ButtonFace; 309 | this.label5.Location = new System.Drawing.Point(11, 303); 310 | this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 311 | this.label5.Name = "label5"; 312 | this.label5.Size = new System.Drawing.Size(119, 15); 313 | this.label5.TabIndex = 84; 314 | this.label5.Text = "Data To Send In Log:"; 315 | // 316 | // label6 317 | // 318 | this.label6.AutoSize = true; 319 | this.label6.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 320 | this.label6.ForeColor = System.Drawing.SystemColors.ButtonFace; 321 | this.label6.Location = new System.Drawing.Point(387, 37); 322 | this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 323 | this.label6.Name = "label6"; 324 | this.label6.Size = new System.Drawing.Size(130, 15); 325 | this.label6.TabIndex = 85; 326 | this.label6.Text = "Global Variable Name:"; 327 | // 328 | // sendWebhookBtn 329 | // 330 | this.sendWebhookBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 331 | this.sendWebhookBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 332 | this.sendWebhookBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 333 | this.sendWebhookBtn.ForeColor = System.Drawing.Color.White; 334 | this.sendWebhookBtn.Location = new System.Drawing.Point(20, 81); 335 | this.sendWebhookBtn.Name = "sendWebhookBtn"; 336 | this.sendWebhookBtn.Size = new System.Drawing.Size(323, 30); 337 | this.sendWebhookBtn.TabIndex = 86; 338 | this.sendWebhookBtn.Text = "Send Webhook"; 339 | this.sendWebhookBtn.UseVisualStyleBackColor = false; 340 | this.sendWebhookBtn.Click += new System.EventHandler(this.sendWebhookBtn_Click_1); 341 | // 342 | // webhookID 343 | // 344 | this.webhookID.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 345 | this.webhookID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 346 | this.webhookID.ForeColor = System.Drawing.Color.White; 347 | this.webhookID.Location = new System.Drawing.Point(20, 55); 348 | this.webhookID.Name = "webhookID"; 349 | this.webhookID.Size = new System.Drawing.Size(98, 20); 350 | this.webhookID.TabIndex = 87; 351 | // 352 | // webhookBaseURL 353 | // 354 | this.webhookBaseURL.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 355 | this.webhookBaseURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 356 | this.webhookBaseURL.ForeColor = System.Drawing.Color.White; 357 | this.webhookBaseURL.Location = new System.Drawing.Point(124, 55); 358 | this.webhookBaseURL.Name = "webhookBaseURL"; 359 | this.webhookBaseURL.Size = new System.Drawing.Size(219, 20); 360 | this.webhookBaseURL.TabIndex = 88; 361 | // 362 | // label7 363 | // 364 | this.label7.AutoSize = true; 365 | this.label7.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 366 | this.label7.ForeColor = System.Drawing.SystemColors.ButtonFace; 367 | this.label7.Location = new System.Drawing.Point(17, 37); 368 | this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 369 | this.label7.Name = "label7"; 370 | this.label7.Size = new System.Drawing.Size(77, 15); 371 | this.label7.TabIndex = 89; 372 | this.label7.Text = "Webhook ID:"; 373 | // 374 | // label8 375 | // 376 | this.label8.AutoSize = true; 377 | this.label8.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 378 | this.label8.ForeColor = System.Drawing.SystemColors.ButtonFace; 379 | this.label8.Location = new System.Drawing.Point(123, 39); 380 | this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 381 | this.label8.Name = "label8"; 382 | this.label8.Size = new System.Drawing.Size(115, 15); 383 | this.label8.TabIndex = 90; 384 | this.label8.Text = "Webhook Base Link:"; 385 | // 386 | // closeBtn 387 | // 388 | this.closeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 389 | this.closeBtn.ForeColor = System.Drawing.Color.White; 390 | this.closeBtn.Location = new System.Drawing.Point(1164, 7); 391 | this.closeBtn.Name = "closeBtn"; 392 | this.closeBtn.Size = new System.Drawing.Size(43, 23); 393 | this.closeBtn.TabIndex = 91; 394 | this.closeBtn.Text = "X"; 395 | this.closeBtn.UseVisualStyleBackColor = true; 396 | this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); 397 | // 398 | // minBtn 399 | // 400 | this.minBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 401 | this.minBtn.ForeColor = System.Drawing.Color.White; 402 | this.minBtn.Location = new System.Drawing.Point(1115, 7); 403 | this.minBtn.Name = "minBtn"; 404 | this.minBtn.Size = new System.Drawing.Size(43, 23); 405 | this.minBtn.TabIndex = 92; 406 | this.minBtn.Text = "-"; 407 | this.minBtn.UseVisualStyleBackColor = true; 408 | this.minBtn.Click += new System.EventHandler(this.minBtn_Click); 409 | // 410 | // label9 411 | // 412 | this.label9.AutoSize = true; 413 | this.label9.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 414 | this.label9.ForeColor = System.Drawing.SystemColors.ButtonFace; 415 | this.label9.Location = new System.Drawing.Point(387, 141); 416 | this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 417 | this.label9.Name = "label9"; 418 | this.label9.Size = new System.Drawing.Size(53, 15); 419 | this.label9.TabIndex = 95; 420 | this.label9.Text = "File Path"; 421 | // 422 | // filePathField 423 | // 424 | this.filePathField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 425 | this.filePathField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 426 | this.filePathField.ForeColor = System.Drawing.Color.White; 427 | this.filePathField.Location = new System.Drawing.Point(390, 159); 428 | this.filePathField.Name = "filePathField"; 429 | this.filePathField.Size = new System.Drawing.Size(323, 20); 430 | this.filePathField.TabIndex = 94; 431 | // 432 | // downloadFileBtn 433 | // 434 | this.downloadFileBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 435 | this.downloadFileBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 436 | this.downloadFileBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 437 | this.downloadFileBtn.ForeColor = System.Drawing.Color.White; 438 | this.downloadFileBtn.Location = new System.Drawing.Point(390, 234); 439 | this.downloadFileBtn.Name = "downloadFileBtn"; 440 | this.downloadFileBtn.Size = new System.Drawing.Size(323, 30); 441 | this.downloadFileBtn.TabIndex = 93; 442 | this.downloadFileBtn.Text = "Download File"; 443 | this.downloadFileBtn.UseVisualStyleBackColor = false; 444 | this.downloadFileBtn.Click += new System.EventHandler(this.downloadFileBtn_Click); 445 | // 446 | // label10 447 | // 448 | this.label10.AutoSize = true; 449 | this.label10.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 450 | this.label10.ForeColor = System.Drawing.SystemColors.ButtonFace; 451 | this.label10.Location = new System.Drawing.Point(387, 190); 452 | this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 453 | this.label10.Name = "label10"; 454 | this.label10.Size = new System.Drawing.Size(117, 15); 455 | this.label10.TabIndex = 97; 456 | this.label10.Text = "File Name/Extension"; 457 | // 458 | // fileExtensionField 459 | // 460 | this.fileExtensionField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 461 | this.fileExtensionField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 462 | this.fileExtensionField.ForeColor = System.Drawing.Color.White; 463 | this.fileExtensionField.Location = new System.Drawing.Point(390, 208); 464 | this.fileExtensionField.Name = "fileExtensionField"; 465 | this.fileExtensionField.Size = new System.Drawing.Size(323, 20); 466 | this.fileExtensionField.TabIndex = 96; 467 | // 468 | // label11 469 | // 470 | this.label11.AutoSize = true; 471 | this.label11.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 472 | this.label11.ForeColor = System.Drawing.SystemColors.ButtonFace; 473 | this.label11.Location = new System.Drawing.Point(387, 303); 474 | this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 475 | this.label11.Name = "label11"; 476 | this.label11.Size = new System.Drawing.Size(180, 15); 477 | this.label11.TabIndex = 100; 478 | this.label11.Text = "2FA (Two Factor Authentication)"; 479 | // 480 | // tfaField 481 | // 482 | this.tfaField.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 483 | this.tfaField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 484 | this.tfaField.ForeColor = System.Drawing.Color.White; 485 | this.tfaField.Location = new System.Drawing.Point(390, 321); 486 | this.tfaField.Name = "tfaField"; 487 | this.tfaField.Size = new System.Drawing.Size(323, 20); 488 | this.tfaField.TabIndex = 99; 489 | // 490 | // enableTfaBtn 491 | // 492 | this.enableTfaBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 493 | this.enableTfaBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 494 | this.enableTfaBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 495 | this.enableTfaBtn.ForeColor = System.Drawing.Color.White; 496 | this.enableTfaBtn.Location = new System.Drawing.Point(390, 347); 497 | this.enableTfaBtn.Name = "enableTfaBtn"; 498 | this.enableTfaBtn.Size = new System.Drawing.Size(155, 30); 499 | this.enableTfaBtn.TabIndex = 98; 500 | this.enableTfaBtn.Text = "Enable"; 501 | this.enableTfaBtn.UseVisualStyleBackColor = false; 502 | this.enableTfaBtn.Click += new System.EventHandler(this.enableTfaBtn_Click); 503 | // 504 | // disableTfaBtn 505 | // 506 | this.disableTfaBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 507 | this.disableTfaBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 508 | this.disableTfaBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 509 | this.disableTfaBtn.ForeColor = System.Drawing.Color.White; 510 | this.disableTfaBtn.Location = new System.Drawing.Point(558, 347); 511 | this.disableTfaBtn.Name = "disableTfaBtn"; 512 | this.disableTfaBtn.Size = new System.Drawing.Size(155, 30); 513 | this.disableTfaBtn.TabIndex = 101; 514 | this.disableTfaBtn.Text = "Disable"; 515 | this.disableTfaBtn.UseVisualStyleBackColor = false; 516 | this.disableTfaBtn.Click += new System.EventHandler(this.disableTfaBtn_Click); 517 | // 518 | // banBtn 519 | // 520 | this.banBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(100)))), ((int)(((byte)(242))))); 521 | this.banBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(29)))), ((int)(((byte)(39))))); 522 | this.banBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 523 | this.banBtn.ForeColor = System.Drawing.Color.White; 524 | this.banBtn.Location = new System.Drawing.Point(390, 414); 525 | this.banBtn.Name = "banBtn"; 526 | this.banBtn.Size = new System.Drawing.Size(323, 30); 527 | this.banBtn.TabIndex = 102; 528 | this.banBtn.Text = "Ban Account"; 529 | this.banBtn.UseVisualStyleBackColor = false; 530 | this.banBtn.Click += new System.EventHandler(this.banBtn_Click); 531 | // 532 | // Main 533 | // 534 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 535 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 536 | this.AutoValidate = System.Windows.Forms.AutoValidate.Disable; 537 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(24)))), ((int)(((byte)(32))))); 538 | this.ClientSize = new System.Drawing.Size(1219, 596); 539 | this.Controls.Add(this.banBtn); 540 | this.Controls.Add(this.disableTfaBtn); 541 | this.Controls.Add(this.label11); 542 | this.Controls.Add(this.tfaField); 543 | this.Controls.Add(this.enableTfaBtn); 544 | this.Controls.Add(this.label10); 545 | this.Controls.Add(this.fileExtensionField); 546 | this.Controls.Add(this.label9); 547 | this.Controls.Add(this.filePathField); 548 | this.Controls.Add(this.downloadFileBtn); 549 | this.Controls.Add(this.minBtn); 550 | this.Controls.Add(this.closeBtn); 551 | this.Controls.Add(this.label8); 552 | this.Controls.Add(this.label7); 553 | this.Controls.Add(this.webhookBaseURL); 554 | this.Controls.Add(this.webhookID); 555 | this.Controls.Add(this.sendWebhookBtn); 556 | this.Controls.Add(this.label6); 557 | this.Controls.Add(this.label5); 558 | this.Controls.Add(this.label3); 559 | this.Controls.Add(this.label4); 560 | this.Controls.Add(this.varDataField); 561 | this.Controls.Add(this.varField); 562 | this.Controls.Add(this.fetchUserVarBtn); 563 | this.Controls.Add(this.setUserVarBtn); 564 | this.Controls.Add(this.globalVariableField); 565 | this.Controls.Add(this.fetchGlobalVariableBtn); 566 | this.Controls.Add(this.checkSessionBtn); 567 | this.Controls.Add(this.sendLogDataBtn); 568 | this.Controls.Add(this.logDataField); 569 | this.Controls.Add(this.sendMsgBtn); 570 | this.Controls.Add(this.chatMsgField); 571 | this.Controls.Add(this.chatroomGrid); 572 | this.Controls.Add(this.onlineUsersField); 573 | this.Controls.Add(this.userDataField); 574 | this.Controls.Add(this.label2); 575 | this.Controls.Add(this.label1); 576 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 577 | this.Name = "Main"; 578 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 579 | this.Text = "Loader"; 580 | this.TransparencyKey = System.Drawing.Color.Maroon; 581 | this.Load += new System.EventHandler(this.Main_Load); 582 | ((System.ComponentModel.ISupportInitialize)(this.chatroomGrid)).EndInit(); 583 | this.ResumeLayout(false); 584 | this.PerformLayout(); 585 | 586 | } 587 | 588 | // Token: 0x04000001 RID: 1 589 | private global::System.ComponentModel.IContainer components = null; 590 | 591 | // Token: 0x0400000A RID: 10 592 | private global::System.Windows.Forms.Label label1; 593 | private System.Windows.Forms.Label label2; 594 | private System.Windows.Forms.Timer timer1; 595 | private System.Windows.Forms.ListBox userDataField; 596 | private System.Windows.Forms.ListBox onlineUsersField; 597 | private System.Windows.Forms.DataGridView chatroomGrid; 598 | private System.Windows.Forms.DataGridViewTextBoxColumn Sender; 599 | private System.Windows.Forms.DataGridViewTextBoxColumn Message; 600 | private System.Windows.Forms.DataGridViewTextBoxColumn Time; 601 | private System.Windows.Forms.TextBox chatMsgField; 602 | private System.Windows.Forms.TextBox logDataField; 603 | private System.Windows.Forms.Button sendMsgBtn; 604 | private System.Windows.Forms.TextBox varDataField; 605 | private System.Windows.Forms.TextBox varField; 606 | private System.Windows.Forms.Button fetchUserVarBtn; 607 | private System.Windows.Forms.Button setUserVarBtn; 608 | private System.Windows.Forms.TextBox globalVariableField; 609 | private System.Windows.Forms.Button fetchGlobalVariableBtn; 610 | private System.Windows.Forms.Button checkSessionBtn; 611 | private System.Windows.Forms.Button sendLogDataBtn; 612 | private System.Windows.Forms.Label label6; 613 | private System.Windows.Forms.Label label5; 614 | private System.Windows.Forms.Label label3; 615 | private System.Windows.Forms.Label label4; 616 | private System.Windows.Forms.Label label8; 617 | private System.Windows.Forms.Label label7; 618 | private System.Windows.Forms.TextBox webhookBaseURL; 619 | private System.Windows.Forms.TextBox webhookID; 620 | private System.Windows.Forms.Button sendWebhookBtn; 621 | private System.Windows.Forms.Button closeBtn; 622 | private System.Windows.Forms.Button minBtn; 623 | private System.Windows.Forms.Label label9; 624 | private System.Windows.Forms.TextBox filePathField; 625 | private System.Windows.Forms.Button downloadFileBtn; 626 | private System.Windows.Forms.Label label10; 627 | private System.Windows.Forms.TextBox fileExtensionField; 628 | private System.Windows.Forms.Label label11; 629 | private System.Windows.Forms.TextBox tfaField; 630 | private System.Windows.Forms.Button enableTfaBtn; 631 | private System.Windows.Forms.Button disableTfaBtn; 632 | private System.Windows.Forms.Button banBtn; 633 | } 634 | } 635 | -------------------------------------------------------------------------------- /Form/Main.cs: -------------------------------------------------------------------------------- 1 | using Loader; 2 | using System; 3 | using System.IO; 4 | using System.Threading; 5 | using System.Windows.Forms; 6 | 7 | namespace KeyAuth 8 | { 9 | public partial class Main : Form 10 | { 11 | /* 12 | * 13 | * WATCH THIS VIDEO TO SETUP APPLICATION: https://www.youtube.com/watch?v=RfDTdiBq4_o 14 | * 15 | * READ HERE TO LEARN ABOUT KEYAUTH FUNCTIONS https://github.com/KeyAuth/KeyAuth-CSHARP-Example#keyauthapp-instance-definition 16 | * 17 | */ 18 | 19 | string chatchannel = "test"; // chat channel name, must be set in order to send/retrieve messages 20 | 21 | 22 | public Main() 23 | { 24 | InitializeComponent(); 25 | Drag.MakeDraggable(this); 26 | } 27 | 28 | private async void Main_Load(object sender, EventArgs e) 29 | { 30 | userDataField.Items.Add($"Username: {Login.KeyAuthApp.user_data.username}"); 31 | userDataField.Items.Add($"License: {Login.KeyAuthApp.user_data.subscriptions[0].key}"); // this can be used if the user used a license, username, and password for register. It'll display the license assigned to the user 32 | userDataField.Items.Add($"Expires: {Login.KeyAuthApp.user_data.subscriptions[0].expiration}"); // this has been changed from expiry to expiration 33 | userDataField.Items.Add($"Subscription: {Login.KeyAuthApp.user_data.subscriptions[0].subscription}"); 34 | userDataField.Items.Add($"IP: {Login.KeyAuthApp.user_data.ip}"); 35 | userDataField.Items.Add($"HWID: {Login.KeyAuthApp.user_data.hwid}"); 36 | userDataField.Items.Add($"Creation Date: {Login.KeyAuthApp.user_data.CreationDate}"); // this has a capital "C" , if you use a lowercase "c" it won't convert unix 37 | userDataField.Items.Add($"Last Login: {Login.KeyAuthApp.user_data.LastLoginDate}"); // this has a capital "L", if you use a lowercase "l" it won't convert unix 38 | userDataField.Items.Add($"Time Left: {Login.KeyAuthApp.expirydaysleft()}"); 39 | 40 | var onlineUsers = await Login.KeyAuthApp.fetchOnline(); 41 | if (onlineUsers != null) 42 | { 43 | Console.Write("\n Online users: "); 44 | foreach (var user in onlineUsers) 45 | { 46 | onlineUsersField.Items.Add(user.credential + ", "); 47 | } 48 | Console.WriteLine("\n"); 49 | } 50 | } 51 | 52 | public static bool SubExist(string name, int len) 53 | { 54 | for (var i = 0; i < len; i++) 55 | { 56 | if (Login.KeyAuthApp.user_data.subscriptions[i].subscription == name) 57 | { 58 | return true; 59 | } 60 | } 61 | return false; 62 | } 63 | 64 | private async void timer1_Tick(object sender, EventArgs e) 65 | { 66 | chatroomGrid.Rows.Clear(); 67 | timer1.Interval = 15000; // get chat messages every 15 seconds 68 | if (!String.IsNullOrEmpty(chatchannel)) 69 | { 70 | var messages = await Login.KeyAuthApp.chatget(chatchannel); 71 | if (messages == null) 72 | { 73 | chatroomGrid.Rows.Insert(0, "KeyAuth", "No Chat Messages", api.UnixTimeToDateTime(DateTimeOffset.Now.ToUnixTimeSeconds())); 74 | } 75 | else 76 | { 77 | foreach (var message in messages) 78 | { 79 | chatroomGrid.Rows.Insert(0, message.author, message.message, api.UnixTimeToDateTime(long.Parse(message.timestamp))); 80 | } 81 | } 82 | } 83 | else 84 | { 85 | timer1.Stop(); 86 | chatroomGrid.Rows.Insert(0, "KeyAuth", "No Chat Messages", api.UnixTimeToDateTime(DateTimeOffset.Now.ToUnixTimeSeconds())); 87 | } 88 | } 89 | 90 | private async void sendWebhookBtn_Click_1(object sender, EventArgs e) 91 | { 92 | await Login.KeyAuthApp.webhook(webhookID.Text, webhookBaseURL.Text); 93 | MessageBox.Show(Login.KeyAuthApp.response.message); 94 | } 95 | 96 | private async void setUserVarBtn_Click_1(object sender, EventArgs e) 97 | { 98 | await Login.KeyAuthApp.setvar(varField.Text, varDataField.Text); 99 | MessageBox.Show(Login.KeyAuthApp.response.message); 100 | } 101 | 102 | private async void fetchUserVarBtn_Click_1(object sender, EventArgs e) 103 | { 104 | await Login.KeyAuthApp.getvar(varField.Text); 105 | MessageBox.Show(Login.KeyAuthApp.response.message); 106 | } 107 | 108 | private async void sendLogDataBtn_Click(object sender, EventArgs e) 109 | { 110 | await Login.KeyAuthApp.log(logDataField.Text); 111 | MessageBox.Show(Login.KeyAuthApp.response.message); 112 | } 113 | 114 | private async void checkSessionBtn_Click_1(object sender, EventArgs e) 115 | { 116 | await Login.KeyAuthApp.check(); 117 | MessageBox.Show(Login.KeyAuthApp.response.message); 118 | } 119 | 120 | private async void fetchGlobalVariableBtn_Click_1(object sender, EventArgs e) 121 | { 122 | string globalVal = await Login.KeyAuthApp.var(globalVariableField.Text); 123 | MessageBox.Show(globalVal); 124 | MessageBox.Show(Login.KeyAuthApp.response.message); // optional since it'll show the response in the var (if it's valid or not) 125 | } 126 | 127 | private async void sendMsgBtn_Click_1(object sender, EventArgs e) 128 | { 129 | if (await Login.KeyAuthApp.chatsend(chatMsgField.Text, chatchannel)) 130 | { 131 | chatroomGrid.Rows.Insert(0, Login.KeyAuthApp.user_data.username, chatMsgField.Text, api.UnixTimeToDateTime(DateTimeOffset.Now.ToUnixTimeSeconds())); 132 | } 133 | else 134 | { 135 | MessageBox.Show(Login.KeyAuthApp.response.message); 136 | } 137 | } 138 | 139 | private async void closeBtn_Click(object sender, EventArgs e) 140 | { 141 | await Login.KeyAuthApp.logout(); // ends the sessions once the application closes 142 | Environment.Exit(0); 143 | } 144 | 145 | private void minBtn_Click(object sender, EventArgs e) 146 | { 147 | this.WindowState = FormWindowState.Maximized; 148 | } 149 | 150 | private async void downloadFileBtn_Click(object sender, EventArgs e) 151 | { 152 | byte[] result = await Login.KeyAuthApp.download(""); 153 | if (!Login.KeyAuthApp.response.success) 154 | { 155 | Console.WriteLine("\n Status: " + Login.KeyAuthApp.response.message); 156 | Thread.Sleep(2500); 157 | Environment.Exit(0); 158 | } 159 | else 160 | File.WriteAllBytes($@"{filePathField.Text}" + $"\\{fileExtensionField.Text}", result); 161 | } 162 | 163 | private async void enableTfaBtn_Click(object sender, EventArgs e) 164 | { 165 | string code = string.IsNullOrEmpty(tfaField.Text) ? null : tfaField.Text; 166 | 167 | await Login.KeyAuthApp.enable2fa(code); 168 | 169 | MessageBox.Show(Login.KeyAuthApp.response.message); 170 | } 171 | 172 | private async void disableTfaBtn_Click(object sender, EventArgs e) 173 | { 174 | await Login.KeyAuthApp.disable2fa(tfaField.Text); 175 | MessageBox.Show(Login.KeyAuthApp.response.message); 176 | } 177 | 178 | private async void banBtn_Click(object sender, EventArgs e) 179 | { 180 | await Login.KeyAuthApp.ban("Testing ban function"); 181 | MessageBox.Show(Login.KeyAuthApp.response.message); 182 | } 183 | } 184 | } -------------------------------------------------------------------------------- /Form/Main.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 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 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 349, 17 122 | 123 | 124 | True 125 | 126 | 127 | True 128 | 129 | 130 | True 131 | 132 | 133 | True 134 | 135 | 136 | True 137 | 138 | 139 | True 140 | 141 | -------------------------------------------------------------------------------- /Form/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | 5 | 6 | namespace KeyAuth 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | 15 | 16 | static void Main() 17 | { 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new Login()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Form/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Loader")] 10 | [assembly: AssemblyDescription("KeyAuth Loader Winform Example")] 11 | [assembly: AssemblyConfiguration("retail")] 12 | [assembly: AssemblyCompany("KeyAuth LLC")] 13 | [assembly: AssemblyProduct("Loader")] 14 | [assembly: AssemblyCopyright("Copyright © KeyAuth.cc")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("c3f887e6-ebeb-4049-9627-b16958d2e50c")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | [assembly: NeutralResourcesLanguage("en-US")] -------------------------------------------------------------------------------- /Form/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace KeyAuth.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KeyAuth.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Form/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 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 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Form/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace KeyAuth.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Form/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Elastic License 2.0 2 | 3 | URL: https://www.elastic.co/licensing/elastic-license 4 | 5 | ## Acceptance 6 | 7 | By using the software, you agree to all of the terms and conditions below. 8 | 9 | ## Copyright License 10 | 11 | The licensor grants you a non-exclusive, royalty-free, worldwide, 12 | non-sublicensable, non-transferable license to use, copy, distribute, make 13 | available, and prepare derivative works of the software, in each case subject to 14 | the limitations and conditions below. 15 | 16 | ## Limitations 17 | 18 | You may not provide the software to third parties as a hosted or managed 19 | service, where the service provides users with access to any substantial set of 20 | the features or functionality of the software. 21 | 22 | You may not move, change, disable, or circumvent the license key functionality 23 | in the software, and you may not remove or obscure any functionality in the 24 | software that is protected by the license key. 25 | 26 | You may not alter, remove, or obscure any licensing, copyright, or other notices 27 | of the licensor in the software. Any use of the licensor’s trademarks is subject 28 | to applicable law. 29 | 30 | ## Patents 31 | 32 | The licensor grants you a license, under any patent claims the licensor can 33 | license, or becomes able to license, to make, have made, use, sell, offer for 34 | sale, import and have imported the software, in each case subject to the 35 | limitations and conditions in this license. This license does not cover any 36 | patent claims that you cause to be infringed by modifications or additions to 37 | the software. If you or your company make any written claim that the software 38 | infringes or contributes to infringement of any patent, your patent license for 39 | the software granted under these terms ends immediately. If your company makes 40 | such a claim, your patent license ends immediately for work on behalf of your 41 | company. 42 | 43 | ## Notices 44 | 45 | You must ensure that anyone who gets a copy of any part of the software from you 46 | also gets a copy of these terms. 47 | 48 | If you modify the software, you must include in any modified copies of the 49 | software prominent notices stating that you have modified the software. 50 | 51 | ## No Other Rights 52 | 53 | These terms do not imply any licenses other than those expressly granted in 54 | these terms. 55 | 56 | ## Termination 57 | 58 | If you use the software in violation of these terms, such use is not licensed, 59 | and your licenses will automatically terminate. If the licensor provides you 60 | with a notice of your violation, and you cease all violation of this license no 61 | later than 30 days after you receive that notice, your licenses will be 62 | reinstated retroactively. However, if you violate these terms after such 63 | reinstatement, any additional violation of these terms will cause your licenses 64 | to terminate automatically and permanently. 65 | 66 | ## No Liability 67 | 68 | *As far as the law allows, the software comes as is, without any warranty or 69 | condition, and the licensor will not be liable to you for any damages arising 70 | out of these terms or the use or nature of the software, under any kind of 71 | legal claim.* 72 | 73 | ## Definitions 74 | 75 | The **licensor** is the entity offering these terms, and the **software** is the 76 | software the licensor makes available under these terms, including any portion 77 | of it. 78 | 79 | **you** refers to the individual or entity agreeing to these terms. 80 | 81 | **your company** is any legal entity, sole proprietorship, or other kind of 82 | organization that you work for, plus all organizations that have control over, 83 | are under the control of, or are under common control with that 84 | organization. **control** means ownership of substantially all the assets of an 85 | entity, or the power to direct its management and policies by vote, contract, or 86 | otherwise. Control can be direct or indirect. 87 | 88 | **your licenses** are all the licenses granted to you for the software under 89 | these terms. 90 | 91 | **use** means anything you do with the software requiring one of your licenses. 92 | 93 | **trademark** means trademarks, service marks, and similar rights. 94 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KeyAuth-CSHARP-Example : Please star 🌟 2 | 3 | KeyAuth C# example SDK for https://keyauth.cc license key API auth. 4 | 5 | ### Tutorial Video 6 | 7 | This video explains both how to use this example, but also how to add KeyAuth to your **OWN PROJECT** https://www.youtube.com/watch?v=5x4YkTmFH-U 8 | 9 | ## **Bugs** 10 | 11 | If you are using our example with no significant changes, and you are having problems, please Report Bug here https://keyauth.cc/app/?page=forms 12 | 13 | However, we do **NOT** provide support for adding KeyAuth to your project. If you can't figure this out you should use Google or YouTube to learn more about the programming language you want to sell a program in. 14 | 15 | ## **Security practices** 16 | 17 | * Utilize obfuscation provided by companies such as VMProtect or Themida (utilize their SDKs too for greater protection) 18 | * Preform frequent integrity checks to ensure the memory of the program has not been modified 19 | * Don't write the bytes of a file you've downloaded to disk if you don't want that file to be retrieved by the user. Rather, execute the file in memory and erase it from memory the moment execution finishes 20 | 21 | While our API ensures licenses validation, it's crucial to implement robust client-side protection like obfuscation and integrity checks to prevent software tampering, as vulnerabilities often stem from insufficient client security. 22 | 23 | ## Copyright License 24 | 25 | KeyAuth is licensed under **Elastic License 2.0** 26 | 27 | * You may not provide the software to third parties as a hosted or managed 28 | service, where the service provides users with access to any substantial set of 29 | the features or functionality of the software. 30 | 31 | * You may not move, change, disable, or circumvent the license key functionality 32 | in the software, and you may not remove or obscure any functionality in the 33 | software that is protected by the license key. 34 | 35 | * You may not alter, remove, or obscure any licensing, copyright, or other notices 36 | of the licensor in the software. Any use of the licensor’s trademarks is subject 37 | to applicable law. 38 | 39 | Thank you for your compliance, we work hard on the development of KeyAuth and do not appreciate our copyright being infringed. 40 | 41 | ## What is KeyAuth? 42 | 43 | KeyAuth is an Open source authentication system with cloud hosting plans as well. Client SDKs available for [C#](https://github.com/KeyAuth/KeyAuth-CSHARP-Example), [C++](https://github.com/KeyAuth/KeyAuth-CPP-Example), [Python](https://github.com/KeyAuth/KeyAuth-Python-Example), [Java](https://github.com/KeyAuth-Archive/KeyAuth-JAVA-api), [JavaScript](https://github.com/mazkdevf/KeyAuth-JS-Example), [VB.NET](https://github.com/KeyAuth/KeyAuth-VB-Example), [PHP](https://github.com/KeyAuth/KeyAuth-PHP-Example), [Rust](https://github.com/KeyAuth/KeyAuth-Rust-Example), [Go](https://github.com/mazkdevf/KeyAuth-Go-Example), [Lua](https://github.com/mazkdevf/KeyAuth-Lua-Examples), [Ruby](https://github.com/mazkdevf/KeyAuth-Ruby-Example), and [Perl](https://github.com/mazkdevf/KeyAuth-Perl-Example). KeyAuth has several unique features such as memory streaming, webhook function where you can send requests to API without leaking the API, discord webhook notifications, ban the user securely through the application at your discretion. Feel free to join https://t.me/keyauth if you have questions or suggestions. 44 | 45 | > [!TIP] 46 | > https://vaultcord.com FREE Discord bot to Backup server, members, channels, messages & more. Custom verify page, block alt accounts, VPNs & more. 47 | 48 | ## Customer connection issues? 49 | 50 | This is common amongst all authentication systems. Program obfuscation causes false positives in virus scanners, and with the scale of KeyAuth this is perceived as a malicious domain. So, `keyauth.com` and `keyauth.win` have been blocked by many internet providers. for dashbord, reseller panel, customer panel, use `keyauth.cc` 51 | 52 | For API, `keyauth.cc` will not work because I purposefully blocked it on there so `keyauth.cc` doesn't get blocked also. So, you should create your own domain and follow this tutorial video https://www.youtube.com/watch?v=a2SROFJ0eYc. The tutorial video shows you how to create a domain name for 100% free if you don't want to purchase one. 53 | 54 | ## `KeyAuthApp` instance definition 55 | 56 | Visit https://keyauth.cc/app/ and select your application, then click on the **C#** tab 57 | 58 | It'll provide you with the code which you should replace with in the `Program.cs` file (or `Login.cs` file if using Form example) 59 | 60 | ```cs 61 | public static api KeyAuthApp = new api( 62 | name: "example", 63 | ownerid: "JjPMBVlIOd", 64 | secret: "db40d586f4b189e04e5c18c3c94b7e72221be3f6551995adc05236948d1762bc", 65 | version: "1.0" 66 | ); 67 | ``` 68 | 69 | ## Initialize application 70 | 71 | You must call this function prior to using any other KeyAuth function. Otherwise the other KeyAuth function won't work. 72 | 73 | ```cs 74 | KeyAuthApp.init(); 75 | if (!KeyAuthApp.response.success) 76 | { 77 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 78 | Thread.Sleep(2500); 79 | Environment.Exit(0); 80 | } 81 | ``` 82 | 83 | ## Display application information 84 | 85 | ```cs 86 | KeyAuthApp.fetchStats(); 87 | Console.WriteLine("\n Application Version: " + KeyAuthApp.app_data.version); 88 | Console.WriteLine(" Customer panel link: " + KeyAuthApp.app_data.customerPanelLink); 89 | Console.WriteLine(" Number of users: " + KeyAuthApp.app_data.numUsers); 90 | Console.WriteLine(" Number of online users: " + KeyAuthApp.app_data.numOnlineUsers); 91 | Console.WriteLine(" Number of keys: " + KeyAuthApp.app_data.numKeys); 92 | ``` 93 | 94 | ## Check session validation 95 | 96 | Use this to see if the user is logged in or not. 97 | 98 | ```cs 99 | KeyAuthApp.check(); 100 | Console.WriteLine($" Current Session Validation Status: {KeyAuthApp.response.message}"); 101 | ``` 102 | 103 | ## Check blacklist status 104 | 105 | Check if HWID or IP Address is blacklisted. You can add this if you want, just to make sure nobody can open your program for less than a second if they're blacklisted. Though, if you don't mind a blacklisted user having the program for a few seconds until they try to login and register, and you care about having the quickest program for your users, you shouldn't use this function then. If a blacklisted user tries to login/register, the KeyAuth server will check if they're blacklisted and deny entry if so. So the check blacklist function is just auxiliary function that's optional. 106 | 107 | ```cs 108 | if(KeyAuthApp.checkblack()) { 109 | Environment.Exit(0); // terminate program if user blacklisted. 110 | } 111 | ``` 112 | 113 | ## Login with username/password 114 | 115 | ```cs 116 | string username; 117 | string password; 118 | Console.WriteLine("\n\n Enter username: "); 119 | username = Console.ReadLine(); 120 | Console.WriteLine("\n\n Enter password: "); 121 | password = Console.ReadLine(); 122 | KeyAuthApp.login(username, password); 123 | if (!KeyAuthApp.response.success) 124 | { 125 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 126 | Thread.Sleep(2500); 127 | Environment.Exit(0); 128 | } 129 | ``` 130 | 131 | ## Register with username/password/key 132 | 133 | ```cs 134 | string username, password, key, email; 135 | Console.Write("\n\n Enter username: "); 136 | username = Console.ReadLine(); 137 | Console.Write("\n\n Enter password: "); 138 | password = Console.ReadLine(); 139 | Console.Write("\n\n Enter license: "); 140 | key = Console.ReadLine(); 141 | Console.Write("\n\n Enter email (just press enter if none): "); 142 | email = Console.ReadLine(); 143 | KeyAuthApp.register(username, password, key, email); 144 | if (!KeyAuthApp.response.success) 145 | { 146 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 147 | Thread.Sleep(2500); 148 | Environment.Exit(0); 149 | } 150 | ``` 151 | 152 | ## Upgrade user username/key 153 | 154 | Used so the user can add extra time to their account by claiming new key. 155 | 156 | > [!WARNING] 157 | > No password is needed to upgrade account. So, unlike login, register, and license functions - you should **not** log user in after successful upgrade. 158 | 159 | ``` 160 | string username; 161 | string password; 162 | string key; 163 | Console.WriteLine("\n\n Enter username: "); 164 | username = Console.ReadLine(); 165 | Console.WriteLine("\n\n Enter license: "); 166 | key = Console.ReadLine(); 167 | KeyAuthApp.upgrade(username, key); 168 | // don't proceed to app, user hasn't authenticated yet. 169 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 170 | Thread.Sleep(2500); 171 | Environment.Exit(0); 172 | ``` 173 | 174 | ## Login with just license key 175 | 176 | Users can use this function if their license key has never been used before, and if it has been used before. So if you plan to just allow users to use keys, you can remove the login and register functions from your code. 177 | 178 | ```cs 179 | string key; 180 | Console.WriteLine("\n\n Enter license: "); 181 | key = Console.ReadLine(); 182 | KeyAuthApp.license(key); 183 | if (!KeyAuthApp.response.success) 184 | { 185 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 186 | Thread.Sleep(2500); 187 | Environment.Exit(0); 188 | } 189 | ``` 190 | 191 | ## Login with web loader 192 | 193 | Have your users login through website. Tutorial video here https://www.youtube.com/watch?v=9-qgmsUUCK4 you can use your own domain for customer panel also, https://www.youtube.com/watch?v=iHQe4GLvgaE 194 | 195 | ```cs 196 | KeyAuthApp.web_login(); 197 | 198 | Console.WriteLine("\n Waiting for button to be clicked"); 199 | KeyAuthApp.button("close"); 200 | ``` 201 | 202 | ## Forgot password 203 | 204 | Allow users to enter their account information and recieve an email to reset their password. 205 | 206 | ```cs 207 | string username, email; 208 | Console.Write("\n\n Enter username: "); 209 | username = Console.ReadLine(); 210 | Console.Write("\n\n Enter email: "); 211 | email = Console.ReadLine(); 212 | KeyAuthApp.forgot(username, email); 213 | // don't proceed to app, user hasn't authenticated yet. 214 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 215 | Thread.Sleep(2500); 216 | Environment.Exit(0); 217 | ``` 218 | 219 | ## User Data 220 | 221 | Show information for current logged-in user. 222 | 223 | ```cs 224 | Console.WriteLine("\n User data:"); 225 | Console.WriteLine(" Username: " + KeyAuthApp.user_data.username); 226 | Console.WriteLine(" IP address: " + KeyAuthApp.user_data.ip); 227 | Console.WriteLine(" Hardware-Id: " + KeyAuthApp.user_data.hwid); 228 | Console.WriteLine(" Created at: " + UnixTimeToDateTime(long.Parse(KeyAuthApp.user_data.createdate))); 229 | if (!String.IsNullOrEmpty(KeyAuthApp.user_data.lastlogin)) // don't show last login on register since there is no last login at that point 230 | Console.WriteLine(" Last login at: " + UnixTimeToDateTime(long.Parse(KeyAuthApp.user_data.lastlogin))); 231 | Console.WriteLine(" Your subscription(s):"); 232 | for (var i = 0; i < KeyAuthApp.user_data.subscriptions.Count; i++) 233 | { 234 | Console.WriteLine(" Subscription name: " + KeyAuthApp.user_data.subscriptions[i].subscription + " - Expires at: " + UnixTimeToDateTime(long.Parse(KeyAuthApp.user_data.subscriptions[i].expiry)) + " - Time left in seconds: " + KeyAuthApp.user_data.subscriptions[i].timeleft); 235 | } 236 | ``` 237 | 238 | ## Check subscription name of user 239 | 240 | If you want to wall off parts of your app to only certain users, you can have multiple subscriptions with different names. Then, when you create licenses that correspond to the level of that subscription, users who use those licenses will get a subscription with the name of the subscription that corresponds to the level of the license key they used. The `SubExist` function is in the `Program.cs` file 241 | 242 | ```cs 243 | if (SubExist("default")) 244 | { 245 | Console.WriteLine(" Default Subscription Exists"); 246 | } 247 | // See if another sub exists with name 248 | if (SubExist("premium")) 249 | { 250 | Console.WriteLine(" Premium Subscription Exists"); 251 | } 252 | ``` 253 | 254 | ## Show list of online users 255 | 256 | ```cs 257 | var onlineUsers = KeyAuthApp.fetchOnline(); 258 | if (onlineUsers != null) 259 | { 260 | Console.Write("\n Online users: "); 261 | foreach (var user in onlineUsers) 262 | { 263 | Console.Write(user.credential + ", "); 264 | } 265 | Console.WriteLine("\n"); 266 | } 267 | ``` 268 | 269 | ## Application variables 270 | 271 | A string that is kept on the server-side of KeyAuth. On the dashboard you can choose for each variable to be authenticated (only logged in users can access), or not authenticated (any user can access before login). These are global and static for all users, unlike User Variables which will be dicussed below this section. 272 | 273 | ```cs 274 | string appvar = KeyAuthApp.var("variableNameHere"); 275 | if (!KeyAuthApp.response.success) 276 | { 277 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 278 | Thread.Sleep(2500); 279 | Environment.Exit(0); 280 | } 281 | else 282 | Console.WriteLine("\n App variable data: " + appvar); 283 | ``` 284 | 285 | ## User Variables 286 | 287 | User variables are strings kept on the server-side of KeyAuth. They are specific to users. They can be set on Dashboard in the Users tab, via SellerAPI, or via your loader using the code below. `discord` is the user variable name you fetch the user variable by. `test#0001` is the variable data you get when fetching the user variable. 288 | 289 | ```cs 290 | KeyAuthApp.setvar("discord", "test#0001"); 291 | if (!KeyAuthApp.response.success) 292 | { 293 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 294 | Thread.Sleep(2500); 295 | Environment.Exit(0); 296 | } 297 | else 298 | Console.WriteLine("\n Successfully set user variable"); 299 | ``` 300 | 301 | And here's how you fetch the user variable: 302 | 303 | ```cs 304 | string uservar = KeyAuthApp.getvar("discord"); 305 | if (!KeyAuthApp.response.success) 306 | { 307 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 308 | Thread.Sleep(2500); 309 | Environment.Exit(0); 310 | } 311 | else 312 | Console.WriteLine("\n User variable value: " + uservar); 313 | ``` 314 | 315 | ## Application Logs 316 | 317 | Can be used to log data. Good for anti-debug alerts and maybe error debugging. If you set Discord webhook in the app settings of the Dashboard, it will send log messages to your Discord webhook rather than store them on site. It's recommended that you set Discord webhook, as logs on site are deleted 1 month after being sent. 318 | 319 | You can use the log function before login & after login. 320 | 321 | ```cs 322 | KeyAuthApp.log("hello I wanted to log this"); 323 | ``` 324 | 325 | ## Ban the user 326 | 327 | Ban the user and blacklist their HWID and IP Address. Good function to call upon if you use anti-debug and have detected an intrusion attempt. 328 | 329 | Function only works after login. 330 | 331 | ```cs 332 | KeyAuthApp.ban(); 333 | ``` 334 | 335 | ## Ban the user (with reason) 336 | 337 | Ban the user and blacklist their HWID and IP Address. Good function to call upon if you use anti-debug and have detected an intrusion attempt. 338 | 339 | Function only works after login. 340 | 341 | The reason paramater will be the ban reason displayed to the user if they try to login, and visible on the KeyAuth dashboard. 342 | 343 | ```cs 344 | KeyAuthApp.ban("You've been banned for a reason."); 345 | ``` 346 | 347 | ## Server-sided webhooks 348 | 349 | Tutorial video https://www.youtube.com/watch?v=ENRaNPPYJbc 350 | 351 | > [!NOTE] 352 | > Read documentation for KeyAuth webhooks here https://keyauth.readme.io/reference/webhooks-1 353 | 354 | Send HTTP requests to URLs securely without leaking the URL in your application. You should definitely use if you want to send requests to SellerAPI from your application, otherwise if you don't use you'll be leaking your seller key to everyone. And then someone can mess up your application. 355 | 356 | 1st example is how to send request with no POST data. just a GET request to the URL. `7kR0UedlVI` is the webhook ID, `https://keyauth.win/api/seller/?sellerkey=sellerkeyhere&type=black` is what you should put as the webhook endpoint on the dashboard. This is the part you don't want users to see. And then you have `&ip=1.1.1.1&hwid=abc` in your program code which will be added to the webhook endpoint on the keyauth server and then the request will be sent. 357 | 358 | 2nd example includes post data. it is form data. it is an example request to the KeyAuth API. `7kR0UedlVI` is the webhook ID, `https://keyauth.win/api/1.2/` is the webhook endpoint. 359 | 360 | 3rd examples included post data though it's JSON. It's an example reques to Discord webhook `7kR0UedlVI` is the webhook ID, `https://discord.com/api/webhooks/...` is the webhook endpoint. 361 | 362 | ```cs 363 | // example to send normal request with no POST data 364 | string resp = KeyAuthApp.webhook("7kR0UedlVI", "&ip=1.1.1.1&hwid=abc"); 365 | 366 | // example to send form data 367 | resp = KeyAuthApp.webhook("7kR0UedlVI", "", "type=init&name=test&ownerid=j9Gj0FTemM", "application/x-www-form-urlencoded"); 368 | 369 | // example to send JSON 370 | resp = KeyAuthApp.webhook("7kR0UedlVI", "", "{\"content\": \"webhook message here\",\"embeds\": null}", "application/json"); // if Discord webhook message successful, response will be empty 371 | 372 | if (!KeyAuthApp.response.success) 373 | { 374 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 375 | Thread.Sleep(2500); 376 | Environment.Exit(0); 377 | } 378 | else 379 | Console.WriteLine("\n Response received from webhook request: " + resp); 380 | ``` 381 | 382 | ## Download file 383 | 384 | > [!NOTE] 385 | > Read documentation for KeyAuth files here https://docs.keyauth.cc/website/dashboard/files 386 | 387 | Keep files secure by providing KeyAuth your file download link on the KeyAuth dashboard. Make sure this is a direct download link (as soon as you go to the link, it starts downloading without you clicking anything). The KeyAuth download function provides the bytes, and then you get to decide what to do with those. This example shows how to write it to a file named `text.txt` in the same folder as the program, though you could execute with RunPE or whatever you want. 388 | 389 | `385624` is the file ID you get from the dashboard after adding file. 390 | 391 | ```cs 392 | byte[] result = KeyAuthApp.download("385624"); 393 | if (!KeyAuthApp.response.success) 394 | { 395 | Console.WriteLine("\n Status: " + KeyAuthApp.response.message); 396 | Thread.Sleep(2500); 397 | Environment.Exit(0); 398 | } 399 | else 400 | File.WriteAllBytes(Directory.GetCurrentDirectory() + "\\test.txt", result); 401 | ``` 402 | 403 | ## Chat channels 404 | 405 | Allow users to communicate amongst themselves in your program. 406 | 407 | Example from the form example on how to fetch the chat messages. 408 | 409 | ```cs 410 | var messages = Login.KeyAuthApp.chatget("chatChannelNameHere"); 411 | if (messages == null) 412 | { 413 | dataGridView1.Rows.Insert(0, "KeyAuth", "No Chat Messages", UnixTimeToDateTime(DateTimeOffset.Now.ToUnixTimeSeconds())); 414 | } 415 | else 416 | { 417 | foreach (var message in messages) 418 | { 419 | dataGridView1.Rows.Insert(0, message.author, message.message, UnixTimeToDateTime(long.Parse(message.timestamp))); 420 | } 421 | } 422 | ``` 423 | 424 | Example from the form example on how to send chat message. 425 | 426 | ```cs 427 | if (Login.KeyAuthApp.chatsend(chatmsg.Text, chatchannel)) 428 | { 429 | dataGridView1.Rows.Insert(0, Login.KeyAuthApp.user_data.username, chatmsg.Text, UnixTimeToDateTime(DateTimeOffset.Now.ToUnixTimeSeconds())); 430 | } 431 | else 432 | chatmsg.Text = "Status: " + Login.KeyAuthApp.response.message; 433 | ``` 434 | --------------------------------------------------------------------------------