Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | None | 0 0
  1.  
  2. # coding: utf-8
  3.  
  4. import io
  5. import re
  6. import sys
  7. import socks
  8. import time
  9.  
  10. sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='cp932', errors='replace')
  11.  
  12. host_addr = 'monachat.dyndns.org'
  13. host_port = 9095
  14.  
  15. proxy_addr = '166.111.54.40'
  16. proxy_port = 1081
  17.  
  18. room = 1
  19. name = 'Dante'.encode('utf-8')
  20. ihash = '未設定(設定不可)'.encode('utf-8')
  21. trip = 'トリプ'.encode('utf-8')
  22. char = 'shodai'.encode('utf-8')
  23. red = 100
  24. green = 100
  25. blue = 100
  26. x = 250
  27. y = 0
  28. scl = 100
  29. stat = '通常'.encode('utf-8')
  30.  
  31. buffer = 1024
  32. time_t = time.time()
  33. send_t = time_t + 25
  34. response = ''.encode('utf-8')
  35.  
  36. room.to_bytes(2, 'big')                                                                  
  37. red.to_bytes(2, 'big')
  38. green.to_bytes(2, 'big')
  39. blue.to_bytes(2, 'big')
  40. x.to_bytes(2, 'big')
  41. y.to_bytes(2, 'big')
  42. scl.to_bytes(2, 'big')
  43.  
  44. sock = socks.socksocket()
  45. sock.set_proxy(socks.SOCKS5, proxy_addr, proxy_port)
  46. sock.connect((host_addr, host_port))
  47. sock.send(b'MojaChat\0')
  48. enter = '<ENTER room="/MONA8094/%d" Name="%s" IHASH="%s" Trip="%s" type="%s" r="%d" g="%d" b="%d" \
  49. x="%d" y="%d" scl="%d" stat="%s" />\0' % (room, name, ihash, trip, char, red, green, blue, x, y, scl, stat)                                                                              
  50. sock.send(bytes(enter, 'utf-8'))
  51.  
  52. while True :
  53.     time_t = time.time()
  54.  
  55.     if send_t < time_t :
  56.         sock.send(b'<NOP />\0')
  57.         send_t = time_t + 25
  58.  
  59.     response = sock.recv(buffer)
  60.     print(response.decode(), flush = True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement