#-*-coding:utf-8-*-import osimport sysif len (sys.argv) = = 2:filename=sys.argv[1]if not os.path.isfile (filename):p rint ' [-] ' + filename + ' does not exist. ' Exit (0) if not os.access (filename, os. R_OK):p rint ' [-] ' + filename + ' access denied. ' Exit (0) print ' [+] reading vulnerabilities from: ' + filename
Execution results: The first is a nonexistent file, the second is a file that exists and has permissions
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9A/E7/wKioL1lbvASyH7J-AAAP2WgtPak670.png "title=" 2017-07-05_000010.png "alt=" Wkiol1lbvasyh7j-aaap2wgtpak670.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/9A/E6/wKiom1lbvFugjvmWAAQF1aT1ixQ791.png "title=" Enjoy. png "alt=" Wkiom1lbvfugjvmwaaqf1at1ixq791.png "/>
This article is from the "Tiandaochouqin" blog, make sure to keep this source http://taindaochouqin.blog.51cto.com/12995943/1944596
Python determines whether a file exists and permissions