Skip to content

Python dictionaries for HTTP status codes, FTP return codes and TCP ports, etc

Notifications You must be signed in to change notification settings

veerendra2/port-dictionaries

Repository files navigation

GitHub stars GitHub forks

Python Dictionaries

Simple python dictionaries for HTTP, FTP return codes and TCP ports, etc. Usefull when code throws number(HTTP return code), instead of diplaying return code number like 404, show message what it means.

In same way, when we are doing some networking stuff in python like collecting network connections, with help of TCPPorts.py we can identify destination service in it. For example, we have collected network connections(with tools like conntrack),the current machine made connection to another machine with destination port 80 which means a web server. Some we can guess like 80,8080 and some we dont know, with TCPPorts.py we can display the service name instead of port number.

Example code snippet

import requests
#Local Imports
import HTTPStatusCodes

headers = {'content-type': 'application/json'}
url="http://www.google.com" #Example URL
data={"data":"Your Data"}
response = requests.post(url, data=data,headers=headers)
print response
if response.status_code in HTTPStatusCodes.codes:
   print HTTPStatusCodes.codes[response.status_code][0]
   print "Description",HTTPStatusCodes.codes[response.status_code][1]

About

Python dictionaries for HTTP status codes, FTP return codes and TCP ports, etc

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages