Importing npm module into Postman

We would like to use additional JS capabilities as part of our postman collections.

  1. How do we import npm modules and 3rd party functions into postman? For example: is-port-reachable module through which we would be able to check all open ports on a remote host, given the IP address (similar to nmap).
  2. If importing 3rd party libraries is not possible, is there a similar functionality in postman? We want to scan all open ports on a remote host.

You can’t import NPM modules into Postman.

Have a look at the following links to see which external libraries are available within the Sandbox.

Postman JavaScript reference | Postman Learning Center

JavaScript libraries — Postman Quick Reference Guide Version 1.9.1 - January 2023 documentation (postman-quick-reference-guide.readthedocs.io)

Adding External Libraries in Postman | Postman Blog

I don’t know about #2. Postman wasn’t built built for security testing. Your better off looking at proper vulnerability scanning software that will tell you about your ports but do a lot more than that. Tenable is the main one that comes to mind, but its expensive. There are cheaper alternatives.

Or just write this in node yourself. You can import whatever libraries you want including chai for assertions, and Mocha for the test library. You can do whatever you want then. If you are already comfortable with node, this is probably the most flexible option.

3 Likes

There’s also this collection that shows different ways of importing external libraries:
https://www.postman.com/postman/workspace/postman-answers/documentation/13455110-7a6c90f0-0062-4089-b206-27c803dc1c37?entity=&branch=&version=

Thanks for the response

Thank you, will look into it.