Made files robot friendly

This commit is contained in:
Mo Langning
2024-02-14 21:06:29 +08:00
parent d0b72e7e31
commit 0f63e7f3d5
13 changed files with 456 additions and 8713 deletions
Regular → Executable
+26 -3
View File
@@ -2,9 +2,9 @@
import os
import sys
import xml.etree.ElementTree as ET
import xml.etree.ElementTree as et
if not sys.argv[1]:
if len(sys.argv) == 1:
exit(0)
files=sys.argv[1].split(" ")
@@ -15,4 +15,27 @@ for i in files:
exit(2)
for i in files:
ET
xml_file = et.parse(i)
contents = []
for j in xml_file.getroot().findall("attack"):
xss = j.find('code').text
if not xss:
continue
if "\n" in xss:
print("Xss have newline in it.")
print(xss, "\n")
contents.append(xss)
file_dir, file_name = i.rsplit("/", 1)
file_name = os.path.join(file_dir, file_name.rsplit(".", 1)[0] + ".txt")
open(file_name, "w").write("\n".join(contents))
print(f"Wrote to {file_name}")