{"id":38862092,"url":"https://github.com/alexwbaule/telegramopenwrt","last_synced_at":"2026-01-17T14:22:50.070Z","repository":{"id":41190247,"uuid":"75874194","full_name":"alexwbaule/telegramopenwrt","owner":"alexwbaule","description":"Telegram Scripts for OpenWrt/Lede Project","archived":false,"fork":false,"pushed_at":"2025-06-02T01:04:22.000Z","size":130,"stargazers_count":128,"open_issues_count":2,"forks_count":44,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-06-02T11:19:49.096Z","etag":null,"topics":["bot-key","lede-project","openwrt","telegram","telegram-scripts"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexwbaule.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-12-07T20:45:26.000Z","updated_at":"2025-06-02T01:04:26.000Z","dependencies_parsed_at":"2025-06-02T02:25:32.189Z","dependency_job_id":"be720c82-98e2-40ec-a175-b6fcc9f70967","html_url":"https://github.com/alexwbaule/telegramopenwrt","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/alexwbaule/telegramopenwrt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwbaule%2Ftelegramopenwrt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwbaule%2Ftelegramopenwrt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwbaule%2Ftelegramopenwrt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwbaule%2Ftelegramopenwrt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexwbaule","download_url":"https://codeload.github.com/alexwbaule/telegramopenwrt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwbaule%2Ftelegramopenwrt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28509945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot-key","lede-project","openwrt","telegram","telegram-scripts"],"created_at":"2026-01-17T14:22:44.236Z","updated_at":"2026-01-17T14:22:50.055Z","avatar_url":"https://github.com/alexwbaule.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegram Scripts for OpenWrt\n\nThis is a set of scripts with a plugins API written in bash, you can use it to manage and get informations on OpenWRT Routers.\n\n### How its works ?\n\nFirst of all, \nMake a bot for you !\nhttps://core.telegram.org/bots/api#authorizing-your-bot\n\nWith the bot created, you need to replace \"[PUT YOUR BOT KEY HERE]\" in the telegramopenwrt config file with your bot key.\n\nSecond, you need to send a initial message to your bot in Telegram App.\nAfter you send the message, in the OpenWRT run this:\n\n``` curl -s -k -X GET https://api.telegram.org/bot\u003cYOUR BOT ID\u003e/getUpdates | grep -oE \"\\\"id\\\":[[:digit:]]+\" | head -n1 | awk -F : '{print $2}'```\n\nGet the number and replace \"[PUT ID OF THE CHAT THAT YOU START WITH BOT]\" in the telegramopenwrt config.\n\n### Directory structure\n\n```\n├── etc\n│   ├── config\n│   │   └── telegramopenwrt\n│   ├── init.d\n│   │   ├── hosts_scan\n│   │   ├── lanports\n│   │   └── telegram_bot\n│   └── telegramopenwrt\n│       └── macaddr.ignore\n├── sbin\n│   ├── camkeyboard\n│   ├── hosts_scan\n│   ├── lanports\n│   ├── proxy\n│   ├── telebot\n│   ├── telegram_bot\n│   ├── telegram_sender\n│   ├── telekeyboard\n│   └── typing\n└── usr\n    └── lib\n        └── telegramopenwrt\n            └── plugins\n                ├── actions\n                │   ├── cam_mv\n                │   ├── chromego\n                │   ├── fw_delete\n                │   ├── fw_disable\n                │   ├── fw_enable\n                │   ├── fwr_disable\n                │   ├── fwr_enable\n                │   ├── interface_down\n                │   ├── interface_restart\n                │   ├── interface_up\n                │   ├── light_control\n                │   ├── proc_restart\n                │   ├── proc_start\n                │   ├── proc_stop\n                │   ├── proxy_disable\n                │   ├── proxy_enable\n                │   ├── wifi_disable\n                │   ├── wifi_enable\n                │   └── wifi_restart\n                ├── cam_movie\n                ├── cam_mv\n                ├── cam_shot\n                ├── cam_vdo\n                ├── chromego_add\n                ├── chromego_del\n                ├── chromego_list\n                ├── ctx\n                │   ├── cam_kbd\n                │   ├── chromego\n                │   ├── fw_list\n                │   ├── fwr_list\n                │   ├── interfaces_list\n                │   ├── light_list\n                │   ├── proxy\n                │   ├── reboot\n                │   ├── service_list\n                │   └── wifi_list\n                ├── fw_add\n                ├── fw_delete\n                ├── fw_disable\n                ├── fw_enable\n                ├── fw_list\n                ├── fwr_disable\n                ├── fwr_enable\n                ├── fwr_list\n                ├── fw_unblock\n                ├── get_ip\n                ├── get_mac\n                ├── get_ping\n                ├── get_uptime\n                ├── help\n                │   ├── cam_movie\n                │   ├── cam_mv\n                │   ├── cam_shot\n                │   ├── cam_vdo\n                │   ├── chromego_add\n                │   ├── chromego_del\n                │   ├── chromego_list\n                │   ├── fw_add\n                │   ├── fw_delete\n                │   ├── fw_disable\n                │   ├── fw_enable\n                │   ├── fw_list\n                │   ├── fwr_disable\n                │   ├── fwr_enable\n                │   ├── fwr_list\n                │   ├── fw_unblock\n                │   ├── get_ip\n                │   ├── get_mac\n                │   ├── get_ping\n                │   ├── get_uptime\n                │   ├── hst_list\n                │   ├── ignoredmac_add\n                │   ├── ignoredmac_list\n                │   ├── interface_down\n                │   ├── interface_restart\n                │   ├── interfaces_list\n                │   ├── interface_up\n                │   ├── lights\n                │   ├── msg_tv\n                │   ├── netstat\n                │   ├── opkg_install\n                │   ├── opkg_update\n                │   ├── ping_udp\n                │   ├── proc_list\n                │   ├── proc_restart\n                │   ├── proc_start\n                │   ├── proc_stop\n                │   ├── proxy_disable\n                │   ├── proxy_enable\n                │   ├── proxy_list\n                │   ├── reboot\n                │   ├── start\n                │   ├── swports_list\n                │   ├── wifi_disable\n                │   ├── wifi_enable\n                │   ├── wifi_list\n                │   ├── wifi_restart\n                │   └── wll_list\n                ├── hst_list\n                ├── ignoredmac_add\n                ├── ignoredmac_list\n                ├── interface_down\n                ├── interface_restart\n                ├── interfaces_list\n                ├── interface_up\n                ├── lights\n                ├── msg_tv\n                ├── netstat\n                ├── opkg_install\n                ├── opkg_update\n                ├── ping_udp\n                ├── proc_list\n                ├── proc_restart\n                ├── proc_start\n                ├── proc_stop\n                ├── proxy_disable\n                ├── proxy_enable\n                ├── proxy_list\n                ├── reboot\n                ├── start\n                ├── swports_list\n                ├── wifi_disable\n                ├── wifi_enable\n                ├── wifi_list\n                ├── wifi_restart\n                └── wll_list\n```\n#### lanports file\n\nThis file reads the router logs with the logread -f command, and sends messages via bot telegram if a router port is turned off / on or the router delivers an IP address via DHCP.\n\n#### init.d directory\n\nContains the necessary files for the scripts to be started at the router boot, just move them to the /etc/init.d/ of the router and run:\n```sh\n/etc/init.d/lanports enable\n/etc/init.d/telegram_bot enable\n```\n\nAnd then:\n\n```sh\n/etc/init.d/lanports start\n/etc/init.d/telegram_bot start\n```\n\n#### plugins directory\n\nThis is the main directory, it contains all the commands that the telegram bot can execute.\n\nThere are some pre-built commands, which are:\n\n* cam_movie: Record 25 seconds of a camIP and send it.\n* cam_mv: Move the camera arround.\n* cam_shot: Get a Pic from the camera.\n* cam_vdo: Get a 25 seconds record from a camIP.\n* chromego_add: Include to a user in chromego, a word to be used in permissions (block url/youtube channel/etc).\n* chromego_del: Remove a word from a user in chromego to be used in permissions (block url/youtube channel/etc).\n* chromego_list: List all permissions in chromego (block url/youtube channel/etc).\n* fw_add: Block a hostname using a deny rule in firewall, if append time to command will block from 23:00 to 8:00\n* fw_delete: Remove a hostname from a deny firewall rule, if hostname is empty, will remove all rules created by this bot.\n* fw_disable: Disable a firewall rule.\n* fw_enable: Enable a firewall rule.\n* fw_list: List all fw rules.\n* fwr_disable: Disable a redirect firewall rule.\n* fwr_enable: Enable a redirect firewall rule.\n* fwr_list: List all redirect fw rules.\n* fw_unblock: Remove a hostname from a deny firewall rule, if hostname is empty, will remove all rules created by this bot.\n* get_ip: Get WAN IPAddress.\n* get_mac: Get the Organization that onwer the MacAddr.\n* get_ping: Ping a address or host, return Up or Down.\n* get_uptime: Return the uptime from this Device.\n* hst_list: Get hosts in the dhcp Leases. If a hostname is present, search only for this hostname.\n* ignoredmac_add: Add a new macaddress to the allowlist and avoid being notified about it.\n* ignoredmac_list: Shows the list of ignored mac addresses that will not be notified by the bot.\n* interface_down: Shutdown a interface by name.\n* interface_restart: Restart a interface by name.\n* interfaces_list: Get interfaces configuration.\n* interface_up: Start up a interface by name.\n* lights: Turn On or Off house Lights.\n* msg_tv: Send Message to Samsung TV\n* netstat: Prints netstat table in ESTABLISHED, CLOSED and TIME\\_WAIT State.\n* opkg_install: Install a package from opkg.\n* opkg_update: Update list of packages avaliable.\n* ping_udp: Create a UDP packet to puncture a hole through a NAT firewall of your ISP\n* proc_list: List all process in execution\n* proc_restart: Restart a process in init.d\n* proc_start: Start a process in init.d\n* proc_stop: Stop a process in init.d\n* proxy_disable: Disable HTTP and HTTPS or HTTP or HTTPS proxy.\n* proxy_enable: Enable HTTP and HTTPS or HTTP or HTTPS proxy.\n* proxy_list: List proxy rules that is enabled.\n* reboot: Reboot the router.\n* start: This menu help!\n* swports_list: Switch ports list with states.\n* wifi_disable: Disable a wireless device radio.\n* wifi_enable: Enable a wireless device radio.\n* wifi_list: List all wireless devices.\n* wifi_restart: Restart a wireless device radio.\n* wll_list: Get a wifi clients list that is connected to this devices.\n\n\n\n#### help directory inside plugins\n\nThis is the directory containing the help files, with the same name as the command, to be displayed by the start command.\n\n#### how to build a plugin ?\n\nBasically it to create a bash script, with openwrt commands (from uci, files, etc).\nIf a plugin has \"user interaction\" (like choose between itens), the script that will provide thats choices, wil be in the\nctx directory (ctx is from `context`, the script gives context to the user), inside plugins. Once the user choose, the script to be\ncalled, will stay on actions directory, inside plugins. (every context has one or more `action`).\n\n#### telebot file\n\nThis file sends the telegram bot messages generated by lanports\n\n\n#### telegram_bot\n\nThe telegram_bot script is a loop that receives the updates every second and checks to see if there is a command to execute. If there is a command, the script checks to see if there is a file with the same name as the command inside the plugins directory and runs it, if it exists. The output of the executed script is sent as a response message from the command.\nInside the plugins directory, there is the special command \"start\", which returns a message with the commands and a brief help on each command.\nFor this command to work properly, you need to create a file inside the plugins / help directory, with the name equal to the command.\n\n## License\n\nSee [LICENSE](LICENSE) file.\n \n## Package Guidelines\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexwbaule%2Ftelegramopenwrt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexwbaule%2Ftelegramopenwrt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexwbaule%2Ftelegramopenwrt/lists"}