-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TeraIO.Network.Http; | ||
|
||
namespace CSharpOpenBMCLAPI.Modules | ||
{ | ||
public class HttpServer : HttpServerAppBase | ||
{ | ||
public HttpServer() : base() { } | ||
|
||
[HttpHandler("/measure")] | ||
public void Measure(HttpClientRequest req) | ||
{ | ||
var a = req.Request; | ||
Debugger.Break(); | ||
} | ||
|
||
public void Load() => this.LoadNew(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace CSharpOpenBMCLAPI.Modules | ||
{ | ||
public static class Utils | ||
{ | ||
public static bool CheckSign(string hash, string secret, string s, string e) | ||
{ | ||
if (string.IsNullOrEmpty(e) || string.IsNullOrEmpty(s)) | ||
{ | ||
return false; | ||
} | ||
var sha1 = SHA1.Create(); | ||
var sign = Convert.ToBase64String(sha1.ComputeHash(Encoding.UTF8.GetBytes($"{secret}{hash}{e}"))); | ||
return sign == s && DateTime.Now.Ticks < (Convert.ToInt32(e, 36) / 100); | ||
} | ||
|
||
} | ||
} |