Skip to content

Commit

Permalink
Registration routes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristineKarimi committed May 21, 2018
1 parent cdc2ce6 commit efc7e31
Show file tree
Hide file tree
Showing 180 changed files with 6,468 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"python.pythonPath": "${workspaceFolder}/virtual/bin/python"
"python.pythonPath": "${workspaceFolder}/virtual/bin/python",
"python.linting.enabled": false
}
Binary file modified carpool/__pycache__/urls.cpython-36.pyc
Binary file not shown.
13 changes: 11 additions & 2 deletions carpool/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.conf.urls import url,include
from django.contrib import admin
# from . import views
from django.contrib.auth import views as view
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
url(r'^admin/', admin.site.urls),
]
# url(r'^$', views.index, name = 'index'),
url(r'^accounts/', include('registration.backends.simple.urls')),
# url(r'^logout/$', view.logout, {"next_page": '/'}),
# url(r'^driver/', include('driver.urls')),
# url(r'^rider/', include('passenger.urls')),
]
11 changes: 11 additions & 0 deletions virtual/bin/confusable_homoglyphs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/home/karimi/Documents/core-projects/carpool/virtual/bin/python3.6

# -*- coding: utf-8 -*-
import re
import sys

from confusable_homoglyphs.cli import cli

if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(cli())
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,125 @@
Metadata-Version: 2.1
Name: confusable-homoglyphs
Version: 3.1.1
Summary: Detect confusable usage of unicode homoglyphs, prevent homograph attacks.
Home-page: https://github.com/vhf/confusable_homoglyphs
Author: Victor Felder
Author-email: [email protected]
License: MIT
Keywords: confusable,homoglyph,attack,homograph,unicode,spoofing
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Text Processing
Classifier: Topic :: Utilities
Provides-Extra: cli
Provides-Extra: cli
Requires-Dist: click; extra == 'cli'

confusable_homoglyphs `[doc] <http://confusable-homoglyphs.readthedocs.io/en/latest/>`__
========================================================================================

.. image:: https://img.shields.io/travis/vhf/confusable_homoglyphs.svg
:target: https://travis-ci.org/vhf/confusable_homoglyphs

.. image:: https://img.shields.io/pypi/v/confusable_homoglyphs.svg
:target: https://pypi.python.org/pypi/confusable_homoglyphs

.. image:: https://readthedocs.org/projects/confusable_homoglyphs/badge/?version=latest
:target: http://confusable-homoglyphs.readthedocs.io/en/latest/
:alt: Documentation Status

*a homoglyph is one of two or more graphemes, characters, or glyphs with
shapes that appear identical or very similar*
`wikipedia:Homoglyph <https://en.wikipedia.org/wiki/Homoglyph>`__

Unicode homoglyphs can be a nuisance on the web. Your most popular
client, AlaskaJazz, might be upset to be impersonated by a trickster who
deliberately chose the username ΑlaskaJazz.

- ``AlaskaJazz`` is single script: only Latin characters.
- ``ΑlaskaJazz`` is mixed-script: the first character is a greek
letter.

You might also want to avoid people being tricked into entering their
password on ``www.microsоft.com`` or ``www.faϲebook.com`` instead of
``www.microsoft.com`` or ``www.facebook.com``. `Here is a
utility <http://unicode.org/cldr/utility/confusables.jsp>`__ to play
with these **confusable homoglyphs**.

Not all mixed-script strings have to be ruled out though, you could only
exclude mixed-script strings containing characters that might be
confused with a character from some unicode blocks of your choosing.

- ``Allo`` and ``ρττ`` are fine: single script.
- ``AlloΓ`` is fine when our preferred script alias is 'latin': mixed script, but ``Γ`` is not confusable.
- ``Alloρ`` is dangerous: mixed script and ``ρ`` could be confused with
``p``.

This library is compatible Python 2 and Python 3.

`API documentation <http://confusable-homoglyphs.readthedocs.io/en/latest/apidocumentation.html>`__
---------------------------------------------------------------------------------------------------

Is the data up to date?
-----------------------

Yep.

The unicode blocks aliases and names for each character are extracted
from `this file <http://www.unicode.org/Public/UNIDATA/Scripts.txt>`__
provided by the unicode consortium.

The matrix of which character can be confused with which other
characters is built using `this
file <http://www.unicode.org/Public/security/latest/confusables.txt>`__
provided by the unicode consortium.

This data is stored in two JSON files: ``categories.json`` and
``confusables.json``. If you delete them, they will both be recreated by
downloading and parsing the two abovementioned files and stored as JSON
files again.




History
-------

1.0.0
=====

Initial release.

2.0.0
=====

- `allowed_categories` renamed to `allowed_aliases`

2.0.1
=====

- Fix a TypeError: https://github.com/vhf/confusable_homoglyphs/pull/2

3.0.0
=====

Courtesy of Ryan P Kilby, via https://github.com/vhf/confusable_homoglyphs/pull/6 :

- Changed file paths to be relative to the `confusable_homoglyphs` package directory instead of the user's current working directory.
- Data files are now distributed with the packaging.
- Fixes tests so that they use the installed distribution instead of the local files. (Originally, the data files were erroneously showing up during testing, despite not being included in the distribution).
- Moves the data file generation into a simple CLI. This way, users have a method for controlling when the data files are updated.
- Since the data files are now included in the distribution, the CLI is made optional. Its dependencies can be installed with the `cli` bundle, eg. `pip install confusable_homoglyphs[cli]`.



Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
confusable_homoglyphs/__init__.py,sha256=DgNjqXRYuoQFQ7QLdwD8K4bwPuT-CdZPtUM_i1VDraU,221
confusable_homoglyphs/_version.py,sha256=9z9DOzaxJcDaYdY06eUzXBTtTXGZOuLV8yhsbiZzYE4,471
confusable_homoglyphs/categories.json,sha256=kJAyq0Usb5JlWu9thDfAdlzwbzRbAXqgou6zWvo0P-c,46232
confusable_homoglyphs/categories.py,sha256=WrdKjQtp4G1VbYVd97S9NFpd-xhYoeO8dk80B8plXyM,2372
confusable_homoglyphs/cli.py,sha256=KWQlkeHQbBqdprIIeM94kbAGw7dS_7R0DyyIFupY9BY,2745
confusable_homoglyphs/confusables.json,sha256=PvvxYbp07NJDNiLmxc4gdquDyUgESnV63Aj8_9O1quI,901246
confusable_homoglyphs/confusables.py,sha256=aijG49UbhMTllg3UOWeGNnxhQkJSEhETIgz1QanSz2E,6168
confusable_homoglyphs/utils.py,sha256=ORFZM0-fVCadIHK7m0iIEbVa1QZx7O2VJ_v9vyAvBw4,1157
confusable_homoglyphs-3.1.1.dist-info/METADATA,sha256=YLOR9BzAFAz--zKk5T6x-icd78W2ASuZora5B4jlZ_Q,4893
confusable_homoglyphs-3.1.1.dist-info/RECORD,,
confusable_homoglyphs-3.1.1.dist-info/WHEEL,sha256=gduuPyBvFJQSQ0zdyxF7k0zynDXbIbvg5ZBHoXum5uk,110
confusable_homoglyphs-3.1.1.dist-info/entry_points.txt,sha256=pdf8be86aII3ebzr0H2ZS8bdEdftVeWUkNIsqcuNszg,73
confusable_homoglyphs-3.1.1.dist-info/top_level.txt,sha256=ozrGYViJigAq-RKQPR-PGpUT5ktbD6a6ux984ue7sYE,22
../../../bin/confusable_homoglyphs,sha256=QhO_RaFloym93cwHFZHBGBAmASEiy6B6kRbe1THnUqI,275
confusable_homoglyphs-3.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
confusable_homoglyphs/__pycache__/_version.cpython-36.pyc,,
confusable_homoglyphs/__pycache__/__init__.cpython-36.pyc,,
confusable_homoglyphs/__pycache__/confusables.cpython-36.pyc,,
confusable_homoglyphs/__pycache__/cli.cpython-36.pyc,,
confusable_homoglyphs/__pycache__/categories.cpython-36.pyc,,
confusable_homoglyphs/__pycache__/utils.cpython-36.pyc,,
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.31.1)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[console_scripts]
confusable_homoglyphs = confusable_homoglyphs.cli:cli

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
confusable_homoglyphs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
from ._version import get_versions

__author__ = 'Victor Felder'
__email__ = '[email protected]'
__version__ = get_versions()['version']
del get_versions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

# This file was generated by 'versioneer.py' (0.15) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.

import json
import sys

version_json = '''
{
"dirty": false,
"error": null,
"full-revisionid": "0fcfb2b773e5431586c2621048af95dd5f8e7090",
"version": "3.1.1"
}
''' # END VERSION_JSON


def get_versions():
return json.loads(version_json)

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# -*- coding: utf-8 -*-
from .utils import load


categories_data = load('categories.json')


def aliases_categories(chr):
"""Retrieves the script block alias and unicode category for a unicode character.
>>> categories.aliases_categories('A')
('LATIN', 'L')
>>> categories.aliases_categories('τ')
('GREEK', 'L')
>>> categories.aliases_categories('-')
('COMMON', 'Pd')
:param chr: A unicode character
:type chr: str
:return: The script block alias and unicode category for a unicode character.
:rtype: (str, str)
"""
l = 0
r = len(categories_data['code_points_ranges']) - 1
c = ord(chr)

# binary search
while r >= l:
m = (l + r) // 2
if c < categories_data['code_points_ranges'][m][0]:
r = m - 1
elif c > categories_data['code_points_ranges'][m][1]:
l = m + 1
else:
return (
categories_data['iso_15924_aliases'][categories_data['code_points_ranges'][m][2]],
categories_data['categories'][categories_data['code_points_ranges'][m][3]])
return 'Unknown', 'Zzzz'


def alias(chr):
"""Retrieves the script block alias for a unicode character.
>>> categories.alias('A')
'LATIN'
>>> categories.alias('τ')
'GREEK'
>>> categories.alias('-')
'COMMON'
:param chr: A unicode character
:type chr: str
:return: The script block alias.
:rtype: str
"""
a, _ = aliases_categories(chr)
return a


def category(chr):
"""Retrieves the unicode category for a unicode character.
>>> categories.category('A')
'L'
>>> categories.category('τ')
'L'
>>> categories.category('-')
'Pd'
:param chr: A unicode character
:type chr: str
:return: The unicode category for a unicode character.
:rtype: str
"""
_, a = aliases_categories(chr)
return a


def unique_aliases(string):
"""Retrieves all unique script block aliases used in a unicode string.
>>> categories.unique_aliases('ABC')
{'LATIN'}
>>> categories.unique_aliases('ρAτ-')
{'GREEK', 'LATIN', 'COMMON'}
:param string: A unicode character
:type string: str
:return: A set of the script block aliases used in a unicode string.
:rtype: (str, str)
"""
cats = [alias(c) for c in string]
return set(cats)
Loading

0 comments on commit efc7e31

Please sign in to comment.