Faste
✅ C# Get value for rule.LocalPorts (Nuget WindowsFirewallHelper)
i can add ports in program like this rule.LocalPorts = new ushort[] { 3389 };
But can You help me how to get value from textBox.text? I want add few ports for example 80, 443
...
Im new in C# i should not make network apps, but only this interesting me so i try.
Btw if some1 have link to big pproject maked with this nuget or better documentation than i find on official nuget website let me know.
4 replies
✅ Why this insta close program
So when i add if (nrM <= 0) with back(); my program close instantly after start.
Let me know why first in order console.readline() not work even if later in program is hidden problem, till i not type value should work.
And other question can i use back(); like i want here to start from begining its my favourite method so if possible i want this way
Sorry i ask simple question like this i know i can easy find how to fix but i want understand why this not work
static void Main(string[] args)
{
void back()
{
short maxValue = short.MaxValue;
Console.WriteLine("Type nr from 1 to " + maxValue);
short nrM = short.Parse(Console.ReadLine());
if (nrM > maxValue)
{
Console.WriteLine("You type too big nr we set it to max possible value: " + maxValue);
nrM = maxValue;
}if (nrM <= 0)
{
Console.WriteLine("You type nr smaller than 1, Choose again.");
back();
}
for (short i = nrM; i > 0; i--)
{
Console.WriteLine(i);
}
Console.ReadLine();
}
}
6 replies
❔ Sharppcap packet manipulation noob question
So yesterday i first time instal C# and i tryied with chatGPT make program to trace routing but i not find packet analyzer with option to block or do something. Today i find nuget Sharppcap i instal npcap too, and in sharppcap i find info he can manipulate packets. I want just outgoing packet to some host> send to loopback. And question this is legal cos gpt say can be not? And second question can i send to loopback incoming packet too or loopback only for outgoing one. Sorry for my english
and btw can i do this manipulation? or sharppcap cant do this? i want know before i waste too much time learning
2 replies