Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Add files via upload

Abdul Wahab Junaid5054cb42f4dd
diff --git a/Shodan/ShodanSearch_FTP_Vulnerable.py b/Shodan/ShodanSearch_FTP_Vulnerable.py
new file mode 100644
index 0000000..b8636e1
--- /dev/null
+++ b/Shodan/ShodanSearch_FTP_Vulnerable.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import shodan
+import re
+import os
+
+servers =[]
+shodanKeyString = os.environ['SHODAN_API_KEY']
+shodanApi = shodan.Shodan(shodanKeyString)
+
+results = shodanApi.search("port: 21 Anonymous user logged in")
+print("hosts number: " + str(len( results['matches'])))
+for result in results['matches']:
+ if result['ip_str'] is not None:
+ servers.append(result['ip_str'])
+
+for server in servers:
+ print(server)
diff --git a/Shodan/print_api_key.py b/Shodan/print_api_key.py
new file mode 100644
index 0000000..c165338
--- /dev/null
+++ b/Shodan/print_api_key.py
@@ -0,0 +1,4 @@
+import os
+
+shodan_api_key = os.environ['SHODAN_API_KEY']
+print(shodan_api_key)
diff --git a/Shodan/shodanSearch.py b/Shodan/shodanSearch.py
new file mode 100644
index 0000000..17b6c15
--- /dev/null
+++ b/Shodan/shodanSearch.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+
+import shodan
+import argparse
+import socket
+import sys
+import os
+
+SHODAN_API_KEY = os.environ['SHODAN_API_KEY']
+
+api = shodan.Shodan(SHODAN_API_KEY)
+
+parser = argparse.ArgumentParser(description='Shodan search')
+
+parser.add_argument("--target", dest="target", help="target IP / domain", required=None)
+parser.add_argument("--search", dest="search", help="search", required=None)
+
+parsed_args = parser.parse_args()
+
+if len(sys.argv)>1 and sys.argv[1] == '--search':
+ try:
+ results = api.search(parsed_args.search)
+ print('Results: %s' % results['total'])
+ for result in results['matches']:
+ print('IP: %s' % result['ip_str'])
+ print(result['data'])
+ except shodan.APIError as exception:
+ print('Error: %s' % exception)
+
+if len(sys.argv)>1 and sys.argv[1] == '--target':
+ try:
+ hostname = socket.gethostbyname(parsed_args.target)
+ results = api.host(hostname)
+ print("""
+ IP: %s
+ Organization: %s
+ Operating System: %s
+ """ % (results['ip_str'], results.get('org', 'n/a'), results.get('os', 'n/a')))
+
+ for item in results['data']:
+ print("""Port: %s Banner: %s""" % (item['port'], item['data']))
+
+ except shodan.APIError as exception:
+ print('Error: %s' % exception)
+
diff --git a/Shodan/shodan_api_key.py b/Shodan/shodan_api_key.py
new file mode 100644
index 0000000..f87f42b
--- /dev/null
+++ b/Shodan/shodan_api_key.py
@@ -0,0 +1,11 @@
+import os
+
+# Set the Shodan API key as an environment variable
+os.environ['SHODAN_API_KEY'] = 'SET_YOUR_OWN_API_KEY'
+
+# Verify that the environment variable is set correctly
+if 'SHODAN_API_KEY' not in os.environ:
+ print("Error: SHODAN_API_KEY environment variable not set.")
+ exit(1)
+
+print("SHODAN_API_KEY environment variable set successfully.")
diff --git a/Shodan/shodan_api_rest.py b/Shodan/shodan_api_rest.py
new file mode 100644
index 0000000..d8b027e
--- /dev/null
+++ b/Shodan/shodan_api_rest.py
@@ -0,0 +1,27 @@
+import shodan
+import requests
+import os
+
+SHODAN_API_KEY = os.environ['Shodan_api_key']
+api = shodan.Shodan(SHODAN_API_KEY)
+
+domain = 'www.python.org'
+
+dnsResolve = f"https://api.shodan.io/dns/resolve?hostnames={domain}&key={SHODAN_API_KEY}"
+
+try:
+ resolved = requests.get(dnsResolve)
+ hostIP = resolved.json()[domain]
+
+ host = api.host(hostIP)
+ print("IP: %s" % host['ip_str'])
+ print("Organization: %s" % host.get('org', 'n/a'))
+ print("Operating System: %s" % host.get('os', 'n/a'))
+
+
+ for item in host['data']:
+ print("Port: %s" % item['port'])
+ print("Banner: %s" % item['data'])
+
+except shodan.APIError as exception:
+ print('Error: %s' % exception)
diff --git a/Shodan/shodan_info_host.py b/Shodan/shodan_info_host.py
new file mode 100644
index 0000000..e3c5ccf
--- /dev/null
+++ b/Shodan/shodan_info_host.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+import requests
+import os
+
+SHODAN_API_KEY = os.environ['SHODAN_API_KEY']
+ip = '1.1.1.1'
+
+def ShodanInfo(ip):
+ try:
+ result = requests.get(f"https://api.shodan.io/shodan/host/{ip}?key={SHODAN_API_KEY}&minify=True").json()
+ except Exception as exception:
+ result = {"error":"Information not available"}
+ return result
+
+print(ShodanInfo(ip))