Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to support Python3 #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ pip install shodan
[Licenced under the WTFPL](http://wtfpl.net)

## Beer
All beer donations can go to 1F3sPdKSEL9mM8LBnymGG8Dv3QCPDSRYeh ;)
Don't donate anything to me, buy someone you don't know a beer next time you go out
39 changes: 20 additions & 19 deletions shodankeys.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
#!/usr/bin/python2
#!/usr/bin/python3
# coding: utf-8
# Quick script I wrote for sorting and categorizing Shodan API
# keys 'borrowed' en masse from Github.
# The reason for discerning between paid and unpaid keys, is we
# can do more with a paid key, so its best to not burn those on
# just blasting out queries all day erry day.
#
# Author: skyhighatrist \ @dailydavedavids \ 0x27.me
# Licence: WTFPL \ http://wtfpl.net
# BTC: 1F3sPdKSEL9mM8LBnymGG8Dv3QCPDSRYeh
# Ver: 05102015.1
# https://github.com/0x27
# Forked and updated from: https://github.com/0x27/shodan_key_checker

import shodan
import sys
import crayons

def test(key):
api = shodan.Shodan(key)
print "{+} Testing Key: %s" %(key)
print("{+} Testing Key: %s" %(key))
try:
info = api.info()
except Exception:
print "{-} Key %s is invalid!" %(key)
print(crayons.red(f"[-] Key {key} is invalid!"))
return False,False
if info['plan'] == 'dev' or info['plan'] == 'edu': #this seems to be how they are categorized
print "{+} Key %s appears to be valid, and bonus, paid!" %(key)
print(crayons.green(f"[+] Key {key} appears to be valid, and bonus, paid!"))
return True,True
elif info['plan'] == 'oss': # however I might be wrong. oh well.
print "{*} Key %s appears to be valid! Not paid for though!" %(key)
print(crayons.cyan(f"[*] Key {key} appears to be valid! Not paid for though!"))
return True,False


Expand All @@ -49,15 +47,18 @@ def main(args):
comm_keys.append(key)
else:
pass
print "\n\n{+} Acquired %d valid keys" %(len(valid_keys))
print "{+} Acquired %d paid-keys" %(len(paid_keys))
print "{+} Acquired %d community-keys" %(len(comm_keys))
print "\n{+} Paid Keys..."
for key in paid_keys:
print key
print "\n{+}Community Keys..."
for key in comm_keys:
print key
if len(valid_keys) > 0:
print (f"\n\n[+] Acquired {len(valid_keys)} valid keys")
print (crayons.green(f"[+] Acquired {len(paid_keys)} paid-keys"))
print (crayons.cyan(f"[+] Acquired {len(comm_keys)} community-keys"))
print ("\n{+} Paid Keys...")
for key in paid_keys:
print (key)
print ("\n{+}Community Keys...")
for key in comm_keys:
print (key)
else:
print (f"\n\n[-] Zero valid keys acquired (._.)")


if __name__ == "__main__":
Expand Down