Skip to content

Commit

Permalink
version 0.1.6 released
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulrajpl committed Jan 18, 2020
1 parent 0c48ad7 commit 83c8c7b
Show file tree
Hide file tree
Showing 25 changed files with 424 additions and 77 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@

This is a commandline tool to find the online presence of a username in popular social media websites like Facebook, Instagram, Twitter, etc.

Development in progress. (As on 18 Jan 2020)


## Installation

Install this tool via following command

`pip install netizenship`

## Usage

Once the tool is installed, run it by executing the command `netizenship`
and then enter the username to search for

## Contribute

Development started on 18 Jan. Present version is at infant stage. All contributions are welcomed.

## License

MIT License

Copyright (c) 2020 Rahul Raj

Read full license [here](./LICENSE)
Read full license [here](./LICENSE)
Binary file added dist/netizenship-0.1.2-py3-none-any.whl
Binary file not shown.
Binary file added dist/netizenship-0.1.2.tar.gz
Binary file not shown.
Binary file added dist/netizenship-0.1.3-py3-none-any.whl
Binary file not shown.
Binary file added dist/netizenship-0.1.3.tar.gz
Binary file not shown.
Binary file added dist/netizenship-0.1.4-py3-none-any.whl
Binary file not shown.
Binary file added dist/netizenship-0.1.4.tar.gz
Binary file not shown.
Binary file added dist/netizenship-0.1.5-py3-none-any.whl
Binary file not shown.
Binary file added dist/netizenship-0.1.5.tar.gz
Binary file not shown.
Binary file added dist/netizenship-0.1.6-py3-none-any.whl
Binary file not shown.
Binary file added dist/netizenship-0.1.6.tar.gz
Binary file not shown.
104 changes: 53 additions & 51 deletions netizenship.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,55 +61,57 @@

}

def get_website_membership(site):
global uname
global websites
url = websites[site]
if not url[:1]=='h':
link = 'https://'+uname+url
else:
link = url+uname
state = "FAIL"

try:
# with eventlet.Timeout(20):
response = requests.get(link)
tag = soup.find(id=response.status_code)
msg = tag.find_parent('dt').text
response.raise_for_status()

except:
print(site.rjust(width), ':', colored(state.ljust(width//2), 'red') , '(Status:', msg, ')')

else:
state = 'SUCCESS'
print(site.rjust(width), ':', colored(state.ljust(width//2), 'green'), '(Status:', msg, ')')


def banner(text, ch='=', length=78):
spaced_text = ' %s ' % text
banner = spaced_text.center(length, ch)
print(banner)

ascii_banner = figlet_format('Netizenship')
print(ascii_banner)
banner_text = "MIT License, Copyright (c) 2020 Rahul Raj"
banner(banner_text)


status_code_html = 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes'
global uname
uname = input("Enter the username: ")
width = 15

page = requests.get(status_code_html)
soup = BeautifulSoup(page.content, 'html.parser')

# with concurrent.futures.ThreadPoolExecutor() as executor:
# executor.map(get_website_membership, list(websites.keys()))

for site in list(websites.keys()):
try:
get_website_membership(site)
except:
pass
def main():

def banner(text, ch='=', length=78):
spaced_text = ' %s ' % text
banner = spaced_text.center(length, ch)
print(banner)

def get_website_membership(site):
global uname
global websites
url = websites[site]
if not url[:1]=='h':
link = 'https://'+uname+url
else:
link = url+uname
state = "FAIL"

try:
# with eventlet.Timeout(20):
response = requests.get(link)
tag = soup.find(id=response.status_code)
msg = tag.find_parent('dt').text
response.raise_for_status()

except:
print(site.rjust(width), ':', colored(state.ljust(width//2), 'red') , '(Status:', msg, ')')

else:
state = 'SUCCESS'
print(site.rjust(width), ':', colored(state.ljust(width//2), 'green'), '(Status:', msg, ')')

ascii_banner = figlet_format('Netizenship')
print(ascii_banner)
banner_text = "MIT License, Copyright (c) 2020 Rahul Raj"
banner(banner_text)

status_code_html = 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes'
global uname
uname = input("Enter the username: ")
width = 15

page = requests.get(status_code_html)
soup = BeautifulSoup(page.content, 'html.parser')

with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
try:
executor.map(get_website_membership, list(websites.keys()), timeout=5)
except:
print('Exception occured, skipping')
pass

if __name__ == '__main__':
main()
135 changes: 135 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.poetry]
name = "netizenship"
version = "0.1.6"
description = "Tool to check the username with popular websites for membership"
authors = ["Rahul Raj <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.7"
requests = "^2.22.0"
beautifulsoup4 = "^4.8.2"
pyfiglet = "^0.8.post1"
termcolor = "^1.1.0"

[tool.poetry.dev-dependencies]

[tool.poetry.scripts]
netizenship = 'netizenship:main'
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

22 changes: 22 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import setuptools

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="netizenship-rahulrajpl", # Replace with your own username
version="0.0.1",
author="Rahul Raj",
author_email="[email protected]",
description="Tool for checking online presence, given a username",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/pypa/sampleproject",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
24 changes: 0 additions & 24 deletions snap/snapcraft.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions venv/bin/netizenship
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/media/rahul/685a0b20-7575-47d9-8748-a731e2cc8892/rahul/code/netizenship/venv/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from netizenship import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Rahul Raj

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Metadata-Version: 2.1
Name: netizenship
Version: 0.1.6
Summary: Tool to check the username with popular websites for membership
Author: Rahul Raj
Author-email: [email protected]
Requires-Python: >=3.7,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Dist: beautifulsoup4 (>=4.8.2,<5.0.0)
Requires-Dist: pyfiglet (>=0.8.post1,<0.9)
Requires-Dist: requests (>=2.22.0,<3.0.0)
Requires-Dist: termcolor (>=1.1.0,<2.0.0)
Loading

0 comments on commit 83c8c7b

Please sign in to comment.