Results 1 to 4 of 4

Thread: Ida Python SegCreate problem

  1. #1
    Red wine, not vodka! ZaiRoN's Avatar
    Join Date
    Oct 2001
    Location
    Italy
    Posts
    922
    Blog Entries
    17

    Ida Python SegCreate problem

    Hi.
    Playing a little with IDa Python I was trying to create a new segment using the function SegCreate. From Ida help you can read the syntax of the function:
    Code:
    success SegCreate(long startea,long endea,long base,long use32,long align,long comb);
    where:
    //	  startea  - linear address of the start of the segment
    //	  endea	- linear address of the end of the segment
    //	   this address will not belong to the segment
    //	   'endea' should be higher than 'startea'
    //	  base	 - base paragraph or selector of the segment.
    //	   a paragraph is 16byte memory chunk.
    //	   If a selector value is specified, the selector should be
    //	   already defined.
    //	  use32	- 0: 16bit segment, 1: 32bit segment, 2: 64bit segment
    //	  align	- segment alignment. see below for alignment values
    //	  comb	 - segment combination. see below for combination values.
    // returns: 0-failed, 1-ok
    The definition of the function taken from idc.py is almost the same:
    Code:
    def SegCreate(startea, endea, base, use32, align, comb)
    so I tried to use:
    Code:
    SegCreate(0x610000, 0x620000, 0x1, 0x1, 0x2, 0x2)
    Unfortunatly I received an error... So, looking at the definition of the function -inside ida.py- I noticed something strange:
    Code:
    def SegCreate(startea, endea, base, use32, align, comb):
    	...
    	success = idaapi.add_segm(startea, endea, para, "Segment", "CODE")
    	...
    Look at the third parameter: para
    This is an error, 'para' is never defined/used/referred before. The right parameter should be 'base'; I tried to change the parameters but I got a warning message, this time from ida:
    "Create a segment (00620000-00000001): end address is lower than start address."
    Seems like there is something wrong with the order of the parameters. The right sequence is base-startea-endea.

    I mailed the author but I didn't receive a reply so I decided to write it here. Is there someone that had the same problem?

    Regards,
    ZaiRoN

  2. #2
    Red wine, not vodka! ZaiRoN's Avatar
    Join Date
    Oct 2001
    Location
    Italy
    Posts
    922
    Blog Entries
    17
    Just to let you know Ida Python 0.8.0 is out at the same address: http://www.d-dome.net/idapython/
    The segcreate problem is still alive but the author resolved the problem fixing the file idc.py; he 'll upload the new version sooner. I have the updated file which I won't upload here until Dyce will give me the authorization, but if you have any kind of problems with the function don't esitate to contact me.

    Regards,
    ZaiRoN

  3. #3
    Thanks, Zairon.

    This thread has awaken my attention to IDA Python.
    I think that this is a good opportunity to me to start learning Python.

    Regards,
    Opcode

  4. #4
    Red wine, not vodka! ZaiRoN's Avatar
    Join Date
    Oct 2001
    Location
    Italy
    Posts
    922
    Blog Entries
    17
    Hi Opcode.
    If you use idc, ida python it's a must

Similar Threads

  1. Hardcoded dll export address: Python approach
    By My Infected Computer in forum Blogs Forum
    Replies: 0
    Last Post: May 14th, 2014, 17:26
  2. Immunity Debugger Python scripts
    By fasmotol in forum Off Topic
    Replies: 2
    Last Post: June 16th, 2012, 12:06
  3. IDA Pro, Python and Qt
    By Hex Blog in forum Blogs Forum
    Replies: 0
    Last Post: October 30th, 2010, 10:17
  4. Python winappdbg module v1.0 is out!
    By QvasiModo in forum Tools of Our Trade (TOT) Messageboard
    Replies: 1
    Last Post: April 25th, 2009, 11:12
  5. Python + Microsoft Minidumps
    By OpenRCE_jms in forum Blogs Forum
    Replies: 0
    Last Post: November 24th, 2007, 18:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •