barmalini

soap5.py

Jun 17th, 2013
557
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import base64
  2. import string, os, sys, httplib, urllib2
  3. import pdb
  4.  
  5. server_addr = "http://109.233.224.68:2237"
  6. service_action = "/magicsys"
  7. username = "magicsys"
  8. password = "magicsys"
  9.  
  10. body = """
  11. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  12. <soapenv:Header/>
  13. <soapenv:Body>
  14. <ws:PutMessage>
  15. <ObjectID>89700415</ObjectID>
  16. <MessageText>TEST</MessageText>
  17. <Time>2012-11-28T16:47:00Z</Time>
  18. </ws:PutMessage>
  19. </soapenv:Body>
  20. </soapenv:Envelope>"""
  21.  
  22. body = """
  23. <?xml version="1.0" encoding="windows-1251"?>
  24. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  25. <soapenv:Header/>
  26. <soapenv:Body>
  27. <ws:PutCoord>
  28. <ObjectID>89700415</ObjectID>
  29. <Coord time="2012-11-28T16:30:01Z" lon="37.754689" lat="55.6586458" speed="20.1" dir="301" valid="1"/>
  30. </ws:PutCoord>
  31. </soapenv:Body>
  32. </soapenv:Envelope>"""
  33.  
  34.  
  35. '''
  36. passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
  37. passman.add_password(None, server_addr + service_action, username, password)
  38. auth_handler = urllib2.HTTPBasicAuthHandler(passman)
  39. opener = urllib2.build_opener(auth_handler)
  40. urllib2.install_opener(opener)
  41. response = urllib2.urlopen(server_addr + service_action, '')
  42. '''
  43.  
  44. req = urllib2.Request(server_addr + service_action)
  45. auth = 'Basic ' + base64.urlsafe_b64encode('%s:%s' % (username, password))
  46. req.add_header('Authorization', auth)
  47. req.add_header('SOAPAction', '""')
  48. req.add_header('Content-Length', str(len(body)))
  49. req.add_data(body)
  50. conn = urllib2.urlopen(req)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×