HtmlOutput it's the wrapper around all the html things. Actually it manages everything related to HTML output.
(flags input.Input, resultFilename string, finalResults []string, finalSecret []scanner.SecretMatched, finalEndpoints []scanner.EndpointMatched, finalExtensions []scanner.FileTypeMatched, finalErrors []scanner.ErrorMatched, finalInfos []scanner.InfoMatched)
| 136 | // HtmlOutput it's the wrapper around all the html things. |
| 137 | // Actually it manages everything related to HTML output. |
| 138 | func HTMLOutput(flags input.Input, resultFilename string, finalResults []string, finalSecret []scanner.SecretMatched, |
| 139 | finalEndpoints []scanner.EndpointMatched, finalExtensions []scanner.FileTypeMatched, |
| 140 | finalErrors []scanner.ErrorMatched, finalInfos []scanner.InfoMatched) { |
| 141 | exists, err := fileUtils.ElementExists(CariddiOutputFolder) |
| 142 | if err != nil { |
| 143 | fmt.Println("Error while creating the output directory.") |
| 144 | os.Exit(1) |
| 145 | } |
| 146 | |
| 147 | if !exists { |
| 148 | fileUtils.CreateOutputFolder() |
| 149 | } |
| 150 | |
| 151 | HeaderHTML("Results found", resultFilename) |
| 152 | |
| 153 | for _, elem := range finalResults { |
| 154 | AppendOutputToHTML(elem, "", resultFilename, true) |
| 155 | } |
| 156 | |
| 157 | FooterHTML(resultFilename) |
| 158 | |
| 159 | // if secrets flag enabled save also secrets |
| 160 | if flags.Secrets && len(finalSecret) > 0 { |
| 161 | HeaderHTML("Secrets found", resultFilename) |
| 162 | |
| 163 | for _, elem := range finalSecret { |
| 164 | AppendOutputToHTML(fmt.Sprintf("%s - %s in %s", elem.Secret.Name, elem.Match, elem.URL), "", resultFilename, false) |
| 165 | } |
| 166 | |
| 167 | FooterHTML(resultFilename) |
| 168 | } |
| 169 | |
| 170 | // if endpoints flag enabled save also endpoints |
| 171 | if flags.Endpoints && len(finalEndpoints) > 0 { |
| 172 | HeaderHTML("Endpoints found", resultFilename) |
| 173 | |
| 174 | for _, elem := range finalEndpoints { |
| 175 | for _, parameter := range elem.Parameters { |
| 176 | finalString := "" + parameter.Parameter |
| 177 | if len(parameter.Attacks) != 0 { |
| 178 | finalString += " -" |
| 179 | for _, attack := range parameter.Attacks { |
| 180 | finalString += " " + attack |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | AppendOutputToHTML(fmt.Sprintf("%s in %s", finalString, elem.URL), "", resultFilename, false) |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | FooterHTML(resultFilename) |
| 189 | } |
| 190 | |
| 191 | // if extensions flag enabled save also extensions |
| 192 | if hasValidExtensionFlag(flags.Extensions) && len(finalExtensions) > 0 { |
| 193 | HeaderHTML("Extensions found", resultFilename) |
| 194 | |
| 195 | for _, elem := range finalExtensions { |
no test coverage detected