-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
55 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
function findssh(port, service, timeout, baseip) | ||
%% FINDSSH find SSH or other servers on an IPv4 subnet | ||
% | ||
% must first do one-time install in Python 3.6 from Terminal: | ||
% pip install -e . | ||
% | ||
% example (find all SSH servers on IPv4 subnet on Port 22): | ||
% findssh() | ||
|
||
assert(~verLessThan('matlab', '8.4'), 'Matlab >= R2014b required') | ||
|
||
if nargin < 1, port=22; end | ||
if nargin < 2, service = ''; end | ||
if nargin < 3, timeout = 0.1; end | ||
if nargin < 4, baseip = ''; end | ||
|
||
|
||
validateattributes(port, {'numeric'}, {'integer', 'nonnegative'}) | ||
validateattributes(service, {'string', 'char'}, {'scalartext'}) | ||
validateattributes(timeout, {'numeric'}, {'real', 'nonnegative'}) | ||
validateattributes(baseip, {'string', 'char'}, {'scalartext'}) | ||
|
||
% Matlab R2018b didn't like ThreadPoolExectutor | ||
servers = py.findssh.run(uint16(port), service, timeout, baseip, true); | ||
|
||
hosts = cellfun(@char, cell(servers), 'uniformoutput', false); | ||
disp(hosts) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters