Added frontend and working fetching.
This commit is contained in:
parent
bab8fa6c25
commit
1c74ae9de5
@ -30,27 +30,27 @@ public class ThreadHandler
|
|||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
//Thread scanner = new(StartScanner);
|
Thread scanner = new(StartScanner);
|
||||||
Thread indexer = new(StartContentFilter);
|
Thread indexer = new(StartContentFilter);
|
||||||
Thread database = new(StartDbHandler);
|
Thread database = new(StartDbHandler);
|
||||||
Thread discarded = new(StartDiscardedDbHandler);
|
Thread discarded = new(StartDiscardedDbHandler);
|
||||||
//Thread filtered = new(StartFilteredDbHandler);
|
Thread filtered = new(StartFilteredDbHandler);
|
||||||
Thread resume = new(StartResumeDbHandler);
|
Thread resume = new(StartResumeDbHandler);
|
||||||
Thread communication = new(StartCommunicationHandler);
|
Thread communication = new(StartCommunicationHandler);
|
||||||
|
|
||||||
//scanner.Start();
|
scanner.Start();
|
||||||
indexer.Start();
|
indexer.Start();
|
||||||
database.Start();
|
database.Start();
|
||||||
discarded.Start();
|
discarded.Start();
|
||||||
//filtered.Start();
|
filtered.Start();
|
||||||
resume.Start();
|
resume.Start();
|
||||||
communication.Start();
|
communication.Start();
|
||||||
|
|
||||||
//scanner.Join();
|
scanner.Join();
|
||||||
indexer.Join();
|
indexer.Join();
|
||||||
database.Join();
|
database.Join();
|
||||||
discarded.Join();
|
discarded.Join();
|
||||||
//filtered.Join();
|
filtered.Join();
|
||||||
resume.Join();
|
resume.Join();
|
||||||
communication.Join();
|
communication.Join();
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
BIN
Models/mydb.db
BIN
Models/mydb.db
Binary file not shown.
@ -1,10 +1,11 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using MessagePack;
|
using AspNetCoreRateLimit;
|
||||||
using Microsoft.AspNetCore.Cors.Infrastructure;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Models.Model.External;
|
using Models.Model.External;
|
||||||
using NetMQ;
|
using NetMQ;
|
||||||
using NetMQ.Sockets;
|
using NetMQ.Sockets;
|
||||||
|
const string myAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||||
|
|
||||||
WebApplicationBuilder builder = WebApplication.CreateSlimBuilder(args);
|
WebApplicationBuilder builder = WebApplication.CreateSlimBuilder(args);
|
||||||
|
|
||||||
@ -15,16 +16,40 @@ builder.Services.ConfigureHttpJsonOptions(options =>
|
|||||||
|
|
||||||
builder.Services.AddCors(options =>
|
builder.Services.AddCors(options =>
|
||||||
{
|
{
|
||||||
options.AddPolicy("CorsPolicy", x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader().Build());
|
options.AddPolicy(name: myAllowSpecificOrigins, x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add memory cache and rate limiting services
|
||||||
|
builder.Services.AddMemoryCache();
|
||||||
|
builder.Services.Configure<IpRateLimitOptions>(options =>
|
||||||
|
{
|
||||||
|
options.GeneralRules =
|
||||||
|
[
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Endpoint = "*", // Apply to all endpoints
|
||||||
|
Period = "10s", // Rate limiting window of 10 second
|
||||||
|
Limit = 5 // Maximum 5 requests per 10 seconds
|
||||||
|
}
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddInMemoryRateLimiting();
|
||||||
|
builder.Services.AddSingleton<IRateLimitConfiguration, RateLimitConfiguration>();
|
||||||
|
|
||||||
WebApplication app = builder.Build();
|
WebApplication app = builder.Build();
|
||||||
|
|
||||||
app.UseCors();
|
app.UseForwardedHeaders(new()
|
||||||
|
{
|
||||||
|
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.UseIpRateLimiting(); // Apply IP-based rate limiting middleware
|
||||||
|
|
||||||
|
app.UseCors(myAllowSpecificOrigins);
|
||||||
|
|
||||||
RouteGroupBuilder progressApi = app.MapGroup("/progress");
|
RouteGroupBuilder progressApi = app.MapGroup("/progress");
|
||||||
progressApi.AllowAnonymous();
|
|
||||||
progressApi.DisableAntiforgery();
|
|
||||||
progressApi.MapGet("/", () =>
|
progressApi.MapGet("/", () =>
|
||||||
{
|
{
|
||||||
CommunicationObject communicationObject = new()
|
CommunicationObject communicationObject = new()
|
||||||
@ -43,8 +68,8 @@ progressApi.MapGet("/", () =>
|
|||||||
return JsonSerializer.Deserialize<ScanningStatus>(msg);
|
return JsonSerializer.Deserialize<ScanningStatus>(msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
RouteGroupBuilder searchApi = app.MapGroup("/search");
|
RouteGroupBuilder searchApi = app.MapGroup("/search");
|
||||||
progressApi.AllowAnonymous();
|
|
||||||
searchApi.MapGet("/{term}", (string term) =>
|
searchApi.MapGet("/{term}", (string term) =>
|
||||||
{
|
{
|
||||||
CommunicationObject communicationObject = new();
|
CommunicationObject communicationObject = new();
|
||||||
@ -61,11 +86,11 @@ searchApi.MapGet("/{term}", (string term) =>
|
|||||||
|
|
||||||
return JsonSerializer.Deserialize<SearchResults?>(msg);
|
return JsonSerializer.Deserialize<SearchResults?>(msg);
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
[JsonSerializable(typeof(ScanningStatus))]
|
[JsonSerializable(typeof(ScanningStatus))]
|
||||||
[JsonSerializable(typeof(SearchResults))]
|
//[JsonSerializable(typeof(SearchResults))]
|
||||||
[JsonSerializable(typeof(CommunicationObject))]
|
[JsonSerializable(typeof(CommunicationObject))]
|
||||||
internal partial class AppJsonSerializerContext : JsonSerializerContext
|
internal partial class AppJsonSerializerContext : JsonSerializerContext
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
|
||||||
<PackageReference Include="NetMQ" Version="4.0.1.13" />
|
<PackageReference Include="NetMQ" Version="4.0.1.13" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Warning",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3,4 +3,5 @@
|
|||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003A02000011pdb3Low_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003FILViewer_003F7c3ed02c2ce44598b7f304f8ac45e58f8600_003F6d_003F99b875d1_003F02000011pdb3Low_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003A02000011pdb3Low_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003FILViewer_003F7c3ed02c2ce44598b7f304f8ac45e58f8600_003F6d_003F99b875d1_003F02000011pdb3Low_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADirectoryInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fe4ec446cfe0489bc3ef68a45c6766d183e999ebdc657e94fb1ad059de2bb9_003FDirectoryInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADirectoryInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fe4ec446cfe0489bc3ef68a45c6766d183e999ebdc657e94fb1ad059de2bb9_003FDirectoryInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpResponseMessage_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F85e97f467d698c9e98eae9e3a1b39d58541173e57992d8f7111eabdd3db3526_003FHttpResponseMessage_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpResponseMessage_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F85e97f467d698c9e98eae9e3a1b39d58541173e57992d8f7111eabdd3db3526_003FHttpResponseMessage_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARateLimitRule_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F8fbca8b1bca27d45830c443b2c773d979015ea216430366f285514a39fc0b9_003FRateLimitRule_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThread_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F693e634d7742afaf486acd69d84fe2a9e1ee1b11ba84f29cd1d67668d20dd59_003FThread_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThread_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F693e634d7742afaf486acd69d84fe2a9e1ee1b11ba84f29cd1d67668d20dd59_003FThread_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
@ -1,8 +1,9 @@
|
|||||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
compatibilityDate: '2024-11-01',
|
compatibilityDate: '2024-11-01',
|
||||||
devtools: { enabled: true },
|
ssr: true,
|
||||||
css: ['~/assets/css/main.css'],
|
devtools: { enabled: false },
|
||||||
|
css: ['@/assets/css/main.css'],
|
||||||
|
|
||||||
postcss: {
|
postcss: {
|
||||||
plugins: {
|
plugins: {
|
||||||
|
@ -5,44 +5,44 @@ const progress = getProgress();
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="m-auto">
|
<div class="h-screen grid place-items-center">
|
||||||
<div v-if="progress">
|
<div v-if="progress">
|
||||||
<table class="table-auto text-left">
|
<table class="table-auto border-gray-300">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Metric</th>
|
<th class="px-4 py-2">Metric</th>
|
||||||
<th>Value</th>
|
<th class="px-4 py-2">Value</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody >
|
<tbody >
|
||||||
<tr>
|
<tr>
|
||||||
<td>Percentage of Ipv4 scanned</td>
|
<td class="px-4 py-2">Percentage of Ipv4 scanned</td>
|
||||||
<td>{{progress.percentageOfIpv4Scanned}}</td>
|
<td class="px-4 py-2">{{progress.percentageOfIpv4Scanned}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Total filtered</td>
|
<td class="px-4 py-2">Total filtered</td>
|
||||||
<td>{{progress.totalFiltered}}</td>
|
<td class="px-4 py-2">{{progress.totalFiltered}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Total Discarded</td>
|
<td class="px-4 py-2">Total Discarded</td>
|
||||||
<td>{{progress.totalDiscarded}}</td>
|
<td class="px-4 py-2">{{progress.totalDiscarded}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Amount of Ipv4 left</td>
|
<td class="px-4 py-2">Amount of Ipv4 left</td>
|
||||||
<td>{{progress.amountOfIpv4Left}}</td>
|
<td class="px-4 py-2">{{progress.amountOfIpv4Left}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Discarded db size</td>
|
<td class="px-4 py-2">Discarded db size</td>
|
||||||
<td>{{progress.discardedDbSize}}</td>
|
<td class="px-4 py-2">{{progress.discardedDbSize}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Filtered db size</td>
|
<td class="px-4 py-2">Filtered db size</td>
|
||||||
<td>{{progress.filteredDbSize}}</td>
|
<td class="px-4 py-2">{{progress.filteredDbSize}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Unfiltered db size</td>
|
<td class="px-4 py-2">Unfiltered db size</td>
|
||||||
<td>{{progress.myDbSize}}</td>
|
<td class="px-4 py-2">{{progress.myDbSize}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -2,7 +2,10 @@ export default function getProgress(){
|
|||||||
|
|
||||||
const progress = ref(null as Progress | null);
|
const progress = ref(null as Progress | null);
|
||||||
|
|
||||||
fetch('http://localhost:5224/progress')
|
fetch('https://proxy.rbwr.dk/progress', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {'Content-Type': 'application/json'}
|
||||||
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then((data: Progress) => {
|
.then((data: Progress) => {
|
||||||
if (data && data.percentageOfIpv4Scanned) {
|
if (data && data.percentageOfIpv4Scanned) {
|
||||||
|
Loading…
Reference in New Issue
Block a user