├── servers
├── dockers
│ ├── idx_0
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ ├── idx_1
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ ├── idx_2
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ ├── idx_3
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ ├── idx_4
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ ├── idx_5
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ ├── idx_6
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ ├── idx_7
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ ├── idx_8
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ ├── idx_9
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
│ └── idx_10
│ │ ├── requirements.txt
│ │ ├── Dockerfile
│ │ └── app.py
└── docker-compose.yml
├── requirements.txt
├── src
├── fuzzer
│ ├── exception.py
│ ├── minimizer.py
│ └── reproducer.py
├── web_api
│ ├── web_api_type.py
│ ├── tag_manager.py
│ ├── value.json
│ ├── value_manager.py
│ ├── tag.json
│ └── web_object.py
├── js_api
│ ├── js_api_type.py
│ └── js_object.py
└── script
│ ├── testcase.py
│ ├── string_instruction.py
│ ├── script.py
│ ├── js_instruction.py
│ ├── web_instruction.py
│ ├── web_page.py
│ ├── statement.py
│ ├── testcase_generator.py
│ └── pattern_builder.py
├── tools
└── domato
│ ├── vbscript
│ ├── README.md
│ └── generator.py
│ ├── jscript
│ ├── README.md
│ ├── template.html
│ └── generator.py
│ ├── template.html
│ ├── php
│ ├── README.md
│ ├── generator.py
│ ├── php.txt
│ ├── parse_types.py
│ └── template.php
│ ├── CONTRIBUTING.md
│ ├── mathml
│ ├── test.py
│ └── mathattrvalues.txt
│ ├── canvas
│ ├── template.html
│ ├── README.md
│ ├── generator.py
│ └── canvas.txt
│ ├── webgl
│ ├── generator.py
│ └── template.html
│ ├── LICENSE
│ └── common.txt
├── kill.sh
├── README.md
├── .gitignore
└── chrome_downloader.py
/servers/dockers/idx_0/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_1/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_2/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_3/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_4/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_5/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_6/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_7/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_8/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_9/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/servers/dockers/idx_10/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
2 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium
2 | bs4
3 | flask
4 | msedge-selenium-tools
5 |
--------------------------------------------------------------------------------
/src/fuzzer/exception.py:
--------------------------------------------------------------------------------
1 | class TestcaseTimeout(Exception):
2 | """Base class for other exceptions"""
3 | pass
4 |
--------------------------------------------------------------------------------
/tools/domato/vbscript/README.md:
--------------------------------------------------------------------------------
1 | Script and grammar for fuzzing Microsoft VBScript engine.
2 |
3 | Usage is the same as for DOM fuzzing.
4 |
--------------------------------------------------------------------------------
/tools/domato/jscript/README.md:
--------------------------------------------------------------------------------
1 | Script and grammar for fuzzing Microsoft jscript.dll JavaScript engine.
2 |
3 | Usage is the same as for DOM fuzzing.
4 |
--------------------------------------------------------------------------------
/src/web_api/web_api_type.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 | from enum import auto
3 |
4 | class WebApiType(Enum):
5 | read_property = auto()
6 | write_property = auto()
7 | call_method = auto()
8 | construct = auto()
--------------------------------------------------------------------------------
/tools/domato/template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/servers/dockers/idx_0/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7000
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_1/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7001
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_10/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7010
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_2/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7002
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_3/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7003
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_4/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7004
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_5/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7005
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_6/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7006
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_7/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7007
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_8/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7008
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/servers/dockers/idx_9/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.7-alpine
2 | WORKDIR /code
3 | ENV FLASK_APP=app.py
4 | ENV FLASK_RUN_HOST=0.0.0.0
5 | RUN apk add --no-cache gcc musl-dev linux-headers
6 | COPY requirements.txt requirements.txt
7 | RUN pip install -r requirements.txt
8 | EXPOSE 7009
9 | COPY . .
10 | CMD ["flask", "run"]
11 |
--------------------------------------------------------------------------------
/src/js_api/js_api_type.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 | from enum import auto
3 |
4 | class JsApiType(Enum):
5 | assign = auto()
6 | operation_addition = auto()
7 | operation_minus = auto()
8 | operation_multiple = auto()
9 | operation_division = auto()
10 | operation_equal = auto()
11 | operation_not_equal = auto()
12 |
--------------------------------------------------------------------------------
/kill.sh:
--------------------------------------------------------------------------------
1 | ps -ef | grep fuzzer.fuzzer | awk -F" " '{print "kill -9 " $2}' | sh
2 | ps -ef | grep chrome | grep /home/shelling/chromium | awk -F" " '{print "kill -9 " $2}' | sh
3 | ps -ef | grep geckodriver | awk -F" " '{print "kill -9 " $2}' | sh
4 | ps -ef | grep firefox-bin | awk -F" " '{print "kill -9 " $2}' | sh
5 | ps -ef | grep msedgedriver | awk -F" " '{print "kill -9 " $2}' | sh
6 | ps -ef | grep msedge | awk -F" " '{print "kill -9 " $2}' | sh
7 | ps -ef | grep firefox | awk -F" " '{print "kill -9 " $2}' | sh
8 | ps -ef | grep chrome | awk -F" " '{print "kill -9 " $2}' | sh
9 |
--------------------------------------------------------------------------------
/src/script/testcase.py:
--------------------------------------------------------------------------------
1 | from src.script.web_page import WebPage
2 |
3 | class Testcase:
4 | def __init__(self, name, origins, pages):
5 | self.data = {}
6 | self.name = name
7 | self.origins = origins
8 | self.pages = pages
9 |
10 | for o in range(self.origins):
11 | self.data[o] = {}
12 | # for p in range(pages):
13 | # self.data[o][p]
14 |
15 | def add(self, html, origin, page):
16 | self.data[origin][page] = html
17 |
18 | def get(self, origin, page):
19 | return self.data[origin][page]
20 |
--------------------------------------------------------------------------------
/src/script/string_instruction.py:
--------------------------------------------------------------------------------
1 | from src.web_api.web_object import WebObject
2 | from src.web_api.web_api_type import WebApiType
3 |
4 | class StrInstruction:
5 | def __init__(self, text, keep=True):
6 | self.text = text
7 | self.keep = keep
8 |
9 | def lift(self, guard=False, debug=False, indent=0):
10 | code = self.text
11 | if guard:
12 | code = "try {" + code + "} catch(e) {"
13 | if debug:
14 | code += "console.log(e);"
15 | code += "} "
16 |
17 | code = " " * indent + code
18 |
19 | return code
20 |
--------------------------------------------------------------------------------
/tools/domato/php/README.md:
--------------------------------------------------------------------------------
1 | The `php_generated.txt` file was generated by running `parse_types.py` on the
2 | source code of php.
3 |
4 | Possible improvements:
5 | - Callbacks are currently unused (`` always point to `phpinfo`).
6 | Generating callback code in a similar manner to the main function could
7 | potentially expose additional bugs, especially if callbacks get access to the
8 | same variables / can mess up stuff that the caller didn't expect.
9 | - Currently, the return values from the function / method calls are ignored.
10 | In cases where function / method calls return non-trivial types, it be better
11 | to store these return values in variables and use them as function arguments
12 | in later calls or potentially call methods on these "generated" objects.
13 | - It would be great to be able to infer the expected classes of the objects
14 | parameters taken by functions/methods.
15 | - The `parse_type.py` code is ugly, and should be refactored a bit.
16 | - Randomize the references (`$ref_` in template.php).
17 |
18 |
--------------------------------------------------------------------------------
/tools/domato/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to contribute
2 |
3 | We'd love to accept your patches and contributions to this project. There are
4 | just a few small guidelines you need to follow.
5 |
6 | ## Contributor License Agreement
7 |
8 | Contributions to any Google project must be accompanied by a Contributor License
9 | Agreement. This is necessary because you own the copyright to your changes, even
10 | after your contribution becomes part of this project. So this agreement simply
11 | gives us permission to use and redistribute your contributions as part of the
12 | project. Head over to to see your current
13 | agreements on file or to sign a new one.
14 |
15 | You generally only need to submit a CLA once, so if you've already submitted one
16 | (even if it was for a different project), you probably don't need to do it
17 | again.
18 |
19 | ## Code reviews
20 |
21 | All submissions, including submissions by project members, require review. We
22 | use GitHub pull requests for this purpose. Consult [GitHub Help] for more
23 | information on using pull requests.
24 |
25 | [GitHub Help]: https://help.github.com/articles/about-pull-requests/
26 |
--------------------------------------------------------------------------------
/src/web_api/tag_manager.py:
--------------------------------------------------------------------------------
1 | import json
2 | import random
3 |
4 | class TagManager:
5 | __grammar = None
6 |
7 | @classmethod
8 | def init(cls):
9 | if cls.__grammar is None:
10 | with open("src/web_api/tag.json") as f:
11 | cls.__grammar = json.load(f)
12 |
13 | @classmethod
14 | def bind(cls, name):
15 | cls.init()
16 | if name in cls.__grammar:
17 | try:
18 | obj = cls.__grammar[name]
19 | if obj:
20 | return obj
21 | else:
22 | return "HTMLElement"
23 | except KeyError as e:
24 | return "HTMLElement"
25 |
26 | @classmethod
27 | def tags(cls):
28 | cls.init()
29 | return list(cls.__grammar.keys())
30 |
31 | @classmethod
32 | def random_tag(cls):
33 | cls.init()
34 | tag = random.choice(list(cls.__grammar.keys()))
35 | return f"'{tag}'"
36 |
37 |
38 | def main():
39 | candidate = TagManager.tags()
40 | print(candidate)
41 |
42 | obj = TagManager.bind("a")
43 | print(obj)
44 |
45 | if __name__ == "__main__":
46 | main()
--------------------------------------------------------------------------------
/tools/domato/mathml/test.py:
--------------------------------------------------------------------------------
1 | # Copyright 2017 Google Inc. All Rights Reserved.
2 | # Licensed under the Apache License, Version 2.0 (the "License");
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an "AS IS" BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 | from __future__ import print_function
15 | import os
16 | import re
17 | import random
18 | import sys
19 |
20 | from grammar import Grammar
21 |
22 | cssgrammar = Grammar()
23 | err = cssgrammar.parse_from_file('css.txt')
24 |
25 | htmlgrammar = Grammar()
26 | htmlgrammar.add_import('cssgrammar', cssgrammar)
27 | htmlgrammar.parse_from_file('mathml.txt')
28 |
29 | # result_string = htmlgrammar .generate_symbol('svgelement_svg')
30 | # just math, without svg
31 |
32 | result_string = htmlgrammar .generate_symbol('mathelement_math')
33 | print('\n' + result_string)
34 |
--------------------------------------------------------------------------------
/tools/domato/canvas/template.html:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/servers/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.5"
2 | services:
3 | idx_0:
4 | build: dockers/idx_0
5 | ports:
6 | - "7000:5000"
7 | volumes:
8 | - ./data/idx_0:/data
9 | idx_1:
10 | build: dockers/idx_1
11 | ports:
12 | - "7001:5000"
13 | volumes:
14 | - ./data/idx_1:/data
15 | idx_2:
16 | build: dockers/idx_2
17 | ports:
18 | - "7002:5000"
19 | volumes:
20 | - ./data/idx_2:/data
21 | idx_3:
22 | build: dockers/idx_3
23 | ports:
24 | - "7003:5000"
25 | volumes:
26 | - ./data/idx_3:/data
27 | idx_4:
28 | build: dockers/idx_4
29 | ports:
30 | - "7004:5000"
31 | volumes:
32 | - ./data/idx_4:/data
33 | idx_5:
34 | build: dockers/idx_5
35 | ports:
36 | - "7005:5000"
37 | volumes:
38 | - ./data/idx_5:/data
39 | idx_6:
40 | build: dockers/idx_6
41 | ports:
42 | - "7006:5000"
43 | volumes:
44 | - ./data/idx_6:/data
45 | idx_7:
46 | build: dockers/idx_7
47 | ports:
48 | - "7007:5000"
49 | volumes:
50 | - ./data/idx_7:/data
51 | idx_8:
52 | build: dockers/idx_8
53 | ports:
54 | - "7008:5000"
55 | volumes:
56 | - ./data/idx_8:/data
57 | idx_9:
58 | build: dockers/idx_9
59 | ports:
60 | - "7009:5000"
61 | volumes:
62 | - ./data/idx_9:/data
63 | idx_10:
64 | build: dockers/idx_10
65 | ports:
66 | - "7010:5000"
67 | volumes:
68 | - ./data/idx_10:/data
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FuzzOrigin
2 |
3 | ## Paper
4 | [FuzzOrigin: Detecting UXSS vulnerabilities in Browsers through Origin Fuzzing](https://www.usenix.org/conference/usenixsecurity22/presentation/kim)
5 |
6 | ## Server Setting
7 | ```
8 | $ sudo apt-get install docker-compose
9 | $ cd servers
10 | $ sudo docker-compose up -d
11 | $ sudo chown -R $(id -nu):$(id -ng) .
12 | ```
13 |
14 | ## Download chrome
15 | ```
16 | $ python3 chrome_downloader.py [version]
17 | ```
18 | Visit [OmahaProxy](https://omahaproxy.appspot.com/) to check chrome version.
19 |
20 | ## Run fuzzer
21 | python3 -m src.fuzzer.fuzzer [browser type] [browser binary] [idx]
22 | - browser type: chrome, firefox, edge
23 | - browser binary: browser binary path
24 | - idx: test idx
25 | ```
26 | $ python3 -m src.fuzzer.fuzzer chrome chrome/103.0.5042.0_999146/chrome 0
27 | ```
28 |
29 | ## Result
30 | tests/output_[idx]
31 | ```
32 | $ ls tests/output_0
33 | ```
34 |
35 | ## Citation
36 | ```
37 | @inproceedings {281314,
38 | author = {Sunwoo Kim and Young Min Kim and Jaewon Hur and Suhwan Song and Gwangmu Lee and Byoungyoung Lee},
39 | title = {{FuzzOrigin}: Detecting {UXSS} vulnerabilities in Browsers through Origin Fuzzing},
40 | booktitle = {31st USENIX Security Symposium (USENIX Security 22)},
41 | year = {2022},
42 | isbn = {978-1-939133-31-1},
43 | address = {Boston, MA},
44 | pages = {1008--1023},
45 | url = {https://www.usenix.org/conference/usenixsecurity22/presentation/kim},
46 | publisher = {USENIX Association},
47 | month = aug,
48 | }
49 | ```
--------------------------------------------------------------------------------
/src/script/script.py:
--------------------------------------------------------------------------------
1 | from src.script.web_instruction import WebInstruction
2 | from src.script.statement import *
3 | from src.web_api.web_api_type import WebApiType
4 |
5 |
6 | class Script:
7 | def __init__(self):
8 | self.instructions = []
9 |
10 | def lift(self, guard=False, debug=False, indent=0):
11 | code = ""
12 | for inst in self.instructions:
13 | code += inst.lift(guard, debug, indent) + "\n"
14 | return code
15 |
16 |
17 | def main():
18 | sc = Script()
19 | inst = WebInstruction("v1", [], "v2", "Node", WebApiType.read_property, "baseURI")
20 | sc.instructions.append(inst)
21 |
22 | state = IfElseStatement()
23 | inst = WebInstruction("v1", [], "v2", "Node", WebApiType.write_property, "nodeValue")
24 | state.if_instructions.append(inst)
25 |
26 | sc.instructions.append(state)
27 |
28 | inst = WebInstruction("v1", ["v2"], "v3", "Element", WebApiType.call_method, "appendChild")
29 | sc.instructions.append(inst)
30 |
31 | state = FunctionStatement("f1", ["v1"])
32 | inst = WebInstruction("v1", [], "v2", "Node", WebApiType.read_property, "baseURI")
33 | state.instructions.append(inst)
34 | sc.instructions.append(state)
35 |
36 | state = TryCatchStatement()
37 | inst = WebInstruction("v1", [], None, "Node", WebApiType.read_property, "baseURI")
38 | state.try_instructions.append(inst)
39 | inst = WebInstruction("v1", ["v2"], "v3", "Element", WebApiType.call_method, "appendChild")
40 | state.catch_instructions.append(inst)
41 | sc.instructions.append(state)
42 |
43 |
44 | if __name__ == "__main__":
45 | main()
46 |
--------------------------------------------------------------------------------
/servers/dockers/idx_1/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_1!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7001)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_10/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_10!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7010)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_2/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_2!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7002)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_3/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_3!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7003)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_4/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_4!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7004)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_5/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_5!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7005)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_6/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_6!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7006)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_7/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_7!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7007)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_8/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_8!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7008)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_9/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 | return r
29 |
30 | @app.route('/svg/')
31 | def svg_send(name):
32 | with open("/data/svg/template.svg") as f:
33 | html = f.read()
34 | html = html.replace("", name.split(".")[0])
35 | r = flask.Response(html, mimetype='image/svg+xml')
36 | return r
37 |
38 | @app.route('/svg_parent/')
39 | def svg_parent_send(name):
40 | with open("/data/svg/template.svg") as f:
41 | html = f.read()
42 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
43 | r = flask.Response(html, mimetype='image/svg+xml')
44 | return r
45 |
46 | @app.route('/')
47 | def hello_world():
48 | return 'Hello, idx_9!'
49 |
50 | if __name__ == '__main__':
51 | app.debug=True
52 | app.run(host="0.0.0.0", port=7009)
53 | #app.run(port=7000)
54 |
--------------------------------------------------------------------------------
/servers/dockers/idx_0/app.py:
--------------------------------------------------------------------------------
1 | import flask
2 | import time
3 | import logging
4 |
5 | logging.basicConfig(filename = "/data/log.txt", level = logging.DEBUG)
6 |
7 | app = flask.Flask(__name__)
8 |
9 | @app.route('/sop/')
10 | def sop_send(name):
11 | with open(f"/data/sop/{name}") as f:
12 | html = f.read()
13 |
14 | response = flask.Response(html)
15 | response.headers["X-Frame-Options"] = "SAMEORIGIN"
16 | return response
17 |
18 | @app.route('/')
19 | def send(name):
20 | # return flask.send_from_directory('.', name)
21 | logging.info(f"[LOG] {name}")
22 | r = flask.make_response(flask.send_from_directory('/data', name))
23 | r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
24 | r.headers["Pragma"] = "no-cache"
25 | r.headers["Expires"] = "0"
26 | r.headers['Cache-Control'] = 'public, max-age=0'
27 | r.set_cookie('userID', 'parent')
28 |
29 | return r
30 |
31 | @app.route('/svg/')
32 | def svg_send(name):
33 | with open("/data/svg/template.svg") as f:
34 | html = f.read()
35 | html = html.replace("", name.split(".")[0])
36 | r = flask.Response(html, mimetype='image/svg+xml')
37 | return r
38 |
39 | @app.route('/svg_parent/')
40 | def svg_parent_send(name):
41 | with open("/data/svg/template.svg") as f:
42 | html = f.read()
43 | html = html.replace("", f"{name.split('.')[0]}.parentNode")
44 | r = flask.Response(html, mimetype='image/svg+xml')
45 | return r
46 |
47 | @app.route('/')
48 | def hello_world():
49 | return 'Hello, idx_0!'
50 |
51 | if __name__ == '__main__':
52 | app.debug=True
53 | app.run(host="0.0.0.0", port=7000)
54 | #app.run(port=7000)
55 |
--------------------------------------------------------------------------------
/src/script/js_instruction.py:
--------------------------------------------------------------------------------
1 | from src.js_api.js_api_type import JsApiType
2 |
3 |
4 | class JsInstruction:
5 | def __init__(self, input, params, output, obj, api_type, name=None, keep=True):
6 | self.input = input
7 | self.params = params
8 | self.output = output
9 | self.obj = obj
10 | self.api_type = api_type
11 | self.name = name
12 | self.keep = keep
13 |
14 | def lift(self, guard=False, debug=False, indent=0):
15 | code = ""
16 |
17 | if self.api_type == JsApiType.assign:
18 | code += f"{self.input}"
19 | else:
20 | if self.api_type == JsApiType.operation_addition:
21 | operation = "+"
22 | elif self.api_type == JsApiType.operation_minus:
23 | operation = "-"
24 | elif self.api_type == JsApiType.operation_multiple:
25 | operation = "*"
26 | elif self.api_type == JsApiType.operation_division:
27 | operation = "/"
28 | elif self.api_type == JsApiType.operation_equal:
29 | operation = "=="
30 | elif self.api_type == JsApiType.operation_not_equal:
31 | operation = "!="
32 | code += f"{self.input} {operation} {self.params[0]}"
33 |
34 | if self.output:
35 | code = f"{self.output} = {code}"
36 |
37 | code += ";"
38 | if guard:
39 | code = "try {" + code + "} catch(e) {"
40 | if debug:
41 | code += "console.log(e);"
42 | code += "} "
43 |
44 | code = " " * indent + code
45 |
46 | return code
47 |
48 |
49 | def main():
50 | inst = JsInstruction("v1", [1], "v2", "Integer", JsApiType.operation_addition, None)
51 | print(inst.lift())
52 |
53 |
54 | if __name__ == "__main__":
55 | main()
--------------------------------------------------------------------------------
/tools/domato/canvas/README.md:
--------------------------------------------------------------------------------
1 | Script and grammar for fuzzing Canvas API based on CanvasRenderingContext2D specification found at https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
2 |
3 | *** Example usage ***
4 |
5 | Running the generate_one_case.py script will yield a sample fuzzed case:
6 |
7 | ```
8 | ctx.clearHitRegions();
9 | /* newvar{fuzzvar00001:path2d} */ var fuzzvar00001 = new Path2D('M1 0 H -1 V 0 H 10 L 1 1');
10 | if (!fuzzvar00001) { fuzzvar00001 = GetVariable(fuzzervars, 'path2d'); } else { SetVariable(fuzzvar00001, 'path2d'); }
11 | ctx.stroke(fuzzvar00001);
12 | console.log(ctx.isPointInPath(fuzzvar00001, 1073741824, 2147483647, "nonzero"));
13 | console.log(ctx.isPointInStroke(fuzzvar00001, -2147483648, 2147483647));
14 | ctx.stroke(fuzzvar00001);
15 | ctx.fill(fuzzvar00001, "evenodd");
16 | console.log(ctx.isPointInPath(fuzzvar00001, -1, 0, "nonzero"));
17 | console.log(ctx.isPointInStroke(fuzzvar00001, -1073741824, 2147483648));
18 | console.log(ctx.isPointInStroke(fuzzvar00001, 536870912, 268435456));
19 | console.log(ctx.isPointInStroke(fuzzvar00001, 268435456, -32769));
20 | ctx.clip(fuzzvar00001, "nonzero");
21 | /* newvar{fuzzvar00002:path2d} */ var fuzzvar00002 = new Path2D(fuzzvar00001);
22 | if (!fuzzvar00002) { fuzzvar00002 = GetVariable(fuzzervars, 'path2d'); } else { SetVariable(fuzzvar00002, 'path2d'); }
23 | console.log(ctx.isPointInPath(fuzzvar00002, -32769, 32768, "nonzero"));
24 | ctx.clip(fuzzvar00002, "nonzero");
25 | console.log(ctx.isPointInPath(fuzzvar00001, -32769, 268435456, "evenodd"));
26 | ctx.clip(fuzzvar00001, "nonzero");
27 | ctx.bezierCurveTo(-2147483648, -2147483648, 268435456, 4294967295, 2147483647, 65535);
28 | ctx.fill(fuzzvar00001, "nonzero");
29 | ctx.fill(fuzzvar00001, "evenodd");
30 | /* newvar{fuzzvar00003:path2d} */ var fuzzvar00003 = new Path2D(fuzzvar00002);
31 | if (!fuzzvar00003) { fuzzvar00003 = GetVariable(fuzzervars, 'path2d'); } else { SetVariable(fuzzvar00003, 'path2d'); }
32 | ```
33 |
34 | Your mileage may vary so feel free to modify/edit template.html.
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/web_api/value.json:
--------------------------------------------------------------------------------
1 | {
2 | "Boolean": ["true", "false"],
3 | "rtlltrString": ["rtl", "ltr"],
4 | "OnOffString": ["on", "off"],
5 | "ReferrerPolicyString": ["no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin", "same-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"],
6 | "RelString": ["alternate", "author", "bookmark", "external", "help", "license", "next", "nofollow", "noreferrer", "noopener", "prev", "search", "tag"],
7 | "TargetString": ["_blank", "_parent", "_self", "_top"],
8 | "CoordsString": ["10, 10, 10", "20, 20, 20, 20"],
9 | "ShapeString": ["rect", "circle", "poly", "default"],
10 | "MethodString": ["get", "post", "dialog"],
11 | "HTTPMethodString": ["GET", "POST", "PUT", "DELETE"],
12 | "TypeString": ["submit", "reset", "button", "menu"],
13 | "AlignString": ["left", "right", "justify", "center"],
14 | "vAlignString": ["top", "middle", "bottom", "baseline"],
15 | "FeaturePolicyString": ["allowsFeature", "features", "allowedFeatures", "getAllowlistForFeature"],
16 | "SandboxString": ["allow-forms", "allow-pointer-lock", "allow-popups", "allow-same-origin", "allow-scripts", "allow-top-navigation"],
17 | "RefString": ["sync", "async", "auto"],
18 | "EagerLazyString": ["eager", "lazy"],
19 | "InputtypeString": ["button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "radio", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week", "datetime"],
20 | "PreloadString": ["none", "metadata", "auto"],
21 | "DateTimeString": ["0062-02-05", "1993-11-01", "2021-07-01", "2162-02-05"],
22 | "ValueTypeString": ["data", "ref", "object"],
23 | "SelectionDirectionString": ["forward", "backward", "none"],
24 | "KindString": ["subtitles", "captions", "descriptions", "chapters", "metadata"],
25 | "PositionString": ["beforebegin", "afterbegin", "beforeend", "afterend"],
26 | "ReadyStateString": ["loading", "interactive", "complete"]
27 |
28 |
29 |
30 |
31 |
32 | }
--------------------------------------------------------------------------------
/tools/domato/jscript/template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/src/script/web_instruction.py:
--------------------------------------------------------------------------------
1 | from src.web_api.web_object import WebObject
2 | from src.web_api.web_api_type import WebApiType
3 |
4 | class WebInstruction:
5 | def __init__(self, input, params, output, obj, api_type, name, keep=True):
6 | self.input = input
7 | self.params = params
8 | self.output = output
9 | self.obj = obj
10 | self.api_type = api_type
11 | self.name = name
12 | self.keep = keep
13 |
14 | def lift(self, guard=False, debug=False, indent=0):
15 | code = ""
16 |
17 | if self.input and self.obj != "Function" and self.obj != "Built-in":
18 | code += f"{self.input}."
19 |
20 | if self.api_type == WebApiType.call_method or self.api_type == WebApiType.construct:
21 | if self.name == "item":
22 | code = code[:-1] + f"[{', '.join(map(str, self.params))}]"
23 | else:
24 | code += f"{self.name}"
25 | code += f"({', '.join(map(str, self.params))})"
26 |
27 | else:
28 | code += f"{self.name}"
29 |
30 | if self.api_type == WebApiType.construct:
31 | code = "new " + code
32 |
33 | if self.output:
34 | if self.api_type == WebApiType.read_property or \
35 | self.api_type == WebApiType.call_method or \
36 | self.api_type == WebApiType.construct:
37 | code = f"{self.output} = {code}"
38 | if self.api_type == WebApiType.write_property:
39 | code = f"{code} = {self.output}"
40 |
41 | code += ";"
42 | if guard:
43 | code = "try {" + code + "} catch(e) {"
44 | if debug:
45 | code += "console.log(e);"
46 | code += "} "
47 |
48 | code = " " * indent + code
49 |
50 | return code
51 |
52 | def get_input_object(self):
53 | return WebObject.create(self.obj)
54 |
55 | def get_output_object(self):
56 | instance = WebObject.create(self.obj)
57 | if instance is not None:
58 | if self.api_type == WebApiType.call_method:
59 | return instance.get_method_return(self.name)
60 | elif self.api_type == WebApiType.construct:
61 | return instance.get_constructor_return(self.name)
62 | else:
63 | return instance.get_property_return(self.name)
64 |
65 |
66 | def main():
67 | inst = WebInstruction("v1", [], "v2", "Node", WebApiType.read_property, "baseURI")
68 | print(inst.lift())
69 |
70 |
71 | if __name__ == "__main__":
72 | main()
--------------------------------------------------------------------------------
/src/script/web_page.py:
--------------------------------------------------------------------------------
1 | import secrets
2 |
3 | class WebPage:
4 | def __init__(self, html=None, event_handlers=[], body_script=[],
5 | foo_bar=None):
6 | self.html = html
7 | self.event_handlers = event_handlers
8 | self.body_script = body_script
9 |
10 | self.handler = False
11 | if len(self.event_handlers) > 0:
12 | self.handler = True
13 | self.event_handler1 = event_handlers[0]
14 | self.event_handler2 = event_handlers[1]
15 |
16 |
17 | self.loader = False
18 |
19 | if len(self.event_handlers) > 2:
20 | self.loader = True
21 | self.load_handler1 = event_handlers[2]
22 | self.load_handler2 = event_handlers[3]
23 | self.load_handler3 = event_handlers[4]
24 | self.load_handler4 = event_handlers[5]
25 |
26 | self.foo_bar = foo_bar
27 |
28 | def to_string(self, skip=False, debug=False):
29 | code = self.html
30 | if skip:
31 | return code
32 |
33 | head_script = \
34 | "\n"
55 | code = code.replace('', head_script)
56 |
57 | if "" in code:
58 | code = code.replace('', self.foo_bar)
59 |
60 | for script in self.body_script:
61 | lift = \
62 | "\n"
69 |
70 | code = code.replace('', lift, 1)
71 | return code
--------------------------------------------------------------------------------
/src/web_api/value_manager.py:
--------------------------------------------------------------------------------
1 | import json
2 | import random
3 | import string
4 |
5 | class ValueManager:
6 | __grammar = None
7 |
8 | @classmethod
9 | def init(cls):
10 | if cls.__grammar is None:
11 | with open("src/web_api/value.json") as f:
12 | cls.__grammar = json.load(f)
13 |
14 | @classmethod
15 | def bind(cls, name):
16 | cls.init()
17 | if name in cls.__grammar:
18 | try:
19 | arr = cls.__grammar[name]
20 | if arr:
21 | return arr
22 | else:
23 | return []
24 | except KeyError as e:
25 | return []
26 |
27 | @classmethod
28 | def random_bind(cls, name):
29 | cls.init()
30 | if name in cls.__grammar:
31 | try:
32 | arr = cls.__grammar[name]
33 | if arr:
34 | value = random.choice(arr)
35 | if name.endswith("String"):
36 | value = f"'{value}'"
37 | return value
38 | else:
39 | return "null"
40 | except KeyError as e:
41 | return "null"
42 | elif name == "Integer":
43 | return str(random.randrange(100))
44 | elif name == "Double":
45 | return str(random.random() * 100)
46 | elif name == "String":
47 | N = random.randrange(10) + 1
48 | value = ''.join(random.choices(string.ascii_letters + string.digits, k=N))
49 | return f"'{value}'"
50 | elif name == "DOMString":
51 | N = random.randrange(10) + 1
52 | value = ''.join(random.choices(string.ascii_letters + string.digits, k=N))
53 | return f"'{value}'"
54 | elif name == "URI":
55 | value = "http://127.0.0.1"
56 | return f"'{value}'"
57 | elif name == "DomainString":
58 | value = "127.0.0.1"
59 | return f"'{value}'"
60 | # elif name == "Markup":
61 | # value = "
7 |
8 |
11 |
71 |
72 |
73 |
74 |
75 |