Compare commits
No commits in common. "03e7ebe421a0f8f9a52ad8b31272a0175cf9b855" and "8256d6a681bbe3400a69471b822bfd5bc3186c91" have entirely different histories.
03e7ebe421
...
8256d6a681
@ -32,7 +32,7 @@ public class IpScanner
|
|||||||
_discardedQueue = discardedQueue;
|
_discardedQueue = discardedQueue;
|
||||||
_unfilteredQueue = unfilteredQueue;
|
_unfilteredQueue = unfilteredQueue;
|
||||||
_resumeQueue = resumeQueue;
|
_resumeQueue = resumeQueue;
|
||||||
|
|
||||||
SetTimeout(64);
|
SetTimeout(64);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,12 +48,24 @@ public class IpScanner
|
|||||||
{
|
{
|
||||||
threadsAmount = 256 / threads;
|
threadsAmount = 256 / threads;
|
||||||
}
|
}
|
||||||
|
|
||||||
WaitHandle[] waitHandle = new WaitHandle[64];
|
WaitHandle[] waitHandle1;
|
||||||
|
WaitHandle[] waitHandle2;
|
||||||
|
|
||||||
|
// This is jank. But it was to get it production ready.
|
||||||
|
if (threads <= 64)
|
||||||
|
{
|
||||||
|
waitHandle1 = new WaitHandle[threads];
|
||||||
|
waitHandle2 = new WaitHandle[threads];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
waitHandle1 = new WaitHandle[64];
|
||||||
|
waitHandle2 = new WaitHandle[64];
|
||||||
|
}
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
int counter2 = 0;
|
||||||
List<WaitHandle[]> waitHandles = [];
|
|
||||||
|
|
||||||
for (int i = 0; i < threads; i++)
|
for (int i = 0; i < threads; i++)
|
||||||
{
|
{
|
||||||
@ -67,27 +79,32 @@ public class IpScanner
|
|||||||
Handle = handle
|
Handle = handle
|
||||||
};
|
};
|
||||||
|
|
||||||
if (counter < 64)
|
if (i < 64)
|
||||||
{
|
{
|
||||||
waitHandle[counter] = handle;
|
waitHandle1[counter] = handle;
|
||||||
counter++;
|
counter++;
|
||||||
|
}
|
||||||
Thread f = new (Scan!);
|
else
|
||||||
f.Start(scanSettings);
|
{
|
||||||
|
waitHandle2[counter2] = handle;
|
||||||
Console.WriteLine($"Scanner thread ({i}) started");
|
counter2++;
|
||||||
Thread.Sleep(100);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
counter = 0;
|
Thread f = new (Scan!);
|
||||||
|
f.Start(scanSettings);
|
||||||
|
|
||||||
waitHandles.Add(waitHandle);
|
Console.WriteLine($"Scanner thread ({i}) started");
|
||||||
|
Thread.Sleep(100);
|
||||||
waitHandle = new WaitHandle[64];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<WaitHandle[]> waitHandles = new();
|
||||||
|
|
||||||
|
Console.WriteLine("Waithandle 1 count = " + waitHandle1.Length);
|
||||||
|
Console.WriteLine("Waithandle 2 count = " + waitHandle2.Length);
|
||||||
|
|
||||||
|
waitHandles.Add(waitHandle1);
|
||||||
|
waitHandles.Add(waitHandle2);
|
||||||
|
|
||||||
return waitHandles;
|
return waitHandles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,8 +183,7 @@ public class IpScanner
|
|||||||
_ = IPAddress.TryParse(ip.ToString(), out IPAddress? address);
|
_ = IPAddress.TryParse(ip.ToString(), out IPAddress? address);
|
||||||
if (address is not null)
|
if (address is not null)
|
||||||
{
|
{
|
||||||
responseCode = IPStatus.TimedOut; //ping.Send(address, _timeout, buf, null).Status;
|
responseCode = ping.Send(address, _timeout, buf, null).Status;
|
||||||
Thread.Sleep(_timeout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -59,7 +59,7 @@ public class ThreadHandler
|
|||||||
{
|
{
|
||||||
Thread.Sleep(5000); // Let the database handler instantiate and warm up first.
|
Thread.Sleep(5000); // Let the database handler instantiate and warm up first.
|
||||||
|
|
||||||
List<WaitHandle[]> wait = _ipScanner.Start(256);
|
List<WaitHandle[]> wait = _ipScanner.Start(128);
|
||||||
|
|
||||||
for (int i = 0; i < wait.Count; i++)
|
for (int i = 0; i < wait.Count; i++)
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ public class ThreadHandler
|
|||||||
|
|
||||||
private void StartDiscardedDbHandler()
|
private void StartDiscardedDbHandler()
|
||||||
{
|
{
|
||||||
WaitHandle[] wait = _dbHandler.Start(5);
|
WaitHandle[] wait = _dbHandler.Start(4);
|
||||||
|
|
||||||
WaitHandle.WaitAll(wait);
|
WaitHandle.WaitAll(wait);
|
||||||
|
|
||||||
|
@ -18,25 +18,11 @@ public static partial class HttpClientHelper
|
|||||||
|
|
||||||
if (port == 80)
|
if (port == 80)
|
||||||
{
|
{
|
||||||
try
|
client.BaseAddress = new($"http://{url}");
|
||||||
{
|
|
||||||
client.BaseAddress = new($"http://{url}");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
client.BaseAddress = new($"https://{url}");
|
||||||
{
|
|
||||||
client.BaseAddress = new($"https://{url}");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client.DefaultRequestHeaders.Accept.Clear();
|
client.DefaultRequestHeaders.Accept.Clear();
|
||||||
@ -101,25 +87,11 @@ public static partial class HttpClientHelper
|
|||||||
|
|
||||||
if (port == 80)
|
if (port == 80)
|
||||||
{
|
{
|
||||||
try
|
client.BaseAddress = new($"http://{url}");
|
||||||
{
|
|
||||||
client.BaseAddress = new($"http://{url}");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
client.BaseAddress = new($"https://{url}");
|
||||||
{
|
|
||||||
client.BaseAddress = new($"https://{url}");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client.DefaultRequestHeaders.Accept.Clear();
|
client.DefaultRequestHeaders.Accept.Clear();
|
||||||
|
@ -60,7 +60,7 @@ progressApi.MapGet("/", (IMemoryCache memoryCache) =>
|
|||||||
return scanningStatus;
|
return scanningStatus;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
RouteGroupBuilder searchApi = app.MapGroup("/search");
|
RouteGroupBuilder searchApi = app.MapGroup("/search");
|
||||||
searchApi.MapGet("/{term}", (string term) =>
|
searchApi.MapGet("/{term}", (string term) =>
|
||||||
{
|
{
|
||||||
@ -78,7 +78,7 @@ 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))]
|
||||||
|
@ -9,12 +9,8 @@ useHead({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="navbar navbar-expand-md navbar-dark bg-dark">
|
<NuxtLayout>
|
||||||
<ul>
|
<NuxtPage page-key="static" />
|
||||||
<li><nuxt-link to="/">Search</nuxt-link></li>
|
</NuxtLayout>
|
||||||
<li><nuxt-link to="/progress">Progress</nuxt-link></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<NuxtPage page-key="static" />
|
|
||||||
</template>
|
</template>
|
@ -13,9 +13,5 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
nitro: {
|
|
||||||
static: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
modules: ['@nuxtjs/tailwindcss', 'nuxt-purgecss'],
|
modules: ['@nuxtjs/tailwindcss', 'nuxt-purgecss'],
|
||||||
});
|
});
|
@ -1,15 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const value = ref<string | null>(null)
|
const route = useRoute()
|
||||||
|
|
||||||
// https://nuxt.com/docs/api/components/nuxt-link#nuxtlink
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="h-screen flex items-center justify-center">
|
<div class="h-screen flex items-center justify-center">
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<input v-model="value" placeholder=".NET C#" class="text-center bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg p-2.5 w-192"/>
|
<input placeholder=".NET C#" class="text-center bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg p-2.5 w-192"/>
|
||||||
<nuxt-link :to="`/searchResult?search=${value}`" class="text-gray-900 bg-gray-50 border border-gray-300 px-4 py-2 rounded-lg">Search</nuxt-link>
|
<button class="text-gray-900 bg-gray-50 border border-gray-300 px-4 py-2 rounded-lg">Search</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -39,51 +39,23 @@ fetchMyData();
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="h-screen grid place-items-center">
|
<div class="h-screen grid place-items-center">
|
||||||
<table class="table-auto border-gray-300">
|
<div v-if="dict">
|
||||||
<thead>
|
<table class="table-auto border-gray-300">
|
||||||
<tr>
|
<thead>
|
||||||
<th class="px-4 py-2">Metric</th>
|
<tr>
|
||||||
<th class="px-4 py-2">Value</th>
|
<th class="px-4 py-2">Metric</th>
|
||||||
</tr>
|
<th class="px-4 py-2">Value</th>
|
||||||
</thead>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<tbody v-if="dict">
|
<tbody>
|
||||||
<tr v-for="d in dict">
|
<tr v-for="d in dict">
|
||||||
<td class="px-4 py-2">{{d.description}}</td>
|
<td class="px-4 py-2">{{d.description}}</td>
|
||||||
<td class="px-4 py-2">{{d.value}}</td>
|
<td class="px-4 py-2">{{d.value}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tbody v-else>
|
</table>
|
||||||
<tr>
|
</div>
|
||||||
<td class="px-4 py-2">Percentage of Ipv4 scanned</td>
|
|
||||||
<td class="px-4 py-2"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="px-4 py-2">Total filtered</td>
|
|
||||||
<td class="px-4 py-2"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="px-4 py-2">Total Discarded</td>
|
|
||||||
<td class="px-4 py-2"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="px-4 py-2">Amount of Ipv4 left</td>
|
|
||||||
<td class="px-4 py-2"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="px-4 py-2">Discarded db size</td>
|
|
||||||
<td class="px-4 py-2"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="px-4 py-2">Filtered db size</td>
|
|
||||||
<td class="px-4 py-2"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="px-4 py-2">Unfiltered db size</td>
|
|
||||||
<td class="px-4 py-2"></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
const route = useRoute();
|
|
||||||
console.log(route.query);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
|
|
||||||
</template>
|
|
14
frontend/types/global.d.ts
vendored
14
frontend/types/global.d.ts
vendored
@ -6,22 +6,12 @@ interface ProgressType {
|
|||||||
discardedDbSize: bigint;
|
discardedDbSize: bigint;
|
||||||
filteredDbSize: bigint;
|
filteredDbSize: bigint;
|
||||||
myDbSize: bigint;
|
myDbSize: bigint;
|
||||||
};
|
}
|
||||||
|
|
||||||
interface ProgressDictionary {
|
interface ProgressDictionary {
|
||||||
description: string;
|
description: string;
|
||||||
value: string;
|
value: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
interface SearchResult {
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
url: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
interface SearchResults {
|
|
||||||
results: SearchResult[];
|
|
||||||
};
|
|
||||||
|
|
||||||
type CacheEntry<T> = {
|
type CacheEntry<T> = {
|
||||||
data: T;
|
data: T;
|
||||||
|
Loading…
Reference in New Issue
Block a user