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

        exp_target_list = ['_vti_bin/shtml.exe/_vti_rpc','_vti_bin/shtml.dll/_vti_rpc']
        data = "method= server version"
        #data="method=list+services:4.0.2.0000&service_name="
    #for item in exploit_targets:

        for item in exp_target_list:
                destination = name + "/" + item

        print "[+] Sending HTTP GET request to - (%s) for verifying whether RPC is listening !" %destination
        try:
                req = urllib2.Request(destination)
                response = urllib2.urlopen(req)
                if response.getcode() == 200:
                        print "[+] target is listening on frontpage RPC - (%s) !\n" % response.getcode()
                else:
                        print "[-] target is not listening on frontpage RPC - (%s) !\n" %response.getcode()

        except urllib2.URLError as e:
                print "[-] url error ! - %s" % e.code
                pass

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



        print "[+] Sending HTTP POST request to retrieve software version - (%s)" %destination
        try:
            req = urllib2.Request(destination,data,headers)
            response = urllib2.urlopen(req)
            if response.getcode() == 200:
                print "[+] target accepts the request - (%s) | (%s) !\n" % (data, response.getcode())
                filename = "__version__.txt" + ".html"
                version = open(filename, 'a')
                version.write(response.read())
                print "[+] check file for contents - (%s) \n" %filename
            else:
                print "[-] target fails to accept request - (%s) | (%s) !\n" %(data,response.getcode())

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

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

        print "[*] ---------------------------------------------------------------------------------------"
dataset/ETHPy150Open alias1/sparty/sparty_v_0.1.py/frontpage_rpc_check/original