
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/fedoseevalex/otusgolanghomework/hw10_program_optimization
Вам дан исходный код функции GetDomainStat(r io.Reader, domain string)
, которая:
r
пользовательские данные вида{"Id":1,"Name":"Howard Mendoza","Username":"0Oliver","Email":"aliquid_qui_ea@Browsedrive.gov","Phone":"6-866-899-36-79","Password":"InAQJvsq","Address":"Blackbird Place 25"}
{"Id":2,"Name":"Brian Olson","Username":"non_quia_id","Email":"FrancesEllis@Quinu.edu","Phone":"237-75-34","Password":"cmEPhX8","Address":"Butterfield Junction 74"}
{"Id":3,"Name":"Justin Oliver Jr. Sr.","Username":"oPerez","Email":"MelissaGutierrez@Twinte.gov","Phone":"106-05-18","Password":"f00GKr9i","Address":"Oak Valley Lane 19"}
(осторожно, в отличие от конкретной строки файл целиком не является валидным JSON);
domain
.Например, для данных, представленных выше:
GetDomainStat(r, "com") // {}
GetDomainStat(r, "gov") // {"browsedrive": 1, "twinte": 1}
GetDomainStat(r, "edu") // {"quinu": 1}
Для большего понимания см. исходный код и тесты.
Необходимо оптимизировать программу таким образом, чтобы она проходила все тесты.
Нельзя:
GetDomainStat
;Можно:
GetDomainStat
);Обратите внимание на запуск TestGetDomainStat_Time_And_Memory
go test -v -count=1 -timeout=30s -tags bench .
Здесь используется билд-тэг bench, чтобы отделить обычные тесты от тестов производительности.
"Email"
и пр. вместо ускорения анмаршалинга более поддерживаемыми и понятными средствами.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.