Skip to content

"An old Powershell script I wrote, which allowed members of a group to pull a screenshot of a shift planner that was located locally on a 3rd party computer via a Telegram bot when they sent their stored password to the bot.

Notifications You must be signed in to change notification settings

CheswickDEV/PS-Telegram-Request-Screenshot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Έ PS-Telegram-Request-Screenshot

A PowerShell script that let group members request screenshots of a shift planner via a Telegram bot β€” authenticated with stored passwords.

GitHub Stars Last Commit Version Status License PowerShell


⚠️ This is an archived project. It was built for a specific use case at a previous job and is no longer actively maintained. The code is preserved here as a reference and portfolio piece.


πŸ’‘ What It Did

The shift planner at work was a desktop application with no API and no remote access. Team members who needed to check their shifts while away from the office had no way to see the schedule.

This script solved that by running on the machine where the shift planner was installed. It:

  1. Listened for incoming Telegram messages via the Bot API (polling loop)
  2. Authenticated the user by checking their stored password
  3. Brought the shift planner window to the foreground using Win32 API calls (ShowWindowAsync)
  4. Captured a screenshot of a defined screen region using System.Drawing
  5. Sent the screenshot back to the user via the Telegram Bot API

The entire flow happened within ~60 seconds of the initial request.


πŸ”„ How It Worked

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Team Member β”‚     β”‚  PowerShell Script    β”‚     β”‚  Shift Planner   β”‚
β”‚  on Telegram │────▢│  (running on PC)      │────▢│  (local app)     β”‚
β”‚              β”‚     β”‚                       β”‚     β”‚                  β”‚
β”‚  "Beispiel1" β”‚     β”‚  1. Match username    β”‚     β”‚  Window brought  β”‚
β”‚              │◀────│  2. Ask for password  │◀────│  to foreground   β”‚
β”‚  "mypass123" │────▢│  3. Verify password   β”‚     β”‚                  β”‚
β”‚              β”‚     β”‚  4. Screenshot region  β”‚     β”‚  Screenshot      β”‚
β”‚  πŸ“· Image   │◀────│  5. Send via Bot API  β”‚     β”‚  captured        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

PowerShell

PS-Telegram-Request-Screenshot/
β”œβ”€β”€ screenshot-bot.ps1    # Main script (polling loop, auth, capture, send)
└── README.md
  • PowerShell 5.1 with System.Drawing for screen capture
  • Win32 API (user32.dll) for window management
  • Telegram Bot API for messaging and photo delivery
  • curl for multipart file uploads to Telegram

⚠️ Notes

  • The script used hardcoded passwords per user β€” this was an internal tool on a trusted network, not a production security model
  • Screen coordinates for the capture region were hardcoded to match the specific shift planner window layout
  • The polling loop ran indefinitely with 120-second sleep intervals between checks

πŸ“ Changelog

v1.0

  • πŸš€ Initial release
  • ✨ Telegram Bot API polling loop
  • ✨ Password-based user authentication
  • ✨ Win32 window management and screen capture
  • ✨ Automatic screenshot delivery via Telegram

πŸ“„ License

Unlicensed β€” provided as-is for reference.


cheswick.dev

Made with πŸ–€ by cheswick.dev

About

"An old Powershell script I wrote, which allowed members of a group to pull a screenshot of a shift planner that was located locally on a 3rd party computer via a Telegram bot when they sent their stored password to the bot.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published