1. #--------------------------------------------------------------------------
  2. # C O L O R S
  3. #--------------------------------------------------------------------------
  4.  
  5. def GetColor(ea, what):
  6. """
  7. Get item color
  8.  
  9. @param ea: address of the item
  10. @param what: type of the item (one of CIC_* constants)
  11.  
  12. @return: color code in RGB (hex 0xBBGGRR)
  13. """
  14. if what not in [ CIC_ITEM, CIC_FUNC, CIC_SEGM ]:
  15. raise ValueError, "'what' must be one of CIC_ITEM, CIC_FUNC and CIC_SEGM"
  16.  
  17. if what == CIC_ITEM:
  18. return idaapi.get_item_color(ea)
  19.  
  20. if what == CIC_FUNC:
  21. func = idaapi.get_func(ea)
  22. if func:
  23. return func.color
  24. else:
  25. return DEFCOLOR
  26.  
  27. if what == CIC_SEGM:
  28. seg = idaapi.getseg(ea)
  29. if seg:
  30. return seg.color
  31. else:
  32. return DEFCOLOR
  33.  
  34. # color item codes:
  35. CIC_ITEM = 1 # one instruction or data
  36. CIC_FUNC = 2 # function
  37. CIC_SEGM = 3 # segment
  38.  
  39. DEFCOLOR = 0xFFFFFFFF # Default color
  40.  
  41. def SetColor(ea, what, color):
  42. """
  43. Set item color
  44.  
  45. @param ea: address of the item
  46. @param what: type of the item (one of CIC_* constants)
  47. @param color: new color code in RGB (hex 0xBBGGRR)
  48.  
  49. @return: success (True or False)
  50. """
  51. if what not in [ CIC_ITEM, CIC_FUNC, CIC_SEGM ]:
  52. raise ValueError, "'what' must be one of CIC_ITEM, CIC_FUNC and CIC_SEGM"
  53.  
  54. if what == CIC_ITEM:
  55. return idaapi.set_item_color(ea, color)
  56.  
  57. if what == CIC_FUNC:
  58. func = idaapi.get_func(ea)
  59. if func:
  60. func.color = color
  61. return bool(idaapi.update_func(func))
  62. else:
  63. return False
  64.  
  65. if what == CIC_SEGM:
  66. seg = idaapi.getseg(ea)
  67. if seg:
  68. seg.color = color
  69. return bool(seg.update())
  70. else:
  71. return False
  72.  
  73. #--------------------------------------------------------------------------
  74. # X M L
  75. #--------------------------------------------------------------------------
  76.  
  77. def SetXML(path, name, value):
  78. """
  79. Set or update one or more XML values.
  80.  
  81. @param path: XPath expression of elements where to create value(s)
  82. @param name: name of the element/attribute
  83. (use @XXX for an attribute) to create.
  84. If 'name' is empty, the elements or
  85. attributes returned by XPath are directly
  86. updated to contain the new 'value'.
  87. @param value: value of the element/attribute
  88.  
  89. @return: success (True or False)
  90. """
  91. return idaapi.set_xml(path, name, value)
  92.  
  93. def GetXML(path):
  94. """
  95. Get one XML value.
  96.  
  97. @param path: XPath expression to an element
  98. or attribute whose value is requested
  99.  
  100. @return: the value, None if failed
  101. """
  102. v = idaapi.value_t()
  103. if idaapi.get_xml(path):
  104. return v.str
  105. else:
  106. return None
  107.  
  108. #----------------------------------------------------------------------------
  109. # A R M S P E C I F I C
  110. #----------------------------------------------------------------------------
  111. def ArmForceBLJump(ea):
  112. """
  113. Some ARM compilers in Thumb mode use BL (branch-and-link)
  114. instead of B (branch) for long jumps, since BL has more range.
  115. By default, IDA tries to determine if BL is a jump or a call.
  116. You can override IDA's decision using commands in Edit/Other menu
  117. (Force BL call/Force BL jump) or the following two functions.
  118.  
  119. Force BL instruction to be a jump
  120.  
  121. @param ea: address of the BL instruction
  122.  
  123. @return: 1-ok, 0-failed
  124. """
  125. return Eval("ArmForceBLJump(0x%x)"%ea)
  126.  
  127. def ArmForceBLCall(ea):
  128. """
  129. Force BL instruction to be a call
  130.  
  131. @param ea: address of the BL instruction
  132.  
  133. @return: 1-ok, 0-failed
  134. """
  135. return Eval("ArmForceBLCall(0x%x)"%ea)
  136.  
  137. #--------------------------------------------------------------------------
  138. # Compatibility macros:
  139. def Compile(file): return CompileEx(file, 1)
  140. def OpOffset(ea,base): return OpOff(ea,-1,base)
  141. def OpNum(ea): return OpNumber(ea,-1)
  142. def OpChar(ea): return OpChr(ea,-1)
  143. def OpSegment(ea): return OpSeg(ea,-1)
  144. def OpDec(ea): return OpDecimal(ea,-1)
  145. def OpAlt1(ea, opstr): return OpAlt(ea, 0, opstr)
  146. def OpAlt2(ea, opstr): return OpAlt(ea, 1, opstr)
  147. def StringStp(x): return SetCharPrm(INF_ASCII_BREAK,x)
  148. def LowVoids(x): return SetLongPrm(INF_LOW_OFF,x)
  149. def HighVoids(x): return SetLongPrm(INF_HIGH_OFF,x)
  150. def TailDepth(x): return SetLongPrm(INF_MAXREF,x)
  151. def Analysis(x): return SetCharPrm(INF_AUTO,x)
  152. def Tabs(x): return SetCharPrm(INF_ENTAB,x)
  153. #def Comments(x): SetCharPrm(INF_CMTFLAG,((x) ? (SW_ALLCMT|GetCharPrm(INF_CMTFLAG)) : (~SW_ALLCMT&GetCharPrm(INF_CMTFLAG))))
  154. def Voids(x): return SetCharPrm(INF_VOIDS,x)
  155. def XrefShow(x): return SetCharPrm(INF_XREFNUM,x)
  156. def Indent(x): return SetCharPrm(INF_INDENT,x)
  157. def CmtIndent(x): return SetCharPrm(INF_COMMENT,x)
  158. def AutoShow(x): return SetCharPrm(INF_SHOWAUTO,x)
  159. def MinEA(): return GetLongPrm(INF_MIN_EA)
  160. def MaxEA(): return GetLongPrm(INF_MAX_EA)
  161. def BeginEA(): return GetLongPrm(INF_BEGIN_EA)
  162. def set_start_cs(x): return SetLongPrm(INF_START_CS,x)
  163. def set_start_ip(x): return SetLongPrm(INF_START_IP,x)
  164.  
  165. def WriteMap(filepath):
  166. return GenerateFile(OFILE_MAP, filepath, 0, BADADDR, GENFLG_MAPSEG|GENFLG_MAPNAME)
  167.  
  168. def WriteTxt(filepath, ea1, ea2):
  169. return GenerateFile(OFILE_ASM, filepath, ea1, ea2, 0)
  170.  
  171. def WriteExe(filepath):
  172. return GenerateFile(OFILE_EXE, filepath, 0, BADADDR, 0)
  173.  
  174. UTP_STRUCT = idaapi.UTP_STRUCT
  175. UTP_ENUM = idaapi.UTP_ENUM
  176.  
  177. def BeginTypeUpdating(utp):
  178. """
  179. Begin type updating. Use this function if you
  180. plan to call AddEnumConst or similar type modification functions
  181. many times or from inside a loop
  182.  
  183. @param utp: one of UTP_xxxx consts
  184. @return: None
  185. """
  186. return idaapi.begin_type_updating(utp)
  187.  
  188. def EndTypeUpdating(utp):
  189. """
  190. End type updating. Refreshes the type system
  191. at the end of type modification operations
  192.  
  193. @param utp: one of idaapi.UTP_xxxx consts
  194. @return: None
  195. """
  196. return idaapi.end_type_updating(utp)
  197.  
  198. def AddConst(enum_id, name,value): return AddConstEx(enum_id, name, value, idaapi.BADADDR)
  199. def AddStruc(index, name): return AddStrucEx(index,name, 0)
  200. def AddUnion(index, name): return AddStrucEx(index,name, 1)
  201. def OpStroff(ea, n, strid): return OpStroffEx(ea,n,strid, 0)
  202. def OpEnum(ea, n, enumid): return OpEnumEx(ea,n,enumid, 0)
  203. def DelConst(constid, v, mask): return DelConstEx(constid, v, 0, mask)
  204. def GetConst(constid, v, mask): return GetConstEx(constid, v, 0, mask)
  205. def AnalyseArea(sEA, eEA): return AnalyzeArea(sEA,eEA)
  206.  
  207. def MakeStruct(ea, name): return MakeStructEx(ea, -1, name)
  208. def MakeCustomData(ea, size, dtid, fid): return MakeCustomDataEx(ea, size, dtid, fid)
  209. def Name(ea): return NameEx(BADADDR, ea)
  210. def GetTrueName(ea): return GetTrueNameEx(BADADDR, ea)
  211. def MakeName(ea, name): return MakeNameEx(ea,name,SN_CHECK)
  212.  
  213. #def GetFrame(ea): return GetFunctionAttr(ea, FUNCATTR_FRAME)
  214. #def GetFrameLvarSize(ea): return GetFunctionAttr(ea, FUNCATTR_FRSIZE)
  215. #def GetFrameRegsSize(ea): return GetFunctionAttr(ea, FUNCATTR_FRREGS)
  216. #def GetFrameArgsSize(ea): return GetFunctionAttr(ea, FUNCATTR_ARGSIZE)
  217. #def GetFunctionFlags(ea): return GetFunctionAttr(ea, FUNCATTR_FLAGS)
  218. #def SetFunctionFlags(ea, flags): return SetFunctionAttr(ea, FUNCATTR_FLAGS, flags)
  219.  
  220. #def SegStart(ea): return GetSegmentAttr(ea, SEGATTR_START)
  221. #def SegEnd(ea): return GetSegmentAttr(ea, SEGATTR_END)
  222. #def SetSegmentType(ea, type): return SetSegmentAttr(ea, SEGATTR_TYPE, type)
  223.  
  224. def SegCreate(a1, a2, base, use32, align, comb): return AddSeg(a1, a2, base, use32, align, comb)
  225. def SegDelete(ea, flags): return DelSeg(ea, flags)
  226. def SegBounds(ea, startea, endea, flags): return SetSegBounds(ea, startea, endea, flags)
  227. def SegRename(ea, name): return RenameSeg(ea, name)
  228. def SegClass(ea, segclass): return SetSegClass(ea, segclass)
  229. def SegAddrng(ea, bitness): return SetSegAddressing(ea, bitness)
  230. def SegDefReg(ea, reg, value): return SetSegDefReg(ea, reg, value)
  231.  
  232. def Comment(ea): return GetCommentEx(ea, 0)
  233. """Returns the regular comment or None"""
  234.  
  235. def RptCmt(ea): return GetCommentEx(ea, 1)
  236. """Returns the repeatable comment or None"""
  237.  
  238. def SetReg(ea, reg, value): return SetRegEx(ea, reg, value, SR_user)
  239.  
  240. # Convenience functions:
  241. def here(): return ScreenEA()
  242. def isEnabled(ea): return (PrevAddr(ea+1)==ea)
  243.  
  244. # Obsolete segdel macros:
  245. SEGDEL_PERM = 0x0001 # permanently, i.e. disable addresses
  246. SEGDEL_KEEP = 0x0002 # keep information (code & data, etc)
  247. SEGDEL_SILENT = 0x0004 # be silent
  248.  
  249. ARGV = []
  250. """The command line arguments passed to IDA via the -S switch."""
  251.  
  252. # END OF IDC COMPATIBILY CODE

color xml arm相关的更多相关文章

  1. XML的相关基础知识分享

    XML和Json是两种最常用的在网络中数据传输的数据序列化格式,随着时代的变迁,XML序列化用于网络传输也逐渐被Json取代,前几天,单位系统集成开发对接接口时,发现大部分都用的WebService技 ...

  2. color.xml

    写控件的时候经常会遇到颜色选择问题,下面贴出常用颜色表示,方便选择. <?xml version="1.0" encoding="utf-8"?>& ...

  3. Android常用的颜色列表 color.xml

    转自:http://blog.csdn.net/libaineu2004/article/details/41548313 <?xml version="1.0" encod ...

  4. android颜色color.xml设置

     XML Code  12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 ...

  5. [转帖]ARM 相关内容

    ARM内核全解析,从ARM7,ARM9到Cortex-A7,A8,A9,A12,A15到Cortex-A53,A57 http://www.myir-tech.com/resource/448.asp ...

  6. XML的相关基础知识分享(二)

    前面我们讲了一下XML相关的基础知识(一),下面我们在加深一下,看一下XML高级方面. 一.命名空间 1.命名冲突 XML命名空间提供避免元素冲突的方法. 命名冲突:在XML中,元素名称是由开发者定义 ...

  7. maven的pom.xml配置文件相关依赖jar包

    <!--声明变量--> <properties> <project.build.sourceEncoding>UTF-8</project.build.sou ...

  8. 如何把android中布局文件(.xml)与相关的类(.java)进行关联?

    eg:把一个布局文件名为page1.xml与MainActivity.java(工程自动生成)进行 1.在存放使用资源的res文件夹下的layout文件夹内新建一个XML布局文件,如命名为:page1 ...

  9. iOS中XML的相关知识

    1.什么是XML “当 XML(扩展标记语言)于 1998 年 2 月被引入软件工业界时,它给整个行业带来了一场风暴.有史以来第一次,这个世界拥有了一种用来结构化文档和数据的通用且适应性强的格式,它不 ...

随机推荐

  1. easyui combobox setValue方法不能触发onSelect事件

    //setValue方法不能触发onSelect事件 //$("#FundingSource").combobox("setValue", data.Fundi ...

  2. vue项目打包后一片空白及资源引入的路径报错解决办法

    网上很多说自己的VUE项目通过Webpack打包生成的list文件,放到HBulider打包后,通过手机打开一片空白.这个主要原因是路径的问题. 1.记得改一下config下面的index.js中bu ...

  3. RabbitMQ in Depth札记——AMQ协议

    RPC传输 作为AMQP的实现,RabbitMQ使用RPC(remote procedure call)模式进行远程会话.而不同于一般的RPC会话--客户端发出指令,服务端响应,但服务端不会向客户端发 ...

  4. linux文件系统扩展属性

    翻译自man手册,水平有限,有错还望不吝指出.... 扩展属性是与文件和目录相关的name:value对,用来提供文件系统的一些附加功能,例如ACL.对文件或是目录拥有读权限的用户可以看到其扩展属性. ...

  5. ArcEngine获取要素数据集的容差和分辨率

    /// <summary> /// 根据数据集获取容差 /// </summary> /// <param name="dataset">< ...

  6. Mac 下的 C++ 开发环境

    1. Xcode 创建 C++ 项目 Xcode (版本 4.6.3)默认支持创建 C++ 项目,步骤很简单:打开 Xcode,新建一个项目:在 OS X 中的 Application 中选择 Com ...

  7. NumPy 广播机制(Broadcasting)

    一.何为广播机制 a.广播机制是Numpy(开源数值计算工具,用于处理大型矩阵)里一种向量化数组操作方法. b.Numpy的通用函数(Universal functions) 中要求输入的两个数组sh ...

  8. 一步步搭建 Spring Boot maven 框架的工程

    摘要:让Spring应用从配置到运行更加快速,演示DIY Spring Boot 框架时,如何配置端口号,如何添加日志. Spring Boot 框架帮助开发者更容易地创建基于Spring的应用程序和 ...

  9. Asp.net Mvc Ajax.BeginForm提交表单

    之前Mvc中一直用Html.BeginForm提交表单,即如下: @using (Html.BeginForm("Add", "News", FormMetho ...

  10. MongoDB update修改器: 针对Arrays的$修改器 $push $pull $pop

    针对Arrays的$修改器 $push : { $push: { key: value } } 它是用来对Array (list)数据类型进行 增加 新元素的,相当于我们Python中 list.ap ...