Basic - OSINT - M01 - Gathering data from Twitter

This post is a part of the OSINT series.

1. Why would you want to use Twitter in OSINT?

These days Twitter is the most commonly used micro-blogging platform in the world. Below I would like to show you some of the most important Twitter numbers:

Worldwide distribution of users:

Twitter also provides a Twitter API which can be very usefull for data mining and gathering interesting information about Twitter users. In this article we are going to use Tweepy library which will help us to use the API with Python language.

2. How to use Twitter in OSINT?

2.1 Get user tweets and save them.

How to run this code:

python all_tweets_from_user.py -u tomkowalczyk

Parameters:

-u - Twitter user name

Output:

tomkowalczyk_tweets.csv

File Header:

"id","created_at","text"

Comment:

When having these kind of data about user we then will be able to find out more information using other technics, For example:

2.2 Discover friends for Twitter user.

How to run this code:

python user_friends.py -u tomkowalczyk

Parameters:

-u - Twitter user name

Output:

friends_of_tomkowalczyk.csv

File Header:

"friend_id","name"

Comment:

When having these kind of data about user we then will be able to find out more information about him, For example:

2.3 Discover followers for Twitter user.

How to run this code:

python user_followers.py -u tomkowalczyk

Parameters:

-u - Twitter user name

Output:

followers_of_tomkowalczyk.csv

File Header:

"follower_id","name"

Comment:

When having these kind of data about user we then will be able to find out more information about him, For example:

2.4 Determine about what people are tweeting at the current moment.

How to run this code:

python location_trends.py -w 523920

Parameters:

-w - WOEID code of location

Output:

Output printed in console

Comment:

When having these kind of data about user we then will be able to find out more information about specific region, For example:

3. Next steps

The aim of this article was to show and present the possibilities of using Twitter as a source of data, I described why Twitter can be so important in OSINT and how to gathenring data from it.

Please remember that this is just an introduction and covers only data gathering, you should realize that this is just a first step into OSINT world, in next we should know how to analyze collected data and how to get information from such data. These steps I would like to describe in Advanced OSINT series, so please leave the comment below if you are interested in such series of articles.

4. Additional information

The source code attached to this article is available on GitHub.

To start working with Twitter API you will need to register as a developer to gain developer keys, you can of course find on Google how to do this or just simple read the instructions from Twitter Developer Site and go to the Twitter Apps.

For the fourth sample code you will also need a WOEID of location you would like to follow, you can get it from here.

Posted with : OSINT

If you liked this post, you can share it with your followers or follow me on Twitter!