Anydesk eingebaut

This commit is contained in:
ms
2024-11-04 11:39:14 +01:00
parent 409e0de0e0
commit 48bf324eff
5 changed files with 105 additions and 10 deletions

View File

@@ -2,6 +2,9 @@
Imports System.Management.Automation
Imports System.Management.Automation.Runspaces
Imports System.Security
Imports System.Diagnostics
Imports System.Text
Imports System.Web
Public Class cExtProgramme
@@ -20,7 +23,7 @@ Public Class cExtProgramme
ElseIf URL = "" Then
Exit Function
Else
Dim mstsc As New Process
Dim mstsc As New Process
mstsc.StartInfo.FileName = "mstsc.exe"
mstsc.StartInfo.Arguments = " /v: " & URL
mstsc.Start()
@@ -143,6 +146,83 @@ Public Class cExtProgramme
End Try
End Function
Public Shared Function RunAnyDeskWithPassword(id As String, Optional password As String = "BmWr501956@4975!") As String
Dim output As New StringBuilder()
Dim err As New StringBuilder()
Try
Dim processInfo As New ProcessStartInfo("cmd.exe")
processInfo.RedirectStandardInput = True
processInfo.RedirectStandardOutput = True
processInfo.RedirectStandardError = True
processInfo.UseShellExecute = False
processInfo.CreateNoWindow = True
Using process As Process = Process.Start(processInfo)
Dim command As String = $"echo {password} | ""{Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)}\AnyDesk\AnyDesk-ad_d4025ddb.exe"" {id} --with-password"
process.StandardInput.WriteLine(command)
process.StandardInput.Close()
' output.Append(process.StandardOutput.ReadToEnd())
'err.Append(process.StandardError.ReadToEnd())
'process.WaitForExit()
End Using
If err.Length > 0 Then
Console.WriteLine("Fehler: " & err.ToString())
End If
Return output.ToString()
Catch ex As Exception
Console.WriteLine("Fehler bei der Ausführung: " & ex.Message)
Return String.Empty
End Try
End Function
Public Shared Function PipeStringToProgram(programPath As String, input As String) As String
Dim output As New StringBuilder()
Dim err As New StringBuilder()
Try
Dim startInfo As New ProcessStartInfo()
startInfo.FileName = programPath
startInfo.UseShellExecute = False
startInfo.RedirectStandardInput = True
startInfo.RedirectStandardOutput = True
startInfo.RedirectStandardError = True
startInfo.CreateNoWindow = False
Using process As New Process()
process.StartInfo = startInfo
process.Start()
' Write the input string to the standard input of the process
Using writer As StreamWriter = process.StandardInput
writer.WriteLine(input)
End Using
' Read the output and error streams
output.Append(process.StandardOutput.ReadToEnd())
err.Append(process.StandardError.ReadToEnd())
process.WaitForExit()
End Using
If err.Length > 0 Then
Console.WriteLine("Error: " & err.ToString())
End If
Return output.ToString()
Catch ex As Exception
Console.WriteLine("Error executing program: " & ex.Message)
Return ex.Message
End Try
End Function
Public Shared Function RDPConnect(host As String, Optional ByVal Username As String = "", Optional ByVal Password As String = "", Optional ByVal Fenster As Boolean = False, Optional ByVal admin As Boolean = False)
Dim mstsc As New Process
Dim AnmeldeDatenVorhanden As Boolean = False