I need a way to check what service a port is running in python, thanks for the help in advance.
joehms22 18 Junior Poster
Recommended Answers
Jump to Postif you know how to do it from CLI then try subprocess
Jump to PostIf you're just doing this for yourself and are not too concerned about efficiency, this should suffice:
from socket import * if __name__ == '__main__': target = "localhost" targetIP = gethostbyname(target) print 'Starting scan on host ', targetIP #scan reserved ports for i in range(20, 1025): s …
Jump to PostI'm not sure this is possible, but I have had some results with the following:
port = 80 proto = getservbyport(portnum) print proto
I'm not quite sure why it returns "www", I would expect "http", but maybe Python has a way of translating it. You might have …
All 10 Replies
nezachem 616 Practically a Posting Shark
Stefano Mtangoo 455 Senior Poster
ShadyTyrant 2 Junior Poster
joehms22 18 Junior Poster
joehms22 18 Junior Poster
SoulMazer 26 Posting Whiz in Training
nezachem 616 Practically a Posting Shark
joehms22 18 Junior Poster
nezachem 616 Practically a Posting Shark
SoulMazer 26 Posting Whiz in Training
joehms22 commented: This is exactly what I needed. +1
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.