from flask import Flask, request
import subprocess
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
try:
subprocess.run(['/usr/bin/python3.9', '/usr/local/bin/sentPhoto.py'], check=True)
return 'Success', 200
except subprocess.CalledProcessError as e:
print(f'Ошибка при запуске скрипта: {e}')
return 'Error', 500
if __name__ == '__main__':
app.run(host='192.168.20.141', port=5000)
Картинка в виде файла отправляющему скрипту есть? Вот и надо отправить её методом sendPhoto
varByteArray = web.ResponseBody
Set web = Nothing
'Now save the file with any available method
On Error Resume Next
Set ado = Nothing
Set ado = CreateObject("ADODB.Stream")
If ado Is Nothing Then
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(baseName(strUrl), ForWriting, True)
strData = ""
strBuffer = ""
For lngCounter = 0 to UBound(varByteArray)
ts.Write Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1, 1)))
Next
ts.Close
Else
ado.Type = adTypeBinary
ado.Open
ado.Write varByteArray
ado.SaveToFile CreateObject("WScript.Shell").ExpandEnvironmentStrings("%TEMP%") & "\" & strSetup, adSaveCreateOverWrite
ado.Close
End If
SaveWebBinary = True
End Function
Function ShowMessage(strMessage)
If LCase(Verbose) <> "no" Then
WScript.Echo strMessage
End If
End Function
'
'
' MAIN
'
'
Dim nMinutesToAdvance, strCmd, strSystemArchitecture, strTempDir, WshShell, objFSO
Set WshShell = WScript.CreateObject("WScript.shell")
nMinutesToAdvance = 5
' Get system architecture
strSystemArchitecture = GetSystemArchitecture()
If (strSystemArchitecture <> "x86") And (strSystemArchitecture <> "x64") Then
ShowMessage("The system architecture is unknown or not supported.")
ShowMessage("Deployment aborted!")
WScript.Quit 1
Else
ShowMessage("System architecture detected: " & strSystemArchitecture)
End If
' Check and auto detect SetupArchitecture
Select Case LCase(SetupArchitecture)
Case "x86"
' The setup architecture is 32-bit
SetupArchitecture = "x86"
Setup = Replace(Setup, "x86", SetupArchitecture, 1, 1, vbTextCompare)
ShowMessage("Setup architecture: " & SetupArchitecture)
Case "x64"
' The setup architecture is 64-bit
SetupArchitecture = "x64"
Setup = Replace(Setup, "x64", SetupArchitecture, 1, 1, vbTextCompare)
ShowMessage("Setup architecture: " & SetupArchitecture)
Case "auto"
' Auto detection of SetupArchitecture
SetupArchitecture = strSystemArchitecture
Setup = Replace(Setup, "Auto", SetupArchitecture, 1, 1, vbTextCompare)
ShowMessage("Setup architecture detected: " & SetupArchitecture)
Case Else
' The setup architecture is not supported
ShowMessage("The setup architecture '" & SetupArchitecture & "' is not supported.")
WScript.Quit 2
End Select
' Check the relation between strSystemArchitecture and SetupArchitecture
If (strSystemArchitecture = "x86") And (SetupArchitecture = "x64") Then
' It isn't possible to execute a 64-bit setup on a 32-bit operative system
ShowMessage("It isn't possible to execute a 64-bit setup on a 32-bit operative system.")
ShowMessage("Deployment aborted!")
WScript.Quit 3
End If
If IsSelectedForce() Or IsInstallationNeeded(SetupVersion, SetupArchitecture, strSystemArchitecture) Then
If isHttp(SetupLocation) Then
ShowMessage("Downloading: " & SetupLocation & "/" & Setup)
If SaveWebBinary(SetupLocation, Setup) Then
strCmd = WshShell.ExpandEnvironmentStrings("%ComSpec%")
strTempDir = WshShell.ExpandEnvironmentStrings("%TEMP%")
ShowMessage("Running: """ & strTempDir & "\" & Setup & """ " & SetupOptions)
WshShell.Run """" & strTempDir & "\" & Setup & """ " & SetupOptions, 0, True
ShowMessage("Scheduling: DEL /Q /F """ & strTempDir & "\" & Setup & """")
WshShell.Run "AT.EXE " & AdvanceTime(nMinutesToAdvance) & " " & strCmd & " /C ""DEL /Q /F """"" & strTempDir & "\" & Setup & """""", 0, True
ShowMessage("Deployment done!")
Else
ShowMessage("Error downloading '" & SetupLocation & "\" & Setup & "'!")
End If
Else
Set objFSO = CreateObject("Scripting.FileSystemObject")
strTempDir = WshShell.ExpandEnvironmentStrings("%TEMP%")
ShowMessage("Copying: " & SetupLocation & "\" & Setup & " to " & strTempDir & "\" & Setup)
objFSO.CopyFile SetupLocation & "\" & Setup, strTempDir & "\" & Setup, true
ShowMessage("Running: """ & strTempDir & "\" & Setup & """ " & SetupOptions)
WshShell.Run "CMD.EXE /C """ & strTempDir & "\" & Setup & """ " & SetupOptions, 0, True
ShowMessage("Deployment done!")
End If
Else
ShowMessage("It isn't needed the installation of '" & Setup & "'.")
End If
WScript.Quit 0
Get-ADUser test -Properties * | select name, pass*