Exploiting FTPs with Shodan and Python
In todays blog, we’ll be finding open FTPs over the internet with the help of Shodan and see how we can access the files. Also we’ll see how we can automat this thing with Python to get most out of it.
The only limit to our realization of tomorrow will be our doubts of today.
-Franklin D. Roosevelt
What is Shodan?
Imagine that the internet is like a huge city with billions of buildings. Most of these buildings have their doors and windows closed, so you can’t see what’s inside unless you visit and have access. However, some buildings accidentally leave their doors wide open for anyone passing by to peek inside.
Shodan is like a virtual explorer that roams around this city (the internet) and looks for those buildings with their doors wide open. Instead of homes and offices, these open buildings are actually internet-connected devices like webcams, printers, routers, servers, and many other things that make up the “Internet of Things” (IoT).
For more technical details please visit this blog:
What is Shodan? The search engine for everything on the internet
Let’s find open FTPs
we’ll use shodan queries to find the effiecient results. see the below query:
220 "230 Login successful." port:21 country:"IN"
I’ve found one Github repo which contains many more of them, Please check out here: https://github.com/jakejarvis/awesome-shodan-queries
now we’ve two ways.
- Manually finding results from Shodan web
- finding all results at one using shodan CLI
see the results of web
But it is always tedious to do things manually, so now we’ll use the power of Shodan CLI and Python.
- First, go to your Shodan Account and find the API key.
- Now install the shodan module for python
pip install shodan - now We’ll develop the script to do things only with one click 😉
I’ve uploaded my script on Github Please go and check it out(I’ll be updating that repo in future adventures)
you can run this script for hours and hours if you’ve VPS or any servers available. or you can simply use your own machine to do so but it’ll consume lot of resources, I used Google Colab, It’s free and we can run stuff for hours. also you can download files from FTP to your Google drive directly!!
Here are the censored results:
Use your queries wisely and effectively, because membership only provides 100 queries per month(for Shodan API)
Please follow me for more such content!