;; Quick and dirty portscanner on tcp
;; because there is no timeout regulation for remote portsscan
;; it could take ages to return nil or true
;; the timeout depends on the remote tcp socket behaviour.
;;
(define (scan host startport endport )
(set 'cnt startport )
(until (> cnt endport)
(println "Scanning - " host " -")
(if (set 'scanned (net-connect host cnt ))
(begin
(println "port :" cnt " -> open")
(net-close scanned)))
(inc 'cnt))
)
(scan "remote.host" 4000 5500)
(exit)
;; eof ;;
Thanks, works great - with your permission can I put this in th 'Tips&Tricks' section on http://newlisp.org/news/ ?
I can put 'Contributed by Norman ???' on it but would need your last name, or if you prefer you can stay anonymous or only with your first name?
Lutz
Hello Lutz,
A nice, yes please use it as an example or tip,
just put my first name with it ;-) I have too many hits on my last name ;-)
Enjoy the examples...
Norman..
** correct version **
;; Quick and dirty portscanner on tcp
;; because there is no timeout regulation for remote portsscan is could
;; take ages
;; to return nil or true, the timeout depends on the remote tcp socket
;; behaviour.
;;
(define (scan host startport endport )
(set 'cnt startport )
(println "Scanning - " host " -")
(until (> cnt endport)
(if (set 'scanned (net-connect host cnt ))
(begin
(println "port :" cnt " -> open")
(net-close scanned)))
(inc 'cnt))
)
(scan "some.host" 4000 5500)
(exit)
;; eof ;;