Skip to content

Repository files navigation

T-Stalk

Simplistic program to monitor telegram user activity (online time and profile updates).

Install / Setup

clone repo https://github.com/Repository42/tstalk.git

create an app at my.telegram.org

put api_id and api_hash into api_creds.json

install requirements: python -m pip -r requirements.txt

setup the database and the database user using tstalk_schema.sql

add the following variables to .bashrc

export TSTALKDBCREDS="~/tstalk/db_creds.json"
export TSTALKAPICREDS="~/tstalk/api_creds.json"

add the script runner.py to cron (this will be changed to systemd timers in the future to allow for more frequent updates)

after you have added script to cron you can check everything is running by checking logs for errors with cat scraper.log if there are errors it will show in the file

Usage

runner.py

add user activity to database.

manager.py

add or remove users from program.

modes: add, remove, list

phone: python manager.py add +44123123123

username: python manager.py add @example

id: python manager.py add 123123123

or if you dont want the user to be logged in your bash history you can do python manager.py {mode} and you will be prompted for the user

if the identifier is not valid the script will raise an error.

viewer.py

generate graphs from data.

Example commands:

get help for commands: python viewer.py help

will output something like:

Available commands: 
  activitydaily        num args: 1  type: bar chart
  activityhourly       num args: 1  type: bar chart
  twoactivitydaily     num args: 2  type: bar chart
  twoactivityhourly    num args: 2  type: bar chart
  threeactivitydaily   num args: 3  type: bar chart
  threeactivityhourly  num args: 3  type: bar chart
  activityscatter      num args: 1  type: scatter plot
  profileupdates       num args: 1  type: scatter plot
  pfpupdates           num args: 1  type: scatter plot
  sharingtime          num args: 1  type: broken barh
  activityline         num args: 1  type: line plot
  help                 num args: 0  type: help

bar chart for a user: python viewer.py activitydaily {uidhere}

daily activity

bar chart for two users: python viewer.py twoactivitydaily {firstuidhere} {seconduidhere}

two users daily activity

bar chart for three users: python viewer.py threeactivitydaily {firstuidhere} {seconduidhere} {thirduidhere}

three users daily activity

user profile updates: python viewer.py profileupdates {uidhere}

profile updates scatter

owner.py

prints information about owner of .session file, so you can verify you are logged in as the correct user.

example of output:

--- Owner Profile ---
User ID: 1234567890
Phone: +123123123
Username: @telegram
Display Name: example

About

T-Stalk, simplistic application to monitor telegram user activity.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages