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)