Skip to content

Commit

Permalink
Merge pull request #72 from WSE-research/70-create-analysemavenlist-p…
Browse files Browse the repository at this point in the history
…ost-endpoint

70 create analysemavenlist post endpoint
  • Loading branch information
KnYL3R authored Nov 6, 2024
2 parents 1b9d504 + 8f62d31 commit 0d5ecbc
Show file tree
Hide file tree
Showing 33 changed files with 8,603 additions and 1,126 deletions.
810 changes: 406 additions & 404 deletions code/AmIVulnerable/AmIVulnerable/Controllers/DbController.cs

Large diffs are not rendered by default.

577 changes: 289 additions & 288 deletions code/AmIVulnerable/AmIVulnerable/Controllers/DependeciesController.cs

Large diffs are not rendered by default.

702 changes: 354 additions & 348 deletions code/AmIVulnerable/AmIVulnerable/Controllers/GitController.cs

Large diffs are not rendered by default.

590 changes: 590 additions & 0 deletions code/AmIVulnerable/AmIVulnerable/Controllers/MetricController.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
using Microsoft.AspNetCore.Mvc;
using MySql.Data.MySqlClient;
using SerilogTimings;
using System.Data;

namespace AmIVulnerable.Controllers {

[Route("api/[controller]")]
[ApiController]
public class MySqlConnectionController : ControllerBase {

private readonly IConfiguration Configuration;

public MySqlConnectionController(IConfiguration configuration) {
Configuration = configuration;
}

[HttpGet, Route("checkReachable")]
public IActionResult PingWithDb() {
using (Operation.Time("TaskDuration")) {
try {
MySqlConnection c = new MySqlConnection(Configuration["ConnectionStrings:cvedb"]);

MySqlCommand cmd = new MySqlCommand("SELECT cve_number, designation FROM cve.cve", c);

c.Open();
MySqlDataReader reader = cmd.ExecuteReader();
DataTable dataTable = new DataTable();
dataTable.Load(reader);
reader.Close();
c.Close();

return Ok();
}
catch (Exception ex) {
return BadRequest(ex.StackTrace!.ToString());
}
}
}
}
}
//using Microsoft.AspNetCore.Mvc;
//using MySql.Data.MySqlClient;
//using SerilogTimings;
//using System.Data;

//namespace AmIVulnerable.Controllers {

// //[Route("api/[controller]")]
// //[ApiController]
// public class MySqlConnectionController : ControllerBase {

// private readonly IConfiguration Configuration;

// public MySqlConnectionController(IConfiguration configuration) {
// Configuration = configuration;
// }

// //[HttpGet, Route("checkReachable")]
// public IActionResult PingWithDb() {
// using (Operation.Time("TaskDuration")) {
// try {
// MySqlConnection c = new MySqlConnection(Configuration["ConnectionStrings:cvedb"]);

// MySqlCommand cmd = new MySqlCommand("SELECT cve_number, designation FROM cve.cve", c);

// c.Open();
// MySqlDataReader reader = cmd.ExecuteReader();
// DataTable dataTable = new DataTable();
// dataTable.Load(reader);
// reader.Close();
// c.Close();

// return Ok();
// }
// catch (Exception ex) {
// return BadRequest(ex.StackTrace!.ToString());
// }
// }
// }
// }
//}
Loading

0 comments on commit 0d5ecbc

Please sign in to comment.