upd
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s

This commit is contained in:
2026-05-26 14:02:32 +03:00
parent bf51924adb
commit eb6235bd3e
41 changed files with 1509 additions and 61 deletions
+40
View File
@@ -0,0 +1,40 @@
namespace snmp_dahua
{
using System.Net;
using System.Net.NetworkInformation;
internal class Program
{
static async Task Main(string[] args)
{
#if DEBUG
args = new string[2];
args[0] = "172.16.50.14";
#endif
string baseUrlS = $"http://{args[0]}";
var credCacheS = new CredentialCache();
credCacheS.Add(new Uri(baseUrlS), "Digest", new NetworkCredential("admin", "4NUDZhJ7"));
using (var handler = new HttpClientHandler
{
Credentials = credCacheS,
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
})
using (var httpClient = new HttpClient(handler))
{
string requestUrl = $"{baseUrlS}/cgi-bin/configManager.cgi?action=setConfig&SNMP.Enable=false";
var response = await httpClient.GetAsync(requestUrl);
response.EnsureSuccessStatusCode();
var r = response.ReasonPhrase;// .Content.ReadAsStringAsync();
if (r.StartsWith("OK"))
{
string requestUrl2 = $"{baseUrlS}/cgi-bin/configManager.cgi?action=setConfig&SNMP.Enable=true";
var response2 = await httpClient.GetAsync(requestUrl2);
var r2 = response2.ReasonPhrase;//.Content.ReadAsStringAsync();
if (r2.StartsWith("OK")) Console.WriteLine("0");
else Console.WriteLine("1");
}
else Console.WriteLine("1");
}
}
}
}
+10
View File
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>