{ "info": { "author": "imlonghao", "author_email": "shield@fastmail.com", "bugtrack_url": null, "classifiers": [], "description": "# portstat \n\n![](https://badge.fury.io/py/portstat.svg) ![](https://travis-ci.org/imlonghao/portstat.svg) ![](https://landscape.io/github/imlonghao/portstat/master/landscape.svg?style=flat)\n\nA simple port traffic monitor\n\n## Install\n\n### Install pip\n\nFor Debian / Ubunut user\n\n```\napt-get update\napt-get install python-pip\n```\n\n### Install portstat\n\n```\npip install portstat\n```\n\n### System setting\n\nAdd the following line to `/etc/rc.local` to run portstat on the startup.\n\nNotice that add it before `exit 0` .\n\n```\n/sbin/iptables -N PORTSTAT\n/sbin/iptables -A INPUT -j PORTSTAT\n/sbin/iptables -A OUTPUT -j PORTSTAT\n/bin/bash /etc/portstat.rules\n```\n\nTo upload the traffic information every minute, we should add the following line in `crontab -e`\n\n```\n* * * * * /usr/local/bin/portstat -u\n```\n\nRun it every 5 minutes like the following\n\n```\n*/5 * * * * /usr/local/bin/portstat -u\n```\n\nTo activate the new iptables rules, please run the `/sbin/iptables` command manually or issue a `reboot` command.\n\nAfter that, you have installed portstat successfully.\n\n## Upgrade\n\nEvery new version I will upload it to pypi so that you can upgrade to the latest version with the following code.\n\n```\npip install -U portstat\n```\n\nFor some unexpectable reason, I can NOT promise that you can upgrade to the latest version without change your settings.\n\nSo, please come back to see what's new at every upgrade.\n\n## Usage\n\n```\nusage: portstat [-h] [-c CONFIG] [-v | -s | -u]\n\nA simple port traffic monitor\n\noptional arguments:\n -h, --help show this help message and exit\n -c CONFIG, --config CONFIG\n Path of the config file.\n -v, --version Show portstat version.\n -s, --sync Sync the portstat settings and iptables.\n -u, --upload Upload the port stat with webhook.\n```\n\n## Tutorial\n\nFirst of all, you should install portstat as I mentioned above.\n\nCreate a conf in where you like, by default the path is `/etc/portstat.conf`, just remenber use `-c path` to declare the config file if you don't use the default path.\nThe conf file should looks like that:\n\n```\n[imlonghao]\nPort=80\nWebhook=https://imlonghao.com/?imlonghao\n\n[shadowsocks]\nPort=10000-10010\nWebhook=https://imlonghao.com/?shadowsocks\n\n[test]\nPort=22,111,8080\nWebhook=https://imlonghao.com/?test\n```\n\n`[name]` used to distinguish every port you want to monitor.\n \n`Port=111` used to declare the port you want to monitor, it should be a int like `111` , or a range like `10000-10010`, or `80,81,8080,8888` .\n\n`Webhook=https://imlonghao.com/` used to received the traffic information, portstat will post the information to the webhook like that\n\n![](https://cloud.githubusercontent.com/assets/4951333/8232820/24432094-1605-11e5-9534-5fc9362d1626.png)\n\nThen, save the config file.\n\nRun `portstat -s` to create new iptables rules to monitor the port you just add.\n\nRun `portstat -u` to upload to port traffic information to webhook manually.\n\n## Contribution\n\n- [Issue](https://github.com/imlonghao/portstat/issues)\n- [Pull Request](https://github.com/imlonghao/portstat/pulls)\n\n## License\n\nLicensed under the Apache License, Version 2.0", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/imlonghao/portstat", "keywords": "port,monitor,traffic", "license": "Apache License 2.0", "maintainer": null, "maintainer_email": null, "name": "portstat", "package_url": "https://pypi.org/project/portstat/", "platform": "any", "project_url": "https://pypi.org/project/portstat/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/imlonghao/portstat" }, "release_url": "https://pypi.org/project/portstat/0.0.6/", "requires_dist": null, "requires_python": null, "summary": "A simple port traffic monitor", "version": "0.0.6" }, "last_serial": 1931861, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "cd6dc441a35f23c4620e7b6a6dc1081f", "sha256": "937efd9513487d34af973de6b7f159a8d9794109d9bf17e377d7c95cf8eed64d" }, "downloads": -1, "filename": "portstat-0.0.1.tar.gz", "has_sig": false, "md5_digest": "cd6dc441a35f23c4620e7b6a6dc1081f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2066, "upload_time": "2015-06-18T11:44:51", "url": "https://files.pythonhosted.org/packages/ec/2f/230f46b529c39e5ca5e48d81469a6e7f4168102c44cfa888d75c00667b8b/portstat-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "899122010ab7f2ad333625280459195a", "sha256": "a40a7ff3583937a5f01155a433500387b3f0ac7faa209ca32a41441abd527c4e" }, "downloads": -1, "filename": "portstat-0.0.2.zip", "has_sig": false, "md5_digest": "899122010ab7f2ad333625280459195a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11955, "upload_time": "2015-06-19T06:49:21", "url": "https://files.pythonhosted.org/packages/8a/d2/92f0b0f0c9ca622d477af1003a88910217f2303a007c31166bfe579679ce/portstat-0.0.2.zip" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "df78e171f5bd73a75a2989453be9adb3", "sha256": "ac63ad1adea5e230e9e6d7e306ad0110eeb990a5e4ee9d436cee76a54393a809" }, "downloads": -1, "filename": "portstat-0.0.3.tar.gz", "has_sig": false, "md5_digest": "df78e171f5bd73a75a2989453be9adb3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7901, "upload_time": "2015-06-19T16:04:53", "url": "https://files.pythonhosted.org/packages/2d/24/11c07cf4f2f4e55d4b17b0c0c2c5d8c30c17c853a1596c39cdc445ed0432/portstat-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "ca05b82d39f22a516e36cdd122aac72e", "sha256": "d46f7970ba14dadc9175b2c70fa7dafcc65c12bc14442e0cfcacbe218892bc59" }, "downloads": -1, "filename": "portstat-0.0.4.tar.gz", "has_sig": false, "md5_digest": "ca05b82d39f22a516e36cdd122aac72e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7907, "upload_time": "2015-07-01T13:14:34", "url": "https://files.pythonhosted.org/packages/de/bd/c56db371fbb10998392b09b2816d62343374276d7a17ca82161cdbe3d176/portstat-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "dd5508674b9905221e78c66abea520f3", "sha256": "f1275686f1924c2e67df646fd18448fcd12602b628be861cf326127bb9387183" }, "downloads": -1, "filename": "portstat-0.0.5.tar.gz", "has_sig": false, "md5_digest": "dd5508674b9905221e78c66abea520f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7956, "upload_time": "2015-08-14T12:48:17", "url": "https://files.pythonhosted.org/packages/02/a7/34695d33d87982ee8f7f6f4703d91ee5bbf7e93c4dbbeb4f50e06cfff5ca/portstat-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "4cbb36c524f2cbbfa68ca37ad3830b36", "sha256": "4bf472eff4079ff8d475bb765280f8422f975c6bb5870808881499b2734517ca" }, "downloads": -1, "filename": "portstat-0.0.6.tar.gz", "has_sig": false, "md5_digest": "4cbb36c524f2cbbfa68ca37ad3830b36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7958, "upload_time": "2015-08-14T12:58:41", "url": "https://files.pythonhosted.org/packages/4e/72/a15d4e7f51bf3815adae3b1235f57256076e77770ffbd2f61a70dae67cf0/portstat-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4cbb36c524f2cbbfa68ca37ad3830b36", "sha256": "4bf472eff4079ff8d475bb765280f8422f975c6bb5870808881499b2734517ca" }, "downloads": -1, "filename": "portstat-0.0.6.tar.gz", "has_sig": false, "md5_digest": "4cbb36c524f2cbbfa68ca37ad3830b36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7958, "upload_time": "2015-08-14T12:58:41", "url": "https://files.pythonhosted.org/packages/4e/72/a15d4e7f51bf3815adae3b1235f57256076e77770ffbd2f61a70dae67cf0/portstat-0.0.6.tar.gz" } ] }