Revision 5b2a7a61
Added by koszko almost 2 years ago
| Makefile.in | ||
|---|---|---|
| 1 | 1 |
# This file is part of Haketilo |
| 2 | 2 |
# |
| 3 | 3 |
# Copyright (C) 2021, jahoti |
| 4 |
# Copyright (C) 2021, Wojtek Kosior |
|
| 4 | 5 |
# |
| 5 | 6 |
# This program is free software: you can redistribute it and/or modify |
| 6 | 7 |
# it under the terms of the CC0 1.0 Universal License as published by |
| ... | ... | |
| 30 | 31 |
all all-unpacked default unpacked \ |
| 31 | 32 |
install install-html install-dvi install-pdf install-ps uninstall \ |
| 32 | 33 |
install-strip clean distclean mostlyclean maintainer-clean TAGS info \ |
| 33 |
dvi html pdf ps dist check installcheck installdirs |
|
| 34 |
dvi html pdf ps dist check installcheck installdirs \ |
|
| 35 |
test test-environment |
|
| 34 | 36 |
|
| 35 | 37 |
# core files |
| 36 | 38 |
icons/haketilo16.png: icons/haketilo.svg |
| ... | ... | |
| 57 | 59 |
%-build.zip: %-unpacked |
| 58 | 60 |
cd $< && zip -q -r ../$@ * |
| 59 | 61 |
|
| 62 |
test/certs/: |
|
| 63 |
mkdir $@ |
|
| 64 |
|
|
| 65 |
test/certs/%.key: | test/certs/ |
|
| 66 |
openssl genrsa -out $@ 2048 |
|
| 67 |
|
|
| 68 |
test/certs/rootCA.pem: test/certs/rootCA.key |
|
| 69 |
openssl req -x509 -new -nodes -key $< -days 1024 -out $@ \ |
|
| 70 |
-subj "/CN=Haketilo Test" |
|
| 71 |
|
|
| 72 |
test: test/certs/rootCA.pem test/certs/site.key |
|
| 73 |
MOZ_HEADLESS=whatever pytest |
|
| 74 |
|
|
| 75 |
test-environment: test/certs/rootCA.pem test/certs/site.key |
|
| 76 |
python3 -m test |
|
| 60 | 77 |
|
| 61 | 78 |
# helper targets |
| 62 | 79 |
clean mostlyclean: |
| 63 | 80 |
rm -rf mozilla-unpacked chromium-unpacked haketilo-$(version) |
| 64 | 81 |
rm -f mozilla-build.zip chromium-build.zip haketilo-$(version).tar.gz \ |
| 65 | 82 |
haketilo-$(version).tar |
| 83 |
rm -rf test/certs |
|
| 84 |
rm -rf $$(find . -name geckodriver.log) |
|
| 85 |
rm -rf $$(find . -type d -name __pycache__) |
|
| 66 | 86 |
|
| 67 | 87 |
distclean: clean |
| 68 | 88 |
rm -f Makefile config.status record.conf |
| copyright | ||
|---|---|---|
| 6 | 6 |
Copyright: 2021 Wojtek Kosior <koszko@koszko.org> |
| 7 | 7 |
License: GPL-3+-javascript or Alicense-1.0 |
| 8 | 8 |
|
| 9 |
Files: *.sh default_settings.json |
|
| 9 |
Files: *.sh default_settings.json Makefile.in
|
|
| 10 | 10 |
Copyright: 2021 Wojtek Kosior <koszko@koszko.org> |
| 11 | 11 |
2021 jahoti <jahoti@tilde.team> |
| 12 | 12 |
License: CC0 |
| 13 | 13 |
|
| 14 |
Files: Makefile |
|
| 15 |
Copyright: 2021 jahoti <jahoti@tilde.team> |
|
| 16 |
License: CC0 |
|
| 17 |
|
|
| 18 | 14 |
Files: icons/* |
| 19 | 15 |
Copyright: 2017 David Lyons <https://openclipart.org/artist/davidblyons> |
| 20 | 16 |
License: CC0 or CC-BY-SA-4.0 |
| ... | ... | |
| 71 | 67 |
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 72 | 68 |
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 73 | 69 |
|
| 70 |
Files: test/* |
|
| 71 |
Copyright: 2021 jahoti <jahoti@tilde.team> |
|
| 72 |
2021 Wojtek Kosior <koszko@koszko.org> |
|
| 73 |
License: AGPL-3+ |
|
| 74 |
Comment: Wojtek Kosior promises not to sue even in case of violations |
|
| 75 |
of the license. |
|
| 76 |
|
|
| 77 |
Files: test/__init__.py test/test_unit.py test/default_profiles/icecat_empty/extensions.json |
|
| 78 |
Copyright: 2021 Wojtek Kosior <koszko@koszko.org> |
|
| 79 |
License: CC0 |
|
| 80 |
|
|
| 81 |
Files: test/profiles.py |
|
| 82 |
Copyright: 2021 Wojtek Kosior <koszko@koszko.org> |
|
| 83 |
License: GPL-3+ |
|
| 84 |
Comment: Wojtek Kosior promises not to sue even in case of violations |
|
| 85 |
of the license. |
|
| 86 |
|
|
| 87 |
Files: test/proxy_core.py |
|
| 88 |
Copyright: 2015, inaz2 |
|
| 89 |
2021 jahoti <jahoti@tilde.team> |
|
| 90 |
2021 Wojtek Kosior <koszko@koszko.org> |
|
| 91 |
License: BSD-3 |
|
| 92 |
Redistribution and use in source and binary forms, with or without |
|
| 93 |
modification, are permitted provided that the following conditions are met: |
|
| 94 |
. |
|
| 95 |
* Redistributions of source code must retain the above copyright notice, this |
|
| 96 |
list of conditions and the following disclaimer. |
|
| 97 |
. |
|
| 98 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
| 99 |
this list of conditions and the following disclaimer in the documentation |
|
| 100 |
and/or other materials provided with the distribution. |
|
| 101 |
. |
|
| 102 |
* Neither the name of proxy2 nor the names of its contributors may be used to |
|
| 103 |
endorse or promote products derived from this software without specific prior |
|
| 104 |
written permission. |
|
| 105 |
. |
|
| 106 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
| 107 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
| 108 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
| 109 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
|
| 110 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
| 111 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
| 112 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
| 113 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
| 114 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
| 115 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
| 116 |
Comment: Wojtek Kosior promises not to sue even in case of violations |
|
| 117 |
of the license. |
|
| 118 |
|
|
| 74 | 119 |
Files: licenses/* |
| 75 | 120 |
Copyright: 2001, 2002, 2011-2013 Creative Commons |
| 76 | 121 |
License: CC-BY-4.0 |
| ... | ... | |
| 83 | 128 |
License: CC0 |
| 84 | 129 |
See `licenses/cc0.txt' |
| 85 | 130 |
|
| 86 |
Files: licenses/gpl-2.txt licenses/gpl-3.0.txt |
|
| 131 |
Files: licenses/gpl-2.txt licenses/gpl-3.0.txt licenses/agpl-3.0.txt
|
|
| 87 | 132 |
Copyright: 2007 Free Software Foundation, Inc. <https://fsf.org/> |
| 88 | 133 |
License: no-changing |
| 89 | 134 |
Everyone is permitted to copy and distribute verbatim copies of |
| ... | ... | |
| 144 | 189 |
along with this program; if not, write to the Free Software |
| 145 | 190 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 146 | 191 |
|
| 192 |
License: AGPL-3+ |
|
| 193 |
This program is free software; you can redistribute it and/or modify |
|
| 194 |
it under the terms of the GNU Affero General Public License as |
|
| 195 |
published by the Free Software Foundation; either version 3 of |
|
| 196 |
the License, or (at your option) any later version. |
|
| 197 |
. |
|
| 198 |
This program is distributed in the hope that it will be useful, |
|
| 199 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 200 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 201 |
GNU Affero General Public License for more details. |
|
| 202 |
. |
|
| 203 |
You should have received a copy of the |
|
| 204 |
GNU Affero General Public License along with this program; if not, |
|
| 205 |
you can get it from `https://www.gnu.org/licenses/agpl-3.0.html'. |
|
| 206 |
|
|
| 147 | 207 |
License: CC-BY-SA-4.0 |
| 148 | 208 |
See `licenses/cc-by-sa-4.0.txt' |
| 149 | 209 |
|
| licenses/agpl-3.0.txt | ||
|---|---|---|
| 1 |
GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 2 |
|
|
| 3 |
Version 3, 19 November 2007 |
|
| 4 |
|
|
| 5 |
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/> |
|
| 6 |
Everyone is permitted to copy and distribute verbatim copies of this |
|
| 7 |
license document, but changing it is not allowed. |
|
| 8 |
|
|
| 9 |
Preamble |
|
| 10 |
|
|
| 11 |
The GNU Affero General Public License is a free, copyleft license for |
|
| 12 |
software and other kinds of works, specifically designed to ensure |
|
| 13 |
cooperation with the community in the case of network server software. |
|
| 14 |
|
|
| 15 |
The licenses for most software and other practical works are designed to |
|
| 16 |
take away your freedom to share and change the works. By contrast, our |
|
| 17 |
General Public Licenses are intended to guarantee your freedom to share and |
|
| 18 |
change all versions of a program--to make sure it remains free software for |
|
| 19 |
all its users. |
|
| 20 |
|
|
| 21 |
When we speak of free software, we are referring to freedom, not price. Our |
|
| 22 |
General Public Licenses are designed to make sure that you have the freedom |
|
| 23 |
to distribute copies of free software (and charge for them if you wish), |
|
| 24 |
that you receive source code or can get it if you want it, that you can |
|
| 25 |
change the software or use pieces of it in new free programs, and that you |
|
| 26 |
know you can do these things. |
|
| 27 |
|
|
| 28 |
Developers that use our General Public Licenses protect your rights with |
|
| 29 |
two steps: (1) assert copyright on the software, and (2) offer you this |
|
| 30 |
License which gives you legal permission to copy, distribute and/or modify |
|
| 31 |
the software. |
|
| 32 |
|
|
| 33 |
A secondary benefit of defending all users' freedom is that improvements |
|
| 34 |
made in alternate versions of the program, if they receive widespread use, |
|
| 35 |
become available for other developers to incorporate. Many developers of |
|
| 36 |
free software are heartened and encouraged by the resulting cooperation. |
|
| 37 |
However, in the case of software used on network servers, this result may |
|
| 38 |
fail to come about. The GNU General Public License permits making a |
|
| 39 |
modified version and letting the public access it on a server without ever |
|
| 40 |
releasing its source code to the public. |
|
| 41 |
|
|
| 42 |
The GNU Affero General Public License is designed specifically to ensure |
|
| 43 |
that, in such cases, the modified source code becomes available to the |
|
| 44 |
community. It requires the operator of a network server to provide the |
|
| 45 |
source code of the modified version running there to the users of that |
|
| 46 |
server. Therefore, public use of a modified version, on a publicly |
|
| 47 |
accessible server, gives the public access to the source code of the |
|
| 48 |
modified version. |
|
| 49 |
|
|
| 50 |
An older license, called the Affero General Public License and published by |
|
| 51 |
Affero, was designed to accomplish similar goals. This is a different |
|
| 52 |
license, not a version of the Affero GPL, but Affero has released a new |
|
| 53 |
version of the Affero GPL which permits relicensing under this license. |
|
| 54 |
|
|
| 55 |
The precise terms and conditions for copying, distribution and modification |
|
| 56 |
follow. |
|
| 57 |
|
|
| 58 |
TERMS AND CONDITIONS |
|
| 59 |
|
|
| 60 |
0. Definitions. |
|
| 61 |
|
|
| 62 |
"This License" refers to version 3 of the GNU Affero General Public |
|
| 63 |
License. |
|
| 64 |
|
|
| 65 |
"Copyright" also means copyright-like laws that apply to other kinds of |
|
| 66 |
works, such as semiconductor masks. |
|
| 67 |
|
|
| 68 |
"The Program" refers to any copyrightable work licensed under this License. |
|
| 69 |
Each licensee is addressed as "you". "Licensees" and "recipients" may be |
|
| 70 |
individuals or organizations. |
|
| 71 |
|
|
| 72 |
To "modify" a work means to copy from or adapt all or part of the work in a |
|
| 73 |
fashion requiring copyright permission, other than the making of an exact |
|
| 74 |
copy. The resulting work is called a "modified version" of the earlier work |
|
| 75 |
or a work "based on" the earlier work. |
|
| 76 |
|
|
| 77 |
A "covered work" means either the unmodified Program or a work based on the |
|
| 78 |
Program. |
|
| 79 |
|
|
| 80 |
To "propagate" a work means to do anything with it that, without |
|
| 81 |
permission, would make you directly or secondarily liable for infringement |
|
| 82 |
under applicable copyright law, except executing it on a computer or |
|
| 83 |
modifying a private copy. Propagation includes copying, distribution (with |
|
| 84 |
or without modification), making available to the public, and in some |
|
| 85 |
countries other activities as well. |
|
| 86 |
|
|
| 87 |
To "convey" a work means any kind of propagation that enables other parties |
|
| 88 |
to make or receive copies. Mere interaction with a user through a computer |
|
| 89 |
network, with no transfer of a copy, is not conveying. |
|
| 90 |
|
|
| 91 |
An interactive user interface displays "Appropriate Legal Notices" to the |
|
| 92 |
extent that it includes a convenient and prominently visible feature that |
|
| 93 |
(1) displays an appropriate copyright notice, and (2) tells the user that |
|
| 94 |
there is no warranty for the work (except to the extent that warranties are |
|
| 95 |
provided), that licensees may convey the work under this License, and how |
|
| 96 |
to view a copy of this License. If the interface presents a list of user |
|
| 97 |
commands or options, such as a menu, a prominent item in the list meets |
|
| 98 |
this criterion. |
|
| 99 |
|
|
| 100 |
1. Source Code. |
|
| 101 |
|
|
| 102 |
The "source code" for a work means the preferred form of the work for |
|
| 103 |
making modifications to it. "Object code" means any non-source form of a |
|
| 104 |
work. |
|
| 105 |
|
|
| 106 |
A "Standard Interface" means an interface that either is an official |
|
| 107 |
standard defined by a recognized standards body, or, in the case of |
|
| 108 |
interfaces specified for a particular programming language, one that is |
|
| 109 |
widely used among developers working in that language. |
|
| 110 |
|
|
| 111 |
The "System Libraries" of an executable work include anything, other than |
|
| 112 |
the work as a whole, that (a) is included in the normal form of packaging a |
|
| 113 |
Major Component, but which is not part of that Major Component, and (b) |
|
| 114 |
serves only to enable use of the work with that Major Component, or to |
|
| 115 |
implement a Standard Interface for which an implementation is available to |
|
| 116 |
the public in source code form. A "Major Component", in this context, means |
|
| 117 |
a major essential component (kernel, window system, and so on) of the |
|
| 118 |
specific operating system (if any) on which the executable work runs, or a |
|
| 119 |
compiler used to produce the work, or an object code interpreter used to |
|
| 120 |
run it. |
|
| 121 |
|
|
| 122 |
The "Corresponding Source" for a work in object code form means all the |
|
| 123 |
source code needed to generate, install, and (for an executable work) run |
|
| 124 |
the object code and to modify the work, including scripts to control those |
|
| 125 |
activities. However, it does not include the work's System Libraries, or |
|
| 126 |
general-purpose tools or generally available free programs which are used |
|
| 127 |
unmodified in performing those activities but which are not part of the |
|
| 128 |
work. For example, Corresponding Source includes interface definition files |
|
| 129 |
associated with source files for the work, and the source code for shared |
|
| 130 |
libraries and dynamically linked subprograms that the work is specifically |
|
| 131 |
designed to require, such as by intimate data communication or control flow |
|
| 132 |
between those subprograms and other parts of the work. |
|
| 133 |
|
|
| 134 |
The Corresponding Source need not include anything that users can |
|
| 135 |
regenerate automatically from other parts of the Corresponding Source. |
|
| 136 |
|
|
| 137 |
The Corresponding Source for a work in source code form is that same work. |
|
| 138 |
|
|
| 139 |
2. Basic Permissions. |
|
| 140 |
|
|
| 141 |
All rights granted under this License are granted for the term of copyright |
|
| 142 |
on the Program, and are irrevocable provided the stated conditions are met. |
|
| 143 |
This License explicitly affirms your unlimited permission to run the |
|
| 144 |
unmodified Program. The output from running a covered work is covered by |
|
| 145 |
this License only if the output, given its content, constitutes a covered |
|
| 146 |
work. This License acknowledges your rights of fair use or other |
|
| 147 |
equivalent, as provided by copyright law. |
|
| 148 |
|
|
| 149 |
You may make, run and propagate covered works that you do not convey, |
|
| 150 |
without conditions so long as your license otherwise remains in force. You |
|
| 151 |
may convey covered works to others for the sole purpose of having them make |
|
| 152 |
modifications exclusively for you, or provide you with facilities for |
|
| 153 |
running those works, provided that you comply with the terms of this |
|
| 154 |
License in conveying all material for which you do not control copyright. |
|
| 155 |
Those thus making or running the covered works for you must do so |
|
| 156 |
exclusively on your behalf, under your direction and control, on terms that |
|
| 157 |
prohibit them from making any copies of your copyrighted material outside |
|
| 158 |
their relationship with you. |
|
| 159 |
|
|
| 160 |
Conveying under any other circumstances is permitted solely under the |
|
| 161 |
conditions stated below. Sublicensing is not allowed; section 10 makes it |
|
| 162 |
unnecessary. |
|
| 163 |
|
|
| 164 |
3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
|
| 165 |
|
|
| 166 |
No covered work shall be deemed part of an effective technological measure |
|
| 167 |
under any applicable law fulfilling obligations under article 11 of the |
|
| 168 |
WIPO copyright treaty adopted on 20 December 1996, or similar laws |
|
| 169 |
prohibiting or restricting circumvention of such measures. |
|
| 170 |
|
|
| 171 |
When you convey a covered work, you waive any legal power to forbid |
|
| 172 |
circumvention of technological measures to the extent such circumvention is |
|
| 173 |
effected by exercising rights under this License with respect to the |
|
| 174 |
covered work, and you disclaim any intention to limit operation or |
|
| 175 |
modification of the work as a means of enforcing, against the work's users, |
|
| 176 |
your or third parties' legal rights to forbid circumvention of |
|
| 177 |
technological measures. |
|
| 178 |
|
|
| 179 |
4. Conveying Verbatim Copies. |
|
| 180 |
|
|
| 181 |
You may convey verbatim copies of the Program's source code as you receive |
|
| 182 |
it, in any medium, provided that you conspicuously and appropriately |
|
| 183 |
publish on each copy an appropriate copyright notice; keep intact all |
|
| 184 |
notices stating that this License and any non-permissive terms added in |
|
| 185 |
accord with section 7 apply to the code; keep intact all notices of the |
|
| 186 |
absence of any warranty; and give all recipients a copy of this License |
|
| 187 |
along with the Program. |
|
| 188 |
|
|
| 189 |
You may charge any price or no price for each copy that you convey, and you |
|
| 190 |
may offer support or warranty protection for a fee. |
|
| 191 |
|
|
| 192 |
5. Conveying Modified Source Versions. |
|
| 193 |
|
|
| 194 |
You may convey a work based on the Program, or the modifications to produce |
|
| 195 |
it from the Program, in the form of source code under the terms of section |
|
| 196 |
4, provided that you also meet all of these conditions: |
|
| 197 |
|
|
| 198 |
⢠a) The work must carry prominent notices stating that you modified it, |
|
| 199 |
and giving a relevant date. |
|
| 200 |
⢠b) The work must carry prominent notices stating that it is released |
|
| 201 |
under this License and any conditions added under section 7. This |
|
| 202 |
requirement modifies the requirement in section 4 to "keep intact all |
|
| 203 |
notices". |
|
| 204 |
⢠c) You must license the entire work, as a whole, under this License to |
|
| 205 |
anyone who comes into possession of a copy. This License will therefore |
|
| 206 |
apply, along with any applicable section 7 additional terms, to the |
|
| 207 |
whole of the work, and all its parts, regardless of how they are |
|
| 208 |
packaged. This License gives no permission to license the work in any |
|
| 209 |
other way, but it does not invalidate such permission if you have |
|
| 210 |
separately received it. |
|
| 211 |
⢠d) If the work has interactive user interfaces, each must display |
|
| 212 |
Appropriate Legal Notices; however, if the Program has interactive |
|
| 213 |
interfaces that do not display Appropriate Legal Notices, your work |
|
| 214 |
need not make them do so. |
|
| 215 |
|
|
| 216 |
A compilation of a covered work with other separate and independent works, |
|
| 217 |
which are not by their nature extensions of the covered work, and which are |
|
| 218 |
not combined with it such as to form a larger program, in or on a volume of |
|
| 219 |
a storage or distribution medium, is called an "aggregate" if the |
|
| 220 |
compilation and its resulting copyright are not used to limit the access or |
|
| 221 |
legal rights of the compilation's users beyond what the individual works |
|
| 222 |
permit. Inclusion of a covered work in an aggregate does not cause this |
|
| 223 |
License to apply to the other parts of the aggregate. |
|
| 224 |
|
|
| 225 |
6. Conveying Non-Source Forms. |
|
| 226 |
|
|
| 227 |
You may convey a covered work in object code form under the terms of |
|
| 228 |
sections 4 and 5, provided that you also convey the machine-readable |
|
| 229 |
Corresponding Source under the terms of this License, in one of these ways: |
|
| 230 |
|
|
| 231 |
⢠a) Convey the object code in, or embodied in, a physical product |
|
| 232 |
(including a physical distribution medium), accompanied by the |
|
| 233 |
Corresponding Source fixed on a durable physical medium customarily |
|
| 234 |
used for software interchange. |
|
| 235 |
⢠b) Convey the object code in, or embodied in, a physical product |
|
| 236 |
(including a physical distribution medium), accompanied by a written |
|
| 237 |
offer, valid for at least three years and valid for as long as you |
|
| 238 |
offer spare parts or customer support for that product model, to give |
|
| 239 |
anyone who possesses the object code either (1) a copy of the |
|
| 240 |
Corresponding Source for all the software in the product that is |
|
| 241 |
covered by this License, on a durable physical medium customarily used |
|
| 242 |
for software interchange, for a price no more than your reasonable cost |
|
| 243 |
of physically performing this conveying of source, or (2) access to |
|
| 244 |
copy the Corresponding Source from a network server at no charge. |
|
| 245 |
⢠c) Convey individual copies of the object code with a copy of the |
|
| 246 |
written offer to provide the Corresponding Source. This alternative is |
|
| 247 |
allowed only occasionally and noncommercially, and only if you received |
|
| 248 |
the object code with such an offer, in accord with subsection 6b. |
|
| 249 |
⢠d) Convey the object code by offering access from a designated place |
|
| 250 |
(gratis or for a charge), and offer equivalent access to the |
|
| 251 |
Corresponding Source in the same way through the same place at no |
|
| 252 |
further charge. You need not require recipients to copy the |
|
| 253 |
Corresponding Source along with the object code. If the place to copy |
|
| 254 |
the object code is a network server, the Corresponding Source may be on |
|
| 255 |
a different server (operated by you or a third party) that supports |
|
| 256 |
equivalent copying facilities, provided you maintain clear directions |
|
| 257 |
next to the object code saying where to find the Corresponding Source. |
|
| 258 |
Regardless of what server hosts the Corresponding Source, you remain |
|
| 259 |
obligated to ensure that it is available for as long as needed to |
|
| 260 |
satisfy these requirements. |
|
| 261 |
⢠e) Convey the object code using peer-to-peer transmission, provided you |
|
| 262 |
inform other peers where the object code and Corresponding Source of |
|
| 263 |
the work are being offered to the general public at no charge under |
|
| 264 |
subsection 6d. |
|
| 265 |
|
|
| 266 |
A separable portion of the object code, whose source code is excluded from |
|
| 267 |
the Corresponding Source as a System Library, need not be included in |
|
| 268 |
conveying the object code work. |
|
| 269 |
|
|
| 270 |
A "User Product" is either (1) a "consumer product", which means any |
|
| 271 |
tangible personal property which is normally used for personal, family, or |
|
| 272 |
household purposes, or (2) anything designed or sold for incorporation into |
|
| 273 |
a dwelling. In determining whether a product is a consumer product, |
|
| 274 |
doubtful cases shall be resolved in favor of coverage. For a particular |
|
| 275 |
product received by a particular user, "normally used" refers to a typical |
|
| 276 |
or common use of that class of product, regardless of the status of the |
|
| 277 |
particular user or of the way in which the particular user actually uses, |
|
| 278 |
or expects or is expected to use, the product. A product is a consumer |
|
| 279 |
product regardless of whether the product has substantial commercial, |
|
| 280 |
industrial or non-consumer uses, unless such uses represent the only |
|
| 281 |
significant mode of use of the product. |
|
| 282 |
|
|
| 283 |
"Installation Information" for a User Product means any methods, |
|
| 284 |
procedures, authorization keys, or other information required to install |
|
| 285 |
and execute modified versions of a covered work in that User Product from a |
|
| 286 |
modified version of its Corresponding Source. The information must suffice |
|
| 287 |
to ensure that the continued functioning of the modified object code is in |
|
| 288 |
no case prevented or interfered with solely because modification has been |
|
| 289 |
made. |
|
| 290 |
|
|
| 291 |
If you convey an object code work under this section in, or with, or |
|
| 292 |
specifically for use in, a User Product, and the conveying occurs as part |
|
| 293 |
of a transaction in which the right of possession and use of the User |
|
| 294 |
Product is transferred to the recipient in perpetuity or for a fixed term |
|
| 295 |
(regardless of how the transaction is characterized), the Corresponding |
|
| 296 |
Source conveyed under this section must be accompanied by the Installation |
|
| 297 |
Information. But this requirement does not apply if neither you nor any |
|
| 298 |
third party retains the ability to install modified object code on the User |
|
| 299 |
Product (for example, the work has been installed in ROM). |
|
| 300 |
|
|
| 301 |
The requirement to provide Installation Information does not include a |
|
| 302 |
requirement to continue to provide support service, warranty, or updates |
|
| 303 |
for a work that has been modified or installed by the recipient, or for the |
|
| 304 |
User Product in which it has been modified or installed. Access to a |
|
| 305 |
network may be denied when the modification itself materially and adversely |
|
| 306 |
affects the operation of the network or violates the rules and protocols |
|
| 307 |
for communication across the network. |
|
| 308 |
|
|
| 309 |
Corresponding Source conveyed, and Installation Information provided, in |
|
| 310 |
accord with this section must be in a format that is publicly documented |
|
| 311 |
(and with an implementation available to the public in source code form), |
|
| 312 |
and must require no special password or key for unpacking, reading or |
|
| 313 |
copying. |
|
| 314 |
|
|
| 315 |
7. Additional Terms. |
|
| 316 |
|
|
| 317 |
"Additional permissions" are terms that supplement the terms of this |
|
| 318 |
License by making exceptions from one or more of its conditions. Additional |
|
| 319 |
permissions that are applicable to the entire Program shall be treated as |
|
| 320 |
though they were included in this License, to the extent that they are |
|
| 321 |
valid under applicable law. If additional permissions apply only to part of |
|
| 322 |
the Program, that part may be used separately under those permissions, but |
|
| 323 |
the entire Program remains governed by this License without regard to the |
|
| 324 |
additional permissions. |
|
| 325 |
|
|
| 326 |
When you convey a copy of a covered work, you may at your option remove any |
|
| 327 |
additional permissions from that copy, or from any part of it. (Additional |
|
| 328 |
permissions may be written to require their own removal in certain cases |
|
| 329 |
when you modify the work.) You may place additional permissions on |
|
| 330 |
material, added by you to a covered work, for which you have or can give |
|
| 331 |
appropriate copyright permission. |
|
| 332 |
|
|
| 333 |
Notwithstanding any other provision of this License, for material you add |
|
| 334 |
to a covered work, you may (if authorized by the copyright holders of that |
|
| 335 |
material) supplement the terms of this License with terms: |
|
| 336 |
|
|
| 337 |
⢠a) Disclaiming warranty or limiting liability differently from the |
|
| 338 |
terms of sections 15 and 16 of this License; or |
|
| 339 |
⢠b) Requiring preservation of specified reasonable legal notices or |
|
| 340 |
author attributions in that material or in the Appropriate Legal |
|
| 341 |
Notices displayed by works containing it; or |
|
| 342 |
⢠c) Prohibiting misrepresentation of the origin of that material, or |
|
| 343 |
requiring that modified versions of such material be marked in |
|
| 344 |
reasonable ways as different from the original version; or |
|
| 345 |
⢠d) Limiting the use for publicity purposes of names of licensors or |
|
| 346 |
authors of the material; or |
|
| 347 |
⢠e) Declining to grant rights under trademark law for use of some trade |
|
| 348 |
names, trademarks, or service marks; or |
|
| 349 |
⢠f) Requiring indemnification of licensors and authors of that material |
|
| 350 |
by anyone who conveys the material (or modified versions of it) with |
|
| 351 |
contractual assumptions of liability to the recipient, for any |
|
| 352 |
liability that these contractual assumptions directly impose on those |
|
| 353 |
licensors and authors. |
|
| 354 |
|
|
| 355 |
All other non-permissive additional terms are considered "further |
|
| 356 |
restrictions" within the meaning of section 10. If the Program as you |
|
| 357 |
received it, or any part of it, contains a notice stating that it is |
|
| 358 |
governed by this License along with a term that is a further restriction, |
|
| 359 |
you may remove that term. If a license document contains a further |
|
| 360 |
restriction but permits relicensing or conveying under this License, you |
|
| 361 |
may add to a covered work material governed by the terms of that license |
|
| 362 |
document, provided that the further restriction does not survive such |
|
| 363 |
relicensing or conveying. |
|
| 364 |
|
|
| 365 |
If you add terms to a covered work in accord with this section, you must |
|
| 366 |
place, in the relevant source files, a statement of the additional terms |
|
| 367 |
that apply to those files, or a notice indicating where to find the |
|
| 368 |
applicable terms. |
|
| 369 |
|
|
| 370 |
Additional terms, permissive or non-permissive, may be stated in the form |
|
| 371 |
of a separately written license, or stated as exceptions; the above |
|
| 372 |
requirements apply either way. |
|
| 373 |
|
|
| 374 |
8. Termination. |
|
| 375 |
|
|
| 376 |
You may not propagate or modify a covered work except as expressly provided |
|
| 377 |
under this License. Any attempt otherwise to propagate or modify it is |
|
| 378 |
void, and will automatically terminate your rights under this License |
|
| 379 |
(including any patent licenses granted under the third paragraph of section |
|
| 380 |
11). |
|
| 381 |
|
|
| 382 |
However, if you cease all violation of this License, then your license from |
|
| 383 |
a particular copyright holder is reinstated (a) provisionally, unless and |
|
| 384 |
until the copyright holder explicitly and finally terminates your license, |
|
| 385 |
and (b) permanently, if the copyright holder fails to notify you of the |
|
| 386 |
violation by some reasonable means prior to 60 days after the cessation. |
|
| 387 |
|
|
| 388 |
Moreover, your license from a particular copyright holder is reinstated |
|
| 389 |
permanently if the copyright holder notifies you of the violation by some |
|
| 390 |
reasonable means, this is the first time you have received notice of |
|
| 391 |
violation of this License (for any work) from that copyright holder, and |
|
| 392 |
you cure the violation prior to 30 days after your receipt of the notice. |
|
| 393 |
|
|
| 394 |
Termination of your rights under this section does not terminate the |
|
| 395 |
licenses of parties who have received copies or rights from you under this |
|
| 396 |
License. If your rights have been terminated and not permanently |
|
| 397 |
reinstated, you do not qualify to receive new licenses for the same |
|
| 398 |
material under section 10. |
|
| 399 |
|
|
| 400 |
9. Acceptance Not Required for Having Copies. |
|
| 401 |
|
|
| 402 |
You are not required to accept this License in order to receive or run a |
|
| 403 |
copy of the Program. Ancillary propagation of a covered work occurring |
|
| 404 |
solely as a consequence of using peer-to-peer transmission to receive a |
|
| 405 |
copy likewise does not require acceptance. However, nothing other than this |
|
| 406 |
License grants you permission to propagate or modify any covered work. |
|
| 407 |
These actions infringe copyright if you do not accept this License. |
|
| 408 |
Therefore, by modifying or propagating a covered work, you indicate your |
|
| 409 |
acceptance of this License to do so. |
|
| 410 |
|
|
| 411 |
10. Automatic Licensing of Downstream Recipients. |
|
| 412 |
|
|
| 413 |
Each time you convey a covered work, the recipient automatically receives a |
|
| 414 |
license from the original licensors, to run, modify and propagate that |
|
| 415 |
work, subject to this License. You are not responsible for enforcing |
|
| 416 |
compliance by third parties with this License. |
|
| 417 |
|
|
| 418 |
An "entity transaction" is a transaction transferring control of an |
|
| 419 |
organization, or substantially all assets of one, or subdividing an |
|
| 420 |
organization, or merging organizations. If propagation of a covered work |
|
| 421 |
results from an entity transaction, each party to that transaction who |
|
| 422 |
receives a copy of the work also receives whatever licenses to the work the |
|
| 423 |
party's predecessor in interest had or could give under the previous |
|
| 424 |
paragraph, plus a right to possession of the Corresponding Source of the |
|
| 425 |
work from the predecessor in interest, if the predecessor has it or can get |
|
| 426 |
it with reasonable efforts. |
|
| 427 |
|
|
| 428 |
You may not impose any further restrictions on the exercise of the rights |
|
| 429 |
granted or affirmed under this License. For example, you may not impose a |
|
| 430 |
license fee, royalty, or other charge for exercise of rights granted under |
|
| 431 |
this License, and you may not initiate litigation (including a cross-claim |
|
| 432 |
or counterclaim in a lawsuit) alleging that any patent claim is infringed |
|
| 433 |
by making, using, selling, offering for sale, or importing the Program or |
|
| 434 |
any portion of it. |
|
| 435 |
|
|
| 436 |
11. Patents. |
|
| 437 |
|
|
| 438 |
A "contributor" is a copyright holder who authorizes use under this License |
|
| 439 |
of the Program or a work on which the Program is based. The work thus |
|
| 440 |
licensed is called the contributor's "contributor version". |
|
| 441 |
|
|
| 442 |
A contributor's "essential patent claims" are all patent claims owned or |
|
| 443 |
controlled by the contributor, whether already acquired or hereafter |
|
| 444 |
acquired, that would be infringed by some manner, permitted by this |
|
| 445 |
License, of making, using, or selling its contributor version, but do not |
|
| 446 |
include claims that would be infringed only as a consequence of further |
|
| 447 |
modification of the contributor version. For purposes of this definition, |
|
| 448 |
"control" includes the right to grant patent sublicenses in a manner |
|
| 449 |
consistent with the requirements of this License. |
|
| 450 |
|
|
| 451 |
Each contributor grants you a non-exclusive, worldwide, royalty-free patent |
|
| 452 |
license under the contributor's essential patent claims, to make, use, |
|
| 453 |
sell, offer for sale, import and otherwise run, modify and propagate the |
|
| 454 |
contents of its contributor version. |
|
| 455 |
|
|
| 456 |
In the following three paragraphs, a "patent license" is any express |
|
| 457 |
agreement or commitment, however denominated, not to enforce a patent (such |
|
| 458 |
as an express permission to practice a patent or covenant not to sue for |
|
| 459 |
patent infringement). To "grant" such a patent license to a party means to |
|
| 460 |
make such an agreement or commitment not to enforce a patent against the |
|
| 461 |
party. |
|
| 462 |
|
|
| 463 |
If you convey a covered work, knowingly relying on a patent license, and |
|
| 464 |
the Corresponding Source of the work is not available for anyone to copy, |
|
| 465 |
free of charge and under the terms of this License, through a publicly |
|
| 466 |
available network server or other readily accessible means, then you must |
|
| 467 |
either (1) cause the Corresponding Source to be so available, or (2) |
|
| 468 |
arrange to deprive yourself of the benefit of the patent license for this |
|
| 469 |
particular work, or (3) arrange, in a manner consistent with the |
|
| 470 |
requirements of this License, to extend the patent license to downstream |
|
| 471 |
recipients. "Knowingly relying" means you have actual knowledge that, but |
|
| 472 |
for the patent license, your conveying the covered work in a country, or |
|
| 473 |
your recipient's use of the covered work in a country, would infringe one |
|
| 474 |
or more identifiable patents in that country that you have reason to |
|
| 475 |
believe are valid. |
|
| 476 |
|
|
| 477 |
If, pursuant to or in connection with a single transaction or arrangement, |
|
| 478 |
you convey, or propagate by procuring conveyance of, a covered work, and |
|
| 479 |
grant a patent license to some of the parties receiving the covered work |
|
| 480 |
authorizing them to use, propagate, modify or convey a specific copy of the |
|
| 481 |
covered work, then the patent license you grant is automatically extended |
|
| 482 |
to all recipients of the covered work and works based on it. |
|
| 483 |
|
|
| 484 |
A patent license is "discriminatory" if it does not include within the |
|
| 485 |
scope of its coverage, prohibits the exercise of, or is conditioned on the |
|
| 486 |
non-exercise of one or more of the rights that are specifically granted |
|
| 487 |
under this License. You may not convey a covered work if you are a party to |
|
| 488 |
an arrangement with a third party that is in the business of distributing |
|
| 489 |
software, under which you make payment to the third party based on the |
|
| 490 |
extent of your activity of conveying the work, and under which the third |
|
| 491 |
party grants, to any of the parties who would receive the covered work from |
|
| 492 |
you, a discriminatory patent license (a) in connection with copies of the |
|
| 493 |
covered work conveyed by you (or copies made from those copies), or (b) |
|
| 494 |
primarily for and in connection with specific products or compilations that |
|
| 495 |
contain the covered work, unless you entered into that arrangement, or that |
|
| 496 |
patent license was granted, prior to 28 March 2007. |
|
| 497 |
|
|
| 498 |
Nothing in this License shall be construed as excluding or limiting any |
|
| 499 |
implied license or other defenses to infringement that may otherwise be |
|
| 500 |
available to you under applicable patent law. |
|
| 501 |
|
|
| 502 |
12. No Surrender of Others' Freedom. |
|
| 503 |
|
|
| 504 |
If conditions are imposed on you (whether by court order, agreement or |
|
| 505 |
otherwise) that contradict the conditions of this License, they do not |
|
| 506 |
excuse you from the conditions of this License. If you cannot convey a |
|
| 507 |
covered work so as to satisfy simultaneously your obligations under this |
|
| 508 |
License and any other pertinent obligations, then as a consequence you may |
|
| 509 |
not convey it at all. For example, if you agree to terms that obligate you |
|
| 510 |
to collect a royalty for further conveying from those to whom you convey |
|
| 511 |
the Program, the only way you could satisfy both those terms and this |
|
| 512 |
License would be to refrain entirely from conveying the Program. |
|
| 513 |
|
|
| 514 |
13. Remote Network Interaction; Use with the GNU General Public License. |
|
| 515 |
|
|
| 516 |
Notwithstanding any other provision of this License, if you modify the |
|
| 517 |
Program, your modified version must prominently offer all users interacting |
|
| 518 |
with it remotely through a computer network (if your version supports such |
|
| 519 |
interaction) an opportunity to receive the Corresponding Source of your |
|
| 520 |
version by providing access to the Corresponding Source from a network |
|
| 521 |
server at no charge, through some standard or customary means of |
|
| 522 |
facilitating copying of software. This Corresponding Source shall include |
|
| 523 |
the Corresponding Source for any work covered by version 3 of the GNU |
|
| 524 |
General Public License that is incorporated pursuant to the following |
|
| 525 |
paragraph. |
|
| 526 |
|
|
| 527 |
Notwithstanding any other provision of this License, you have permission to |
|
| 528 |
link or combine any covered work with a work licensed under version 3 of |
|
| 529 |
the GNU General Public License into a single combined work, and to convey |
|
| 530 |
the resulting work. The terms of this License will continue to apply to the |
|
| 531 |
part which is the covered work, but the work with which it is combined will |
|
| 532 |
remain governed by version 3 of the GNU General Public License. |
|
| 533 |
|
|
| 534 |
14. Revised Versions of this License. |
|
| 535 |
|
|
| 536 |
The Free Software Foundation may publish revised and/or new versions of the |
|
| 537 |
GNU Affero General Public License from time to time. Such new versions will |
|
| 538 |
be similar in spirit to the present version, but may differ in detail to |
|
| 539 |
address new problems or concerns. |
|
| 540 |
|
|
| 541 |
Each version is given a distinguishing version number. If the Program |
|
| 542 |
specifies that a certain numbered version of the GNU Affero General Public |
|
| 543 |
License "or any later version" applies to it, you have the option of |
|
| 544 |
following the terms and conditions either of that numbered version or of |
|
| 545 |
any later version published by the Free Software Foundation. If the Program |
|
| 546 |
does not specify a version number of the GNU Affero General Public License, |
|
| 547 |
you may choose any version ever published by the Free Software Foundation. |
|
| 548 |
|
|
| 549 |
If the Program specifies that a proxy can decide which future versions of |
|
| 550 |
the GNU Affero General Public License can be used, that proxy's public |
|
| 551 |
statement of acceptance of a version permanently authorizes you to choose |
|
| 552 |
that version for the Program. |
|
| 553 |
|
|
| 554 |
Later license versions may give you additional or different permissions. |
|
| 555 |
However, no additional obligations are imposed on any author or copyright |
|
| 556 |
holder as a result of your choosing to follow a later version. |
|
| 557 |
|
|
| 558 |
15. Disclaimer of Warranty. |
|
| 559 |
|
|
| 560 |
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE |
|
| 561 |
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR |
|
| 562 |
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, |
|
| 563 |
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
| 564 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
|
| 565 |
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. |
|
| 566 |
SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY |
|
| 567 |
SERVICING, REPAIR OR CORRECTION. |
|
| 568 |
|
|
| 569 |
16. Limitation of Liability. |
|
| 570 |
|
|
| 571 |
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL |
|
| 572 |
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE |
|
| 573 |
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
|
| 574 |
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
|
| 575 |
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
|
| 576 |
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
|
| 577 |
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
|
| 578 |
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
| 579 |
SUCH DAMAGES. |
|
| 580 |
|
|
| 581 |
17. Interpretation of Sections 15 and 16. |
|
| 582 |
|
|
| 583 |
If the disclaimer of warranty and limitation of liability provided above |
|
| 584 |
cannot be given local legal effect according to their terms, reviewing |
|
| 585 |
courts shall apply local law that most closely approximates an absolute |
|
| 586 |
waiver of all civil liability in connection with the Program, unless a |
|
| 587 |
warranty or assumption of liability accompanies a copy of the Program in |
|
| 588 |
return for a fee. |
|
| 589 |
|
|
| 590 |
END OF TERMS AND CONDITIONS |
|
| 591 |
|
|
| 592 |
How to Apply These Terms to Your New Programs |
|
| 593 |
|
|
| 594 |
If you develop a new program, and you want it to be of the greatest |
|
| 595 |
possible use to the public, the best way to achieve this is to make it free |
|
| 596 |
software which everyone can redistribute and change under these terms. |
|
| 597 |
|
|
| 598 |
To do so, attach the following notices to the program. It is safest to |
|
| 599 |
attach them to the start of each source file to most effectively state the |
|
| 600 |
exclusion of warranty; and each file should have at least the "copyright" |
|
| 601 |
line and a pointer to where the full notice is found. |
|
| 602 |
|
|
| 603 |
<one line to give the program's name and a brief idea of what it does.> |
|
| 604 |
Copyright (C) <year> <name of author> |
|
| 605 |
|
|
| 606 |
This program is free software: you can redistribute it and/or modify |
|
| 607 |
it under the terms of the GNU Affero General Public License as |
|
| 608 |
published by the Free Software Foundation, either version 3 of the |
|
| 609 |
License, or (at your option) any later version. |
|
| 610 |
|
|
| 611 |
This program is distributed in the hope that it will be useful, |
|
| 612 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 613 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 614 |
GNU Affero General Public License for more details. |
|
| 615 |
|
|
| 616 |
You should have received a copy of the GNU Affero General Public License |
|
| 617 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 618 |
|
|
| 619 |
Also add information on how to contact you by electronic and paper mail. |
|
| 620 |
|
|
| 621 |
If your software can interact with users remotely through a computer |
|
| 622 |
network, you should also make sure that it provides a way for users to get |
|
| 623 |
its source. For example, if your program is a web application, its |
|
| 624 |
interface could display a "Source" link that leads users to an archive of |
|
| 625 |
the code. There are many ways you could offer source, and different |
|
| 626 |
solutions will be better for different programs; see section 13 for the |
|
| 627 |
specific requirements. |
|
| 628 |
|
|
| 629 |
You should also get your employer (if you work as a programmer) or school, |
|
| 630 |
if any, to sign a "copyright disclaimer" for the program, if necessary. For |
|
| 631 |
more information on this, and how to apply and follow the GNU AGPL, see < |
|
| 632 |
http://www.gnu.org/licenses/>. |
|
| 633 |
|
|
| test/__init__.py | ||
|---|---|---|
| 1 |
# SPDX-License-Identifier: CC0-1.0 |
|
| test/__main__.py | ||
|---|---|---|
| 1 |
# SPDX-License-Identifier: AGPL-3.0-or-later |
|
| 2 |
|
|
| 3 |
""" |
|
| 4 |
Run a Firefox-type browser with WebDriver attached and Python console open |
|
| 5 |
""" |
|
| 6 |
|
|
| 7 |
# This file is part of Haketilo. |
|
| 8 |
# |
|
| 9 |
# Copyright (C) 2021 jahoti <jahoti@tilde.team> |
|
| 10 |
# Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org> |
|
| 11 |
# |
|
| 12 |
# This program is free software: you can redistribute it and/or modify |
|
| 13 |
# it under the terms of the GNU Affero General Public License as |
|
| 14 |
# published by the Free Software Foundation, either version 3 of the |
|
| 15 |
# License, or (at your option) any later version. |
|
| 16 |
# |
|
| 17 |
# This program 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 |
|
| 20 |
# GNU Affero General Public License for more details. |
|
| 21 |
# |
|
| 22 |
# You should have received a copy of the GNU Affero General Public License |
|
| 23 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
| 24 |
# |
|
| 25 |
# |
|
| 26 |
# I, Wojtek Kosior, thereby promise not to sue for violation of this |
|
| 27 |
# file's license. Although I request that you do not make use this code |
|
| 28 |
# in a proprietary program, I am not going to enforce this in court. |
|
| 29 |
|
|
| 30 |
import sys |
|
| 31 |
import time |
|
| 32 |
import code |
|
| 33 |
|
|
| 34 |
from .server import do_an_internet |
|
| 35 |
from .misc_constants import * |
|
| 36 |
from .profiles import firefox_safe_mode |
|
| 37 |
|
|
| 38 |
def fail(msg, error_code): |
|
| 39 |
print('Error:', msg)
|
|
| 40 |
print('Usage:', sys.argv[0], '[certificates_directory] [proxy_port]')
|
|
| 41 |
sys.exit(error_code) |
|
| 42 |
|
|
| 43 |
certdir = Path(sys.argv[1]).resolve() if len(sys.argv) > 1 else default_cert_dir |
|
| 44 |
if not certdir.is_dir(): |
|
| 45 |
fail('selected certificate directory does not exist.', 2)
|
|
| 46 |
|
|
| 47 |
port = sys.argv[2] if len(sys.argv) > 2 else str(default_proxy_port) |
|
| 48 |
if not port.isnumeric(): |
|
| 49 |
fail('port must be an integer.', 3)
|
|
| 50 |
|
|
| 51 |
httpd = do_an_internet(certdir, int(port)) |
|
| 52 |
driver = firefox_safe_mode(proxy_port=int(port)) |
|
| 53 |
|
|
| 54 |
print("You can now control the browser through 'driver' object")
|
|
| 55 |
|
|
| 56 |
code.InteractiveConsole(locals=globals()).interact() |
|
| 57 |
|
|
| 58 |
driver.quit() |
|
| 59 |
httpd.shutdown() |
|
| test/data/pages/gotmyowndomain.html | ||
|---|---|---|
| 1 |
<!DOCTYPE html> |
|
| 2 |
<!-- |
|
| 3 |
SPDX-License-Identifier: AGPL-3.0-or-later |
|
| 4 |
|
|
| 5 |
Sample testig page |
|
| 6 |
|
|
| 7 |
This file is part of Haketilo. |
|
| 8 |
|
|
| 9 |
Copyright (C) 2021 jahoti <jahoti@tilde.team> |
|
| 10 |
|
|
| 11 |
This program is free software: you can redistribute it and/or modify |
|
| 12 |
it under the terms of the GNU Affero General Public License as |
|
| 13 |
published by the Free Software Foundation, either version 3 of the |
|
| 14 |
License, or (at your option) any later version. |
|
| 15 |
|
|
| 16 |
This program is distributed in the hope that it will be useful, |
|
| 17 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 18 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 19 |
GNU Affero General Public License for more details. |
|
| 20 |
|
|
| 21 |
You should have received a copy of the GNU Affero General Public License |
|
| 22 |
along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
| 23 |
--> |
|
| 24 |
<html> |
|
| 25 |
<head> |
|
| 26 |
<meta name=charset value="latin1"> |
|
| 27 |
<title>Schrodinger's Document</title> |
|
| 28 |
</head> |
|
| 29 |
<body> |
|
| 30 |
A nice, simple page for testing. |
|
| 31 |
<script> |
|
| 32 |
document.write('<p><b>Or so you thought...</b></p>');
|
|
| 33 |
</script> |
|
| 34 |
</body> |
|
| 35 |
</html> |
|
| test/data/pages/gotmyowndomain_https.html | ||
|---|---|---|
| 1 |
<!DOCTYPE html> |
|
| 2 |
<!-- |
|
| 3 |
SPDX-License-Identifier: AGPL-3.0-or-later |
|
| 4 |
|
|
| 5 |
Sample testig page to serve over HTTPS |
|
| 6 |
|
|
| 7 |
This file is part of Haketilo. |
|
| 8 |
|
|
| 9 |
Copyright (C) 2021 jahoti <jahoti@tilde.team> |
|
| 10 |
|
|
| 11 |
This program is free software: you can redistribute it and/or modify |
|
| 12 |
it under the terms of the GNU Affero General Public License as |
|
| 13 |
published by the Free Software Foundation, either version 3 of the |
|
| 14 |
License, or (at your option) any later version. |
|
| 15 |
|
|
| 16 |
This program is distributed in the hope that it will be useful, |
|
| 17 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 18 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 19 |
GNU Affero General Public License for more details. |
|
| 20 |
|
|
| 21 |
You should have received a copy of the GNU Affero General Public License |
|
| 22 |
along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
| 23 |
--> |
|
| 24 |
<html> |
|
| 25 |
<head> |
|
| 26 |
<meta name=charset value="latin1"> |
|
| 27 |
<title>Schrodinger's Document</title> |
|
| 28 |
</head> |
|
| 29 |
<body> |
|
| 30 |
A nice, simple page for testing (using HTTPS). |
|
| 31 |
<script> |
|
| 32 |
document.write('<p><b>Or so you thought...</b></p>');
|
|
| 33 |
</script> |
|
| 34 |
</body> |
|
| 35 |
</html> |
|
| test/default_profiles/icecat_empty/extensions.json | ||
|---|---|---|
| 1 |
{"schemaVersion":25,"addons":[{"id":"jid1-KtlZuoiikVfFew@jetpack","location":"app-global","userDisabled":true,"path":"/usr/lib/icecat/browser/extensions/jid1-KtlZuoiikVfFew@jetpack"},{"id":"uBlock0@raymondhill.net","location":"app-global","userDisabled":true,"path":"/usr/lib/icecat/browser/extensions/uBlock0@raymondhill.net.xpi"},{"id":"SubmitMe@0xbeef.coffee","location":"app-global","userDisabled":true,"path":"/usr/lib/icecat/browser/extensions/SubmitMe@0xbeef.coffee"},{"id":"FreeUSPS@0xbeef.coffee","location":"app-global","userDisabled":true,"path":"/usr/lib/icecat/browser/extensions/FreeUSPS@0xbeef.coffee"},{"id":"tortm-browser-button@jeremybenthum","location":"app-global","userDisabled":true,"path":"/usr/lib/icecat/browser/extensions/tortm-browser-button@jeremybenthum"},{"id":"tprb.addon@searxes.danwin1210.me","location":"app-global","userDisabled":true,"path":"/usr/lib/icecat/browser/extensions/tprb.addon@searxes.danwin1210.me"},{"id":"SimpleSumOfUs@0xbeef.coffee","location":"app-global","userDisabled":true,"path":"/usr/lib/icecat/browser/extensions/SimpleSumOfUs@0xbeef.coffee"}]}
|
|
| test/misc_constants.py | ||
|---|---|---|
| 1 |
# SPDX-License-Identifier: AGPL-3.0-or-later |
|
| 2 |
|
|
| 3 |
""" |
|
| 4 |
Miscellaneous data that were found useful |
|
| 5 |
""" |
|
| 6 |
|
|
| 7 |
# This file is part of Haketilo. |
|
| 8 |
# |
|
| 9 |
# Copyright (C) 2021 jahoti <jahoti@tilde.team> |
|
| 10 |
# Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org> |
|
| 11 |
# |
|
| 12 |
# This program is free software: you can redistribute it and/or modify |
|
| 13 |
# it under the terms of the GNU Affero General Public License as |
|
| 14 |
# published by the Free Software Foundation, either version 3 of the |
|
| 15 |
# License, or (at your option) any later version. |
|
| 16 |
# |
|
| 17 |
# This program 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 |
|
| 20 |
# GNU Affero General Public License for more details. |
|
| 21 |
# |
|
| 22 |
# You should have received a copy of the GNU Affero General Public License |
|
| 23 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
| 24 |
# |
|
| 25 |
# |
|
| 26 |
# I, Wojtek Kosior, thereby promise not to sue for violation of this |
|
| 27 |
# file's license. Although I request that you do not make use this code |
|
| 28 |
# in a proprietary program, I am not going to enforce this in court. |
|
| 29 |
|
|
| 30 |
from pathlib import Path |
|
| 31 |
|
|
| 32 |
here = Path(__file__).resolve().parent |
|
| 33 |
|
|
| 34 |
default_firefox_binary = '/usr/lib/icecat/icecat' |
|
| 35 |
# The browser might be loading some globally-installed add-ons by default. They |
|
| 36 |
# could interfere with the tests, so we'll disable all of them. |
|
| 37 |
default_clean_profile_dir = here / 'default_profile' / 'icecat_empty' |
|
| 38 |
|
|
| 39 |
default_proxy_host = '127.0.0.1' |
|
| 40 |
default_proxy_port = 1337 |
|
| 41 |
|
|
| 42 |
default_cert_dir = here / 'certs' |
|
| 43 |
|
|
| 44 |
mime_types = {
|
|
| 45 |
"7z": "application/x-7z-compressed", "oga": "audio/ogg", |
|
| 46 |
"abw": "application/x-abiword", "ogv": "video/ogg", |
|
| 47 |
"arc": "application/x-freearc", "ogx": "application/ogg", |
|
| 48 |
"bin": "application/octet-stream", "opus": "audio/opus", |
|
| 49 |
"bz": "application/x-bzip", "otf": "font/otf", |
|
| 50 |
"bz2": "application/x-bzip2", "pdf": "application/pdf", |
|
| 51 |
"css": "text/css", "png": "image/png", |
|
| 52 |
"csv": "text/csv", "sh": "application/x-sh", |
|
| 53 |
"gif": "image/gif", "svg": "image/svg+xml", |
|
| 54 |
"gz": "application/gzip", "tar": "application/x-tar", |
|
| 55 |
"htm": "text/html", "ts": "video/mp2t", |
|
| 56 |
"html": "text/html", "ttf": "font/ttf", |
|
| 57 |
"ico": "image/vnd.microsoft.icon", "txt": "text/plain", |
|
| 58 |
"js": "text/javascript", "wav": "audio/wav", |
|
| 59 |
"jpeg": "image/jpeg", "weba": "audio/webm", |
|
| 60 |
"jpg": "image/jpeg", "webm": "video/webm", |
|
| 61 |
"json": "application/json", "woff": "font/woff", |
|
| 62 |
"mjs": "text/javascript", "woff2": "font/woff2", |
|
| 63 |
"mp3": "audio/mpeg", "xhtml": "application/xhtml+xml", |
|
| 64 |
"mp4": "video/mp4", "zip": "application/zip", |
|
| 65 |
"mpeg": "video/mpeg", |
|
| 66 |
"odp": "application/vnd.oasis.opendocument.presentation", |
|
| 67 |
"ods": "application/vnd.oasis.opendocument.spreadsheet", |
|
| 68 |
"odt": "application/vnd.oasis.opendocument.text", |
|
| 69 |
"xml": "application/xml" # text/xml if readable from casual users |
|
| 70 |
} |
|
| test/profiles.py | ||
|---|---|---|
| 1 |
# SPDX-License-Identifier: GPL-3.0-or-later |
|
| 2 |
|
|
| 3 |
""" |
|
| 4 |
Browser profiles and Selenium driver initialization |
|
| 5 |
""" |
|
| 6 |
|
|
| 7 |
# This file is part of Haketilo. |
|
| 8 |
# |
|
| 9 |
# Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org> |
|
| 10 |
# |
|
| 11 |
# This program is free software: you can redistribute it and/or modify |
|
| 12 |
# it under the terms of the GNU General Public License as published by |
|
| 13 |
# the Free Software Foundation, either version 3 of the License, or |
|
| 14 |
# (at your option) any later version. |
|
| 15 |
# |
|
| 16 |
# This program is distributed in the hope that it will be useful, |
|
| 17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 19 |
# GNU General Public License for more details. |
|
| 20 |
# |
|
| 21 |
# You should have received a copy of the GNU General Public License |
|
| 22 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
| 23 |
# |
|
| 24 |
# I, Wojtek Kosior, thereby promise not to sue for violation of this file's |
|
| 25 |
# license. Although I request that you do not make use this code in a |
|
| 26 |
# proprietary program, I am not going to enforce this in court. |
|
| 27 |
|
|
| 28 |
from selenium import webdriver |
|
| 29 |
from selenium.webdriver.firefox.options import Options |
|
| 30 |
import time |
|
| 31 |
|
|
| 32 |
from .misc_constants import * |
|
| 33 |
|
|
| 34 |
def set_profile_proxy(profile, proxy_host, proxy_port): |
|
| 35 |
# proxy type 1 designates "manual" |
|
| 36 |
profile.set_preference('network.proxy.type', 1)
|
|
| 37 |
profile.set_preference('network.proxy.no_proxies_on', '')
|
|
| 38 |
profile.set_preference('network.proxy.share_proxy_settings', True)
|
|
| 39 |
|
|
| 40 |
for proto in ['http', 'ftp', 'socks', 'ssl']: |
|
| 41 |
profile.set_preference(f'network.proxy.{proto}', proxy_host)
|
|
| 42 |
profile.set_preference(f'network.proxy.{proto}_port', proxy_port)
|
|
| 43 |
profile.set_preference(f'network.proxy.backup.{proto}', '')
|
|
| 44 |
profile.set_preference(f'network.proxy.backup.{proto}_port', 0)
|
|
| 45 |
|
|
| 46 |
def firefox_safe_mode(firefox_binary=default_firefox_binary, |
|
| 47 |
proxy_host=default_proxy_host, |
|
| 48 |
proxy_port=default_proxy_port): |
|
| 49 |
profile = webdriver.FirefoxProfile() |
|
| 50 |
set_profile_proxy(profile, proxy_host, proxy_port) |
|
| 51 |
|
|
| 52 |
options = Options() |
|
| 53 |
options.add_argument('--safe-mode')
|
|
| 54 |
|
|
| 55 |
return webdriver.Firefox(options=options, firefox_profile=profile, |
|
| 56 |
firefox_binary=firefox_binary) |
|
| 57 |
|
|
| 58 |
def firefox_with_profile(firefox_binary=default_firefox_binary, |
|
| 59 |
profile_dir=default_clean_profile_dir, |
|
| 60 |
proxy_host=default_proxy_host, |
|
| 61 |
proxy_port=default_proxy_port): |
|
| 62 |
profile = webdriver.FirefoxProfile(profile_dir) |
|
| 63 |
set_profile_proxy(profile, proxy_host, proxy_port) |
|
| 64 |
|
|
| 65 |
return webdriver.Firefox(firefox_profile=profile, |
|
| 66 |
firefox_binary=firefox_binary) |
|
| test/proxy_core.py | ||
|---|---|---|
| 1 |
# SPDX-License-Identifier: BSD-3-Clause |
|
| 2 |
|
|
| 3 |
""" |
|
| 4 |
The core for a "virtual network" proxy. |
|
| 5 |
""" |
|
| 6 |
|
|
| 7 |
# This file is part of Haketilo. |
|
| 8 |
# |
|
| 9 |
# Copyright (c) 2015, inaz2 |
|
| 10 |
# Copyright (C) 2021 jahoti <jahoti@tilde.team> |
|
| 11 |
# Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org> |
|
| 12 |
# |
|
| 13 |
# Redistribution and use in source and binary forms, with or without |
|
| 14 |
# modification, are permitted provided that the following conditions are met: |
|
| 15 |
# |
|
| 16 |
# * Redistributions of source code must retain the above copyright notice, this |
|
| 17 |
# list of conditions and the following disclaimer. |
|
| 18 |
# |
|
| 19 |
# * Redistributions in binary form must reproduce the above copyright notice, |
|
| 20 |
# this list of conditions and the following disclaimer in the documentation |
|
| 21 |
# and/or other materials provided with the distribution. |
|
| 22 |
# |
|
| 23 |
# * Neither the name of proxy2 nor the names of its contributors may be used to |
|
| 24 |
# endorse or promote products derived from this software without specific |
|
| 25 |
# prior written permission. |
|
| 26 |
# |
|
| 27 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
| 28 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
| 29 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
| 30 |
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
|
| 31 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
| 32 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
| 33 |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
| 34 |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
| 35 |
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
| 36 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
| 37 |
# |
|
| 38 |
# |
|
| 39 |
# I, Wojtek Kosior, thereby promise not to sue for violation of this file's |
|
| 40 |
# license. Although I request that you do not make use this code in a way |
|
| 41 |
# incompliant with the license, I am not going to enforce this in court. |
|
| 42 |
|
|
| 43 |
from pathlib import Path |
|
| 44 |
import socket, ssl, subprocess, sys, threading |
|
| 45 |
from http.server import HTTPServer, BaseHTTPRequestHandler |
|
| 46 |
from socketserver import ThreadingMixIn |
|
| 47 |
|
|
| 48 |
lock = threading.Lock() |
|
| 49 |
|
|
| 50 |
class ProxyRequestHandler(BaseHTTPRequestHandler): |
|
| 51 |
""" |
|
| 52 |
Handles a network request made to the proxy. Configures SSL encryption when |
|
| 53 |
needed. |
|
| 54 |
""" |
|
| 55 |
def __init__(self, *args, **kwargs): |
|
| 56 |
""" |
|
| 57 |
Initialize self. Uses the same arguments as |
|
| 58 |
http.server.BaseHTTPRequestHandler's constructor but also expect a |
|
| 59 |
`certdir` keyword argument with appropriate path. |
|
| 60 |
""" |
|
| 61 |
self.certdir = Path(kwargs.pop('certdir')).resolve()
|
|
| 62 |
super().__init__(*args, **kwargs) |
|
| 63 |
|
|
| 64 |
def log_error(self, *args, **kwargs): |
|
| 65 |
""" |
|
| 66 |
Like log_error in http.server.BaseHTTPRequestHandler but suppresses |
|
| 67 |
"Request timed out: timeout('timed out',)".
|
|
| 68 |
""" |
|
| 69 |
if not isinstance(args[0], socket.timeout): |
|
| 70 |
super().log_error(*args, **kwargs) |
|
| 71 |
|
|
| 72 |
def get_cert(self, hostname): |
|
| 73 |
""" |
|
| 74 |
If needed, generate a signed x509 certificate for `hostname`. Return |
|
| 75 |
paths to certificate's key file and to certificate itself in a tuple. |
|
| 76 |
""" |
|
| 77 |
root_keyfile = self.certdir / 'rootCA.key' |
|
| 78 |
root_certfile = self.certdir / 'rootCA.pem' |
|
| 79 |
keyfile = self.certdir / 'site.key' |
|
| 80 |
certfile = self.certdir / f'{hostname}.crt'
|
|
| 81 |
|
|
| 82 |
with lock: |
|
| 83 |
requestfile = self.certdir / f'{hostname}.csr'
|
|
| 84 |
if not certfile.exists(): |
|
| 85 |
subprocess.run([ |
|
| 86 |
'openssl', 'req', '-new', '-key', str(keyfile), |
|
| 87 |
'-subj', f'/CN={hostname}', '-out', str(requestfile)
|
|
| 88 |
], check=True) |
|
| 89 |
subprocess.run([ |
|
| 90 |
'openssl', 'x509', '-req', '-in', str(requestfile), |
|
| 91 |
'-CA', str(root_certfile), '-CAkey', str(root_keyfile), |
|
| 92 |
'-CAcreateserial', '-out', str(certfile), '-days', '1024' |
|
| 93 |
], check=True) |
|
| 94 |
|
|
| 95 |
return keyfile, certfile |
|
| 96 |
|
|
| 97 |
def do_CONNECT(self): |
|
| 98 |
"""Wrap the connection with SSL using on-demand signed certificate.""" |
|
| 99 |
hostname = self.path.split(':')[0]
|
|
| 100 |
sslargs = {'server_side': True}
|
|
| 101 |
sslargs['keyfile'], sslargs['certfile'] = self.get_cert(hostname) |
|
| 102 |
|
|
| 103 |
self.send_response(200) |
|
| 104 |
self.end_headers() |
|
| 105 |
|
|
| 106 |
self.connection = ssl.wrap_socket(self.connection, **sslargs) |
|
| 107 |
self.rfile = self.connection.makefile('rb', self.rbufsize)
|
|
| 108 |
self.wfile = self.connection.makefile('wb', self.wbufsize)
|
|
| 109 |
|
|
| 110 |
connection_header = self.headers.get('Proxy-Connection', '').lower()
|
|
| 111 |
self.close_connection = int(connection_header == 'close') |
|
| 112 |
|
|
| 113 |
def do_GET(self): |
|
| 114 |
content_length = int(self.headers.get('Content-Length', 0))
|
|
| 115 |
req_body = self.rfile.read(content_length) if content_length else None |
|
| 116 |
|
|
| 117 |
if self.path[0] == '/': |
|
| 118 |
secure = 's' if isinstance(self.connection, ssl.SSLSocket) else '' |
|
| 119 |
self.path = f'http{secure}://{self.headers["Host"]}{self.path}'
|
|
| 120 |
|
|
| 121 |
self.handle_request(req_body) |
|
| 122 |
|
|
| 123 |
do_OPTIONS = do_DELETE = do_PUT = do_HEAD = do_POST = do_GET |
|
| 124 |
|
|
| 125 |
def handle_request(self, req_body): |
|
| 126 |
"""Default handler that does nothing. Please override.""" |
|
| 127 |
pass |
|
| 128 |
|
|
| 129 |
|
|
| 130 |
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer): |
|
| 131 |
"""The actual proxy server""" |
|
| 132 |
address_family, daemon_threads = socket.AF_INET6, True |
|
| 133 |
|
|
| 134 |
def handle_error(self, request, client_address): |
|
| 135 |
""" |
|
| 136 |
Like handle_error in http.server.HTTPServer but suppresses socket/ssl |
|
| 137 |
related errors. |
|
| 138 |
""" |
|
| 139 |
cls, e = sys.exc_info()[:2] |
|
| 140 |
if not (cls is socket.error or cls is ssl.SSLError): |
|
| 141 |
return super().handle_error(request, client_address) |
|
| test/server.py | ||
|---|---|---|
| 1 |
# SPDX-License-Identifier: AGPL-3.0-or-later |
|
| 2 |
|
|
| 3 |
""" |
|
| 4 |
A modular "virtual network" proxy, |
|
| 5 |
wrapping the classes in proxy_core.py |
|
| 6 |
""" |
|
| 7 |
|
|
| 8 |
# This file is part of Haketilo. |
|
| 9 |
# |
|
| 10 |
# Copyright (C) 2021 jahoti <jahoti@tilde.team> |
|
| 11 |
# Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org> |
|
| 12 |
# |
|
| 13 |
# This program is free software: you can redistribute it and/or modify |
|
| 14 |
# it under the terms of the GNU Affero General Public License as |
|
| 15 |
# published by the Free Software Foundation, either version 3 of the |
|
| 16 |
# License, or (at your option) any later version. |
|
| 17 |
# |
|
| 18 |
# This program 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 |
|
| 21 |
# GNU Affero General Public License for more details. |
|
| 22 |
# |
|
| 23 |
# You should have received a copy of the GNU Affero General Public License |
|
| 24 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
| 25 |
# |
|
| 26 |
# |
|
| 27 |
# I, Wojtek Kosior, thereby promise not to sue for violation of this |
|
| 28 |
# file's license. Although I request that you do not make use this code |
|
| 29 |
# in a proprietary program, I am not going to enforce this in court. |
|
| 30 |
|
|
| 31 |
from pathlib import Path |
|
| 32 |
from urllib.parse import parse_qs |
|
| 33 |
from threading import Thread |
|
| 34 |
|
|
| 35 |
from .proxy_core import ProxyRequestHandler, ThreadingHTTPServer |
|
| 36 |
from .misc_constants import * |
|
| 37 |
from .world_wide_library import catalog as internet |
|
| 38 |
|
|
| 39 |
class RequestHijacker(ProxyRequestHandler): |
|
| 40 |
def handle_request(self, req_body): |
|
| 41 |
path_components = self.path.split('?', maxsplit=1)
|
|
| 42 |
path = path_components[0] |
|
| 43 |
try: |
|
| 44 |
# Response format: (status_code, headers (dict. of strings), |
|
| 45 |
# body as bytes or filename containing body as string) |
|
| 46 |
if path in internet: |
|
| 47 |
info = internet[path] |
|
| 48 |
if type(info) is tuple: |
|
| 49 |
status_code, headers, body_file = info |
|
| 50 |
resp_body = b'' |
|
| 51 |
if body_file is not None: |
|
| 52 |
if 'Content-Type' not in headers: |
|
| 53 |
ext = body_file.suffix[1:] |
|
| 54 |
if ext and ext in mime_types: |
|
| 55 |
headers['Content-Type'] = mime_types[ext] |
|
| 56 |
|
|
| 57 |
with open(body_file, mode='rb') as f: |
|
| 58 |
resp_body = f.read() |
|
| 59 |
else: |
|
| 60 |
# A function to evaluate to get the response |
|
| 61 |
get_params, post_params = {}, {}
|
|
| 62 |
if len(path_components) == 2: |
|
| 63 |
get_params = parse_qs(path_components[1]) |
|
| 64 |
|
|
| 65 |
# Parse POST parameters; currently only supports |
|
| 66 |
# application/x-www-form-urlencoded |
|
| 67 |
if req_body: |
|
| 68 |
post_params = parse_qs(req_body.encode()) |
|
| 69 |
|
|
| 70 |
status_code, headers, resp_body = info(self.command, get_params, post_params) |
|
| 71 |
if type(resp_body) == str: |
|
| 72 |
resp_body = resp_body.encode() |
|
| 73 |
|
|
| 74 |
if type(status_code) != int or status_code <= 0: |
|
| 75 |
raise Exception('Invalid status code %r' % status_code)
|
|
| 76 |
|
|
| 77 |
for header, header_value in headers.items(): |
|
| 78 |
if type(header) != str: |
|
| 79 |
raise Exception('Invalid header key %r' % header)
|
|
| 80 |
|
|
| 81 |
elif type(header_value) != str: |
|
| 82 |
raise Exception('Invalid header value %r' % header_value)
|
|
| 83 |
else: |
|
| 84 |
status_code, headers = 404, {'Content-Type': 'text/plain'}
|
|
| 85 |
resp_body = b'Handler for this URL not found.' |
|
| 86 |
|
|
| 87 |
except Exception as e: |
|
| 88 |
status_code, headers, resp_body = 500, {'Content-Type': 'text/plain'}, b'Internal Error:\n' + repr(e).encode()
|
|
| 89 |
|
|
| 90 |
headers['Content-Length'] = str(len(resp_body)) |
|
| 91 |
self.send_response(status_code) |
|
| 92 |
for header, header_value in headers.items(): |
|
| 93 |
self.send_header(header, header_value) |
|
| 94 |
|
|
| 95 |
self.end_headers() |
|
| 96 |
if resp_body: |
|
| 97 |
self.wfile.write(resp_body) |
|
| 98 |
|
|
| 99 |
def do_an_internet(certdir=default_cert_dir, port=default_proxy_port): |
|
| 100 |
"""Start up the proxy/server""" |
|
| 101 |
class RequestHijackerWithCertdir(RequestHijacker): |
|
| 102 |
def __init__(self, *args, **kwargs): |
|
| 103 |
super().__init__(*args, certdir=certdir, **kwargs) |
|
| 104 |
|
|
| 105 |
httpd = ThreadingHTTPServer(('', port), RequestHijackerWithCertdir)
|
|
| 106 |
Thread(target=httpd.serve_forever).start() |
|
| 107 |
|
|
| 108 |
return httpd |
|
| test/test_unit.py | ||
|---|---|---|
| 1 |
# SPDX-License-Identifier: CC0-1.0 |
|
| 2 |
|
|
| 3 |
""" |
|
| 4 |
Haketilo unit tests |
|
| 5 |
""" |
|
| 6 |
|
|
| 7 |
# This file is part of Haketilo |
|
| 8 |
# |
|
| 9 |
# Copyright (C) 2021, jahoti |
|
| 10 |
# Copyright (C) 2021, Wojtek Kosior |
|
| 11 |
# |
|
| 12 |
# This program is free software: you can redistribute it and/or modify |
|
| 13 |
# it under the terms of the CC0 1.0 Universal License as published by |
|
| 14 |
# the Creative Commons Corporation. |
|
| 15 |
# |
|
| 16 |
# This program is distributed in the hope that it will be useful, |
|
| 17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 19 |
# CC0 1.0 Universal License for more details. |
|
| 20 |
|
|
| 21 |
import pytest |
|
| 22 |
from .profiles import firefox_safe_mode |
|
| 23 |
from .server import do_an_internet |
|
| 24 |
|
|
| 25 |
@pytest.fixture |
|
| 26 |
def proxy(): |
|
| 27 |
httpd = do_an_internet() |
|
| 28 |
yield httpd |
|
| 29 |
httpd.shutdown() |
|
| 30 |
|
|
| 31 |
@pytest.fixture |
|
| 32 |
def driver(proxy): |
|
| 33 |
with firefox_safe_mode() as driver: |
|
| 34 |
yield driver |
|
| 35 |
driver.quit() |
|
| 36 |
|
|
| 37 |
def test_basic(driver): |
|
| 38 |
driver.get('https://gotmyowndoma.in')
|
|
| 39 |
element = driver.find_element_by_tag_name('title')
|
|
| 40 |
title = driver.execute_script('return arguments[0].innerText;', element)
|
|
| 41 |
assert "Schrodinger's Document" in title |
|
| test/world_wide_library.py | ||
|---|---|---|
| 1 |
# SPDX-License-Identifier: AGPL-3.0-or-later |
|
| 2 |
|
|
| 3 |
""" |
|
| 4 |
Our helpful little stand-in for the Internet |
|
| 5 |
""" |
|
| 6 |
|
|
| 7 |
# This file is part of Haketilo. |
|
| 8 |
# |
|
| 9 |
# Copyright (C) 2021 jahoti <jahoti@tilde.team> |
|
| 10 |
# Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org> |
|
| 11 |
# |
|
| 12 |
# This program is free software: you can redistribute it and/or modify |
|
| 13 |
# it under the terms of the GNU Affero General Public License as |
|
| 14 |
# published by the Free Software Foundation, either version 3 of the |
|
| 15 |
# License, or (at your option) any later version. |
|
| 16 |
# |
|
| 17 |
# This program 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 |
|
| 20 |
# GNU Affero General Public License for more details. |
|
| 21 |
# |
|
| 22 |
# You should have received a copy of the GNU Affero General Public License |
|
| 23 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
| 24 |
# |
|
| 25 |
# |
|
| 26 |
# I, Wojtek Kosior, thereby promise not to sue for violation of this |
|
| 27 |
# file's license. Although I request that you do not make use this code |
|
| 28 |
# in a proprietary program, I am not going to enforce this in court. |
|
| 29 |
|
|
| 30 |
from .misc_constants import here |
|
| 31 |
|
|
| 32 |
catalog = {
|
|
| 33 |
'http://gotmyowndoma.in': (302, {'location': 'http://gotmyowndoma.in/index.html'}, None),
|
|
| 34 |
'http://gotmyowndoma.in/': (302, {'location': 'http://gotmyowndoma.in/index.html'}, None),
|
|
| 35 |
'http://gotmyowndoma.in/index.html': (200, {}, here / 'data' / 'pages' / 'gotmyowndomain.html'),
|
|
| 36 |
'https://gotmyowndoma.in': (302, {'location': 'https://gotmyowndoma.in/index.html'}, None),
|
|
| 37 |
'https://gotmyowndoma.in/': (302, {'location': 'https://gotmyowndoma.in/index.html'}, None),
|
|
| 38 |
'https://gotmyowndoma.in/index.html': (200, {}, here / 'data' / 'pages' / 'gotmyowndomain_https.html')
|
|
| 39 |
} |
|
Also available in: Unified diff
add Selenium- and Python-based test system