Telegram OSINT VM Part 2
Telegram OSINT VM Part 2
Thank you for returning to read part two of my Telegram OSINT VM, in this second blog I am going walk through the resources I use to research Telegram.
If you didn’t catch Part 1, you can find it here: –
https://www.cqcore.uk/telegram-osint-vm-part-1/
I will start by listing what I use as my base: –
Telegram Web
Telegram Desktop
Geogramint https://github.com/Alb-310/Geogramint
Telepathy https://github.com/jordanwildon/Telepathy
Telegram Tracker https://github.com/estebanpdl/telegram-tracker
I will talk through and illustrate the installation of the above. I will then move on to the other resources that I install and these in the whole will be bookmarks and useful links.
We will start with the installation of Telegram Web and desktop. Open your Telegram container, where we can save the Telegram Web bookmark. Once you have the below screen, Fig 2.1, right click and you will be presented with Fig 2.2, this is where you can save Telegram Web to your Telegram Container.
Fig 2.1
Fig 2.2
You can now save Telegram Web as a bookmark in your bookmark menu. The first time you open the Telegram bookmark you will be asked to confirm that you want to use the Telegram container from now on to open Telegram Web.
Now it’s time to download Telegram Desktop, navigate your way to https://desktop.telegram.org/ where you can download the application. The default option will be for Linux x64. Once downloaded you can extract the files and run the program and you will then be presented with the below, Fig 2.3
Fig 2.3
You maybe asking yourself why do I need both Telegram Web and Desktop? Well, they both do things different, offer flexibility and resilience. You do not have to use both at the same time.
Now we are in a position to log into our Telegram sock account as we will need an API key for the other resources I mentioned earlier.
Once logged in, lets look at some settings that will be beneficial to our OPSEC and security,
In Data & Storage, disable Auto-Download Media, Fig 2.4: –
Fig 2.4
Then we can look at the Privacy settings, Fig 2.5. You will see that I have set the profile picture to everybody. This is due to Geogramint requiring you to have your profile pictures on view. You can disable this when you are not using Geogramint. Only premium users can disable voice or video messages.
Fig 2.5
Annoyingly the settings from Telegram Web do not carry over to Telegram Desktop, in relation to the automatic media downloads.
In Advanced settings, I enable, ‘Ask download path for each file’
In each of the Private Chats, Groups, Channel, I disable. ‘Automatically download, videos & file,’ Fig 2.6.
Fig 2.6
If you are using a mobile, I would also disable the People Nearby option. You will find it by navigating to Contacts – Find People Nearby. I would like see to Find People Nearby come to the Web and Desktop app, so i could use a location spoofing extension, however this is why we have Geogramint.
The above settings will really depend on the nature of your deployment. Experience has shown me that files can be automatically downloaded in the background to your device, without you knowing, just take the added precaution of choosing what I want to view. I like to have a look at the channel or group first.
I will walk you through how to obtain your API-id and API-hash. You need to log-in to your Telegram account on Telegram Web, you then need to navigate to the API development tools at the following URL:
https://my.telegram.org/auth?to=apps
Then you will need to enter the number that you used to sign up to Telegram, Fig 2.7. You will then be sent a confirmation code to your Telegram account. You need this code to access the, ‘Your Telegram Core,’ where you will select the API development tools option.
Fig 2.7.
You will be taken to the following screen, Fig 2.8.
Fig 2.8
In the default fields, typing, ‘Anything” should enable you to obtain your API. You will be taken to the next page where you will obtain your API-id & API-Hash.
This short video is a good tutorial on how to obtain your API-id & API-Hash.
https://www.youtube.com/watch?v=8naENmP3rg4
Once you have your API-id & API-Hash, keep it safe in your password manager.
You may have gathered that there is an OPSEC issue in how we have obfuscated our Ubuntu setup earlier. We have to use a mobile number that is not necessarily from the same country as we set our VM to, not only that the next step requires you to use an IP address for the country of the number too, otherwise Telegram will not provide you with your API key and Hash.
If you have no intention of using the cmd line tools then you do not need to concern yourself with obtaining the API key and Hash. Alternatively like I have done in the past, obtain a SIM from your obfuscation country. It all depends on what our deployment entails and the risks involved.
With OSINT, there is always a balance to be had between, OPSEC, Privacy and usability versus reward. We can lock ourselves down but this will affect our ability to carry out OSINT.
Before moving on to installing the cmd line tools I am going to create two more bookmarks.
I am going to create a custom bookmarklet that has been created by @Webbreacher based on a blog by @hatless1der. I have included a link to the blog below so that you can read up on how this bookmarklet works.
Copy the text below, go into your browser bookmarks, create a new bookmark, and paste the text where you would normally put the URL for a bookmark and save. Give it a name you will remember, i’ll call mine Bookmarklet: –
javascript:(function()%7Bvar a %3D document.getElementsByClassName(‘tgme_page_description’)%5B0%5D%3B alert(a.innerText)%7D)()
The link to @hatless1der blog is here: –
https://hatless1der.com/telegram-osint-basics-5-tips-anyone-can-do-right-now/
I am now going to add my own GitHub repo bookmark where I have collected my Telegram OSINT toolkit. You now have access to my GitHub repo where you can access the numerous, blogs, bots, CSE, extensions, resources and videos, to help you with your research of Telegram. Feel free to add your resources toolkit of choice, @Cyb_Detective has a good GitHub repo too. I will allocate my GitHub repo to a container.
https://github.com/cqcore/Telegram-OSINT
It is a good idea to add a Yandex bookmark too. I add the following in a bookmark folder, called Yandex: –
https://translate.yandex.com/ocr
At the same time I am going to allocate them a container named Yandex, Fig 2.9
Fig 2.9
*I said earlier that I add extensions as I go, you have the option here to add a ‘Translate’ extension. In Firefox’s Add-Ons there are couple of recommended ‘Google Translate’ extensions. Firefox has its own Translate extension, however it is limited in the languages available to translate.
*Next I am going to a create a bookmark folder for the following website resources: –
https://telemetr.io/en/channels
*As with everything related to the internet ensure that you are happy with the resources you use. Ensure that you are using the appropriate OPSEC for your deployment.
Now is the time to download from GitHub our cmd line tools. We have created the cqcore GitHub container and we can use the same container to install the cmd line tools we are going use. You will find tutorials on my GitHub Telegram Repository on how to use the below tools. As I go, I create text documents on my VM for each tool, which contains the installation instructions and also the commands for its deployment.
Geogramint https://github.com/Alb-310/Geogramint
Telepathy https://github.com/jordanwildon/Telepathy
Telegram Tracker https://github.com/estebanpdl/telegram-tracker
First we will start with Geogrmint: –
git clone https://github.com/Alb-310/Geogramint.git
(If you don’t have git – sudo apt install git)
cd Geogramint
pip3 install -r requirements.txt
(If you don’t have pip3 – sudo apt install python3-pip)
python3 geogramint.py
This will then launch the GUI. In the bottom right corner is the settings cog, click this and the below image will be launched, where you can input your Telegram API-id, API-Hash and telephone number, Fig 3.0.
Ensure you have the + and your country code, minus the first 0, +44(number here) format.
Fig 3.0
Next is Telepathy: –
pip3 install telepathy
When you first run Telepathy you will be asked to enter your, API-id, API-Hash & phone number.
We will use a default cmd, the target is one of the inventors of Telegram, Fig 3.1.
Fig 3.1
You will enter your API-Id then,
Next is your API-Hash,
Then you will enter your telephone number. Ensure you have the + and your country code, minus the first 0, +44(number here) format.
You will receive a code to your Telegram account, once that is input into the terminal you will then enter your password, and you are away.
A basic cmd as a test would be – telepathy -t CHANNEL NAME
Next we can install Telegram Tracker: –
*To use this tool, you need to be aware that Telegram Tracker will not work if you have 2FA enabled. the first time you run it.*
git clone https://github.com/estebanpdl/telegram-api.git
Then download the ZIP file from GitHub, Fig 3.2, and unpack the file telegram-tracker.zip to your preferred location.
Fig 3.2
cd telegram-tracker-main
*pip3 install -r requirements.txt
Go to the telegram-tracker-main and complete the config file with the below
[Telegram API credentials]
api_id = api_id
api_hash = api_hash
phone = phone
Note: Your phone must be included to authenticate for the first time. Ensure you have the + and your country code, minus the first 0, +44(number here) format. Telegram API will send you a code via Telegram app that you will need to include.
A basic cmd: –
*python3 main.py –telegram-channel channelname
*If you used pip and not pip3 the cmd would be python main.py –telegram-channel CHANNELNAME
When I have finished the above I add the GitHub tools to a bookmark folder for easy access. I also create txt notes with how to use each tool, Fig 3.3.