moriarty-project 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- moriarty/__init__.py +5 -0
- moriarty/adapters/__init__.py +0 -0
- moriarty/agent/__init__.py +0 -0
- moriarty/assets/modules/.gitkeep +0 -0
- moriarty/assets/modules/asia/douban.yaml +19 -0
- moriarty/assets/modules/asia/kakao.yaml +19 -0
- moriarty/assets/modules/asia/line.yaml +19 -0
- moriarty/assets/modules/asia/mixi.yaml +19 -0
- moriarty/assets/modules/asia/naver.yaml +19 -0
- moriarty/assets/modules/asia/qq.yaml +19 -0
- moriarty/assets/modules/asia/vk.yaml +19 -0
- moriarty/assets/modules/asia/wechat.yaml +19 -0
- moriarty/assets/modules/asia/weibo.yaml +19 -0
- moriarty/assets/modules/asia/xiaohongshu.yaml +19 -0
- moriarty/assets/modules/behance.yaml +47 -0
- moriarty/assets/modules/business/crunchbase.yaml +27 -0
- moriarty/assets/modules/business/fiverr.yaml +32 -0
- moriarty/assets/modules/business/freelancer.yaml +27 -0
- moriarty/assets/modules/business/glassdoor.yaml +27 -0
- moriarty/assets/modules/business/guru.yaml +26 -0
- moriarty/assets/modules/business/indeed.yaml +25 -0
- moriarty/assets/modules/business/monster.yaml +25 -0
- moriarty/assets/modules/business/peopleperhour.yaml +26 -0
- moriarty/assets/modules/business/toptal.yaml +28 -0
- moriarty/assets/modules/business/upwork.yaml +27 -0
- moriarty/assets/modules/business/ziprecruiter.yaml +25 -0
- moriarty/assets/modules/content/buymeacoffee.yaml +27 -0
- moriarty/assets/modules/content/gumroad.yaml +27 -0
- moriarty/assets/modules/content/ko-fi.yaml +32 -0
- moriarty/assets/modules/content/onlyfans.yaml +27 -0
- moriarty/assets/modules/content/patreon.yaml +33 -0
- moriarty/assets/modules/content/substack.yaml +32 -0
- moriarty/assets/modules/creative/500px.yaml +31 -0
- moriarty/assets/modules/creative/artstation.yaml +33 -0
- moriarty/assets/modules/creative/deviantart.yaml +32 -0
- moriarty/assets/modules/creative/flickr.yaml +31 -0
- moriarty/assets/modules/creative/pexels.yaml +26 -0
- moriarty/assets/modules/creative/unsplash.yaml +26 -0
- moriarty/assets/modules/creative/vimeo.yaml +31 -0
- moriarty/assets/modules/crypto/binance.yaml +27 -0
- moriarty/assets/modules/crypto/bitcointalk.yaml +33 -0
- moriarty/assets/modules/crypto/coinbase.yaml +26 -0
- moriarty/assets/modules/crypto/etherscan.yaml +32 -0
- moriarty/assets/modules/crypto/foundation.yaml +28 -0
- moriarty/assets/modules/crypto/kraken.yaml +27 -0
- moriarty/assets/modules/crypto/mirror.yaml +27 -0
- moriarty/assets/modules/crypto/niftygateway.yaml +26 -0
- moriarty/assets/modules/crypto/opensea.yaml +32 -0
- moriarty/assets/modules/crypto/rarible.yaml +27 -0
- moriarty/assets/modules/crypto/superrare.yaml +29 -0
- moriarty/assets/modules/dating/bumble.yaml +25 -0
- moriarty/assets/modules/dating/grindr.yaml +27 -0
- moriarty/assets/modules/dating/happn.yaml +25 -0
- moriarty/assets/modules/dating/her.yaml +27 -0
- moriarty/assets/modules/dating/hinge.yaml +25 -0
- moriarty/assets/modules/dating/match.yaml +25 -0
- moriarty/assets/modules/dating/meetme.yaml +27 -0
- moriarty/assets/modules/dating/okcupid.yaml +25 -0
- moriarty/assets/modules/dating/pof.yaml +25 -0
- moriarty/assets/modules/dating/tinder.yaml +25 -0
- moriarty/assets/modules/dating-nsfw/adultfriendfinder.yaml +28 -0
- moriarty/assets/modules/dating-nsfw/ashley-madison.yaml +26 -0
- moriarty/assets/modules/design/adobe-portfolio.yaml +27 -0
- moriarty/assets/modules/design/carbonmade.yaml +27 -0
- moriarty/assets/modules/design/cgsociety.yaml +27 -0
- moriarty/assets/modules/design/coroflot.yaml +27 -0
- moriarty/assets/modules/design/figma.yaml +27 -0
- moriarty/assets/modules/design/sketch.yaml +26 -0
- moriarty/assets/modules/dev/bitbucket.yaml +35 -0
- moriarty/assets/modules/dev/codeforces.yaml +32 -0
- moriarty/assets/modules/dev/codepen.yaml +34 -0
- moriarty/assets/modules/dev/hackerone.yaml +32 -0
- moriarty/assets/modules/dev/hackthebox.yaml +27 -0
- moriarty/assets/modules/dev/huggingface.yaml +27 -0
- moriarty/assets/modules/dev/kaggle.yaml +32 -0
- moriarty/assets/modules/dev/leetcode.yaml +32 -0
- moriarty/assets/modules/dev/replit.yaml +31 -0
- moriarty/assets/modules/dribbble.yaml +53 -0
- moriarty/assets/modules/ecommerce/etsy.yaml +32 -0
- moriarty/assets/modules/education/duolingo.yaml +32 -0
- moriarty/assets/modules/education/edx.yaml +26 -0
- moriarty/assets/modules/education/khanacademy.yaml +26 -0
- moriarty/assets/modules/education/lynda.yaml +27 -0
- moriarty/assets/modules/education/memrise.yaml +27 -0
- moriarty/assets/modules/education/pluralsight.yaml +27 -0
- moriarty/assets/modules/education/skillshare.yaml +27 -0
- moriarty/assets/modules/education/udacity.yaml +27 -0
- moriarty/assets/modules/email/github_email.yaml +40 -0
- moriarty/assets/modules/email/gravatar.yaml +23 -0
- moriarty/assets/modules/europe/badoo.yaml +19 -0
- moriarty/assets/modules/europe/lovoo.yaml +19 -0
- moriarty/assets/modules/europe/myspace.yaml +19 -0
- moriarty/assets/modules/europe/netlog.yaml +19 -0
- moriarty/assets/modules/europe/ok.yaml +19 -0
- moriarty/assets/modules/europe/skyrock.yaml +19 -0
- moriarty/assets/modules/europe/studivz.yaml +19 -0
- moriarty/assets/modules/europe/tuenti.yaml +19 -0
- moriarty/assets/modules/europe/viadeo.yaml +19 -0
- moriarty/assets/modules/europe/xing.yaml +19 -0
- moriarty/assets/modules/fitness/fitbit.yaml +27 -0
- moriarty/assets/modules/fitness/garmin.yaml +27 -0
- moriarty/assets/modules/fitness/myfitnesspal.yaml +27 -0
- moriarty/assets/modules/fitness/strava.yaml +33 -0
- moriarty/assets/modules/fitness/zwift.yaml +28 -0
- moriarty/assets/modules/food/allrecipes.yaml +27 -0
- moriarty/assets/modules/food/tasty.yaml +27 -0
- moriarty/assets/modules/food/yelp.yaml +32 -0
- moriarty/assets/modules/food/zomato.yaml +28 -0
- moriarty/assets/modules/forums/4chan.yaml +26 -0
- moriarty/assets/modules/forums/8kun.yaml +26 -0
- moriarty/assets/modules/forums/9gag.yaml +26 -0
- moriarty/assets/modules/forums/discourse.yaml +26 -0
- moriarty/assets/modules/forums/disqus.yaml +31 -0
- moriarty/assets/modules/forums/hackernews.yaml +32 -0
- moriarty/assets/modules/forums/launchpad.yaml +27 -0
- moriarty/assets/modules/forums/phpbb.yaml +25 -0
- moriarty/assets/modules/forums/quora.yaml +32 -0
- moriarty/assets/modules/forums/serverfault.yaml +27 -0
- moriarty/assets/modules/forums/slashdot.yaml +28 -0
- moriarty/assets/modules/forums/stackexchange.yaml +32 -0
- moriarty/assets/modules/forums/superuser.yaml +27 -0
- moriarty/assets/modules/forums/vbulletin.yaml +25 -0
- moriarty/assets/modules/forums/xenforo.yaml +25 -0
- moriarty/assets/modules/forums-nsfw/kiwifarms.yaml +25 -0
- moriarty/assets/modules/forums-nsfw/lolcow.yaml +26 -0
- moriarty/assets/modules/gaming/apextracker.yaml +27 -0
- moriarty/assets/modules/gaming/battlenet.yaml +26 -0
- moriarty/assets/modules/gaming/chess.yaml +30 -0
- moriarty/assets/modules/gaming/discord-public.yaml +27 -0
- moriarty/assets/modules/gaming/dotabuff.yaml +32 -0
- moriarty/assets/modules/gaming/epicgames.yaml +25 -0
- moriarty/assets/modules/gaming/faceit.yaml +33 -0
- moriarty/assets/modules/gaming/fortnitetracker.yaml +32 -0
- moriarty/assets/modules/gaming/gog.yaml +26 -0
- moriarty/assets/modules/gaming/itch.yaml +32 -0
- moriarty/assets/modules/gaming/kongregate.yaml +25 -0
- moriarty/assets/modules/gaming/minecraft.yaml +31 -0
- moriarty/assets/modules/gaming/opgg.yaml +32 -0
- moriarty/assets/modules/gaming/origin.yaml +26 -0
- moriarty/assets/modules/gaming/playstation.yaml +30 -0
- moriarty/assets/modules/gaming/roblox.yaml +31 -0
- moriarty/assets/modules/gaming/xbox.yaml +25 -0
- moriarty/assets/modules/github.yaml +68 -0
- moriarty/assets/modules/gitlab.yaml +60 -0
- moriarty/assets/modules/instagram.yaml +48 -0
- moriarty/assets/modules/latam/fotolog.yaml +27 -0
- moriarty/assets/modules/latam/orkut.yaml +26 -0
- moriarty/assets/modules/latam/taringa.yaml +27 -0
- moriarty/assets/modules/learning/coursera.yaml +26 -0
- moriarty/assets/modules/learning/udemy.yaml +26 -0
- moriarty/assets/modules/linkedin.yaml +40 -0
- moriarty/assets/modules/marketplaces/depop.yaml +28 -0
- moriarty/assets/modules/marketplaces/ebay.yaml +32 -0
- moriarty/assets/modules/marketplaces/grailed.yaml +27 -0
- moriarty/assets/modules/marketplaces/mercari.yaml +26 -0
- moriarty/assets/modules/marketplaces/poshmark.yaml +27 -0
- moriarty/assets/modules/marketplaces/reverb.yaml +27 -0
- moriarty/assets/modules/marketplaces/vinted.yaml +28 -0
- moriarty/assets/modules/medium.yaml +44 -0
- moriarty/assets/modules/music/audiomack.yaml +26 -0
- moriarty/assets/modules/music/bandcamp.yaml +30 -0
- moriarty/assets/modules/music/beatport.yaml +28 -0
- moriarty/assets/modules/music/deezer.yaml +26 -0
- moriarty/assets/modules/music/discogs.yaml +32 -0
- moriarty/assets/modules/music/genius.yaml +26 -0
- moriarty/assets/modules/music/lastfm.yaml +30 -0
- moriarty/assets/modules/music/mixcloud.yaml +26 -0
- moriarty/assets/modules/music/reverbnation.yaml +31 -0
- moriarty/assets/modules/music/soundcloud.yaml +31 -0
- moriarty/assets/modules/music/spotify.yaml +26 -0
- moriarty/assets/modules/music/tidal.yaml +26 -0
- moriarty/assets/modules/nsfw/adultwork.yaml +27 -0
- moriarty/assets/modules/nsfw/bongacams.yaml +28 -0
- moriarty/assets/modules/nsfw/cam4.yaml +28 -0
- moriarty/assets/modules/nsfw/chaturbate.yaml +28 -0
- moriarty/assets/modules/nsfw/clips4sale.yaml +27 -0
- moriarty/assets/modules/nsfw/extralunchmoney.yaml +27 -0
- moriarty/assets/modules/nsfw/fansly.yaml +28 -0
- moriarty/assets/modules/nsfw/fetlife.yaml +28 -0
- moriarty/assets/modules/nsfw/iwantclips.yaml +27 -0
- moriarty/assets/modules/nsfw/justforfans.yaml +28 -0
- moriarty/assets/modules/nsfw/loyalfans.yaml +28 -0
- moriarty/assets/modules/nsfw/manyvids.yaml +27 -0
- moriarty/assets/modules/nsfw/myfreecams.yaml +28 -0
- moriarty/assets/modules/nsfw/niteflirt.yaml +26 -0
- moriarty/assets/modules/nsfw/pornhub.yaml +32 -0
- moriarty/assets/modules/nsfw/redtube.yaml +27 -0
- moriarty/assets/modules/nsfw/stripchat.yaml +28 -0
- moriarty/assets/modules/nsfw/xhamster.yaml +27 -0
- moriarty/assets/modules/nsfw/xvideos.yaml +27 -0
- moriarty/assets/modules/nsfw/youporn.yaml +27 -0
- moriarty/assets/modules/photography/eyeem.yaml +25 -0
- moriarty/assets/modules/photography/fotki.yaml +25 -0
- moriarty/assets/modules/photography/photobucket.yaml +26 -0
- moriarty/assets/modules/photography/smugmug.yaml +25 -0
- moriarty/assets/modules/photography/vsco.yaml +27 -0
- moriarty/assets/modules/pinterest.yaml +40 -0
- moriarty/assets/modules/podcasts/anchor.yaml +26 -0
- moriarty/assets/modules/podcasts/castbox.yaml +26 -0
- moriarty/assets/modules/podcasts/podbean.yaml +26 -0
- moriarty/assets/modules/professional/about.yaml +31 -0
- moriarty/assets/modules/professional/academia.yaml +27 -0
- moriarty/assets/modules/professional/angellist.yaml +27 -0
- moriarty/assets/modules/professional/calendly.yaml +26 -0
- moriarty/assets/modules/professional/issuu.yaml +27 -0
- moriarty/assets/modules/professional/mendeley.yaml +27 -0
- moriarty/assets/modules/professional/notion.yaml +27 -0
- moriarty/assets/modules/professional/orcid.yaml +27 -0
- moriarty/assets/modules/professional/producthunt.yaml +31 -0
- moriarty/assets/modules/professional/researchgate.yaml +32 -0
- moriarty/assets/modules/professional/scribd.yaml +27 -0
- moriarty/assets/modules/professional/slideshare.yaml +31 -0
- moriarty/assets/modules/professional/trello.yaml +26 -0
- moriarty/assets/modules/professional/typeform.yaml +27 -0
- moriarty/assets/modules/reddit.yaml +46 -0
- moriarty/assets/modules/regional/amino.yaml +27 -0
- moriarty/assets/modules/regional/ask-fm.yaml +32 -0
- moriarty/assets/modules/regional/babycenter.yaml +26 -0
- moriarty/assets/modules/regional/cafemom.yaml +27 -0
- moriarty/assets/modules/regional/care2.yaml +27 -0
- moriarty/assets/modules/regional/diaspora.yaml +26 -0
- moriarty/assets/modules/regional/ello.yaml +27 -0
- moriarty/assets/modules/regional/gaia.yaml +27 -0
- moriarty/assets/modules/regional/habbo.yaml +27 -0
- moriarty/assets/modules/regional/imvu.yaml +27 -0
- moriarty/assets/modules/regional/lemmy.yaml +27 -0
- moriarty/assets/modules/regional/peertube.yaml +26 -0
- moriarty/assets/modules/regional/pixelfed.yaml +27 -0
- moriarty/assets/modules/regional/plurk.yaml +26 -0
- moriarty/assets/modules/regional/recroom.yaml +27 -0
- moriarty/assets/modules/regional/secondlife.yaml +26 -0
- moriarty/assets/modules/regional/vine-archive.yaml +27 -0
- moriarty/assets/modules/regional/vrchat.yaml +27 -0
- moriarty/assets/modules/regional/weheartit.yaml +27 -0
- moriarty/assets/modules/social/anilist.yaml +27 -0
- moriarty/assets/modules/social/beacons.yaml +26 -0
- moriarty/assets/modules/social/blogger.yaml +27 -0
- moriarty/assets/modules/social/crunchyroll.yaml +27 -0
- moriarty/assets/modules/social/discord.yaml +27 -0
- moriarty/assets/modules/social/dreamwidth.yaml +26 -0
- moriarty/assets/modules/social/facebook.yaml +34 -0
- moriarty/assets/modules/social/goodreads.yaml +32 -0
- moriarty/assets/modules/social/imdb.yaml +27 -0
- moriarty/assets/modules/social/kitsu.yaml +27 -0
- moriarty/assets/modules/social/letterboxd.yaml +32 -0
- moriarty/assets/modules/social/linktree.yaml +26 -0
- moriarty/assets/modules/social/livejournal.yaml +27 -0
- moriarty/assets/modules/social/mastodon.yaml +30 -0
- moriarty/assets/modules/social/minds.yaml +25 -0
- moriarty/assets/modules/social/myanimelist.yaml +32 -0
- moriarty/assets/modules/social/ravelry.yaml +27 -0
- moriarty/assets/modules/social/snapchat.yaml +25 -0
- moriarty/assets/modules/social/telegram.yaml +35 -0
- moriarty/assets/modules/social/tiktok.yaml +35 -0
- moriarty/assets/modules/social/trakt.yaml +28 -0
- moriarty/assets/modules/social/wattpad.yaml +32 -0
- moriarty/assets/modules/social/wordpress-com.yaml +26 -0
- moriarty/assets/modules/sports/espn.yaml +26 -0
- moriarty/assets/modules/sports/untappd.yaml +32 -0
- moriarty/assets/modules/stackoverflow.yaml +47 -0
- moriarty/assets/modules/steam.yaml +47 -0
- moriarty/assets/modules/streaming/caffeine.yaml +25 -0
- moriarty/assets/modules/streaming/dlive.yaml +27 -0
- moriarty/assets/modules/streaming/trovo.yaml +25 -0
- moriarty/assets/modules/travel/airbnb.yaml +26 -0
- moriarty/assets/modules/travel/booking.yaml +26 -0
- moriarty/assets/modules/travel/couchsurfing.yaml +27 -0
- moriarty/assets/modules/travel/tripadvisor.yaml +32 -0
- moriarty/assets/modules/tumblr.yaml +40 -0
- moriarty/assets/modules/twitch.yaml +48 -0
- moriarty/assets/modules/twitter.yaml +39 -0
- moriarty/assets/modules/youtube.yaml +42 -0
- moriarty/assets/templates/cves/CVE-2017-5638.yaml +27 -0
- moriarty/assets/templates/cves/CVE-2018-7600.yaml +30 -0
- moriarty/assets/templates/cves/CVE-2019-11510.yaml +27 -0
- moriarty/assets/templates/cves/CVE-2019-19781.yaml +28 -0
- moriarty/assets/templates/cves/CVE-2020-14882.yaml +28 -0
- moriarty/assets/templates/cves/CVE-2020-14883.yaml +29 -0
- moriarty/assets/templates/cves/CVE-2020-3452.yaml +28 -0
- moriarty/assets/templates/cves/CVE-2020-5902.yaml +28 -0
- moriarty/assets/templates/cves/CVE-2021-21972.yaml +31 -0
- moriarty/assets/templates/cves/CVE-2021-21985.yaml +28 -0
- moriarty/assets/templates/cves/CVE-2021-26084.yaml +30 -0
- moriarty/assets/templates/cves/CVE-2021-41773.yaml +25 -0
- moriarty/assets/templates/cves/CVE-2021-42013.yaml +28 -0
- moriarty/assets/templates/cves/CVE-2021-44228.yaml +27 -0
- moriarty/assets/templates/cves/CVE-2022-0185.yaml +21 -0
- moriarty/assets/templates/cves/CVE-2022-1388.yaml +36 -0
- moriarty/assets/templates/cves/CVE-2022-22954.yaml +28 -0
- moriarty/assets/templates/cves/CVE-2022-22965.yaml +31 -0
- moriarty/assets/templates/cves/CVE-2022-26134.yaml +27 -0
- moriarty/assets/templates/cves/CVE-2023-22515.yaml +27 -0
- moriarty/assets/templates/cves/CVE-2023-22527.yaml +29 -0
- moriarty/assets/templates/cves/CVE-2023-23752.yaml +33 -0
- moriarty/assets/templates/cves/CVE-2023-27350.yaml +27 -0
- moriarty/assets/templates/cves/CVE-2023-2868.yaml +27 -0
- moriarty/assets/templates/cves/CVE-2023-34362.yaml +27 -0
- moriarty/assets/templates/cves/CVE-2023-3519.yaml +28 -0
- moriarty/assets/templates/cves/CVE-2023-4966.yaml +27 -0
- moriarty/assets/templates/default-logins/admin-weak.yaml +40 -0
- moriarty/assets/templates/default-logins/wordpress-default.yaml +38 -0
- moriarty/assets/templates/exposures/aws-credentials.yaml +35 -0
- moriarty/assets/templates/exposures/backup-files.yaml +36 -0
- moriarty/assets/templates/exposures/database-files.yaml +34 -0
- moriarty/assets/templates/exposures/docker-exposed.yaml +31 -0
- moriarty/assets/templates/exposures/env-exposed.yaml +41 -0
- moriarty/assets/templates/exposures/git-exposed.yaml +41 -0
- moriarty/assets/templates/exposures/phpinfo.yaml +36 -0
- moriarty/assets/templates/exposures/svn-exposed.yaml +28 -0
- moriarty/assets/templates/fuzzing/api-endpoints.yaml +39 -0
- moriarty/assets/templates/fuzzing/common-files.yaml +37 -0
- moriarty/assets/templates/fuzzing/open-redirect-fuzz.yaml +35 -0
- moriarty/assets/templates/fuzzing/xss-search-fuzz.yaml +29 -0
- moriarty/assets/templates/git-config.yaml +18 -0
- moriarty/assets/templates/misconfigurations/cors-misconfiguration.yaml +30 -0
- moriarty/assets/templates/misconfigurations/debug-enabled.yaml +29 -0
- moriarty/assets/templates/misconfigurations/directory-listing.yaml +33 -0
- moriarty/assets/templates/misconfigurations/jwt-none-algo.yaml +30 -0
- moriarty/assets/templates/misconfigurations/ssl-tls-weak.yaml +23 -0
- moriarty/assets/templates/vulnerabilities/lfi-basic.yaml +31 -0
- moriarty/assets/templates/vulnerabilities/open-redirect.yaml +31 -0
- moriarty/assets/templates/vulnerabilities/rce-basic.yaml +34 -0
- moriarty/assets/templates/vulnerabilities/sqli-error.yaml +39 -0
- moriarty/assets/templates/vulnerabilities/ssrf-basic.yaml +31 -0
- moriarty/assets/templates/vulnerabilities/xss-reflected.yaml +38 -0
- moriarty/assets/templates/vulnerabilities/xxe-basic.yaml +30 -0
- moriarty/assets/wordlists/subdomains-1000.txt +1063 -0
- moriarty/cli/__init__.py +3 -0
- moriarty/cli/app.py +120 -0
- moriarty/cli/async_utils.py +19 -0
- moriarty/cli/dns.py +83 -0
- moriarty/cli/domain_cmd.py +572 -0
- moriarty/cli/email.py +383 -0
- moriarty/cli/email_investigate.py +224 -0
- moriarty/cli/intelligence.py +329 -0
- moriarty/cli/output.py +62 -0
- moriarty/cli/rdap.py +94 -0
- moriarty/cli/state.py +38 -0
- moriarty/cli/tls.py +91 -0
- moriarty/cli/user.py +227 -0
- moriarty/core/cache_backend.py +223 -0
- moriarty/core/config_manager.py +303 -0
- moriarty/correlator/__init__.py +0 -0
- moriarty/data/__init__.py +81 -0
- moriarty/data/ioc/__init__.py +142 -0
- moriarty/data/ioc/matcher.py +254 -0
- moriarty/data/ioc/types.py +267 -0
- moriarty/data/local_intelligence.py +507 -0
- moriarty/data/signature_loaders/__init__.py +103 -0
- moriarty/data/signature_loaders/base.py +54 -0
- moriarty/data/signature_loaders/ioc_feed.py +356 -0
- moriarty/data/signature_loaders/wappalyzer.py +112 -0
- moriarty/dsl/__init__.py +0 -0
- moriarty/dsl/loader.py +99 -0
- moriarty/dsl/schema.py +47 -0
- moriarty/export/__init__.py +0 -0
- moriarty/intelligence/__init__.py +27 -0
- moriarty/intelligence/__main__.py +150 -0
- moriarty/intelligence/config.py +395 -0
- moriarty/intelligence/ioc.py +267 -0
- moriarty/intelligence/signatures.py +550 -0
- moriarty/intelligence/storage.py +501 -0
- moriarty/interop/__init__.py +0 -0
- moriarty/logging/__init__.py +0 -0
- moriarty/logging/config.py +47 -0
- moriarty/models/__init__.py +16 -0
- moriarty/models/assertion.py +24 -0
- moriarty/models/entity.py +22 -0
- moriarty/models/evidence.py +37 -0
- moriarty/models/relation.py +24 -0
- moriarty/models/types.py +28 -0
- moriarty/modules/__init__.py +0 -0
- moriarty/modules/avatar_hash.py +184 -0
- moriarty/modules/directory_fuzzer.py +322 -0
- moriarty/modules/dns_scan.py +40 -0
- moriarty/modules/domain_scanner.py +620 -0
- moriarty/modules/email_check.py +98 -0
- moriarty/modules/email_investigate.py +267 -0
- moriarty/modules/email_security.py +274 -0
- moriarty/modules/googlemaps_lookup.py +106 -0
- moriarty/modules/headless_executor.py +201 -0
- moriarty/modules/orchestrator.py +60 -0
- moriarty/modules/passive_recon.py +444 -0
- moriarty/modules/phone_extractor.py +151 -0
- moriarty/modules/pipeline_orchestrator.py +726 -0
- moriarty/modules/port_scanner.py +129 -0
- moriarty/modules/rdap.py +61 -0
- moriarty/modules/rdap_extended.py +188 -0
- moriarty/modules/stealth_mode.py +610 -0
- moriarty/modules/subdomain_discovery.py +595 -0
- moriarty/modules/technology_profiler.py +361 -0
- moriarty/modules/template_executor.py +239 -0
- moriarty/modules/template_scanner.py +1048 -0
- moriarty/modules/tls_scan.py +46 -0
- moriarty/modules/tls_validator.py +188 -0
- moriarty/modules/vuln_scanner.py +483 -0
- moriarty/modules/waf_detector.py +585 -0
- moriarty/modules/wayback_discovery.py +234 -0
- moriarty/modules/web_crawler.py +163 -0
- moriarty/net/__init__.py +0 -0
- moriarty/net/dns_cache.py +175 -0
- moriarty/net/dns_client.py +188 -0
- moriarty/net/rdap_client.py +52 -0
- moriarty/net/smtp_client.py +114 -0
- moriarty/net/tls_client.py +111 -0
- moriarty/parsers/__init__.py +0 -0
- moriarty/parsers/html_parser.py +136 -0
- moriarty/tests/__init__.py +0 -0
- moriarty/tests/test_email_service.py +17 -0
- moriarty/tests/test_models.py +46 -0
- moriarty/tests/test_orchestrator.py +30 -0
- moriarty/tests/test_tls_client.py +18 -0
- moriarty_project-0.1.6.dist-info/METADATA +388 -0
- moriarty_project-0.1.6.dist-info/RECORD +418 -0
- moriarty_project-0.1.6.dist-info/WHEEL +4 -0
- moriarty_project-0.1.6.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,303 @@
|
|
1
|
+
"""Gerenciador de configurações e API keys."""
|
2
|
+
import os
|
3
|
+
import yaml
|
4
|
+
from pathlib import Path
|
5
|
+
from typing import Any, Dict, Optional
|
6
|
+
from dataclasses import dataclass
|
7
|
+
|
8
|
+
import structlog
|
9
|
+
|
10
|
+
logger = structlog.get_logger(__name__)
|
11
|
+
|
12
|
+
|
13
|
+
@dataclass
|
14
|
+
class APIKeys:
|
15
|
+
"""API Keys configuration."""
|
16
|
+
virustotal: Optional[str] = None
|
17
|
+
securitytrails: Optional[str] = None
|
18
|
+
shodan: Optional[str] = None
|
19
|
+
censys: Optional[str] = None
|
20
|
+
censys_id: Optional[str] = None
|
21
|
+
censys_secret: Optional[str] = None
|
22
|
+
hunter: Optional[str] = None
|
23
|
+
fofa: Optional[str] = None
|
24
|
+
zoomeye: Optional[str] = None
|
25
|
+
binaryedge: Optional[str] = None
|
26
|
+
github: Optional[str] = None
|
27
|
+
telegram: Optional[str] = None
|
28
|
+
discord_webhook: Optional[str] = None
|
29
|
+
slack_webhook: Optional[str] = None
|
30
|
+
passivetotal_username: Optional[str] = None
|
31
|
+
passivetotal_key: Optional[str] = None
|
32
|
+
spyse_key: Optional[str] = None
|
33
|
+
leakix_key: Optional[str] = None
|
34
|
+
leakpeek_key: Optional[str] = None
|
35
|
+
hibp_key: Optional[str] = None
|
36
|
+
captcha_solver: Optional[str] = None
|
37
|
+
captcha_solver_url: Optional[str] = None
|
38
|
+
|
39
|
+
|
40
|
+
@dataclass
|
41
|
+
class ProxyConfig:
|
42
|
+
"""Proxy configuration."""
|
43
|
+
http_proxies: list[str] = None
|
44
|
+
socks_proxies: list[str] = None
|
45
|
+
tor_enabled: bool = False
|
46
|
+
tor_port: int = 9050
|
47
|
+
i2p_enabled: bool = False
|
48
|
+
i2p_port: int = 4444
|
49
|
+
rotate_interval: int = 60 # seconds
|
50
|
+
health_check_interval: int = 300 # seconds
|
51
|
+
|
52
|
+
|
53
|
+
@dataclass
|
54
|
+
class CacheConfig:
|
55
|
+
"""Cache configuration."""
|
56
|
+
enabled: bool = True
|
57
|
+
backend: str = "memory" # memory, sqlite, redis
|
58
|
+
sqlite_path: Optional[str] = None
|
59
|
+
redis_url: Optional[str] = None
|
60
|
+
ttl_default: int = 3600 # seconds
|
61
|
+
max_size: int = 10000
|
62
|
+
eviction_policy: str = "lru" # lru, lfu, fifo
|
63
|
+
persistence: bool = True
|
64
|
+
warmup_enabled: bool = False
|
65
|
+
|
66
|
+
|
67
|
+
@dataclass
|
68
|
+
class NotificationConfig:
|
69
|
+
"""Notification configuration."""
|
70
|
+
enabled: bool = False
|
71
|
+
discord_enabled: bool = False
|
72
|
+
discord_webhook: Optional[str] = None
|
73
|
+
slack_enabled: bool = False
|
74
|
+
slack_webhook: Optional[str] = None
|
75
|
+
email_enabled: bool = False
|
76
|
+
email_smtp: Optional[str] = None
|
77
|
+
email_from: Optional[str] = None
|
78
|
+
email_to: Optional[list[str]] = None
|
79
|
+
telegram_enabled: bool = False
|
80
|
+
telegram_token: Optional[str] = None
|
81
|
+
telegram_chat_id: Optional[str] = None
|
82
|
+
|
83
|
+
|
84
|
+
class ConfigManager:
|
85
|
+
"""Centralized configuration manager."""
|
86
|
+
|
87
|
+
_instance = None
|
88
|
+
|
89
|
+
def __new__(cls):
|
90
|
+
if cls._instance is None:
|
91
|
+
cls._instance = super().__new__(cls)
|
92
|
+
cls._instance._initialized = False
|
93
|
+
return cls._instance
|
94
|
+
|
95
|
+
def __init__(self):
|
96
|
+
if not self._initialized:
|
97
|
+
self.config_dir = Path.home() / ".moriarty"
|
98
|
+
self.config_file = self.config_dir / "config.yaml"
|
99
|
+
self.api_keys = APIKeys()
|
100
|
+
self.proxies = ProxyConfig()
|
101
|
+
self.cache = CacheConfig()
|
102
|
+
self.notifications = NotificationConfig()
|
103
|
+
self.wordlists = {}
|
104
|
+
self.templates_dir = None
|
105
|
+
self._load_config()
|
106
|
+
self._initialized = True
|
107
|
+
|
108
|
+
def _load_config(self):
|
109
|
+
"""Load configuration from file."""
|
110
|
+
if not self.config_dir.exists():
|
111
|
+
self.config_dir.mkdir(parents=True, exist_ok=True)
|
112
|
+
self._create_default_config()
|
113
|
+
|
114
|
+
if self.config_file.exists():
|
115
|
+
try:
|
116
|
+
with open(self.config_file, 'r') as f:
|
117
|
+
config = yaml.safe_load(f) or {}
|
118
|
+
|
119
|
+
# Load API keys
|
120
|
+
api_keys = config.get('api_keys', {})
|
121
|
+
for key, value in api_keys.items():
|
122
|
+
if hasattr(self.api_keys, key):
|
123
|
+
setattr(self.api_keys, key, value or os.getenv(f"MORIARTY_{key.upper()}"))
|
124
|
+
|
125
|
+
# Load proxy config
|
126
|
+
proxy_config = config.get('proxies', {})
|
127
|
+
self.proxies.http_proxies = proxy_config.get('http', [])
|
128
|
+
self.proxies.socks_proxies = proxy_config.get('socks', [])
|
129
|
+
self.proxies.tor_enabled = proxy_config.get('tor_enabled', False)
|
130
|
+
self.proxies.tor_port = proxy_config.get('tor_port', 9050)
|
131
|
+
self.proxies.i2p_enabled = proxy_config.get('i2p_enabled', False)
|
132
|
+
self.proxies.rotate_interval = proxy_config.get('rotate_interval', 60)
|
133
|
+
|
134
|
+
# Load cache config
|
135
|
+
cache_config = config.get('cache', {})
|
136
|
+
self.cache.enabled = cache_config.get('enabled', True)
|
137
|
+
self.cache.backend = cache_config.get('backend', 'memory')
|
138
|
+
self.cache.sqlite_path = cache_config.get('sqlite_path', str(self.config_dir / 'cache.db'))
|
139
|
+
self.cache.redis_url = cache_config.get('redis_url')
|
140
|
+
self.cache.ttl_default = cache_config.get('ttl_default', 3600)
|
141
|
+
self.cache.max_size = cache_config.get('max_size', 10000)
|
142
|
+
self.cache.eviction_policy = cache_config.get('eviction_policy', 'lru')
|
143
|
+
|
144
|
+
# Load notifications
|
145
|
+
notif_config = config.get('notifications', {})
|
146
|
+
self.notifications.enabled = notif_config.get('enabled', False)
|
147
|
+
self.notifications.discord_webhook = notif_config.get('discord_webhook')
|
148
|
+
self.notifications.slack_webhook = notif_config.get('slack_webhook')
|
149
|
+
self.notifications.telegram_token = notif_config.get('telegram_token')
|
150
|
+
self.notifications.telegram_chat_id = notif_config.get('telegram_chat_id')
|
151
|
+
|
152
|
+
# Load wordlists
|
153
|
+
self.wordlists = config.get('wordlists', {
|
154
|
+
'subdomains': str(self.config_dir / 'wordlists' / 'subdomains.txt'),
|
155
|
+
'directories': str(self.config_dir / 'wordlists' / 'directories.txt'),
|
156
|
+
'passwords': str(self.config_dir / 'wordlists' / 'passwords.txt'),
|
157
|
+
})
|
158
|
+
|
159
|
+
# Load templates directory
|
160
|
+
self.templates_dir = Path(config.get('templates_dir', self.config_dir / 'templates'))
|
161
|
+
|
162
|
+
logger.info("config.loaded", config_file=str(self.config_file))
|
163
|
+
|
164
|
+
except Exception as e:
|
165
|
+
logger.error("config.load.error", error=str(e))
|
166
|
+
self._create_default_config()
|
167
|
+
|
168
|
+
def _create_default_config(self):
|
169
|
+
"""Create default configuration file."""
|
170
|
+
default_config = {
|
171
|
+
'api_keys': {
|
172
|
+
'virustotal': None,
|
173
|
+
'securitytrails': None,
|
174
|
+
'shodan': None,
|
175
|
+
'censys': None,
|
176
|
+
'censys_id': None,
|
177
|
+
'censys_secret': None,
|
178
|
+
'hunter': None,
|
179
|
+
'fofa': None,
|
180
|
+
'zoomeye': None,
|
181
|
+
'binaryedge': None,
|
182
|
+
'github': None,
|
183
|
+
'discord_webhook': None,
|
184
|
+
'slack_webhook': None,
|
185
|
+
'passivetotal_username': None,
|
186
|
+
'passivetotal_key': None,
|
187
|
+
'spyse_key': None,
|
188
|
+
'leakix_key': None,
|
189
|
+
'leakpeek_key': None,
|
190
|
+
'hibp_key': None,
|
191
|
+
'captcha_solver': None,
|
192
|
+
'captcha_solver_url': None,
|
193
|
+
},
|
194
|
+
'proxies': {
|
195
|
+
'http': [],
|
196
|
+
'socks': [],
|
197
|
+
'tor_enabled': False,
|
198
|
+
'tor_port': 9050,
|
199
|
+
'i2p_enabled': False,
|
200
|
+
'i2p_port': 4444,
|
201
|
+
'rotate_interval': 60,
|
202
|
+
'health_check_interval': 300,
|
203
|
+
},
|
204
|
+
'cache': {
|
205
|
+
'enabled': True,
|
206
|
+
'backend': 'memory', # memory, sqlite, redis
|
207
|
+
'sqlite_path': str(self.config_dir / 'cache.db'),
|
208
|
+
'redis_url': None,
|
209
|
+
'ttl_default': 3600,
|
210
|
+
'max_size': 10000,
|
211
|
+
'eviction_policy': 'lru',
|
212
|
+
'persistence': True,
|
213
|
+
'warmup_enabled': False,
|
214
|
+
},
|
215
|
+
'notifications': {
|
216
|
+
'enabled': False,
|
217
|
+
'discord_webhook': None,
|
218
|
+
'slack_webhook': None,
|
219
|
+
'telegram_token': None,
|
220
|
+
'telegram_chat_id': None,
|
221
|
+
'email_smtp': None,
|
222
|
+
'email_from': None,
|
223
|
+
'email_to': [],
|
224
|
+
},
|
225
|
+
'wordlists': {
|
226
|
+
'subdomains': str(self.config_dir / 'wordlists' / 'subdomains.txt'),
|
227
|
+
'directories': str(self.config_dir / 'wordlists' / 'directories.txt'),
|
228
|
+
'passwords': str(self.config_dir / 'wordlists' / 'passwords.txt'),
|
229
|
+
},
|
230
|
+
'templates_dir': str(self.config_dir / 'templates'),
|
231
|
+
}
|
232
|
+
|
233
|
+
with open(self.config_file, 'w') as f:
|
234
|
+
yaml.dump(default_config, f, default_flow_style=False)
|
235
|
+
|
236
|
+
logger.info("config.created", config_file=str(self.config_file))
|
237
|
+
|
238
|
+
# Create wordlists directory
|
239
|
+
wordlists_dir = self.config_dir / 'wordlists'
|
240
|
+
wordlists_dir.mkdir(parents=True, exist_ok=True)
|
241
|
+
|
242
|
+
# Create templates directory
|
243
|
+
templates_dir = self.config_dir / 'templates'
|
244
|
+
templates_dir.mkdir(parents=True, exist_ok=True)
|
245
|
+
|
246
|
+
def get_api_key(self, service: str) -> Optional[str]:
|
247
|
+
"""Get API key for service."""
|
248
|
+
return getattr(self.api_keys, service, None)
|
249
|
+
|
250
|
+
def get_proxies(self) -> list[str]:
|
251
|
+
"""Get all configured proxies."""
|
252
|
+
proxies = []
|
253
|
+
if self.proxies.http_proxies:
|
254
|
+
proxies.extend(self.proxies.http_proxies)
|
255
|
+
if self.proxies.socks_proxies:
|
256
|
+
proxies.extend(self.proxies.socks_proxies)
|
257
|
+
if self.proxies.tor_enabled:
|
258
|
+
proxies.append(f"socks5://127.0.0.1:{self.proxies.tor_port}")
|
259
|
+
return proxies
|
260
|
+
|
261
|
+
def save_config(self):
|
262
|
+
"""Save current configuration to file."""
|
263
|
+
config = {
|
264
|
+
'api_keys': {
|
265
|
+
k: v for k, v in self.api_keys.__dict__.items() if v
|
266
|
+
},
|
267
|
+
'proxies': {
|
268
|
+
'http': self.proxies.http_proxies or [],
|
269
|
+
'socks': self.proxies.socks_proxies or [],
|
270
|
+
'tor_enabled': self.proxies.tor_enabled,
|
271
|
+
'tor_port': self.proxies.tor_port,
|
272
|
+
'rotate_interval': self.proxies.rotate_interval,
|
273
|
+
},
|
274
|
+
'cache': {
|
275
|
+
'enabled': self.cache.enabled,
|
276
|
+
'backend': self.cache.backend,
|
277
|
+
'sqlite_path': self.cache.sqlite_path,
|
278
|
+
'redis_url': self.cache.redis_url,
|
279
|
+
'ttl_default': self.cache.ttl_default,
|
280
|
+
'max_size': self.cache.max_size,
|
281
|
+
'eviction_policy': self.cache.eviction_policy,
|
282
|
+
},
|
283
|
+
'notifications': {
|
284
|
+
'enabled': self.notifications.enabled,
|
285
|
+
'discord_webhook': self.notifications.discord_webhook,
|
286
|
+
'slack_webhook': self.notifications.slack_webhook,
|
287
|
+
'telegram_token': self.notifications.telegram_token,
|
288
|
+
'telegram_chat_id': self.notifications.telegram_chat_id,
|
289
|
+
},
|
290
|
+
'wordlists': self.wordlists,
|
291
|
+
'templates_dir': str(self.templates_dir),
|
292
|
+
}
|
293
|
+
|
294
|
+
with open(self.config_file, 'w') as f:
|
295
|
+
yaml.dump(config, f, default_flow_style=False)
|
296
|
+
|
297
|
+
logger.info("config.saved", config_file=str(self.config_file))
|
298
|
+
|
299
|
+
|
300
|
+
# Global instance
|
301
|
+
config_manager = ConfigManager()
|
302
|
+
|
303
|
+
__all__ = ["ConfigManager", "config_manager", "APIKeys", "ProxyConfig", "CacheConfig", "NotificationConfig"]
|
File without changes
|
@@ -0,0 +1,81 @@
|
|
1
|
+
"""Módulo de armazenamento e processamento de inteligência local.
|
2
|
+
|
3
|
+
Este módulo fornece funcionalidades para armazenar e processar dados de inteligência
|
4
|
+
localmente, incluindo assinaturas de ameaças, IOCs (Indicadores de Comprometimento)
|
5
|
+
e outras informações relevantes para análise de segurança.
|
6
|
+
"""
|
7
|
+
from pathlib import Path
|
8
|
+
from typing import Optional, Dict, Any, List, Union
|
9
|
+
|
10
|
+
from .local_intelligence import (
|
11
|
+
LocalIntelligence,
|
12
|
+
LocalIntelligenceConfig,
|
13
|
+
get_local_intelligence
|
14
|
+
)
|
15
|
+
from .ioc import (
|
16
|
+
IOC,
|
17
|
+
IOCType,
|
18
|
+
ThreatType,
|
19
|
+
create_ioc,
|
20
|
+
IPAddress,
|
21
|
+
Domain,
|
22
|
+
IOCMatcher,
|
23
|
+
load_iocs_from_file,
|
24
|
+
save_iocs_to_file,
|
25
|
+
merge_iocs
|
26
|
+
)
|
27
|
+
|
28
|
+
# Caminho padrão para armazenamento de dados
|
29
|
+
DEFAULT_DATA_DIR = Path("~/.moriarty/data").expanduser()
|
30
|
+
|
31
|
+
def init_local_intelligence(data_dir: Optional[Union[str, Path]] = None,
|
32
|
+
config: Optional[Dict[str, Any]] = None) -> LocalIntelligence:
|
33
|
+
"""
|
34
|
+
Inicializa e retorna uma instância de LocalIntelligence.
|
35
|
+
|
36
|
+
Args:
|
37
|
+
data_dir: Diretório para armazenamento de dados (opcional)
|
38
|
+
config: Configuração adicional (opcional)
|
39
|
+
|
40
|
+
Returns:
|
41
|
+
Instância de LocalIntelligence configurada
|
42
|
+
"""
|
43
|
+
# Configuração padrão
|
44
|
+
cfg = LocalIntelligenceConfig()
|
45
|
+
|
46
|
+
# Atualiza com o diretório de dados personalizado, se fornecido
|
47
|
+
if data_dir is not None:
|
48
|
+
cfg.data_dir = Path(data_dir).expanduser().resolve()
|
49
|
+
|
50
|
+
# Aplica configurações adicionais
|
51
|
+
if config:
|
52
|
+
for key, value in config.items():
|
53
|
+
if hasattr(cfg, key):
|
54
|
+
setattr(cfg, key, value)
|
55
|
+
|
56
|
+
return LocalIntelligence(cfg)
|
57
|
+
|
58
|
+
__all__ = [
|
59
|
+
# Classes principais
|
60
|
+
'LocalIntelligence',
|
61
|
+
'LocalIntelligenceConfig',
|
62
|
+
'IOC',
|
63
|
+
'IOCType',
|
64
|
+
'ThreatType',
|
65
|
+
'IOCMatcher',
|
66
|
+
'IPAddress',
|
67
|
+
'Domain',
|
68
|
+
|
69
|
+
# Funções de fábrica
|
70
|
+
'get_local_intelligence',
|
71
|
+
'init_local_intelligence',
|
72
|
+
'create_ioc',
|
73
|
+
|
74
|
+
# Funções de utilidade
|
75
|
+
'load_iocs_from_file',
|
76
|
+
'save_iocs_to_file',
|
77
|
+
'merge_iocs',
|
78
|
+
|
79
|
+
# Constantes
|
80
|
+
'DEFAULT_DATA_DIR'
|
81
|
+
]
|
@@ -0,0 +1,142 @@
|
|
1
|
+
"""Módulo para manipulação de Indicadores de Comprometimento (IOCs)."""
|
2
|
+
from pathlib import Path
|
3
|
+
from typing import Dict, List, Optional, Any, Union, Set
|
4
|
+
|
5
|
+
from .types import (
|
6
|
+
IOC, IOCType, ThreatType,
|
7
|
+
create_ioc, IPAddress, Domain
|
8
|
+
)
|
9
|
+
from .matcher import IOCMatcher
|
10
|
+
|
11
|
+
# Exporta as classes e funções principais
|
12
|
+
__all__ = [
|
13
|
+
'IOC',
|
14
|
+
'IOCType',
|
15
|
+
'ThreatType',
|
16
|
+
'create_ioc',
|
17
|
+
'IPAddress',
|
18
|
+
'Domain',
|
19
|
+
'IOCMatcher',
|
20
|
+
'load_iocs_from_file',
|
21
|
+
'save_iocs_to_file',
|
22
|
+
'merge_iocs'
|
23
|
+
]
|
24
|
+
|
25
|
+
def load_iocs_from_file(file_path: Union[str, Path],
|
26
|
+
format_name: str = 'auto') -> List[IOC]:
|
27
|
+
"""
|
28
|
+
Carrega IOCs de um arquivo.
|
29
|
+
|
30
|
+
Args:
|
31
|
+
file_path: Caminho para o arquivo
|
32
|
+
format_name: Formato do arquivo ('json', 'yaml', 'csv', 'auto' para detectar)
|
33
|
+
|
34
|
+
Returns:
|
35
|
+
Lista de IOCs carregados
|
36
|
+
"""
|
37
|
+
from ..signature_loaders import create_loader
|
38
|
+
|
39
|
+
file_path = Path(file_path)
|
40
|
+
if not file_path.exists():
|
41
|
+
raise FileNotFoundError(f"Arquivo não encontrado: {file_path}")
|
42
|
+
|
43
|
+
# Tenta detectar o formato se não for especificado
|
44
|
+
if format_name == 'auto':
|
45
|
+
if file_path.suffix.lower() == '.json':
|
46
|
+
format_name = 'ioc'
|
47
|
+
elif file_path.suffix.lower() in ('.yaml', '.yml'):
|
48
|
+
format_name = 'ioc'
|
49
|
+
elif file_path.suffix.lower() == '.csv':
|
50
|
+
format_name = 'ioc'
|
51
|
+
else:
|
52
|
+
format_name = 'ioc' # Padrão
|
53
|
+
|
54
|
+
# Cria o carregador apropriado
|
55
|
+
loader = create_loader(file_path, format_name)
|
56
|
+
|
57
|
+
# Carrega os IOCs
|
58
|
+
ioc_dicts = loader.load()
|
59
|
+
|
60
|
+
# Converte para objetos IOC
|
61
|
+
iocs = []
|
62
|
+
for ioc_dict in ioc_dicts:
|
63
|
+
try:
|
64
|
+
ioc = IOC.from_dict(ioc_dict) if isinstance(ioc_dict, dict) else ioc_dict
|
65
|
+
if isinstance(ioc, IOC):
|
66
|
+
iocs.append(ioc)
|
67
|
+
except Exception as e:
|
68
|
+
print(f"Erro ao carregar IOC: {e}")
|
69
|
+
|
70
|
+
return iocs
|
71
|
+
|
72
|
+
def save_iocs_to_file(iocs: List[IOC],
|
73
|
+
file_path: Union[str, Path],
|
74
|
+
format_name: str = 'json') -> None:
|
75
|
+
"""
|
76
|
+
Salva uma lista de IOCs em um arquivo.
|
77
|
+
|
78
|
+
Args:
|
79
|
+
iocs: Lista de IOCs para salvar
|
80
|
+
file_path: Caminho para o arquivo de saída
|
81
|
+
format_name: Formato de saída ('json', 'yaml', 'csv')
|
82
|
+
"""
|
83
|
+
file_path = Path(file_path)
|
84
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
85
|
+
|
86
|
+
# Converte os IOCs para dicionários
|
87
|
+
ioc_dicts = [ioc.to_dict() for ioc in iocs]
|
88
|
+
|
89
|
+
# Salva no formato apropriado
|
90
|
+
if format_name.lower() == 'json':
|
91
|
+
import json
|
92
|
+
with open(file_path, 'w', encoding='utf-8') as f:
|
93
|
+
json.dump({'iocs': ioc_dicts}, f, indent=2, ensure_ascii=False)
|
94
|
+
|
95
|
+
elif format_name.lower() in ('yaml', 'yml'):
|
96
|
+
import yaml
|
97
|
+
with open(file_path, 'w', encoding='utf-8') as f:
|
98
|
+
yaml.safe_dump({'iocs': ioc_dicts}, f, allow_unicode=True)
|
99
|
+
|
100
|
+
elif format_name.lower() == 'csv':
|
101
|
+
import csv
|
102
|
+
if not ioc_dicts:
|
103
|
+
return
|
104
|
+
|
105
|
+
# Extrai todos os campos possíveis
|
106
|
+
all_fields = set()
|
107
|
+
for ioc in ioc_dicts:
|
108
|
+
all_fields.update(ioc.keys())
|
109
|
+
|
110
|
+
fieldnames = sorted(all_fields)
|
111
|
+
|
112
|
+
with open(file_path, 'w', newline='', encoding='utf-8') as f:
|
113
|
+
writer = csv.DictWriter(f, fieldnames=fieldnames)
|
114
|
+
writer.writeheader()
|
115
|
+
writer.writerows(ioc_dicts)
|
116
|
+
|
117
|
+
else:
|
118
|
+
raise ValueError(f"Formato não suportado: {format_name}")
|
119
|
+
|
120
|
+
def merge_iocs(*ioc_lists: List[IOC]) -> List[IOC]:
|
121
|
+
"""
|
122
|
+
Combina várias listas de IOCs, removendo duplicatas.
|
123
|
+
|
124
|
+
Args:
|
125
|
+
*ioc_lists: Listas de IOCs para combinar
|
126
|
+
|
127
|
+
Returns:
|
128
|
+
Lista única de IOCs únicos
|
129
|
+
"""
|
130
|
+
seen = set()
|
131
|
+
result = []
|
132
|
+
|
133
|
+
for ioc_list in ioc_lists:
|
134
|
+
for ioc in ioc_list:
|
135
|
+
# Cria uma chave única para cada IOC
|
136
|
+
key = (ioc.ioc_type.value, ioc.value.lower())
|
137
|
+
|
138
|
+
if key not in seen:
|
139
|
+
seen.add(key)
|
140
|
+
result.append(ioc)
|
141
|
+
|
142
|
+
return result
|