Advertisement
8thbit

UdemyDL License Server

Feb 3rd, 2016
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.67 KB | None | 0 0
  1. import socket
  2. import random
  3. import string
  4. import base64
  5. from email.utils import formatdate
  6.  
  7. print "License Emulation by Mr.8ThBiT :)"
  8. email = ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.digits) for _ in range(8)) +"@" +''.join(random.SystemRandom().choice(string.ascii_uppercase) for _ in range(3)) + ".com"
  9. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  10. try:
  11.     s.bind(('127.0.0.1', 80))
  12.     s.listen(1)
  13. except:
  14.     print("unable to bind socket:(")
  15.     exit(-1)
  16. while True:
  17.     c , ip = s.accept()
  18.     print("Connection Established with " + str(ip))
  19.     buf = c.recv(2048)
  20.     buf = buf.split('\r\n')
  21.     if 'POST /api/1.0/ HTTP/1.1' in buf or 'GET /api/1.0/ HTTP/1.1' in buf:
  22.         response = 'eyJ4MSI6IjAiLCJ4MiI6IjIiLCJ4MyI6IjMiLCJhdXRoIjoiT0siLCJ1c2VyIjoiQ3JhY2tlZCBCeSA4VGhCaVQiLCJlbWFpbCI6InswfSIsImxhdGVzdF92ZXJzIjoiMCIsInVwZGF0ZV9kbCI6Imh0dHA6Ly84dGhiaXQubmV0LyIsInNpZ251cFVybCI6Imh0dHBzOi8vd3d3LnVkZW15LmNvbS9qb2luL3NpZ251cC1wb3B1cC8iLCJkcGx5Ijp7IjEiOiJkYXRhLWNvdXJzZS1pZD1cIiguKilcIiIsIjIiOiJkYXRhLWNvdXJzZS1pZD1cIiguKilcIiIsIjMiOiI8ZGl2IGNsYXNzPVwicHJpY2VcIj5cbiguKikuKiIsIjYiOiI8ZGl2IGNsYXNzPVwidzNjLWRlZmF1bHRcIj4oLiopIn19'
  23.         response = base64.b64decode(response)
  24.         response = response.replace("{0}",email)
  25.         packet =  'HTTP/1.1 200 OK\r\n'
  26.         packet += 'Connection: Keep-Alive\r\n'
  27.         packet += 'Content-Length: ' + str(len(response)) + '\r\n'
  28.         packet += 'Content-Type: application/json\r\n'
  29.         packet += 'Date: ' + formatdate(timeval=None, localtime=False, usegmt=True) + '\r\n'
  30.         packet += 'Keep-Alive: timeout=5, max=50\r\n\r\n'
  31.         packet += response
  32.         c.sendall(packet)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement