From f5339ae80caee50bd151f2d5f12b0b39a741cdf0 Mon Sep 17 00:00:00 2001
From: Aidan Feess <145503050+AidanFeess@users.noreply.github.com>
Date: Thu, 14 Dec 2023 12:35:20 -0800
Subject: [PATCH] add json to html powershell parser
---
parsers/json2html.ps1 | 398 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 398 insertions(+)
create mode 100644 parsers/json2html.ps1
diff --git a/parsers/json2html.ps1 b/parsers/json2html.ps1
new file mode 100644
index 0000000..b22e07d
--- /dev/null
+++ b/parsers/json2html.ps1
@@ -0,0 +1,398 @@
+# Based on https://github.com/carlospolop/PEASS-ng/blob/master/parsers/json2html.py
+# TODO: create the script
+function parse_dict {
+ param (
+ [System.Object] $json_dict
+ )
+
+ # Parse the given dict from the given json adding it to the HTML file
+ $dict_text = ""
+ foreach($obj in $json_dict.psobject.properties){
+ $key = $obj.Name
+ $value = $obj.Value
+ $n = Get-Random -Minimum 1 -Maximum 999999
+ $infos = [System.Collections.ArrayList]@()
+
+ foreach($info in $value."infos"){
+ if(([string]$info).StartsWith('http')){
+ $infos.Add("$info
`n")
+ }
+ else{
+ $infos.Add([string]$info + "
`n")
+ }
+ }
+
+ $dict_text += "`t`t
`n"
+ $dict_text += "" + ($infos -join "") + ""
+ $dict_text += "