;; 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 ;;
5 Cents tip for today [ Portscanner ]
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
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
Correction
** 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 ;;
;; 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 ;;