Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Small and medium teams
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
risuxx
IDAPython-study
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
IDAPython-study
/
SearchBinaryMagic.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
22 lines (19 loc) · 1.05 KB
main
Breadcrumbs
IDAPython-study
/
SearchBinaryMagic.py
Copy path
Top
File metadata and controls
Code
Blame
22 lines (19 loc) · 1.05 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import idc
import idaapi
import idautils
pattern = "74 32 FF"
# 搜索形式可以是 16 进制格式,比如 0x55 0x8B 0xEC和 55 8B EC 都是可以的,
# \x55\x8B\xEC 这种格式可不行,除非你使用 idc.find_text(ea, flag,y, x, searchstr)这个函数
addr = idc.get_inf_attr(idc.INF_MIN_EA)
for x in range(0, 5):
# 这里只找5个满足条件的地址
# 这里需要设置两个标记,一个是SEARCH_DOWN,表示从addr开始向下搜索,另一个是SEARCH_NEXT,表示从addr的下一个地址开始搜索
# 假如不设置SEARCH_NEXT,那么搜索到的地址就是addr,但是不会再往下搜索了
# SEARCH_UP 和 SEARCH_DOWN 用来指明搜索的方向
# SEARCH_NEXT 用来获取下一个已经找到的对象
# SEARCH_CASE 用来指明是否区分大小写
# SEARCH_NOSHOW 用来指明是否显示搜索的进度
addr = idc.find_binary(addr, idc.SEARCH_DOWN | idc.SEARCH_NEXT, pattern)
if addr != idc.BADADDR:
# 假如找到了就把他打印出来
print(hex(addr), idc.GetDisasm(addr))
You can’t perform that action at this time.