Twitter OSiNT (Ethical Hacking)

NetworkChuck
29 Apr 202114:19

Summary

TLDRThis video introduces a Python-based tool called Twint, which allows users to scrape Twitter data without an API, login, or rate limits. The host provides a step-by-step guide on setting up Twint, demonstrating its use via CLI and within Python scripts. Emphasizing ethical hacking, the host explores various commands for collecting tweets, searching by user, keyword, location, and more. The video also delves into advanced features like saving data to JSON files, and using the tool in real-world investigations, encouraging viewers to explore its potential for educational purposes.

Takeaways

  • πŸ”’ Twint is a powerful Python hacking tool used to gather information from Twitter without API, rate limits, or login.
  • πŸ’» The tool works via CLI and can also be imported into Python code for deeper functionality.
  • ⚠️ The tool is legal, but intent matters β€” it should only be used for educational purposes and ethical hacking.
  • ⏱️ Setup is quick and can be done in five minutes using any Linux system or the free Google Cloud Console.
  • πŸ› οΈ Essential commands for setup include installing Git, Python 3, and Pip, followed by cloning the Twint repository.
  • πŸ” Twint can scrape tweets, filter results by username, keyword, date, location, popularity, and more.
  • πŸ“‚ Results can be exported to JSON files for further analysis or storage.
  • πŸ‘¨β€πŸ’» Twint can be used programmatically within Python scripts, allowing for advanced search and automation.
  • 🌍 The tool supports searching by geolocation, helping find tweets near specific locations or within a defined radius.
  • πŸ’‘ Twint is a valuable tool for Open-Source Intelligence (OSINT) investigations, making information gathering easier.

Q & A

  • What is the purpose of the video?

    -The video demonstrates how to use a Python hacking tool called Twint to gather information from Twitter without the need for API access, login, or rate limits.

  • Is Twint an illegal tool?

    -No, Twint is not illegal. However, the user's intent when using the tool is important, and the video stresses the importance of using it for educational purposes only.

  • What does Twint stand for?

    -Twint stands for Twitter Intelligence, a powerful Python tool for scraping information from Twitter.

  • What are the main features of Twint?

    -Twint allows users to scrape Twitter data without using the Twitter API, login, or facing rate limits. It can gather tweets based on usernames, search terms, locations, and more. It can also output data in JSON format and be integrated into Python code.

  • How can Twint be installed?

    -Twint can be installed by cloning the tool from GitHub using 'git clone,' navigating to the Twint directory, and installing the required dependencies using 'pip3 install -r requirements.txt'.

  • What are some common uses of Twint via the command line?

    -Some common uses include searching for tweets from a specific user, limiting the number of tweets retrieved, searching by keyword, and exporting results to a file.

  • Can Twint be used programmatically within Python scripts?

    -Yes, Twint can be imported as a Python module, and its functionality can be customized in Python scripts, allowing for more complex and dynamic queries.

  • How can you search for tweets near a specific location using Twint?

    -You can use the '--near' option followed by the name of a city or '--geo' followed by latitude and longitude coordinates, along with a radius, to search for tweets near a specific location.

  • How can you filter tweets based on their popularity using Twint?

    -You can use the '--min-likes' option followed by a number to filter tweets that have received at least that number of likes.

  • What is one practical use case of Twint demonstrated in the video?

    -One practical use case is searching for tweets about coffee near a user's location or for popular tweets about Raspberry Pi in different cities. The video also demonstrates gathering tweets and exporting them to JSON files for further analysis.

Outlines

00:00

πŸ” Introduction to Ethical Twitter Hacking with Twint

This paragraph introduces the topic of ethical hacking on Twitter using a Python tool called Twint. The narrator clarifies that they won’t be hacking accounts but rather using Twint to gather public information without API limits or logins. A quick disclaimer emphasizes the legal use of the tool, warning viewers to avoid unethical practices. The narrator shares their excitement about the tool's ease of setup and power, explaining that it can be run via the Google Cloud Console for free. The paragraph closes with an appeal to like, subscribe, and interact with the video.

05:00

🐍 Using Twint in Python and CLI

The narrator shifts to demonstrating Twint’s use through Python modules and CLI. They highlight the simplicity and versatility of using Twint via command line, showing how to search for specific users and limit the number of tweets returned. They also demonstrate how to search for specific keywords in tweets, output the results in JSON format, and explore the data in files. By showcasing the power of Twint in pulling data, the narrator sets the stage for more advanced use cases in Python.

10:02

βš™οΈ Exploring Advanced Twint Capabilities

The third paragraph delves into more advanced functionalities of Twint. The narrator explains how to search by location, find popular posts based on likes, and even retrieve tweets with images. The demonstration includes searching tweets from specific users like David Bomble and filtering them by date or popularity. These examples emphasize how Twint can be used for deeper exploration and information gathering, showing the practical applications of the tool.

Mindmap

Keywords

πŸ’‘Twint

Twint is a Python-based tool for gathering information from Twitter without using the Twitter API or requiring login credentials. In the video, the presenter demonstrates how Twint can be used to scrape Twitter data for a variety of purposes, including searching tweets and gathering user information. The tool is central to the video’s theme of ethical data collection.

πŸ’‘CLI (Command Line Interface)

CLI refers to interacting with the computer through text-based commands instead of graphical interfaces. In the video, the presenter shows how to use Twint via the CLI, making it easy to search for Twitter information. The CLI is highlighted as a simple yet powerful way to run searches and customize queries.

πŸ’‘Python Modules

Python modules are libraries or collections of functions and tools that can be imported into Python scripts for various purposes. In the video, Twint is shown as a Python module, and the presenter explains how it can be integrated into scripts to make more sophisticated searches on Twitter. This concept is central to the demonstration of automated data collection.

πŸ’‘Data Scraping

Data scraping refers to extracting information from websites or online platforms. In the context of the video, Twint is used to scrape data from Twitter, allowing users to gather tweets, user information, and search results without the need for API access or login credentials. This term is a key part of the video, as it relates to how Twint operates.

πŸ’‘Google Cloud Console

Google Cloud Console is a web-based platform for managing and running cloud-based services. In the video, the presenter uses Google Cloud Console as the preferred environment to run Twint, praising its free availability and ease of access. The Console is presented as an ideal tool for users who may not have Linux machines locally.

πŸ’‘JSON

JSON (JavaScript Object Notation) is a lightweight data format used for structuring data. In the video, the presenter uses JSON to output the results of Twint queries, making the data easy to read and store. This format is emphasized for storing Twitter data in a structured, reusable way.

πŸ’‘Ethical Hacking

Ethical hacking refers to using hacking tools and techniques for legitimate purposes, such as security testing or research, rather than malicious intent. The video strongly emphasizes ethical use of Twint, warning viewers against hacking with ill intent and promoting the tool as a means for education or authorized purposes.

Highlights

Introduction to the Twint tool: a Python-based hacking tool to gather Twitter data without API or login requirements.

Twint setup is fast and easy, with no rate limits, making it a powerful tool for data scraping on Twitter.

Quick setup demonstration on Google Cloud Console, where Twint can be used in under five minutes.

Tool allows gathering tweets by username without API restrictions, demonstrating how to scrape all tweets from a specific user.

Example usage of Twint CLI (Command Line Interface), including how to limit the number of tweets retrieved.

Twint can filter tweets based on keywords, like finding all tweets mentioning 'Raspberry Pi' by a specific user.

Outputting scraped data to a JSON file for further analysis, showcasing how to save Twitter data locally.

Advanced search capabilities like filtering tweets based on minimum likes or searching tweets with images only.

Geolocation search feature allows users to search for tweets near specific cities or even based on exact geo-coordinates.

Twint’s Python module can be integrated into Python scripts for automated and customizable data collection.

Demonstration of creating an interactive Python script that searches for popular topics based on user input.

Example Python script that retrieves tweets mentioning a specific topic from a chosen location.

Showcase of a script that collects all Twitter replies to a user's tweets and retrieves recent activity from those users.

Emphasis on the ethical usage of Twint, highlighting the importance of educational and responsible hacking practices.

Encouragement for viewers to explore Twint’s functionalities further by building their own Python scripts.

Transcripts

play00:00

twitter hacking

play00:02

kind of because if you think we're going

play00:03

to be hacking into twitter or hacking

play00:05

into someone's account we're not doing

play00:07

that so if you're here for that get out

play00:09

of here not the video for you but we

play00:11

will be using this amazing python

play00:13

hacking tool to gather information from

play00:15

twitter this tool is crazy powerful no

play00:17

rate limit no login no api the setup is

play00:19

super fast it seriously takes seconds

play00:21

and i'll show you how to use this tool

play00:22

via cli and even how to import this into

play00:24

your python code now real quick

play00:26

disclaimer while the tool we're using is

play00:29

not illegal and the way it searches

play00:30

twitter is not illegal your intent does

play00:32

matter please do not hack anyone without

play00:35

their permission or use this tool with

play00:37

any kind of ill intent so be careful use

play00:39

it for educational purposes only the

play00:41

hacking tool we're using is called twint

play00:43

which stands for twitter intelligence

play00:45

and seriously no joke i've never had

play00:47

more fun playing with a hacking tool

play00:49

like i spent way too much time playing

play00:51

with this so i'm crazy excited to show

play00:53

you this for real and it's super crazy

play00:55

easy to set up all you'll need is about

play00:57

five minutes you can use any linux

play00:59

computer and of course i'll show you how

play01:00

to get free access to google cloud

play01:02

console which is my preferred way to do

play01:03

all this completely free like you can

play01:05

start using this tool right now in five

play01:07

minutes

play01:07

all you need is your web browser i love

play01:09

that so much anyways and then last but

play01:11

certainly not least i need some coffee

play01:14

man you need some hacking fuel two cups

play01:16

minimum networkchuck.coffee if you don't

play01:18

already have some

play01:19

let's get started oh wait hold on real

play01:21

quick have you hacked the youtube

play01:22

algorithm today make sure you do hit

play01:24

that like button subscribe notification

play01:26

bell comment let's hack youtube today

play01:28

ethically of course now again i'll be

play01:30

demoing this on the google cloud console

play01:32

which is completely free and amazing you

play01:34

can do it right now i've got a link

play01:35

below in the description just click that

play01:36

sucker and go now of course you can use

play01:38

your own environment that's fine too the

play01:39

steps will be the same so i'm gonna get

play01:40

signed into my google cloud console and

play01:43

get this party started i'm so excited

play01:45

once you're logged in click on the cloud

play01:46

console icon at the very top right here

play01:48

and that'll launch your cloud shell and

play01:50

it's so cool again i can't say it enough

play01:52

thank you google for doing something

play01:54

like this now real quick if you're not

play01:55

using google cloud console like me you

play01:57

will need a few things installed like

play01:59

apt install git

play02:01

do that apt install

play02:03

python 3 do that and apt install python3

play02:09

dash pip and that should be enough let's

play02:12

keep going first command we're going to

play02:13

use git to clone our tool now i will

play02:16

have all these commands below in the

play02:17

description feel free to copy and paste

play02:18

but typing it in feels so much better

play02:20

just do that anyways git clone

play02:22

we'll do a dash dash depth equals one

play02:25

and then the url to the project it'll be

play02:27

https colon whack whack and the url and

play02:30

hit enter

play02:31

it's gonna clone that sucker done so

play02:33

fast then we're gonna change directories

play02:35

into the twent directory that we just

play02:37

downloaded cd twin

play02:39

there and then last command to get this

play02:40

going we're gonna install our

play02:41

requirements so pip three

play02:44

install we'll do a space then a dot and

play02:47

then a space dash r

play02:49

requirements

play02:50

dot txt and hit enter

play02:53

coffee break

play02:56

and while we're all sipping our coffee

play02:58

i'd like to thank the sponsor of this

play02:59

video skillshare skillshare is an online

play03:01

learning community with a ton of classes

play03:03

like over a thousand thousands now what

play03:05

i love about skillshare is that it's not

play03:06

necessarily about i.t it's more about

play03:08

creative stuff like how to make coffee

play03:11

yeah there's a course on that or how to

play03:12

develop my already excellent drawing

play03:14

skills i mean i think it's pretty

play03:16

obvious that i don't need any more help

play03:17

i'm already pretty dang good so i'll

play03:18

check out that course and see if they

play03:20

can teach me anything i doubt it so be

play03:22

watching the channel see if i improve my

play03:23

drawing skills but seriously i do think

play03:25

it's important that i.t people like us

play03:27

explore the soft skills side of our

play03:29

skill sets learning things like hey how

play03:31

do i talk in front of people public

play03:33

speaking how do i teach and get an idea

play03:35

across how do i stay productive like for

play03:37

example i'm going through thomas frank's

play03:39

productivity class for creatives it's

play03:40

these x factor skills that make you

play03:42

great in i.t and also i do think it's

play03:44

important that you have hobbies and

play03:45

interests outside of technology i know

play03:47

it's kind of hard to because it's

play03:48

awesome so explore your creative side a

play03:50

bit learn how to make a cup of coffee

play03:52

learn how to draw maybe learn how to

play03:53

make a ui a user interface the pretty

play03:55

part of it instead of just the back end

play03:56

so check it out link below in the

play03:58

description the first 1 000 people to

play04:00

click that link will get a free trial of

play04:01

the skillshare premium membership after

play04:03

that it's only 10 bucks a month anyways

play04:05

coffee break over let's keep going and

play04:07

that's it it's installed ready to go

play04:10

just like that and honestly it's so

play04:11

simple and cool to use watch this i'm

play04:13

gonna clear my screen so let's try this

play04:15

first type in twent

play04:17

then we'll do a dash u for a username

play04:19

and we'll specify a user let's say just

play04:21

myself network chuck

play04:24

what this tool is doing is so cool no

play04:26

api required it's not using the twitter

play04:27

apis

play04:29

no twitter login required it's simply

play04:30

scraping twitter and it's crazy powerful

play04:32

let's try it out right now ready set go

play04:37

ah

play04:38

i'm going to hit ctrl c to stop but look

play04:40

at all that look at all my tweets that

play04:42

is so stinking cool but this is just the

play04:44

beginning here we go

play04:46

let me clear my screen once more now

play04:47

first real quick how do you get help if

play04:49

you don't know what you're doing simply

play04:50

type in twent and then dash h it'll tell

play04:53

you all the switches you can use now

play04:55

this way is cool using the cli we'll go

play04:57

through a few more examples here in a

play04:58

moment but the more powerful amazing way

play05:00

to do this the more fun way

play05:02

is through python modules

play05:04

or the python module we can import twins

play05:06

into our code and use it for some cool

play05:08

stuff i'll show you here in a moment but

play05:09

anyways the cli is powerful by itself

play05:11

let's try a few things so let's do that

play05:12

same search we just did twins

play05:14

dash u for user name network chuck now

play05:17

what if you don't want a million tweets

play05:19

what if you only want my last 20 tweets

play05:21

we can do that dash dash limit

play05:23

to the last 20 tweets that's more

play05:25

digestible let's try that out real quick

play05:27

okay there we go not too bad you can

play05:29

also search through tweets so i can do

play05:31

twin

play05:32

u for my username network chuck once

play05:34

more and then we can do a dash s to

play05:36

search and this can be any keyword for

play05:38

example we may want to see all the

play05:40

raspberry pi tweets i put out

play05:42

so put raspberry pi between quotes and

play05:44

let's take a look

play05:46

it even has my first tweet about

play05:48

raspberry pi's which was back in 2016.

play05:51

oh my gosh oh my gosh this is when i put

play05:54

a unified controller openvpn dynamic dns

play05:57

all running on my pi 3. that was fun all

play05:59

right let's keep going let's go deeper

play06:01

let's get crazier we can also output

play06:03

these results to a file so we can you

play06:04

know store them and look at them later

play06:06

twint will do the same thing network

play06:07

chuck for my username

play06:09

i'll search for it every time i've said

play06:12

right now and then i'll do a dash o

play06:15

to output it to a file

play06:17

see right now

play06:19

dot json and then i'll do a dash dash

play06:22

json to make sure the data is formatted

play06:23

to be json now let's check it out

play06:26

now it'll still output to the terminal

play06:27

but let's do an ls to see what's inside

play06:29

my folder here there it is right

play06:30

now.json let's look inside i'll do a

play06:32

nano right now.json

play06:35

and there they all are that is so cool

play06:38

okay here we go even deeper more cool

play06:40

things let's pick on david bomble so

play06:42

twint dash u david bomble

play06:45

if you don't know who david bomble is go

play06:46

follow that guy he's amazing we've been

play06:48

friends for years now i want to see all

play06:49

david bomble's popular post i'll do dash

play06:51

dash men dash likes

play06:54

and i'll do 100 this will return all

play06:57

tweets that have at least 100 likes if

play06:59

it doesn't have 100 likes ain't gonna be

play07:00

there let's try it out

play07:02

yeah look at david so popular look at

play07:04

all those

play07:06

popular tweets let's see all the times

play07:07

he's talked about me i'll search for

play07:09

myself

play07:12

yeah oh it's still going yeah we hang

play07:14

out a lot we talk a lot

play07:17

maybe i only want to see his tweets from

play07:18

today let's try that i'll do dash dash

play07:21

sense and i'll specify the date 2021

play07:24

today's april 28th

play07:27

let's see lil congrats to all these

play07:29

winners of the contest so just one tweet

play07:31

today we can also go back and look at

play07:33

previous stuff like let's specify a year

play07:35

2016 was david even on twitter yeah he

play07:38

was wow

play07:38

[Laughter]

play07:41

he's talking about sdn and open flow

play07:42

like crazy now i want to see his

play07:44

pictures from 2016 so i can actually

play07:46

specify tweets only with images i'll do

play07:48

dash dash images here we go oh he's got

play07:50

one talking about raspberry pi's let's

play07:52

go take a look at that

play07:54

oh someone retweeted david and how he's

play07:56

messing with

play07:57

a raspberry pi zero that's fun now what

play08:00

we're doing here might seem silly i'm

play08:01

just looking at pictures and old tweets

play08:03

but that's that's hacking gathering

play08:05

information is a vital part of hacking

play08:07

now just a few more cli commands before

play08:09

we go crazy in python so here we go you

play08:11

don't have to just search by username or

play08:13

by one account

play08:15

i can search simply by a search term so

play08:17

maybe i want to find out all the people

play08:18

talking about coffee

play08:21

near where i live here in dallas i can

play08:23

do that so i'll do dash dash near dallas

play08:27

and i want to see it for today so i'll

play08:28

do

play08:29

sense 2021 blah blah today and these

play08:32

things have to be popular so i want a

play08:33

minimum likes

play08:35

of at least 15 likes let's try it out

play08:39

that is too cool

play08:41

six hours straight of drinking coffee

play08:42

while listening to edm probably not

play08:44

healthy choice i don't know sounds great

play08:46

to me maybe i'm in paris and i want to

play08:47

hang out with people talking about

play08:48

raspberry pies so let's see if anyone's

play08:50

talking about raspberry pies today in

play08:51

paris

play08:53

and there certainly are let's go check

play08:54

this guy out real quick raspberry pi

play08:56

news looks pretty cool and you can also

play08:57

be more precise so you don't have to do

play08:59

near

play09:00

you can actually search by coordinates

play09:02

by geo coordinates so let's uh specify

play09:04

some geo coordinates dash g

play09:07

equals latitude and longitude

play09:09

i'll do a comma after that and specify

play09:11

the radius we'll say within like

play09:14

20 kilometers no one this is austin

play09:17

texas no one's talking about raspberry

play09:18

pi's

play09:20

i bet they're talking about coffee let's

play09:21

test that out yeah look at all those

play09:23

coffee people in austin texas

play09:26

now the cli it's fun but the real power

play09:29

comes in with python you ready let's do

play09:32

this this is so cool seriously anyways

play09:34

here we go i'm going to create a new

play09:36

python file using nano leave me alone

play09:38

nano and i'll name this hot topic

play09:42

nothing to do with the store not

play09:44

sponsored relax

play09:45

dot pi

play09:46

first thing we'll do here is make sure

play09:48

we got

play09:50

twint

play09:51

involved we'll import twint

play09:53

that's importing that python module so

play09:55

we can use it in our script so for this

play09:57

script i want it to be interactive so

play09:58

here we go i want to be able to launch

play10:00

this and say hey

play10:01

this is what i'm searching for and what

play10:03

city

play10:04

i'm searching for it in to kind of get

play10:06

hot topics like maybe raspberry pi's in

play10:08

dallas coffee in berlin t in england

play10:11

there you go david let's try it out i'll

play10:13

name my first variable search

play10:16

and i'll have that equal

play10:18

an input it'll ask me for input it'll

play10:21

ask me what are you searching for

play10:23

another one i'll name city and equal

play10:25

that

play10:26

also an input i'll say where and then

play10:28

let's get twent set up now this is all

play10:30

foreign to you that's fine this is a

play10:32

great opportunity for you to learn a

play10:34

little bit of python and if you already

play10:35

know python do you go crazy with this

play10:37

and have a ton of fun seriously this is

play10:39

so cool anyways

play10:40

okay have i said that enough yet so i'll

play10:42

say c another variable i'll have that

play10:44

equal

play10:46

twint.config case being very important

play10:48

here i'll say c dot search

play10:52

equals my variable search c dot

play10:56

near

play10:57

equals

play10:58

my variable city i do want to limit my

play11:00

search so i'll say limit it to 20 tweets

play11:03

and i only want to see popular tweets

play11:05

now i can say number of likes like it

play11:07

has to have 100 likes or i can do

play11:09

popular

play11:11

tweets

play11:13

this is boolean so how they equal

play11:15

true i believe that is yeah oh wait the

play11:18

t needs to be lower case

play11:20

case is important

play11:21

and yeah you know i think that's good so

play11:23

now we're going to launch the command

play11:24

it'll be twint.run.search

play11:28

and then my variable c which

play11:30

encapsulates all that business right

play11:31

here that should be good i'm going to

play11:33

control x

play11:35

to get out of there why do you see it

play11:37

want to save it

play11:38

easy for me to say and hit enter

play11:40

cool time to run my script by doing

play11:43

python3 and then what i name it oh hot

play11:46

topic hot topic dot pi let's see what

play11:48

happens

play11:50

what am i searching for hmm

play11:53

let's see let's do coffee in berlin

play11:55

coffee

play11:56

berlin

play11:59

how cool is that that's so cool

play12:02

something about coffee and space i want

play12:04

to see that tweet let's check it out ooh

play12:06

a new coffee machine love it okay one

play12:08

more python thing i want to show you

play12:09

just to kind of show you the power of

play12:11

what you can actually do yourself

play12:13

so on twitter i tweeted two things i

play12:15

said retweet this and then uh reply to

play12:18

this that was for right now so i've got

play12:20

a script let me show you what i'm doing

play12:22

so here it is let's jump in there real

play12:23

quick

play12:24

i called it my people

play12:28

dot pi and here's the script i'm pulling

play12:30

in date time to get today's date

play12:33

now now i'm saying whoever tweets at me

play12:36

today i want to pull all those tweets

play12:38

it's going to run that search and then

play12:39

throw that into a a list a python list

play12:42

if you don't know what that is we'll

play12:43

cover some of that stuff later in a new

play12:44

series i then create a new list just

play12:47

called my people and that new list with

play12:49

this command will only have all of your

play12:50

usernames everyone who replied to me or

play12:53

or sent me stuff i've got all your

play12:55

usernames in a nice little list it's

play12:56

going to print that list

play12:58

and then it's going to go through all of

play13:00

your accounts

play13:01

and pull your last 20 tweets and 20

play13:04

tweets 10 times fast and then print that

play13:06

on the terminal

play13:08

pretty cool right i mean it's kind of

play13:09

pointless

play13:10

but if you think about what you can do

play13:12

for an actual ocean investigation when

play13:14

you're hacking whatever

play13:16

so check it out let's try it python3

play13:21

my people

play13:26

dot pi here we go ready for this here we

play13:28

go

play13:29

there you all are thank you

play13:31

and then here comes all your tweets

play13:34

how cool is that

play13:36

twit a python hacking tool for twitter

play13:39

it's awesome i can seriously spend hours

play13:41

just playing with this and creating

play13:42

scripts in fact i would love to see what

play13:44

you guys create so let me know below

play13:46

comment below with what you have that's

play13:48

awesome anyways let me know you think of

play13:49

the video in the comments below make

play13:51

sure you hack youtube today ethically of

play13:53

course the algorithm so like the video

play13:55

comment notification bell all that

play13:57

youtubey stuff and yeah that's all i

play13:59

have today

play14:00

i'll catch you next time

play14:03

[Music]

play14:16

[Music]

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Python hackingTwint toolTwitter scrapingEthical hackingNo API limitsData gatheringGoogle Cloud setupSocial media OSINTNetwork securityCLI tutorial