Ejemplo n.º 1
0
data = {}
data["displayParameters"] = []
if args.message:
    data["displayParameters"].append({
        "Key": "display.message.text",
        "Value": args.message
    })

if args.title:
    data["displayParameters"].append({
        "Key": "display.message.title",
        "Value": args.title
    })

response = user_services_object.authenticateUserWithPush(
    "SupportPush", args.user, None, data)

status = user_services_object.getResponseValue(response, 'status')
statusMessage = user_services_object.getResponseValue(response,
                                                      'statusMessage')

if (status == '6040'):
    print("Push Initiated for", args.user)
    transaction = user_services_object.getResponseValue(
        response, 'transactionId')
    request = user_services_object.getResponseValue(response, 'requestId')
else:
    print("Error sending push to", args.user, ":", statusMessage)
    exit()

isExit = False
Ejemplo n.º 2
0
import logging
from symantec_package.lib.userService.SymantecUserServices import SymantecUserServices
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

from suds.client import Client
#from suds.transport.https import

# the URLs for now which will have the WSDL files and the XSD file
url = 'http://webdev.cse.msu.edu/~yehanlin/vip/vipuserservices-query-1.7.wsdl'
userservices_url = 'http://webdev.cse.msu.edu/~morcoteg/Symantec/WSDL/vipuserservices-auth-1.4.wsdl'

# initializing the Suds clients for each url, with the client certificate youll have in the same dir as this file
client = Client(url,
                transport=HTTPSClientCertTransport('vip_certificate.crt',
                                                   'vip_certificate.crt'))
user_services_client = Client(userservices_url,
                              transport=HTTPSClientCertTransport(
                                  'vip_certificate.crt',
                                  'vip_certificate.crt'))

get_user_info_result = client.service.getUserInfo(requestId="123123",
                                                  userId="y1196293")

# Gabe here, testing pushing to phone with wrapper class SymantecUserServices
test_user_services_object = SymantecUserServices(user_services_client)
send_push_to_phone_result = test_user_services_object.authenticateUserWithPush(
    "push_123", "Arren_phone")
print(test_user_services_object.__str__("push_123", "Arren_phone"))

print(str(get_user_info_result).split('\n'))
Ejemplo n.º 3
0
def sendPush(userid):

    user_services_url = urllib.parse.urljoin('file:', pathname2url(os.path.abspath('./wsdl_files/vipuserservices-auth-1.7.wsdl')))
    user_services_client = Client(user_services_url,
      transport = HTTPSClientCertTransport( './privateKey_nopass.pem', './publicCert.pem'))
    query_services_url = urllib.parse.urljoin('file:', pathname2url(os.path.abspath('./wsdl_files/vipuserservices-query-1.7.wsdl')))
    query_services_client = Client(query_services_url,
      transport = HTTPSClientCertTransport( './privateKey_nopass.pem', './publicCert.pem'))

    user_services_object = SymantecUserServices(user_services_client)
    query_services_object = SymantecQueryServices(query_services_client)

    data = {}
    data["displayParameters"] = []
    data["displayParameters"].append({"Key":"display.message.text", "Value": message})
    data["displayParameters"].append({"Key":"display.message.title", "Value": title})

    response = user_services_object.authenticateUserWithPush("SupportPush",userid, None, data)

    status=user_services_object.getResponseValue(response,'status')
    statusMessage=user_services_object.getResponseValue(response,'statusMessage')

    if (status == '6040'):
        print("Push Initiated for", userid)
        transaction=user_services_object.getResponseValue(response,'transactionId')
        request=user_services_object.getResponseValue(response,'requestId')
    else:
        print("Error sending push to", userid, ":" , statusMessage)
        return("Error: Unable to send push to " + userid + ": " + statusMessage) 

    isExit = False
    isError = False

    for sec in range(1,30 // 3):
        if isExit:
            break
        time.sleep(3) # NEED NEW SOLUTION for querying on interval in python
        poll_status = query_services_object.pollPushStatus(request,transaction)
        transaction_status = query_services_object.getResponseValue(poll_status,'transactionStatus')
        for tup in transaction_status:
            status=tup[1]
            msg=tup[2]

        if isError:
            print("\n\tError: " + msg)
            return("Error: Unable to validate user: "******"0000" in status: # ignore this first status for polling connection
            continue
        elif "7000" in status:
            print("SUCCESS! Push Accepted by " + userid)
            return("Push Accepted by "+ userid)
            isExit = True
            break
        elif "7001" in status:
            print("Waiting for response...")
            continue
        elif "7002" in status:
            print("Push Denied by", userid)
            return("Error: Push denied by "+ userid)
            isExit = True
            break
        else:
            isError = True
    return("Error: Request to " + userid + " timed out.")