(jsFileUrl string, OutputType string, source string, )
| 308 | |
| 309 | |
| 310 | func (crawler *Crawler) feedLinkfinder(jsFileUrl string, OutputType string, source string, ) { |
| 311 | |
| 312 | if !crawler.jsSet.Duplicate(jsFileUrl) { |
| 313 | outputFormat := fmt.Sprintf("[%s] - %s", OutputType, jsFileUrl) |
| 314 | |
| 315 | if crawler.JsonOutput { |
| 316 | sout := SpiderOutput{ |
| 317 | Input: crawler.Input, |
| 318 | Source: source, |
| 319 | OutputType: OutputType, |
| 320 | Output: jsFileUrl, |
| 321 | } |
| 322 | if data, err := jsoniter.MarshalToString(sout); err == nil { |
| 323 | outputFormat = data |
| 324 | fmt.Println(outputFormat) |
| 325 | } |
| 326 | |
| 327 | } else if !crawler.Quiet { |
| 328 | fmt.Println(outputFormat) |
| 329 | } |
| 330 | |
| 331 | if crawler.Output != nil { |
| 332 | crawler.Output.WriteToFile(outputFormat) |
| 333 | } |
| 334 | |
| 335 | // If JS file is minimal format. Try to find original format |
| 336 | if strings.Contains(jsFileUrl, ".min.js") { |
| 337 | originalJS := strings.ReplaceAll(jsFileUrl, ".min.js", ".js") |
| 338 | _ = crawler.LinkFinderCollector.Visit(originalJS) |
| 339 | } |
| 340 | |
| 341 | // Send Javascript to Link Finder Collector |
| 342 | _ = crawler.LinkFinderCollector.Visit(jsFileUrl) |
| 343 | |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | func (crawler *Crawler) Start(linkfinder bool) { |
| 348 | // Setup Link Finder |
no test coverage detected