Skip to content

Commit

Permalink
Review fullfill
Browse files Browse the repository at this point in the history
  • Loading branch information
Kretchen001 committed Mar 24, 2024
1 parent dd4f0a9 commit 616304e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 371 deletions.
6 changes: 0 additions & 6 deletions code/AmIVulnerable/AmIVulnerable.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AmIVulnerable", "AmIVulnera
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{62D82FEA-37BC-41E2-A628-27C3B32E34AC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiteDbLib", "LiteDbLib\LiteDbLib.csproj", "{A58AA5A3-E651-422C-AE34-A857DBD283AF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Modells", "Modells\Modells.csproj", "{03B60F6F-8975-4531-8B21-F2EAEE0B5B17}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AmIVulnerable.Test", "AmIVulnerable.Test\AmIVulnerable.Test.csproj", "{D298A9EB-0556-4734-A5B8-52D58D4A994A}"
Expand All @@ -32,10 +30,6 @@ Global
{62D82FEA-37BC-41E2-A628-27C3B32E34AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62D82FEA-37BC-41E2-A628-27C3B32E34AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62D82FEA-37BC-41E2-A628-27C3B32E34AC}.Release|Any CPU.Build.0 = Release|Any CPU
{A58AA5A3-E651-422C-AE34-A857DBD283AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A58AA5A3-E651-422C-AE34-A857DBD283AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A58AA5A3-E651-422C-AE34-A857DBD283AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A58AA5A3-E651-422C-AE34-A857DBD283AF}.Release|Any CPU.Build.0 = Release|Any CPU
{03B60F6F-8975-4531-8B21-F2EAEE0B5B17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03B60F6F-8975-4531-8B21-F2EAEE0B5B17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03B60F6F-8975-4531-8B21-F2EAEE0B5B17}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
44 changes: 7 additions & 37 deletions code/AmIVulnerable/AmIVulnerable/Controllers/DbController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@

namespace AmIVulnerable.Controllers {

/// <summary></summary>
/// <summary>Interact direct with the database, like create the cve-table or request packages.</summary>
[Route("api/[controller]")]
[ApiController]
public class DbController : ControllerBase {

/// <summary></summary>
#region Config
private readonly IConfiguration Configuration;

/// <summary></summary>
/// <param name="configuration"></param>
public DbController(IConfiguration configuration) {
Configuration = configuration;
}
#endregion

#region Controller
/// <summary>Get-route checking if raw cve data is in directory.</summary>
Expand All @@ -39,38 +38,8 @@ public IActionResult IsRawDataThere() {
}
}

#region oldcode
///// <summary>Get-route converting raw cve data to db data.</summary>
///// <returns>OK if successful</returns>
//[HttpGet]
//[Route("ConvertRawDirToDb")]
//public IActionResult ConvertRawFile() {
// List<string> fileList = new List<string>();
// List<int> indexToDelete = new List<int>();
// string path = $"{AppDomain.CurrentDomain.BaseDirectory}raw";
// ExploreFolder(path, fileList);

// //filter for json files
// foreach (int i in Enumerable.Range(0, fileList.Count)) {
// if (!Regex.IsMatch(fileList[i], @"CVE-[-\S]+.json")) {
// indexToDelete.Add(i);
// }
// }
// foreach (int i in Enumerable.Range(0, indexToDelete.Count)) {
// fileList.RemoveAt(indexToDelete[i] - i);
// }
// ConvertCveToDbController ccdbc = new ConvertCveToDbController(fileList);

// using (Operation.Time($"Konvertieren der Datenbank")) {
// ccdbc.ConvertRawCve();
// }

// return Ok();
//}
#endregion

/// <summary></summary>
/// <returns></returns>
/// <summary>By call the raw cve.json's will be inserted in the MySql-Database.</summary>
/// <returns>The status, if the database is finished created.</returns>
[HttpGet]
[Route("ConvertRawCveToDb")]
public IActionResult ConvertRawFilesToMySql() {
Expand All @@ -94,14 +63,15 @@ public IActionResult ConvertRawFilesToMySql() {
// MySql Connection
MySqlConnection connection = new MySqlConnection(Configuration["ConnectionStrings:cvedb"]);

connection.Open();
// Create the Table cve.cve if it is not already there.
MySqlCommand cmdTable = new MySqlCommand("" +
"CREATE TABLE IF NOT EXISTS cve.cve(" +
"cve_number VARCHAR(20) PRIMARY KEY NOT NULL," +
"designation VARCHAR(500) NOT NULL," +
"version_affected TEXT NOT NULL," +
"full_text MEDIUMTEXT NOT NULL" +
")", connection);
connection.Open();
cmdTable.ExecuteNonQuery();
connection.Close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ namespace AmIVulnerable.Controllers {
[ApiController]
public class DependeciesController : ControllerBase {

/// <summary></summary>
#region Config
private readonly IConfiguration Configuration;

/// <summary></summary>
/// <param name="configuration"></param>
public DependeciesController(IConfiguration configuration) {
Configuration = configuration;
}
#endregion

/// <summary>
/// Extract dependecies of different project types as json
Expand Down

This file was deleted.

Loading

0 comments on commit 616304e

Please sign in to comment.