File size: 1,567 Bytes
56a1b20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import requests
import json
import os
# import glob
import time
import string
import random

def send_retrieve_cookie_msg(channelid):
  print("getting cookie")
  secret = os.environ['DISCORD_CODE']
  data = {"content": "n.gen netflix"}
  headers = {"authorization": secret}
  r = requests.post(
"https://discord.com/api/v9/channels/1098276770584731729/messages",
  data=data,
  headers=headers)
  time.sleep(10)
  os.chdir("./cookies/")
  if r.status_code != 429:
    headers = {'authorization': secret}
    r = requests.get(
      f' https://discord.com/api/v9/channels/{channelid}/messages?limit=1',
      headers=headers)
    jsonn = json.loads(r.text)
    # n = 0
  
    for value in jsonn:
      # n = n + 1
      S = 6
      ran = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S))
      # attachmentUrl = value['attachments'][0]
      try:
        attachmentUrl = value['attachments'][0]['url']
        filename = str(ran) + ".txt"
        response = requests.get(attachmentUrl)
        open("old" + filename, "wb").write(response.content)
        s = 1
        with open("old" + filename, 'r') as r, open(filename, 'w') as o:
          for line in r:
            #strip() function
            if line.strip():
              if (s == 1):
                o.write("# Netscape HTTP Cookie File\n")
                s = 2
              o.write(line)
        os.remove("old" + filename)
      except Exception as e:
  
        print(e)
        pass
  else:
    print("cooldown")
  
  os.chdir("../")


send_retrieve_cookie_msg(1098347140033560706)