1. #---------------------------------------------------------------------
  2. # IDAPython - Python plugin for Interactive Disassembler
  3. #
  4. # Copyright (c) 2004-2010 Gergely Erdelyi <gergely.erdelyi@d-dome.net>
  5. #
  6. # All rights reserved.
  7. #
  8. # For detailed copyright information see the file COPYING in
  9. # the root of the distribution archive.
  10. #---------------------------------------------------------------------
  11. """
  12. idautils.py - High level utility functions for IDA
  13. """
  14. import idaapi
  15. import idc
  16. import types
  17. import os
  18. def refs(ea, funcfirst, funcnext):
  19. """
  20. Generic reference collector - INTERNAL USE ONLY.
  21. """
  22. ref = funcfirst(ea)
  23. while ref != idaapi.BADADDR:
  24. yield ref
  25. ref = funcnext(ea, ref)
  26. def CodeRefsTo(ea, flow):
  27. """
  28. Get a list of code references to 'ea'
  29. @param ea: Target address
  30. @param flow: Follow normal code flow or not
  31. @type flow: Boolean (0/1, False/True)
  32. @return: list of references (may be empty list)
  33. Example::
  34. for ref in CodeRefsTo(ScreenEA(), 1):
  35. print ref
  36. """
  37. if flow == 1:
  38. return refs(ea, idaapi.get_first_cref_to, idaapi.get_next_cref_to)
  39. else:
  40. return refs(ea, idaapi.get_first_fcref_to, idaapi.get_next_fcref_to)
  41. def CodeRefsFrom(ea, flow):
  42. """
  43. Get a list of code references from 'ea'
  44. @param ea: Target address
  45. @param flow: Follow normal code flow or not
  46. @type flow: Boolean (0/1, False/True)
  47. @return: list of references (may be empty list)
  48. Example::
  49. for ref in CodeRefsFrom(ScreenEA(), 1):
  50. print ref
  51. """
  52. if flow == 1:
  53. return refs(ea, idaapi.get_first_cref_from, idaapi.get_next_cref_from)
  54. else:
  55. return refs(ea, idaapi.get_first_fcref_from, idaapi.get_next_fcref_from)
  56. def DataRefsTo(ea):
  57. """
  58. Get a list of data references to 'ea'
  59. @param ea: Target address
  60. @return: list of references (may be empty list)
  61. Example::
  62. for ref in DataRefsTo(ScreenEA()):
  63. print ref
  64. """
  65. return refs(ea, idaapi.get_first_dref_to, idaapi.get_next_dref_to)
  66. def DataRefsFrom(ea):
  67. """
  68. Get a list of data references from 'ea'
  69. @param ea: Target address
  70. @return: list of references (may be empty list)
  71. Example::
  72. for ref in DataRefsFrom(ScreenEA()):
  73. print ref
  74. """
  75. return refs(ea, idaapi.get_first_dref_from, idaapi.get_next_dref_from)
  76. def XrefTypeName(typecode):
  77. """
  78. Convert cross-reference type codes to readable names
  79. @param typecode: cross-reference type code
  80. """
  81. ref_types = {
  82. 0 : 'Data_Unknown',
  83. 1 : 'Data_Offset',
  84. 2 : 'Data_Write',
  85. 3 : 'Data_Read',
  86. 4 : 'Data_Text',
  87. 5 : 'Data_Informational',
  88. 16 : 'Code_Far_Call',
  89. 17 : 'Code_Near_Call',
  90. 18 : 'Code_Far_Jump',
  91. 19 : 'Code_Near_Jump',
  92. 20 : 'Code_User',
  93. 21 : 'Ordinary_Flow'
  94. }
  95. assert typecode in ref_types, "unknown reference type %d" % typecode
  96. return ref_types[typecode]
  97. def _copy_xref(xref):
  98. """ Make a private copy of the xref class to preserve its contents """
  99. class _xref(object):
  100. pass
  101. xr = _xref()
  102. for attr in [ 'frm', 'to', 'iscode', 'type', 'user' ]:
  103. setattr(xr, attr, getattr(xref, attr))
  104. return xr
  105. def XrefsFrom(ea, flags=0):
  106. """
  107. Return all references from address 'ea'
  108. @param ea: Reference address
  109. @param flags: any of idaapi.XREF_* flags
  110. Example::
  111. for xref in XrefsFrom(here(), 0):
  112. print xref.type, XrefTypeName(xref.type), \
  113. 'from', hex(xref.frm), 'to', hex(xref.to)
  114. """
  115. xref = idaapi.xrefblk_t()
  116. if xref.first_from(ea, flags):
  117. yield _copy_xref(xref)
  118. while xref.next_from():
  119. yield _copy_xref(xref)
  120. def XrefsTo(ea, flags=0):
  121. """
  122. Return all references to address 'ea'
  123. @param ea: Reference address
  124. @param flags: any of idaapi.XREF_* flags
  125. Example::
  126. for xref in XrefsTo(here(), 0):
  127. print xref.type, XrefTypeName(xref.type), \
  128. 'from', hex(xref.frm), 'to', hex(xref.to)
  129. """
  130. xref = idaapi.xrefblk_t()
  131. if xref.first_to(ea, flags):
  132. yield _copy_xref(xref)
  133. while xref.next_to():
  134. yield _copy_xref(xref)
  135. def Threads():
  136. """Returns all thread IDs"""
  137. for i in xrange(0, idc.GetThreadQty()):
  138. yield idc.GetThreadId(i)
  139. def Heads(start=None, end=None):
  140. """
  141. Get a list of heads (instructions or data)
  142. @param start: start address (default: inf.minEA)
  143. @param end: end address (default: inf.maxEA)
  144. @return: list of heads between start and end
  145. """
  146. if not start: start = idaapi.cvar.inf.minEA
  147. if not end: end = idaapi.cvar.inf.maxEA
  148. ea = start
  149. if not idc.isHead(idc.GetFlags(ea)):
  150. ea = idaapi.next_head(ea, end)
  151. while ea != idaapi.BADADDR:
  152. yield ea
  153. ea = idaapi.next_head(ea, end)
  154. def Functions(start=None, end=None):
  155. """
  156. Get a list of functions
  157. @param start: start address (default: inf.minEA)
  158. @param end: end address (default: inf.maxEA)
  159. @return: list of heads between start and end
  160. @note: The last function that starts before 'end' is included even
  161. if it extends beyond 'end'. Any function that has its chunks scattered
  162. in multiple segments will be reported multiple times, once in each segment
  163. as they are listed.
  164. """
  165. if not start: start = idaapi.cvar.inf.minEA
  166. if not end: end = idaapi.cvar.inf.maxEA
  167. # find first function head chunk in the range
  168. chunk = idaapi.get_fchunk(start)
  169. if not chunk:
  170. chunk = idaapi.get_next_fchunk(start)
  171. while chunk and chunk.startEA < end and (chunk.flags & idaapi.FUNC_TAIL) != 0:
  172. chunk = idaapi.get_next_fchunk(chunk.startEA)
  173. func = chunk
  174. while func and func.startEA < end:
  175. startea = func.startEA
  176. yield startea
  177. func = idaapi.get_next_func(startea)
  178. def Chunks(start):
  179. """
  180. Get a list of function chunks
  181. @param start: address of the function
  182. @return: list of funcion chunks (tuples of the form (start_ea, end_ea))
  183. belonging to the function
  184. """
  185. func_iter = idaapi.func_tail_iterator_t( idaapi.get_func( start ) )
  186. status = func_iter.main()
  187. while status:
  188. chunk = func_iter.chunk()
  189. yield (chunk.startEA, chunk.endEA)
  190. status = func_iter.next()
  191. def Modules():
  192. """
  193. Returns a list of module objects with name,size,base and the rebase_to attributes
  194. """
  195. mod = idaapi.module_info_t()
  196. result = idaapi.get_first_module(mod)
  197. while result:
  198. yield idaapi.object_t(name=mod.name, size=mod.size, base=mod.base, rebase_to=mod.rebase_to)
  199. result = idaapi.get_next_module(mod)
  200. def Names():
  201. """
  202. Returns a list of names
  203. @return: List of tuples (ea, name)
  204. """
  205. for i in xrange(idaapi.get_nlist_size()):
  206. ea = idaapi.get_nlist_ea(i)
  207. name = idaapi.get_nlist_name(i)
  208. yield (ea, name)
  209. def Segments():
  210. """
  211. Get list of segments (sections) in the binary image
  212. @return: List of segment start addresses.
  213. """
  214. for n in xrange(idaapi.get_segm_qty()):
  215. seg = idaapi.getnseg(n)
  216. if seg:
  217. yield seg.startEA
  218. def Entries():
  219. """
  220. Returns a list of entry points
  221. @return: List of tuples (index, ordinal, ea, name)
  222. """
  223. n = idaapi.get_entry_qty()
  224. for i in xrange(0, n):
  225. ordinal = idaapi.get_entry_ordinal(i)
  226. ea = idaapi.get_entry(ordinal)
  227. name = idaapi.get_entry_name(ordinal)
  228. yield (i, ordinal, ea, name)
  229. def FuncItems(start):
  230. """
  231. Get a list of function items
  232. @param start: address of the function
  233. @return: ea of each item in the function
  234. """
  235. func = idaapi.get_func(start)
  236. if not func:
  237. return
  238. fii = idaapi.func_item_iterator_t()
  239. ok = fii.set(func)
  240. while ok:
  241. yield fii.current()
  242. ok = fii.next_code()
  243. def Structs():
  244. """
  245. Get a list of structures
  246. @return: List of tuples (idx, sid, name)
  247. """
  248. idx = idc.GetFirstStrucIdx()
  249. while idx != idaapi.BADADDR:
  250. sid = idc.GetStrucId(idx)
  251. yield (idx, sid, idc.GetStrucName(sid))
  252. idx = idc.GetNextStrucIdx(idx)
  253. def StructMembers(sid):
  254. """
  255. Get a list of structure members information (or stack vars if given a frame).
  256. @param sid: ID of the structure.
  257. @return: List of tuples (offset, name, size)
  258. @note: If 'sid' does not refer to a valid structure,
  259. an exception will be raised.
  260. @note: This will not return 'holes' in structures/stack frames;
  261. it only returns defined structure members.
  262. """
  263. m = idc.GetFirstMember(sid)
  264. if m == -1:
  265. raise Exception("No structure with ID: 0x%x" % sid)
  266. while (m != idaapi.BADADDR):
  267. name = idc.GetMemberName(sid, m)
  268. if name:
  269. yield (m, name, idc.GetMemberSize(sid, m))
  270. m = idc.GetStrucNextOff(sid, m)
  271. def DecodePrecedingInstruction(ea):
  272. """
  273. Decode preceding instruction in the execution flow.
  274. @param ea: address to decode
  275. @return: (None or the decode instruction, farref)
  276. farref will contain 'true' if followed an xref, false otherwise
  277. """
  278. prev_addr, farref = idaapi.decode_preceding_insn(ea)
  279. if prev_addr == idaapi.BADADDR:
  280. return (None, False)
  281. else:
  282. return (idaapi.cmd.copy(), farref)
  283. def DecodePreviousInstruction(ea):
  284. """
  285. Decodes the previous instruction and returns an insn_t like class
  286. @param ea: address to decode
  287. @return: None or a new insn_t instance
  288. """
  289. inslen = idaapi.decode_prev_insn(ea)
  290. if inslen == 0:
  291. return None
  292. return idaapi.cmd.copy()
  293. def DecodeInstruction(ea):
  294. """
  295. Decodes an instruction and returns an insn_t like class
  296. @param ea: address to decode
  297. @return: None or a new insn_t instance
  298. """
  299. inslen = idaapi.decode_insn(ea)
  300. if inslen == 0:
  301. return None
  302. return idaapi.cmd.copy()
  303. def GetDataList(ea, count, itemsize=1):
  304. """
  305. Get data list - INTERNAL USE ONLY
  306. """
  307. if itemsize == 1:
  308. getdata = idaapi.get_byte
  309. elif itemsize == 2:
  310. getdata = idaapi.get_word
  311. elif itemsize == 4:
  312. getdata = idaapi.get_long
  313. elif itemsize == 8:
  314. getdata = idaapi.get_qword
  315. else:
  316. raise ValueError, "Invalid data size! Must be 1, 2, 4 or 8"
  317. endea = ea + itemsize * count
  318. curea = ea
  319. while curea < endea:
  320. yield getdata(curea)
  321. curea += itemsize
  322. def PutDataList(ea, datalist, itemsize=1):
  323. """
  324. Put data list - INTERNAL USE ONLY
  325. """
  326. putdata = None
  327. if itemsize == 1:
  328. putdata = idaapi.patch_byte
  329. if itemsize == 2:
  330. putdata = idaapi.patch_word
  331. if itemsize == 4:
  332. putdata = idaapi.patch_long
  333. assert putdata, "Invalid data size! Must be 1, 2 or 4"
  334. for val in datalist:
  335. putdata(ea, val)
  336. ea = ea + itemsize
  337. def MapDataList(ea, length, func, wordsize=1):
  338. """
  339. Map through a list of data words in the database
  340. @param ea: start address
  341. @param length: number of words to map
  342. @param func: mapping function
  343. @param wordsize: size of words to map [default: 1 byte]
  344. @return: None
  345. """
  346. PutDataList(ea, map(func, GetDataList(ea, length, wordsize)), wordsize)
  347. def GetInputFileMD5():
  348. """
  349. Return the MD5 hash of the input binary file
  350. @return: MD5 string or None on error
  351. """
  352. return idc.GetInputMD5()
  353. class Strings(object):
  354. """
  355. Returns the string list.
  356. Example:
  357. s = Strings()
  358. for i in s:
  359. print "%x: len=%d type=%d -> '%s'" % (i.ea, i.length, i.type, str(i))
  360. """
  361. class StringItem(object):
  362. """
  363. Class representing each string item.
  364. """
  365. def __init__(self, si):
  366. self.ea = si.ea
  367. """String ea"""
  368. self.type = si.type
  369. """string type (ASCSTR_xxxxx)"""
  370. self.length = si.length
  371. """string length"""
  372. def __str__(self):
  373. return idc.GetString(self.ea, self.length, self.type)
  374. STR_C = 0x0001
  375. """C-style ASCII string"""
  376. STR_PASCAL = 0x0002
  377. """Pascal-style ASCII string (length byte)"""
  378. STR_LEN2 = 0x0004
  379. """Pascal-style, length is 2 bytes"""
  380. STR_UNICODE = 0x0008
  381. """Unicode string"""
  382. STR_LEN4 = 0x0010
  383. """Pascal-style, length is 4 bytes"""
  384. STR_ULEN2 = 0x0020
  385. """Pascal-style Unicode, length is 2 bytes"""
  386. STR_ULEN4 = 0x0040
  387. """Pascal-style Unicode, length is 4 bytes"""
  388. def clear_cache(self):
  389. """Clears the strings list cache"""
  390. self.refresh(0, 0) # when ea1=ea2 the kernel will clear the cache
  391. def __init__(self, default_setup = True):
  392. """
  393. Initializes the Strings enumeration helper class
  394. @param default_setup: Set to True to use default setup (C strings, min len 5, ...)
  395. """
  396. self.size = 0
  397. if default_setup:
  398. self.setup()
  399. self._si = idaapi.string_info_t()
  400. def refresh(self, ea1=None, ea2=None):
  401. """Refreshes the strings list"""
  402. if ea1 is None:
  403. ea1 = idaapi.cvar.inf.minEA
  404. if ea2 is None:
  405. ea2 = idaapi.cvar.inf.maxEA
  406. idaapi.refresh_strlist(ea1, ea2)
  407. self.size = idaapi.get_strlist_qty()
  408. def setup(self,
  409. strtypes = STR_C,
  410. minlen = 5,
  411. only_7bit = True,
  412. ignore_instructions = False,
  413. ea1 = None,
  414. ea2 = None,
  415. display_only_existing_strings = False):
  416. if ea1 is None:
  417. ea1 = idaapi.cvar.inf.minEA
  418. if ea2 is None:
  419. ea2 = idaapi.cvar.inf.maxEA
  420. t = idaapi.strwinsetup_t()
  421. t.strtypes = strtypes
  422. t.minlen = minlen
  423. t.only_7bit = only_7bit
  424. t.ea1 = ea1
  425. t.ea2 = ea2
  426. t.display_only_existing_strings = display_only_existing_strings
  427. idaapi.set_strlist_options(t)
  428. # Automatically refreshes
  429. self.refresh()
  430. def _get_item(self, index):
  431. if not idaapi.get_strlist_item(index, self._si):
  432. return None
  433. else:
  434. return Strings.StringItem(self._si)
  435. def __iter__(self):
  436. return (self._get_item(index) for index in xrange(0, self.size))
  437. def __getitem__(self, index):
  438. """Returns a string item or None"""
  439. if index >= self.size:
  440. raise KeyError
  441. else:
  442. return self._get_item(index)
  443. # -----------------------------------------------------------------------
  444. def GetIdbDir():
  445. """
  446. Get IDB directory
  447. This function returns directory path of the current IDB database
  448. """
  449. return os.path.dirname(idaapi.cvar.database_idb) + os.sep
  450. # -----------------------------------------------------------------------
  451. def GetRegisterList():
  452. """Returns the register list"""
  453. return idaapi.ph_get_regnames()
  454. # -----------------------------------------------------------------------
  455. def GetInstructionList():
  456. """Returns the instruction list of the current processor module"""
  457. return [i[0] for i in idaapi.ph_get_instruc() if i[0]]
  458. # -----------------------------------------------------------------------
  459. def _Assemble(ea, line):
  460. """
  461. Please refer to Assemble() - INTERNAL USE ONLY
  462. """
  463. if type(line) == types.StringType:
  464. lines = [line]
  465. else:
  466. lines = line
  467. ret = []
  468. for line in lines:
  469. seg = idaapi.getseg(ea)
  470. if not seg:
  471. return (False, "No segment at ea")
  472. ip = ea - (idaapi.ask_selector(seg.sel) << 4)
  473. buf = idaapi.AssembleLine(ea, seg.sel, ip, seg.bitness, line)
  474. if not buf:
  475. return (False, "Assembler failed: " + line)
  476. ea += len(buf)
  477. ret.append(buf)
  478. if len(ret) == 1:
  479. ret = ret[0]
  480. return (True, ret)
  481. def Assemble(ea, line):
  482. """
  483. Assembles one or more lines (does not display an message dialogs)
  484. If line is a list then this function will attempt to assemble all the lines
  485. This function will turn on batch mode temporarily so that no messages are displayed on the screen
  486. @param ea: start address
  487. @return: (False, "Error message") or (True, asm_buf) or (True, [asm_buf1, asm_buf2, asm_buf3])
  488. """
  489. old_batch = idc.Batch(1)
  490. ret = _Assemble(ea, line)
  491. idc.Batch(old_batch)
  492. return ret
  493. def _copy_obj(src, dest, skip_list = None):
  494. """
  495. Copy non private/non callable attributes from a class instance to another
  496. @param src: Source class to copy from
  497. @param dest: If it is a string then it designates the new class type that will be created and copied to.
  498. Otherwise dest should be an instance of another class
  499. @return: A new instance or "dest"
  500. """
  501. if type(dest) == types.StringType:
  502. # instantiate a new destination class of the specified type name?
  503. dest = new.classobj(dest, (), {})
  504. for x in dir(src):
  505. # skip special and private fields
  506. if x.startswith("__") and x.endswith("__"):
  507. continue
  508. # skip items in the skip list
  509. if skip_list and x in skip_list:
  510. continue
  511. t = getattr(src, x)
  512. # skip callable
  513. if callable(t):
  514. continue
  515. setattr(dest, x, t)
  516. return dest
  517. # -----------------------------------------------------------------------
  518. class _reg_dtyp_t(object):
  519. """
  520. INTERNAL
  521. This class describes a register's number and dtyp.
  522. The equal operator is overloaded so that two instances can be tested for equality
  523. """
  524. def __init__(self, reg, dtyp):
  525. self.reg = reg
  526. self.dtyp = dtyp
  527. def __eq__(self, other):
  528. return (self.reg == other.reg) and (self.dtyp == other.dtyp)
  529. # -----------------------------------------------------------------------
  530. class _procregs(object):
  531. """Utility class allowing the users to identify registers in a decoded instruction"""
  532. def __getattr__(self, attr):
  533. ri = idaapi.reg_info_t()
  534. if not idaapi.parse_reg_name(attr, ri):
  535. raise AttributeError()
  536. r = _reg_dtyp_t(ri.reg, ord(idaapi.get_dtyp_by_size(ri.size)))
  537. self.__dict__[attr] = r
  538. return r
  539. def __setattr__(self, attr, value):
  540. raise AttributeError(attr)
  541. # -----------------------------------------------------------------------
  542. class _cpu(object):
  543. "Simple wrapper around GetRegValue/SetRegValue"
  544. def __getattr__(self, name):
  545. #print "cpu.get(%s)" % name
  546. return idc.GetRegValue(name)
  547. def __setattr__(self, name, value):
  548. #print "cpu.set(%s)" % name
  549. return idc.SetRegValue(value, name)
  550. # --------------------------------------------------------------------------
  551. class __process_ui_actions_helper(object):
  552. def __init__(self, actions, flags = 0):
  553. """Expect a list or a string with a list of actions"""
  554. if isinstance(actions, str):
  555. lst = actions.split(";")
  556. elif isinstance(actions, (list, tuple)):
  557. lst = actions
  558. else:
  559. raise ValueError, "Must pass a string, list or a tuple"
  560. # Remember the action list and the flags
  561. self.__action_list = lst
  562. self.__flags = flags
  563. # Reset action index
  564. self.__idx = 0
  565. def __len__(self):
  566. return len(self.__action_list)
  567. def __call__(self):
  568. if self.__idx >= len(self.__action_list):
  569. return False
  570. # Execute one action
  571. idaapi.process_ui_action(
  572. self.__action_list[self.__idx],
  573. self.__flags)
  574. # Move to next action
  575. self.__idx += 1
  576. # Reschedule
  577. return True
  578. # --------------------------------------------------------------------------
  579. def ProcessUiActions(actions, flags=0):
  580. """
  581. @param actions: A string containing a list of actions separated by semicolon, a list or a tuple
  582. @param flags: flags to be passed to process_ui_action()
  583. @return: Boolean. Returns False if the action list was empty or execute_ui_requests() failed.
  584. """
  585. # Instantiate a helper
  586. helper = __process_ui_actions_helper(actions, flags)
  587. return False if len(helper) < 1 else idaapi.execute_ui_requests((helper,))
  588. # -----------------------------------------------------------------------
  589. class peutils_t(object):
  590. """
  591. PE utility class. Retrieves PE information from the database.
  592. Constants from pe.h
  593. """
  594. PE_NODE = "$ PE header" # netnode name for PE header
  595. PE_ALT_DBG_FPOS = idaapi.BADADDR & -1 # altval() -> translated fpos of debuginfo
  596. PE_ALT_IMAGEBASE = idaapi.BADADDR & -2 # altval() -> loading address (usually pe.imagebase)
  597. PE_ALT_PEHDR_OFF = idaapi.BADADDR & -3 # altval() -> offset of PE header
  598. PE_ALT_NEFLAGS = idaapi.BADADDR & -4 # altval() -> neflags
  599. PE_ALT_TDS_LOADED = idaapi.BADADDR & -5 # altval() -> tds already loaded(1) or invalid(-1)
  600. PE_ALT_PSXDLL = idaapi.BADADDR & -6 # altval() -> if POSIX(x86) imports from PSXDLL netnode
  601. def __init__(self):
  602. self.__penode = idaapi.netnode()
  603. self.__penode.create(peutils_t.PE_NODE)
  604. imagebase = property(
  605. lambda self: self.__penode.altval(peutils_t.PE_ALT_IMAGEBASE)
  606. )
  607. header = property(
  608. lambda self: self.__penode.altval(peutils_t.PE_ALT_PEHDR_OFF)
  609. )
  610. def __str__(self):
  611. return "peutils_t(imagebase=%s, header=%s)" % (hex(self.imagebase), hex(self.header))
  612. def header(self):
  613. """
  614. Returns the complete PE header as an instance of peheader_t (defined in the SDK).
  615. """
  616. return self.__penode.valobj()
  617. # -----------------------------------------------------------------------
  618. cpu = _cpu()
  619. """This is a special class instance used to access the registers as if they were attributes of this object.
  620. For example to access the EAX register:
  621. print "%x" % cpu.Eax
  622. """
  623. procregs = _procregs()
  624. """This object is used to access the processor registers. It is useful when decoding instructions and you want to see which instruction is which.
  625. For example:
  626. x = idautils.DecodeInstruction(here())
  627. if x[0] == procregs.Esp:
  628. print "This operand is the register ESP
  629. """

IDAPython类库---idautils.py的源码的更多相关文章

  1. IDAPython类库---idc.py的源码

    #!/usr/bin/env python #--------------------------------------------------------------------- # IDAPy ...

  2. IDAPython类库---idaapi.py的源码

    #ThisfilewasautomaticallygeneratedbySWIG(http://www.swig.org).#Version2.0.12##Donotmakechangestothis ...

  3. django python mange.py runserver 源码

    django python mange.py runserver 源码 入 口 mange.py文件 execute_from_command_line函数 输入参数为['manage.py', 'r ...

  4. quartz.net插件类库封装(含源码)

    1.前言 目录: 1.quartz.net任务调度:源码及使用文档 2.quartz.net插件类库封装 最近项目需要做一写任务作业调度的工作,最终选择了quartz.net这个插件,它提供了巨大的灵 ...

  5. python附录-re.py模块源码(含re官方文档链接)

    re模块 python官方文档链接:https://docs.python.org/zh-cn/3/library/re.html re模块源码 r"""Support ...

  6. 【第三方类库】underscore.js源码---each forEach 每次迭代跟{}比较的疑惑

    var each = _.each = _.forEach = function(obj, iterator, context) { if (obj == null) return; //首先判断是否 ...

  7. 史林枫:开源HtmlAgilityPack公共小类库封装 - 网页采集(爬虫)辅助解析利器【附源码+可视化工具推荐】

    做开发的,可能都做过信息采集相关的程序,史林枫也经常做一些数据采集或某些网站的业务办理自动化操作软件. 获取目标网页的信息很简单,使用网络编程,利用HttpWebResponse.HttpWebReq ...

  8. chrome源码编译常见的错误解决

    最近编译chrome浏览器源码时,下载源码和一般的设置,网络中都有说明,而且一般的说明都是类似的,然后都说编译成功了,但本人没有试成功,碰到常见的2个错误,记录下,不知道大家碰到没有. 1.pytho ...

  9. Python paramiko 修改源码实现用户命令抓取

    paramiko 源码修改 paramiko主要用来实现ssh客户端.服务端链接,上一节我们说到了堡垒机,堡垒机内有一个需求是“用户行为审计”,在这里我们就可以通过修改paramiko内文件的源码来实 ...

随机推荐

  1. SHELL编程概念&变量剖析

    一.shell软件概念和应用场景 1) 学习Linux技术,不是为了学习系统安装.命令操作.用户权限.配置IP.网络管理,学习Linux技术重点:基于Linux系统部署和维护各种应用软件.程序(Apa ...

  2. groovy-map.each{}

    ConfigDetail postEdiUrl(TtxSession sess, String code) { return cdSvc.getByRecordTypeAndIdentifier(se ...

  3. java基础:数据类型拓展

    public static void main(String[] args) { //单行注释 //输出hello,world! //System.out.println("hello,wo ...

  4. shiro太复杂?快来试试这个轻量级权限认证框架!

    前言 在java的世界里,有很多优秀的权限认证框架,如Apache Shiro.Spring Security 等等.这些框架背景强大,历史悠久,其生态也比较齐全. 但同时这些框架也并非十分完美,在前 ...

  5. Radar Scanner Gym - 102220G

    题目链接:https://vjudge.net/problem/Gym-102220G 题意:在水平直角坐标系中有n个矩形,你可以将矩形沿着平行于X轴和Y轴水平移动,问至少经过几次移动可以使得所有的矩 ...

  6. python3 int() 各数据类型转int

    print(int('0b1010',0))#二进制数print(int('0xa',0))#十六进制数print(int('0xa',16))print(int('a',16))print(int( ...

  7. Oracle 19c Data Guard DML Redirection ADG备库上执行DML重定向(未来更好的进行读写分离)

    资料来自官方网站: https://docs.oracle.com/en/database/oracle/oracle-database/19/sbydb/managing-oracle-data-g ...

  8. 系统编程-信号-总体概述和signal基本使用

    信号章节 -- 信号章节总体概要 信号基本概念 信号是异步事件,发送信号的线程可以继续向下执行而不阻塞. 信号无优先级. 1到31号信号是非实时信号,发送的信号可能会丢失,不支持信号排队. 31号信号 ...

  9. 提高Python的性能

    01 使用哈希表的数据结构   如果在程序中遇到大量搜索操作时,并且数据中没有重复项,则可以使用查找而不是循环.举例如下: items = ['a', 'b',..,'100m'] #1000s of ...

  10. ubuntu20.04开机显示recovering journal死机的解决方法

    事发突然,在今天开机的时候无法进入登陆界面,一直卡在黑屏界面,屏幕上只显示几行代码,且任何按键都无法起作用 /dev/sdb2:recovering journal /dev/sdb2:Clearin ...