±£´æÖ¸¶¨Îļþ¼ÐϵÄĿ¼ºÍÎļþÃûµ½ÎļþÖÐ Python ½Å±¾
ÕæÊǵ¹Ã¹£¬¸ÕÂò²»¾ÃµÄÒƶ¯Ó²ÅÌ£¬×òÌìɾ³ýÒ»¸ö·ÖÇøʧ°Üºó£¬¼¸¸ö·ÖÇø¶¼²»¼ûÁË£¬ÄÃÈ¥ÐÞ£¬Î´¹û
»»Á˸öеģ¬µ«ÆäÖÐÊý¾ÝȫûÁË¡£ÄÇÊÇÎÒƽʱÊÕ¼¯µÄºÜÓÐÓõÄ×ÊÁÏ
ºÜ¶à¶¼¿ÉÒÔÖØÐÂÏÂÔØ£¬µ«ÔõÄÜÏëÆðÓ²ÅÌÖеÄËùÓж«Î÷
½ñÌì»»Ó²ÅÌ»ØÀ´
¾ÍÏñдһ¸ö±£´æÖ¸¶¨Â·¾¶ÏÂËùÓÐÎļþ¼ÐºÍÎļþÃûµÄ³ÌÐò
ÕâÑù£¬Èç¹û¶«Î÷¶ªÁË£¬¿´¿´ÄÇÀïÓÐЩʲô£¬Ò²¿ÉÁÄÒÔ¸æο
#filesindir.py for files in directory
#result is a txt file with the name of the directory to record
#cmd:filesindir.py "dirname"
# result will be stored in the directory
#or cmd:filesindir.py "dirname" "directory to store the result"
import os
import os.path
import sys
def dirparser(directory,indent,file):
try:
dirlist=os.listdir(directory)
dirli=[]
for i in dirlist:
if(os.path.isdir(directory+'\\'+i)==True):
dirli.append(directory+'\\'+i)
else:
for ind in range(indent):
file.write(' ')
file.write(i+'\n')
for dir in dirli:
for ind in range(indent):
file.write(' ')
indent+=1
file.write(dir+'\n')
dirparser(dir,indent,file)
indent-=1
except:
file.write(' !!!Access denied\n')
return
if __name__ == "__main__":
argc=len(sys.argv)
dir2rec=''
dir2pla=''
if(argc==1):
print("the command is used like this :")
print(" filesindir.py \"dirname\"")
print(" filesindir.py \"dirname\" \"directory to store the result\"")
sys.exit(0)
elif(argc==2):
dir2rec=sys.argv[1]
dir2pla=sys.argv[1]
else:
dir2rec=sys.argv[1]
dir2pla=sys.argv[2]
indent=0
file=open(dir2pla+'\\'+'filesindir.txt','w')
file.write('files in '+dir2rec+' :\n\n')
dirparser(dir2rec,indent,file)
file.close()
print('Done')
Ïà¹ØÎĵµ£º
ÓÃPythonµ¼³öQQ¿Õ¼äµÄÈÕÖ¾µ½WordPress
ÎÄÕÂÀ´Ô´£ºhttp://www.keakon.cn/bbs/thread-964-1-1.html·½·¨ºÜ¼òµ¥£¬ÕÒ³öÈÕÖ¾µÄµØÖ·£¬ÔÙ±éÀúÁгöÈÕÖ¾µÄÄÚÈÝ¡£
ÒòΪµ¥´¿µ¼³öûÓ㬻¹µÃת»»³ÉÆäËû¸ñʽ£¬ËùÒÔÎÒ±£´æµ½Ò»¸öÁбíÀÿƪÈÕÖ¾¶¼¶ÔÓ¦ÆäÖеÄÒ»¸ö×ÖµäÔªËØ£¬×ÖµäµÄÊôÐÔ¶¼ÓÃunicode±àÂë¡£
È»ºódump³öÀ´£¬¿ÉÒÔ·½±ãÒÔºóÓÃPyth ......
Ethereal ×Ô´øÐí¶àÐÒéµÄ decoder,¼òµ¥,Ò×ÓÃ,»ùÓÚwinpcapµÄÒ»¸ö¿ªÔ´µÄÈí¼þ.µ«ÊÇËüµÄ¼Ü¹¹²¢²»Áé»î,ÈçºÎÄãÒª¼ÓÈëÒ»¸ö×Ô¼º¶¨ÒåµÄµÄ½âÂëÆ÷,µÃÈ¥ÐÞ¸Ä EtherealµÄ´úÂë,ÔÙÖØбàÒë,ºÜ·³Ëö.¶ÔÓÚÒ»°ãµÄÃ÷ÎÄ ÐÒé,ûÓÐʲôÎÊÌâ,µ«ÊǶÔÓÚ¼ÓÃÜÐÒé,±ÈÈçÍøÂçÓÎÏ·,¿Í»§¶Ë³ÌÐòÒ»°ã»áÔÚ¸ÕÁ¬½ÓÉϵÄʱºò,·¢ËÍÒ»¸öËæ»úÃÜÔ¿,¶øºóµÄ±¨ÎĶ¼»áÓÃÕ⸠......
½ñÌì¿´¿´ÈçºÎÓÃpythonʵÏÖ×¥°ü¡£
ÒÔÇ°ÎÒÃÇÔøÓùýwinpcapʵÏÖ×¥°ü£¬Æäʵ½ñÌìÎÒÃÇ»¹ÊÇÓÃËü£¬Ö»²»¹ýÊÇËüÔÚpythonϵÄÄ£¿é£¬ÔÚÓÃ֮ǰÎÒÃDZØÐëÏÈÏÂÔØÁ½¸ö¿â£¬pcap¿âºÍdpkt¿â£¬Õâ¸ö¿ÉÒÔÔÚGoogle codeÀïºÜÈÝÒ×ÕÒµ½£¬ÐèҪעÒâµÄÊÇpcapÖ»Ö§³Öµ½python2.5 £¬ËùÒÔÎÒÃÇÒªÓÃ2.5À´±àд¡£
°²×°ÍêÁ ......
Python 3 ÊÇ Guido van Rossum ¹¦ÄÜÇ¿´óµÄͨÓñà³ÌÓïÑÔµÄ×îа汾¡£ËüËäÈ»´òÆÆÁËÓë 2.x °æ±¾µÄÏòºó¼æÈÝÐÔ£¬µ«È´ÇåÀíÁËijЩÓï·¨·½ÃæµÄÎÊÌâ¡£±¾ÎÄÊÇϵÁÐÎÄÕÂÖеĵÚһƪ£¬½éÉÜÁËÓ°Ïì¸ÃÓïÑÔ¼°Ïòºó¼æÈÝÐԵĸ÷Öֱ仯£¬²¢ÇÒ»¹ÌṩÁËÐÂÌØÐԵļ¸¸öÀý×Ó¡£
Python °æ±¾ 3£¬Ò²±»³ÆΪ Python 3000 »ò Py3K£¨·ÂЧ Microsoft® Windows ......
def Start(self):
if (self.conn == None) or (self.conn.State == 1):
self.conn = win32com.client.Dispatch(r'ADODB.Connection')
&n ......