completed tag class def

This commit is contained in:
Daniele Linguaglossa 2023-10-25 11:25:41 +02:00
parent 9e0ea55f29
commit 196ffdcd4f
2 changed files with 25 additions and 0 deletions

View File

@ -8,6 +8,23 @@ class HTMLTag:
self.attributes = []
self.children = []
def __str__(self) -> str:
tag = ""
if self.self_closing:
tag = f"<{self.name} "
for attr in self.attributes:
tag += f"{attr} "
tag += "/>"
else:
tag = f"<{self.name}"
for attr in self.attributes:
tag += f"{attr} "
tag += ">"
for child in self.children:
tag += f"{child}"
tag += f"</{self.name}>"
return tag
class HTMLTagAttributeType:
TypeText = 0

View File

@ -10,6 +10,14 @@ from tags import Attributes
# WAFBypass class
from language import HTMLTag, HTMLAttribute, HTMLTagAttributeType
t = HTMLTag("form")
i = HTMLTag("input", self_closing=True)
i.attributes.append(HTMLAttribute("type", HTMLTagAttributeType.TypeText))
t.children.append(i)
print(t)
class WAFBypass():
code = "window.alert_trigger = false;window.alert = function() {window.alert_trigger = true;}"