This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
7,751 additions
and
5,189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
package main | ||
|
||
import ( | ||
"engine/internal/browser" | ||
"log" | ||
"os" | ||
"sync" | ||
"time" | ||
|
||
"github.com/gofiber/fiber/v2" | ||
"github.com/zenthangplus/goccm" | ||
) | ||
|
||
var ( | ||
browsers = 5 | ||
|
||
pool []*browser.Instance | ||
mt sync.Mutex | ||
curr = 0 | ||
) | ||
|
||
func next() *browser.Instance { | ||
mt.Lock() | ||
defer mt.Unlock() | ||
|
||
if curr >= len(pool) { | ||
curr = 0 | ||
} | ||
|
||
c := pool[curr] | ||
curr++ | ||
|
||
return c | ||
} | ||
|
||
func initBrowser() { | ||
c := goccm.New(browsers) | ||
|
||
for { | ||
c.Wait() | ||
|
||
go func() { | ||
defer c.Done() | ||
|
||
client, err := browser.NewInstance(true) | ||
if err != nil { | ||
log.Println(err) | ||
return | ||
} | ||
|
||
defer client.CloseInstance() | ||
|
||
if err := client.NavigateToDiscord(); err != nil { | ||
log.Println(err) | ||
return | ||
} | ||
|
||
if err := client.TriggerCaptcha(); err != nil { | ||
log.Println(err) | ||
return | ||
} | ||
|
||
log.Println("Hooked!") | ||
|
||
mt.Lock() | ||
pool = append(pool, client) | ||
mt.Unlock() | ||
|
||
defer func() { | ||
mt.Lock() | ||
defer mt.Unlock() | ||
|
||
for i, c := range pool { | ||
if c == client { | ||
pool = append(pool[:i], pool[i+1:]...) | ||
break | ||
} | ||
} | ||
}() | ||
select {} | ||
}() | ||
} | ||
} | ||
|
||
func solveHandler(c *fiber.Ctx) error { | ||
token := c.Query("req") | ||
|
||
if token == "" { | ||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{ | ||
"error": "Token is missing", | ||
}) | ||
} | ||
|
||
log.Println("recv", token[:61]) | ||
|
||
t := time.Now() | ||
pow, err := next().Hsw(token) | ||
if err != nil { | ||
return c.Send([]byte("")) | ||
} | ||
|
||
log.Printf("solved (%dms): %s\n", time.Since(t).Milliseconds(), pow[:50]) | ||
return c.Send([]byte(pow)) | ||
} | ||
|
||
func engine() { | ||
go initBrowser() | ||
|
||
app := fiber.New() | ||
|
||
app.Get("/n", solveHandler) | ||
|
||
err := app.Listen(":4000") | ||
if err != nil { | ||
log.Fatalf("Error starting the server: %v", err) | ||
} | ||
} | ||
|
||
func debug() { | ||
log.Println("ctrl+c to exit.") | ||
|
||
|
||
client, err := browser.NewInstance(true) | ||
if err != nil { | ||
log.Println(err) | ||
return | ||
} | ||
|
||
defer client.CloseInstance() | ||
|
||
client.Page.Goto("https://abrahamjuliot.github.io/creepjs/") | ||
select {} | ||
} | ||
|
||
func main() { | ||
switch os.Args[1] { | ||
case "debug": | ||
debug() | ||
case "engine": | ||
engine() | ||
default: | ||
panic("invalid args. use: debug, engine") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
let resolution = "1920x1080" | ||
let userAgent = navigator.userAgent | ||
let platform = "Win32" | ||
|
||
|
||
Object.defineProperty(window, 'MediaStreamTrack', { | ||
get: function () { | ||
return undefined; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window, 'RTCPeerConnection', { | ||
get: function () { | ||
return undefined; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window, 'RTCSessionDescription', { | ||
get: function () { | ||
return undefined; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window, 'webkitMediaStreamTrack', { | ||
get: function () { | ||
return undefined; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window, 'webkitRTCPeerConnection', { | ||
get: function () { | ||
return undefined; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window, 'webkitRTCSessionDescription', { | ||
get: function () { | ||
return undefined; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window.navigator, 'getUserMedia', { | ||
get: function () { | ||
return undefined; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window.navigator, 'webkitGetUserMedia', { | ||
get: function () { | ||
return undefined; | ||
} | ||
}); | ||
|
||
|
||
Object.defineProperty(window.navigator, 'hardwareConcurrency', { | ||
get: function () { | ||
return 16; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window.navigator, 'deviceMemory', { | ||
get: function () { | ||
return 8; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window.navigator, 'userAgent', { | ||
get: function () { | ||
return userAgent; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window.navigator, 'platform', { | ||
get: function () { | ||
return platform; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window.navigator, 'appName', { | ||
get: function () { | ||
return 'Netscape'; | ||
} | ||
}); | ||
|
||
Object.defineProperty(window.navigator, 'appVersion', { | ||
get: function () { | ||
return userAgent.substring(userAgent.indexOf('/') + 1, userAgent.length); | ||
} | ||
}); | ||
|
||
|
||
|
||
|
||
delete Object.getPrototypeOf(navigator).webdriver; | ||
|
||
// Set window.ContentIndex | ||
window.ContentIndex = 42; | ||
|
||
// ContactsManager | ||
const ContactsManager = { | ||
contacts: [], | ||
|
||
addContact: function (name, email) { | ||
this.contacts.push({ name, email }); | ||
}, | ||
|
||
getContacts: function () { | ||
return this.contacts; | ||
} | ||
}; | ||
|
||
window.ContactsManager = ContactsManager; | ||
|
||
// Check and modify NetworkInformation prototype | ||
const networkInfoPrototype = window.NetworkInformation?.prototype || {}; | ||
networkInfoPrototype.downlinkMax = 100; | ||
|
||
if (window.NetworkInformation) { | ||
window.NetworkInformation.prototype = networkInfoPrototype; | ||
} | ||
|
||
// canvas | ||
const canvas = document.createElement('canvas'); | ||
canvas.width = 220; | ||
canvas.height = 30; | ||
const ctx = canvas.getContext('2d'); | ||
|
||
for (let x = 0; x < canvas.width; x++) { | ||
for (let y = 0; y < canvas.height; y++) { | ||
const r = Math.floor(Math.random() * 256); | ||
const g = Math.floor(Math.random() * 256); | ||
const b = Math.floor(Math.random() * 256); | ||
ctx.fillStyle = `rgb(${r},${g},${b})`; | ||
ctx.fillRect(x, y, 1, 1); | ||
} | ||
} | ||
|
||
const randomDataURL = canvas.toDataURL('image/png'); | ||
const originalToDataURL = HTMLCanvasElement.prototype.toDataURL; | ||
|
||
// Override the toDataURL method for specific dimensions | ||
HTMLCanvasElement.prototype.toDataURL = function (type) { | ||
if (type === 'image/png' && this.width === 220 && this.height === 30) { | ||
return randomDataURL; | ||
} | ||
return originalToDataURL.apply(this, arguments); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module engine | ||
|
||
go 1.20 | ||
|
||
require ( | ||
github.com/andybalholm/brotli v1.0.5 // indirect | ||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect | ||
github.com/go-jose/go-jose/v3 v3.0.0 // indirect | ||
github.com/go-stack/stack v1.8.1 // indirect | ||
github.com/gofiber/fiber/v2 v2.48.0 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/klauspost/compress v1.16.3 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.19 // indirect | ||
github.com/mattn/go-runewidth v0.0.14 // indirect | ||
github.com/playwright-community/playwright-go v0.3500.0 // indirect | ||
github.com/rivo/uniseg v0.2.0 // indirect | ||
github.com/valyala/bytebufferpool v1.0.0 // indirect | ||
github.com/valyala/fasthttp v1.48.0 // indirect | ||
github.com/valyala/tcplisten v1.0.0 // indirect | ||
github.com/zenthangplus/goccm v1.1.3 // indirect | ||
go.uber.org/multierr v1.11.0 // indirect | ||
golang.org/x/sys v0.10.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= | ||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= | ||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= | ||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= | ||
github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= | ||
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= | ||
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= | ||
github.com/gofiber/fiber/v2 v2.48.0 h1:cRVMCb9aUJDsyHxGFLwz/sGzDggdailZZyptU9F9cU0= | ||
github.com/gofiber/fiber/v2 v2.48.0/go.mod h1:xqJgfqrc23FJuqGOW6DVgi3HyZEm2Mn9pRqUb2kHSX8= | ||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= | ||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | ||
github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= | ||
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= | ||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= | ||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= | ||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= | ||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= | ||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= | ||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= | ||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= | ||
github.com/playwright-community/playwright-go v0.3500.0 h1:pWUwUa+JDibO3IOOjWsZ6d0gVehsLVCt6ZpJitePJXM= | ||
github.com/playwright-community/playwright-go v0.3500.0/go.mod h1:5BciqynTw2vyGwuMfhqfsc7hktCoZvoYQ+TBHRxvUME= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= | ||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= | ||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= | ||
github.com/valyala/fasthttp v1.48.0 h1:oJWvHb9BIZToTQS3MuQ2R3bJZiNSa2KiNdeI8A+79Tc= | ||
github.com/valyala/fasthttp v1.48.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA= | ||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= | ||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= | ||
github.com/zenthangplus/goccm v1.1.3 h1:66XVj24yexO2fCkBum8b+y6tOJ7Giq05LIn2vn3whGE= | ||
github.com/zenthangplus/goccm v1.1.3/go.mod h1:DUzu/BC4TkgUfXP8J1P6Md73Djt+0l0CHq001Pt4weA= | ||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= | ||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= | ||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | ||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= | ||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
Oops, something went wrong.