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
+6
View File
@@ -8,4 +8,10 @@
</PropertyGroup>
<ItemGroup>
<None Update="listCam.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
+52 -2
View File
@@ -1,4 +1,5 @@
using System.Net;
using System.Net.NetworkInformation;
namespace ChekTimeDahua
{
@@ -8,7 +9,7 @@ namespace ChekTimeDahua
{
#if DEBUG
args = new string[4];
args[0] = "check";
args[0] = "set";
args[1] = "172.16.50.14";
args[2] = "admin";
args[3] = "4NUDZhJ7";
@@ -55,7 +56,7 @@ namespace ChekTimeDahua
string baseUrlU = $"http://{server}";
var credCacheU = new CredentialCache();
credCacheU.Add(new Uri(baseUrlU), "Digest", new NetworkCredential(login, password));
using (var handler = new HttpClientHandler
using (var handler = new HttpClientHandler
{
Credentials = credCacheU,
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
@@ -82,6 +83,55 @@ namespace ChekTimeDahua
else Console.WriteLine("1");
}
break;
case "set":
var list = new List<string>();
var lines = File.ReadAllLines("listCam.csv");
foreach (var line in lines)
{
list.Add(line);
}
foreach (var host in list)
{
using (Ping ping = new Ping())
{
PingReply pingReply = ping.Send(host);
if (pingReply.Status != IPStatus.Success)
{
Console.WriteLine($"{host}\t NO PING");
continue;
}
}
string baseUrlS = $"http://{host}";
var credCacheS = new CredentialCache();
credCacheS.Add(new Uri(baseUrlS), "Digest", new NetworkCredential(login, password));
using (var handler = new HttpClientHandler
{
Credentials = credCacheS,
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
})
using (var httpClient = new HttpClient(handler))
{
string requestUrl = $"{baseUrlS}/cgi-bin/global.cgi?action=setCurrentTime&time={DateTime.Now:yyyy-MM-dd HH:mm:ss}";
var response = await httpClient.GetAsync(requestUrl);
try
{
response.EnsureSuccessStatusCode();
}
catch (Exception)
{
Console.WriteLine($"{host}\t Rechek");
}
var r = await response.Content.ReadAsStringAsync();
//r = r.Replace("\r\n", "");
if (r.StartsWith("OK"))
{
Console.WriteLine($"{host}\t OK");
}
else Console.WriteLine($"{host}\t Rechek");
}
}
break;
default:
break;
}
+16
View File
@@ -0,0 +1,16 @@
172.16.54.28
172.16.54.29
172.16.54.30
172.16.54.31
172.16.54.32
172.16.54.33
172.16.54.34
172.16.54.35
172.16.54.36
172.16.54.37
172.16.54.38
172.16.54.39
172.16.54.40
172.16.54.41
172.16.54.42
172.16.54.43
1 172.16.54.28
2 172.16.54.29
3 172.16.54.30
4 172.16.54.31
5 172.16.54.32
6 172.16.54.33
7 172.16.54.34
8 172.16.54.35
9 172.16.54.36
10 172.16.54.37
11 172.16.54.38
12 172.16.54.39
13 172.16.54.40
14 172.16.54.41
15 172.16.54.42
16 172.16.54.43