智一面的面试题提供python的测试题
使用地址:http://www.gtalent.cn/exam/interview?token=52cf92de494f4a8b6165d817a7279966

这个确实很实用啊,可以扫描网站后台地址,不要做坏事哦
  1. #!/usr/bin/python
  2.  
  3. import sys,httplib
  4. from optparse import OptionParser
  5. usageString = "Usage: %prog [options] hostname"
  6. parser = OptionParser(usage=usageString)
  7. (opts,args) = parser.parse_args()
  8. if len(args) < 1:
  9.     parser.error("Hostname is required")
  10. print __doc__
  11. website = args[0]
  12. #login path
  13. dirs = ["admin","login","admin_index","admin/admin","admin/login","admin/index","admin/user"]
  14.  
  15. for line in dirs:
  16.     conn = httplib.HTTPConnection(website)
  17.     conn.request('GET','/'+line)
  18.     r1 = conn.getresponse()
  19.     if r1.status == 200 or r1.status == 301:
  20.         print "********************************Lucky?*************************************"
  21.     print website+'/'+line,r1.status,r1.reason
  22.     conn.close()
  23.     conn = httplib.HTTPConnection(website)
  24.     conn.request('GET','/'+line+'.asp')
  25.     r1 = conn.getresponse()
  26.     if r1.status == 200 or r1.status == 301:
  27.         print "********************************Lucky?*************************************"
  28.     print website+'/'+line+'.asp',r1.status,r1.reason
  29.     conn.close()
  30.     conn = httplib.HTTPConnection(website)
  31.     conn.request('GET','/'+line+'.php')
  32.     r1 = conn.getresponse()
  33.     if r1.status == 200 or r1.status == 301:
  34.         print "********************************Lucky?*************************************"
  35.     print website+'/'+line+'.php',r1.status,r1.reason
  36.     conn.close()
  37. f.close()
  38.