getJS – 사이트에서 Javascript 소스/파일을 가져오는 Go 기반 도구

· 1년 전 · 350

URL과 웹 페이지/HTTP 응답에서 JavaScript 소스를 추출하는 강력한 도구입니다.

 

https://github.com/003random/getJS

 

package main

import (
    "fmt"
    "log"
    "net/http"
    "net/url"

    "github.com/003random/getJS/extractor"
)

func main() {
    baseURL, err := url.Parse("https://google.com")
    if (err != nil) {
        log.Fatalf("Error parsing base URL: %v", err)
    }

    resp, err := extractor.FetchResponse(baseURL.String(), "GET", http.Header{})
    if (err != nil) {
        log.Fatalf("Error fetching response: %v", err)
    }
    defer resp.Body.Close()

    // Custom extraction points (optional).
    extractionPoints := map[string][]string{
        "script": {"src", "data-src"},
        "a": {"href"},
    }

    sources, err := extractor.ExtractSources(resp.Body, extractionPoints)
    if (err != nil) {
        log.Fatalf("Error extracting sources: %v", err)
    }

    // Filtering and extending extracted sources.
    filtered, err := extractor.Filter(sources, extractor.WithComplete(baseURL), extractor.WithResolve())
    if (err != nil) {
        log.Fatalf("Error filtering sources: %v", err)
    }

    for source := range filtered {
        fmt.Println(source.String())
    }
}

 

웹학교 무료강좌 / 웹학교 컨텐츠몰

PHP포탈 / 구인구직 솔루션

By 웹학교

|
댓글을 작성하시려면 로그인이 필요합니다.

365ok IT뉴스

+
제목 글쓴이 날짜 조회
1년 전 조회 457
1년 전 조회 421
1년 전 조회 442
1년 전 조회 505
1년 전 조회 451
1년 전 조회 458
1년 전 조회 567
1년 전 조회 574
1년 전 조회 384
1년 전 조회 419
1년 전 조회 438
1년 전 조회 393
1년 전 조회 344
1년 전 조회 408
1년 전 조회 351
1년 전 조회 362
1년 전 조회 346
1년 전 조회 428
1년 전 조회 417
1년 전 조회 465
1년 전 조회 358
1년 전 조회 482
1년 전 조회 435
1년 전 조회 349
1년 전 조회 426
1년 전 조회 411
1년 전 조회 482
1년 전 조회 406
1년 전 조회 470
1년 전 조회 416