{"id":18332101,"url":"https://github.com/oneoffcoder/pyip","last_synced_at":"2025-04-06T03:33:34.256Z","repository":{"id":76214818,"uuid":"201859769","full_name":"oneoffcoder/pyip","owner":"oneoffcoder","description":"External IP locator using Python for Linux and Windows","archived":false,"fork":false,"pushed_at":"2019-10-14T01:33:05.000Z","size":11,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T16:21:20.379Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oneoffcoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-12T04:49:25.000Z","updated_at":"2021-01-18T22:24:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b3e8e6a-eb60-4f5e-898f-bc7feb22571e","html_url":"https://github.com/oneoffcoder/pyip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneoffcoder%2Fpyip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneoffcoder%2Fpyip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneoffcoder%2Fpyip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneoffcoder%2Fpyip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oneoffcoder","download_url":"https://codeload.github.com/oneoffcoder/pyip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430838,"owners_count":20937873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T19:37:22.330Z","updated_at":"2025-04-06T03:33:34.247Z","avatar_url":"https://github.com/oneoffcoder.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![One-Off Coder Logo](/logo.png \"One-Off Coder\")\n\n# Intro\n\nA simple Python program that may be used as a service for Linux and Windows to get your external (public) IP and send it to yourself. Use at your own risk as password parameter for the email account being used has to be passed in unencrypted. The following is a printout of the help.\n\n```\nusage: IP Locator [-h] [-u URL] [-m MAX_EMAILS] [-s SLEEP] -e EMAIL -p\n                  PASSWORD [--subject SUBJECT] [--version]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -u URL, --url URL     the URL of the site to get your external IP (default: https://myexternalip.com/raw)\n                            Other sites that may work.\n                                - https://www.ipchicken.com\n                                - https://myexternalip.com/raw\n                            \n  -m MAX_EMAILS, --max_emails MAX_EMAILS\n                        maximum emails; set to -1 for indefinite (default: -1)\n  -s SLEEP, --sleep SLEEP\n                        seconds between checking/sending IP in email (default: 3600)\n  -e EMAIL, --email EMAIL\n                        gmail email address\n  -p PASSWORD, --password PASSWORD\n                        gmail email password\n  --subject SUBJECT     email subject line modifier (default: IP Address)\n  --version             show program's version number and exit\n\nOne-Off Coder, http://www.oneoffcoder.com\n```\n\nNote that only the email `-e` and password `-p` are required, and that this program has only been tested against a `gmail` account. A quick and dirty example of using this program is as follows (of course, substitute the email and password values with your own).\n\n```bash\npython ip.py -e alan.turing@gmail.com -p codebreaker\n```\n\n# Installation\n\n## CentOS Linux\n\n```bash\n# copy python file\nsudo cp ip.py /usr/bin\nsudo chmod 600 /usr/bin/ip.py\n\n# copy service file\n# make sure you modify ExecStart with the appropriate email and password\n# make sure the path to python is absolute e.g. /home/super/anaconda3/bin/python\nsudo cp pyip.service /lib/systemd/system\nsudo nano /lib/systemd/system/pyip.service\nsudo chmod 600 /lib/systemd/system/pyip.service \n\n# to enable, start, stop, etc.. the service\nsudo systemctl daemon-reload\nsudo systemctl enable pyip.service\nsudo systemctl start pyip.service\nsudo systemctl status pyip.service\nsudo systemctl stop pyip.service\nsudo systemctl restart pyip.service\n```\n\n## Windows\n\nOn Windows, use the [sc command](https://docs.microsoft.com/en-us/windows/win32/services/controlling-a-service-using-sc).\n\n```bash\nsc create PyIP binPath=\"C:\\ProgramData\\Anaconda3\\python.exe C:\\dev\\ip.py -e alan.turing@gmail.com -p codebreaker\"\nsc start PyIP\nsc delete PyIP\n```\n\n# References\n\n* https://tecadmin.net/setup-autorun-python-script-using-systemd/\n* https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/sc-create\n* https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/sc-delete\n* https://datatofish.com/python-script-windows-scheduler/\n* https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units\n* https://askubuntu.com/questions/814174/cannot-make-a-systemd-script-run\n\n# Citation\n\n```\n@misc{oneoffcoder_ip_locator_2019, \ntitle={External IP locator using Python for Linux and Windows}, \nurl={https://github.com/oneoffcoder/pyip}, \njournal={GitHub},\nauthor={One-Off Coder}, \nyear={2019}, \nmonth={Aug}}\n```\n\n# Copyright Stuff\n\n```\nCopyright 2019 One-Off Coder\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n# Contact\n\n[One-Off Coder](https://cloud.docker.com/u/oneoffcoder/) \n* [Website](https://www.oneoffcoder.com)\n* [Twitter](https://twitter.com/oneoffcoder)\n* [Facebook](https://www.facebook.com/oneoffcoder)\n* [YouTube](https://www.youtube.com/channel/UCCCv8Glpb2dq2mhUj5mcHCQ)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneoffcoder%2Fpyip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foneoffcoder%2Fpyip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneoffcoder%2Fpyip/lists"}