
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
github.com/go-some/crawler
crowl ์๋น์ค์ ํฌ๋กค๋ฌ๋ฅผ ๊ตฌํํฉ๋๋ค.
go get -u github.com/gocolly/colly/...
go get go.mongodb.org/mongo-driver
go get -u github.com/go-some/crawler
type Reuters struct {
}
articleCollector
์ ๋ฆฌ์๋ฒ๋ฅผ ํตํด ์ ์ฅํฉ๋๋ค.News
struct ํ์์ ๋ง๊ฒ mongoDB์ ์ ์ฅ๋๋ฉฐ WriteDocs
(writer.go)ํจ์์์ ๊ทธ ๊ธฐ๋ฅ์ ์ํํฉ๋๋ค.func (rc *Reuters) Run(wtr DocsWriter) {
// Instantiate default NewCollector
c := colly.NewCollector(
colly.MaxDepth(3),
// Visit only finance and businessnews section
colly.URLFilters(
regexp.MustCompile("https://www\\.reuters\\.com/finance"),
regexp.MustCompile("https://www\\.reuters\\.com/news/archive/businessnews.+"),
),
colly.DisallowedURLFilters(
regexp.MustCompile("https://www\\.reuters\\.com/finance/.+"),
),
)
c.AllowURLRevisit = false
// Create another collector to scrape each news article
articleCollector := colly.NewCollector()
c.OnHTML("a[href]", func(e *colly.HTMLElement) {
/* crawl all href links recursively */
link := e.Request.AbsoluteURL(e.Attr("href"))
//if the link is article page, crawl using articleCollector
//else, visit the link until MaxDepth
if strings.Index(link, "reuters.com/article") != -1 {
articleCollector.Visit(link)
} else {
e.Request.Visit(link) //e.Request.Visit์ ์ด์ฉํด์ผ MaxDepth ์ฒ๋ฆฌ๊ฐ ๋๋ค.
}
})
articleCollector.OnHTML("div.StandardArticle_inner-container", func(e *colly.HTMLElement) {
/* Read article page and save to mongoDB
- ์ต์ข
์ ์ผ๋ก ์ฐ๋ฆฌ๊ฐ ํฌ๋กคํ๊ณ ์ ํ๋ ๊ธฐ์ฌ ํ์ด์ง (leaf node)
*/
doc := News{
Title: e.ChildText(".ArticleHeader_headline"),
Body: e.ChildText("div.StandardArticleBody_body"),
Time: e.ChildText(".ArticleHeader_date"),
Url: e.Request.URL.String(),
Origin: "Reuters",
}
cnt, err := wtr.WriteDocs([]News{doc})
if err != nil {
fmt.Println(err)
} else {
fmt.Println(cnt, "docs saved")
}
})
c.Visit("https://www.reuters.com/finance")
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.