Skip to content

Commit

Permalink
templateize
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jun 20, 2018
1 parent b32151c commit 02dac9a
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 87 deletions.
7 changes: 2 additions & 5 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ clone_depth: 3
before_build:
- cmd: set PATH=%PY_DIR%;%PY_DIR%\Scripts;%PATH%

build_script:
- python --version
- pip install -e .[tests]
build_script: pip install -e .[tests]

after_build:
- python findssh.py
after_build: pytest -sv

16 changes: 16 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[run]
cover_pylib = false
omit =
/home/travis/virtualenv/*

[report]
exclude_lines =
pragma: no cover
def __repr__
RuntimeError
NotImplementedError
ImportError
KeyError
FileNotFoundError
logging.warning

6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ git:
install: pip -q install -e .[tests]

script:
- python findssh.py
- mypy findssh.py
- pytest -sv
- mypy . --ignore-missing-imports
- flake8


after_success:
- if [[ $TRAVIS_PYTHON_VERSION == 3.6* ]]; then
coverage run findssh.py;
coverage run tests/test_all.py;
coveralls;
fi
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[![Travis-CI status](https://travis-ci.org/scivision/findssh.svg?branch=master)](https://travis-ci.org/scivision/findssh)
[![Coverage percent](https://coveralls.io/repos/github/scivision/findssh/badge.svg?branch=master)](https://coveralls.io/github/scivision/findssh?branch=master)
[![AppVeyor-CI status](https://ci.appveyor.com/api/projects/status/pk5ebkekh0u4q90t?svg=true)](https://ci.appveyor.com/project/scivision/findssh)
[![PyPi versions](https://img.shields.io/pypi/pyversions/findssh.svg)](https://pypi.python.org/pypi/findssh)
[![PyPi format](https://img.shields.io/pypi/format/findssh.svg)](https://pypi.python.org/pypi/findssh)
[![Maintainability](https://api.codeclimate.com/v1/badges/c7409d3c78d12c3df14b/maintainability)](https://codeclimate.com/github/scivision/findssh/maintainability)
[![PyPi Download stats](http://pepy.tech/badge/findssh)](http://pepy.tech/project/findssh)

# Find SSH servers (without NMAP)

Platform-independent **Python ≥ 3.6** script that finds SSH servers (or other services with open ports) on an IPv4 subnet, WITHOUT NMAP.
Scans entire IPv4 subnet in less than 1 second using 100 threads via Python standard library
[concurrent.futures](https://docs.python.org/3/library/concurrent.futures.html).

## Install

Just run `findssh.py` directly.
To allow use from other programs, you can install by:

pip install findssh

or from this repo:

pip install -e .


## Usage

findssh

or from within Python

```python
import findssh

findssh.run()
```

### Command line options

* `-s` check the string from the server to attempt to verify the correct service has been found
* `-t` timeout per server (seconds) useful for high latency connection
* `-b` baseip (check other subnet besides your own)
* `-p` network port to scan (default 22)
75 changes: 0 additions & 75 deletions README.rst

This file was deleted.

6 changes: 5 additions & 1 deletion findssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def scanhosts(net: ip.IPv4Network,
return servers


if __name__ == '__main__':
def main():
from argparse import ArgumentParser
p = ArgumentParser('scan for hosts with open port, without NMAP')
p.add_argument('-p', '--port', help='single port to try',
Expand All @@ -175,3 +175,7 @@ def scanhosts(net: ip.IPv4Network,
P = p.parse_args()

run(P.port, P.service, P.timeout, P.baseip, P.debug)


if __name__ == '__main__':
main()
7 changes: 7 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 132
exclude = .git,__pycache__,doc/,docs/,build/,dist/,archive/

[metadata]
description-file = README.md

10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
install_requires = []
from typing import List

install_requires: List[str] = []
tests_require = ['pytest', 'coveralls', 'flake8', 'mypy']
# %%

setup(name='findssh',
packages=find_packages(),
version='1.0.5',
version='1.0.6',
author='Michael Hirsch, Ph.D.',
url='https://github.com/scivision/findssh',
long_description=open('README.rst').read(),
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
description='find open servers on your IPv4 subnet, e.g. SSH.',
install_requires=install_requires,
tests_require=tests_require,
Expand All @@ -27,6 +30,7 @@
'Topic :: System :: Networking',
'Topic :: Utilities',
],
entry_points={'console_scripts': ['findssh = findssh:main']},
scripts=['findssh.py'],
include_package_data=True,
)

0 comments on commit 02dac9a

Please sign in to comment.