-
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
4 changed files
with
290 additions
and
286 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,63 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using TuringMachine.Core.Interfaces; | ||
using TuringMachine.Core.Logs; | ||
|
||
namespace TuringMachine.RPC.Controllers | ||
{ | ||
[ApiController, Route("configs")] | ||
public class ConfigsController : ControllerBase | ||
{ | ||
/// <summary> | ||
/// Server | ||
/// </summary> | ||
private readonly RpcServer _server; | ||
|
||
/// <summary> | ||
/// Controller | ||
/// </summary> | ||
public ConfigsController(RpcServer server) | ||
{ | ||
_server = server; | ||
} | ||
|
||
[HttpPost("add")] | ||
public ActionResult<bool> Add([FromBody]FuzzingConfigBase entry) | ||
{ | ||
_server.Server.Configurations.Add(entry.Id, new FuzzerStat<FuzzingConfigBase>(entry)); | ||
_server.Server.UpdateConfigurations(); | ||
return true; | ||
} | ||
|
||
[HttpGet("remove")] | ||
public ActionResult<bool> Remove(Guid id) | ||
{ | ||
if (_server.Server.Configurations.Remove(id)) | ||
{ | ||
_server.Server.UpdateConfigurations(); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
[HttpGet("all")] | ||
public ActionResult<IEnumerable<FuzzingConfigBase>> GetAll() | ||
{ | ||
return _server.Server.Configurations.Values.Select(u => u.Source).ToArray(); | ||
} | ||
|
||
[HttpGet("stat")] | ||
public ActionResult<FuzzerStat<FuzzingConfigBase>> GetStat(Guid id) | ||
{ | ||
return _server.Server.Configurations.Values.Where(u => u.Id == id).FirstOrDefault(); | ||
} | ||
|
||
[HttpGet("stats")] | ||
public ActionResult<IEnumerable<FuzzerStat<FuzzingConfigBase>>> GetStats() | ||
{ | ||
return _server.Server.Configurations.Values.ToArray(); | ||
} | ||
} | ||
} | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using TuringMachine.Core.Interfaces; | ||
using TuringMachine.Core.Logs; | ||
|
||
namespace TuringMachine.RPC.Controllers | ||
{ | ||
[ApiController, Route("configs")] | ||
public class ConfigsController : ControllerBase | ||
{ | ||
/// <summary> | ||
/// Server | ||
/// </summary> | ||
private readonly RpcServer _server; | ||
|
||
/// <summary> | ||
/// Controller | ||
/// </summary> | ||
public ConfigsController(RpcServer server) | ||
{ | ||
_server = server; | ||
} | ||
|
||
[HttpPost("add")] | ||
public ActionResult<bool> Add([FromBody]FuzzingConfigBase entry) | ||
{ | ||
_server.Server.Configurations.Add(entry.Id, new FuzzerStat<FuzzingConfigBase>(entry)); | ||
_server.Server.UpdateConfigurations(); | ||
return true; | ||
} | ||
|
||
[HttpGet("remove")] | ||
public ActionResult<bool> Remove(Guid id) | ||
{ | ||
if (_server.Server.Configurations.Remove(id)) | ||
{ | ||
_server.Server.UpdateConfigurations(); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
[HttpGet("all")] | ||
public ActionResult<IEnumerable<FuzzingConfigBase>> GetAll() | ||
{ | ||
return _server.Server.Configurations.Values.Select(u => u.Source).ToArray(); | ||
} | ||
|
||
[HttpGet("stat")] | ||
public ActionResult<FuzzerStat<FuzzingConfigBase>> GetStat(Guid id) | ||
{ | ||
return _server.Server.Configurations.Values.Where(u => u.Id == id).FirstOrDefault(); | ||
} | ||
|
||
[HttpGet("stats")] | ||
public ActionResult<IEnumerable<FuzzerStat<FuzzingConfigBase>>> GetStats() | ||
{ | ||
return _server.Server.Configurations.Values.ToArray(); | ||
} | ||
} | ||
} |
88 changes: 44 additions & 44 deletions
88
src/TuringMachine/RPC/Controllers/ConnectionsController.cs
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 |
---|---|---|
@@ -1,44 +1,44 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using TuringMachine.Core.Fuzzers; | ||
using TuringMachine.Core.Logs; | ||
|
||
namespace TuringMachine.RPC.Controllers | ||
{ | ||
[ApiController, Route("connections")] | ||
public class ConnectionsController : ControllerBase | ||
{ | ||
/// <summary> | ||
/// Server | ||
/// </summary> | ||
private readonly RpcServer _server; | ||
|
||
/// <summary> | ||
/// Controller | ||
/// </summary> | ||
public ConnectionsController(RpcServer server) | ||
{ | ||
_server = server; | ||
} | ||
|
||
[HttpGet("all")] | ||
public ActionResult<IEnumerable<FuzzerClientInfo>> GetAll() | ||
{ | ||
return _server.Server.Connections.Values.Select(u => u.Source).ToArray(); | ||
} | ||
|
||
[HttpGet("stat")] | ||
public ActionResult<FuzzerStat<FuzzerClientInfo>> GetStat(Guid id) | ||
{ | ||
return _server.Server.Connections.Values.Where(u => u.Id == id).FirstOrDefault(); | ||
} | ||
|
||
[HttpGet("stats")] | ||
public ActionResult<IEnumerable<FuzzerStat<FuzzerClientInfo>>> GetStats() | ||
{ | ||
return _server.Server.Connections.Values.ToArray(); | ||
} | ||
} | ||
} | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using TuringMachine.Core.Fuzzers; | ||
using TuringMachine.Core.Logs; | ||
|
||
namespace TuringMachine.RPC.Controllers | ||
{ | ||
[ApiController, Route("connections")] | ||
public class ConnectionsController : ControllerBase | ||
{ | ||
/// <summary> | ||
/// Server | ||
/// </summary> | ||
private readonly RpcServer _server; | ||
|
||
/// <summary> | ||
/// Controller | ||
/// </summary> | ||
public ConnectionsController(RpcServer server) | ||
{ | ||
_server = server; | ||
} | ||
|
||
[HttpGet("all")] | ||
public ActionResult<IEnumerable<FuzzerClientInfo>> GetAll() | ||
{ | ||
return _server.Server.Connections.Values.Select(u => u.Source).ToArray(); | ||
} | ||
|
||
[HttpGet("stat")] | ||
public ActionResult<FuzzerStat<FuzzerClientInfo>> GetStat(Guid id) | ||
{ | ||
return _server.Server.Connections.Values.Where(u => u.Id == id).FirstOrDefault(); | ||
} | ||
|
||
[HttpGet("stats")] | ||
public ActionResult<IEnumerable<FuzzerStat<FuzzerClientInfo>>> GetStats() | ||
{ | ||
return _server.Server.Connections.Values.ToArray(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,63 +1,63 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using TuringMachine.Core.Interfaces; | ||
using TuringMachine.Core.Logs; | ||
|
||
namespace TuringMachine.RPC.Controllers | ||
{ | ||
[ApiController, Route("inputs")] | ||
public class InputsController : ControllerBase | ||
{ | ||
/// <summary> | ||
/// Server | ||
/// </summary> | ||
private readonly RpcServer _server; | ||
|
||
/// <summary> | ||
/// Controller | ||
/// </summary> | ||
public InputsController(RpcServer server) | ||
{ | ||
_server = server; | ||
} | ||
|
||
[HttpPost("add")] | ||
public ActionResult<bool> Add([FromBody]FuzzingInputBase entry) | ||
{ | ||
_server.Server.Inputs.Add(entry.Id, new FuzzerStat<FuzzingInputBase>(entry)); | ||
_server.Server.UpdateInputs(); | ||
return true; | ||
} | ||
|
||
[HttpGet("remove")] | ||
public ActionResult<bool> Remove(Guid id) | ||
{ | ||
if (_server.Server.Inputs.Remove(id)) | ||
{ | ||
_server.Server.UpdateInputs(); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
[HttpGet("all")] | ||
public ActionResult<IEnumerable<FuzzingInputBase>> GetAll() | ||
{ | ||
return _server.Server.Inputs.Values.Select(u => u.Source).ToArray(); | ||
} | ||
|
||
[HttpGet("stat")] | ||
public ActionResult<FuzzerStat<FuzzingInputBase>> GetStat(Guid id) | ||
{ | ||
return _server.Server.Inputs.Values.Where(u => u.Id == id).FirstOrDefault(); | ||
} | ||
|
||
[HttpGet("stats")] | ||
public ActionResult<IEnumerable<FuzzerStat<FuzzingInputBase>>> GetStats() | ||
{ | ||
return _server.Server.Inputs.Values.ToArray(); | ||
} | ||
} | ||
} | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using TuringMachine.Core.Interfaces; | ||
using TuringMachine.Core.Logs; | ||
|
||
namespace TuringMachine.RPC.Controllers | ||
{ | ||
[ApiController, Route("inputs")] | ||
public class InputsController : ControllerBase | ||
{ | ||
/// <summary> | ||
/// Server | ||
/// </summary> | ||
private readonly RpcServer _server; | ||
|
||
/// <summary> | ||
/// Controller | ||
/// </summary> | ||
public InputsController(RpcServer server) | ||
{ | ||
_server = server; | ||
} | ||
|
||
[HttpPost("add")] | ||
public ActionResult<bool> Add([FromBody]FuzzingInputBase entry) | ||
{ | ||
_server.Server.Inputs.Add(entry.Id, new FuzzerStat<FuzzingInputBase>(entry)); | ||
_server.Server.UpdateInputs(); | ||
return true; | ||
} | ||
|
||
[HttpGet("remove")] | ||
public ActionResult<bool> Remove(Guid id) | ||
{ | ||
if (_server.Server.Inputs.Remove(id)) | ||
{ | ||
_server.Server.UpdateInputs(); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
[HttpGet("all")] | ||
public ActionResult<IEnumerable<FuzzingInputBase>> GetAll() | ||
{ | ||
return _server.Server.Inputs.Values.Select(u => u.Source).ToArray(); | ||
} | ||
|
||
[HttpGet("stat")] | ||
public ActionResult<FuzzerStat<FuzzingInputBase>> GetStat(Guid id) | ||
{ | ||
return _server.Server.Inputs.Values.Where(u => u.Id == id).FirstOrDefault(); | ||
} | ||
|
||
[HttpGet("stats")] | ||
public ActionResult<IEnumerable<FuzzerStat<FuzzingInputBase>>> GetStats() | ||
{ | ||
return _server.Server.Inputs.Values.ToArray(); | ||
} | ||
} | ||
} |
Oops, something went wrong.