├── .gitignore ├── .vscode └── settings.json ├── Dockerfile ├── LICENSE ├── README.md ├── SECURITY.md ├── is_wordpress ├── __init__.py ├── cli.py ├── get_requests.py ├── parser.py └── run.py ├── requirements-develop.txt ├── requirements.txt └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | #venv 2 | venv 3 | venv/* 4 | .dist 5 | .dist/* 6 | .vscode 7 | .vscode/* 8 | !.vscode/settings.json 9 | !.vscode/tasks.json 10 | !.vscode/launch.json 11 | !.vscode/extensions.json 12 | tempCodeRunnerFile.py 13 | # Byte-compiled / optimized / DLL files 14 | __pycache__/ 15 | *.py[cod] 16 | *$py.class 17 | 18 | # C extensions 19 | *.so 20 | 21 | # Distribution / packaging 22 | .Python 23 | build/ 24 | develop-eggs/ 25 | dist/ 26 | downloads/ 27 | eggs/ 28 | .eggs/ 29 | lib/ 30 | lib64/ 31 | parts/ 32 | sdist/ 33 | var/ 34 | wheels/ 35 | pip-wheel-metadata/ 36 | share/python-wheels/ 37 | *.egg-info/ 38 | .installed.cfg 39 | *.egg 40 | MANIFEST 41 | 42 | # PyInstaller 43 | # Usually these files are written by a python script from a template 44 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 45 | *.manifest 46 | *.spec 47 | 48 | # Installer logs 49 | pip-log.txt 50 | pip-delete-this-directory.txt 51 | 52 | # Unit test / coverage reports 53 | htmlcov/ 54 | .tox/ 55 | .nox/ 56 | .coverage 57 | .coverage.* 58 | .cache 59 | nosetests.xml 60 | coverage.xml 61 | *.cover 62 | .hypothesis/ 63 | .pytest_cache/ 64 | 65 | # Translations 66 | *.mo 67 | *.pot 68 | 69 | # Django stuff: 70 | *.log 71 | local_settings.py 72 | db.sqlite3 73 | 74 | # Flask stuff: 75 | instance/ 76 | .webassets-cache 77 | 78 | # Scrapy stuff: 79 | .scrapy 80 | 81 | # Sphinx documentation 82 | docs/_build/ 83 | 84 | # PyBuilder 85 | target/ 86 | 87 | # Jupyter Notebook 88 | .ipynb_checkpoints 89 | 90 | # IPython 91 | profile_default/ 92 | ipython_config.py 93 | 94 | # pyenv 95 | .python-version 96 | 97 | # celery beat schedule file 98 | celerybeat-schedule 99 | 100 | # SageMath parsed files 101 | *.sage.py 102 | 103 | # Environments 104 | .env 105 | .venv 106 | env/ 107 | venv/ 108 | ENV/ 109 | env.bak/ 110 | venv.bak/ 111 | 112 | # Spyder project settings 113 | .spyderproject 114 | .spyproject 115 | 116 | # Rope project settings 117 | .ropeproject 118 | 119 | # mkdocs documentation 120 | /site 121 | 122 | # mypy 123 | .mypy_cache/ 124 | .dmypy.json 125 | dmypy.json 126 | 127 | # Pyre type checker 128 | .pyre/ 129 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.pythonPath": "venv/bin/python", 3 | "python.linting.enabled": true 4 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | FROM python:3.7-alpine as build 3 | RUN pip install is-wordpress 4 | 5 | ENTRYPOINT ["is_wordpress"] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 amirhossein 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 7 | # is_wordpress 8 | A simple (or useless) Program to check if a website is based on wordpress or not and if it's on wordpress which version does it use. 9 | 10 | # Installing 11 | ``` pip install is-wordpress``` 12 | 13 | # Usage 14 | ``` 15 | usage: main.py [-h] url 16 | 17 | Check if selected website is based on wordpress or not.It also show the 18 | wordpress version. 19 | 20 | positional arguments: 21 | url URL to check the website. 22 | 23 | optional arguments: 24 | -h, --help show this help message and exit 25 | ``` 26 | 27 | ## Docker usage 28 | Build docker image 29 | ``` 30 | $ docker build -t is_wordpress . 31 | ``` 32 | Now you can simply invoke `is_wordpress` by: 33 | ``` 34 | $ docker run --rm is_wordpress goodarzi.net 35 | ``` 36 | 37 | Or simply run it by **docker hub** 38 | ``` 39 | $ docker run theyahya/is_wordpress goodarzi.net 40 | ``` 41 | ## Example 42 | ``` 43 | $ is_wordpress goodarzi.net 44 | WordPress 4.9.8 45 | ``` 46 | # Contribution 47 | Feel free to fork and fix problems. PRs are welcome. :heart: 48 | 49 | # Issues 50 | Use Issues section to report any problem. 51 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /is_wordpress/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 amirhossein 2 | # 3 | # This software is released under the MIT License. 4 | # https://opensource.org/licenses/MIT 5 | 6 | -------------------------------------------------------------------------------- /is_wordpress/cli.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 amirhossein 2 | # 3 | # This software is released under the MIT License. 4 | # https://opensource.org/licenses/MIT 5 | from . import run 6 | def main(): 7 | print(run.run()) -------------------------------------------------------------------------------- /is_wordpress/get_requests.py: -------------------------------------------------------------------------------- 1 | import requests 2 | def get_page_requests(url): 3 | if (url.startswith('http')): 4 | pass 5 | else: 6 | url = 'http://'+url 7 | page_code = requests.get(url) 8 | return page_code.text -------------------------------------------------------------------------------- /is_wordpress/parser.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import re 3 | def parse_data(req): 4 | soup = BeautifulSoup(req, 'html.parser') 5 | for tags in soup.find_all("meta"): 6 | if (tags.get("name", None) == 'generator'): 7 | return tags.get("content", None) 8 | -------------------------------------------------------------------------------- /is_wordpress/run.py: -------------------------------------------------------------------------------- 1 | from . import get_requests, parser 2 | import sys 3 | import argparse 4 | import re 5 | def run(): 6 | argparser = argparse.ArgumentParser(description='Check if selected website is based on wordpress or not.It also show the wordpress version.') 7 | argparser.add_argument("url", help='URL to check the website.') 8 | args = argparser.parse_args() 9 | website = get_requests.get_page_requests(args.url) 10 | if parser.parse_data(website) == None: 11 | return "It's not wordpress or cannot identified" 12 | if (re.findall('^WordPress.*', parser.parse_data(website))): 13 | return parser.parse_data(website) 14 | -------------------------------------------------------------------------------- /requirements-develop.txt: -------------------------------------------------------------------------------- 1 | astroid==2.1.0 2 | beautifulsoup4==4.7.1 3 | bs4==0.0.1 4 | certifi==2018.11.29 5 | chardet==3.0.4 6 | idna==2.8 7 | isort==4.3.4 8 | lazy-object-proxy==1.3.1 9 | mccabe==0.6.1 10 | pkg-resources==0.0.0 11 | pylint==2.2.2 12 | requests==2.21.0 13 | six==1.12.0 14 | soupsieve==1.7.3 15 | typed-ast==1.3.2 16 | urllib3==1.26.5 17 | wrapt==1.11.1 18 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.7.1 2 | bs4==0.0.1 3 | certifi==2018.11.29 4 | chardet==3.0.4 5 | idna==2.8 6 | requests==2.21.0 7 | soupsieve==1.7.3 8 | urllib3==1.26.5 9 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 amirhossein 2 | # 3 | # This software is released under the MIT License. 4 | # https://opensource.org/licenses/MIT 5 | 6 | import setuptools 7 | import os 8 | thelibFolder = os.path.dirname(os.path.realpath(__file__)) 9 | requirementPath = thelibFolder + '/requirements.txt' 10 | install_requires = [] 11 | if os.path.isfile(requirementPath): 12 | with open(requirementPath) as f: 13 | install_requires = f.read().splitlines() 14 | 15 | with open("README.md", "r") as fh: 16 | long_description = fh.read() 17 | 18 | setuptools.setup( 19 | name="is_wordpress", 20 | version="0.0.2", 21 | author="AmirHossein Goodarzi", 22 | author_email="amir@goodarzi.net", 23 | description="A simple (or useless) Program to check if a website is based on wordpress or not and if it's on wordpress which version does it use.", 24 | long_description=long_description, 25 | long_description_content_type="text/markdown", 26 | url="https://github.com/numb95/is_wordpress", 27 | download_url='https://github.com/numb95/is_wordpress/archive/0.0.2.tar.gz', 28 | packages=setuptools.find_packages(), 29 | classifiers=[ 30 | "Programming Language :: Python :: 3", 31 | "License :: OSI Approved :: MIT License", 32 | "Operating System :: OS Independent", 33 | ], 34 | entry_points = { 35 | 'console_scripts': ['is_wordpress=is_wordpress.cli:main'], 36 | },install_requires=install_requires, 37 | ) --------------------------------------------------------------------------------