Try to read Sqlmap source (a)

Source: Internet
Author: User

I python more than a piece of vegetable. Replying to the Industry model ~ ~

sqlmap.py script in 72~83

def Modulepath ():     """ This would get us the program's     directory, even if we are frozen    using    py2exe"" "    t Ry:        ifelse__file__    except  nameerror :        = inspect.getsourcefile (modulepath)    returnor unicode_encoding )

Modulepath by name, it should be related to the path.

Sys.executable gets the current Python interpreter path.

__FILE__ the relative path under execution obtains the relative path, and the absolute path is obtained by executing the absolute path.

Wearefrozen () This function here, Hasattr gets the frozen property in the Sys and returns a Boolean value.

Tip: Python gets its own absolute path
Python has a magic variable can get the name of the script itself, but converted to EXE after the variable is invalidated, you have to use sys.executable to obtain the name of the executable program, you can use HASATTR (sys, "Frozen") to determine whether you have been packaged, Here is a convenient way to take the absolute path.

In order to understand, and then did the test.

Too sleepy .... The following part, read again at night.

Try to read Sqlmap source (a)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.