-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.js
147 lines (116 loc) · 4.76 KB
/
helper.js
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
const OBJ = {}
OBJ.sliceMethod = (psCode) => {
const variable1 = randomString(1)
const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&()*+,-./:;<=>?@[\\]^_{|}~\\t\\n\\r\\v\\f ' + "`'"
function builder(data) {
let value = ""
for (let index = 0; index < data.length; index++) {
const charIndex = chars.indexOf(data[index])
value += `$${variable1}[${charIndex}]`
if (index != (data.length - 1)) value += '+'
}
return value
}
return `$${variable1}='${chars}'';&(${builder("iex")})(${builder(psCode)})`
}
OBJ.spaceMethod = (psCode) => {
function builder(data) {
let value = ""
for (let index = 0; index < data.length; index++) {
const spaceCount = data[index].charCodeAt()
value += `([char]('${' '.repeat(spaceCount)}'.Length))`
if (index != (data.length - 1)) value += '+'
}
return value
}
return `&(${builder('iex')})(${builder(psCode)})`
}
OBJ.binaryMethod = (psCode) => {
const variable1 = randomString(1)
const variable2 = randomString(2)
const variable3 = randomString(3)
const variable4 = randomString(4)
function builder(data) {
const value = []
for (let char of data) {
value.push(`'${char.charCodeAt().toString(2).padStart(8, '0')}'`)
}
return `@(${value.join(',')})`
}
return `function ${variable4}($${variable1}){$${variable3}='';foreach ($${variable2} in $${variable1}) {$${variable3}+=[char][Convert]::ToInt32($${variable2}, 2)};return $${variable3}};&(${variable4}(${builder('iex')}))(${variable4}(${builder(psCode)}))`
}
OBJ.unicodeMethod = (psCode) => {
const variable1 = randomString(5)
const variable2 = randomString(5)
function builder(data) {
let value = ''
for (let index = 0; index < data.length; index++) {
value += `(${variable1}(0x${data[index].codePointAt(0).toString(16)}))`
if (index != (data.length - 1)) value += '+'
}
return value
}
return `function ${variable1}($${variable2}) {return [char]::ConvertFromUtf32($${variable2})}&(${builder('iex')})(${builder(psCode)})`
}
OBJ.boolMethod = (psCode) => {
const variable1 = randomString(1)
const variable2 = randomString(2)
const variable3 = randomString(3)
const variable4 = randomString(4)
const variable5 = randomString(5)
const variable6 = randomString(6)
function builder(data) {
const value = []
for (let char of data) {
const innerValue = []
for (let bin of char.charCodeAt().toString(2).padStart(8, '0')) {
if (bin == '1') {
innerValue.push('$true')
} else {
innerValue.push('$false')
}
}
value.push(`@(${innerValue.join(',')})`)
}
return `@(${value.join(',')})`
}
return `function ${variable1}($${variable2}) {$${variable3} = "";foreach($${variable4} in $${variable2}){$${variable6} = "";foreach($${variable5} in $${variable4}) {if($${variable5}) {$${variable6} += "1";} else {$${variable6} += "0";}}$${variable3} += ([char][Convert]::ToInt32($${variable6}, 2));}return $${variable3}}&(${variable1}(${builder('iex')}))(${variable1}(${builder(psCode)}))`
}
OBJ.decimalMethod = (psCode) => {
function builder(data) {
let value = ""
for (let index = 0; index < data.length; index++) {
const decimal = data[index].charCodeAt()
value += `([char](${decimal}))`
if (index != (data.length - 1)) value += '+'
}
return value
}
return `&(${builder('iex')})(${builder(psCode)})`
}
OBJ.zeroMethod = (psCode) => {
const variable1 = randomString(1)
const variable2 = randomString(2)
const variable3 = randomString(3)
const variable4 = randomString(4)
const variable5 = randomString(5)
function builder(data) {
let value = []
for (let index = 0; index < data.length; index++) {
const spaceCount = data[index].charCodeAt()
value.push(`@(${'0'.repeat(spaceCount).split('').join(",")})`)
}
return `@(${value.join(',')})`
}
return `function ${variable1}($${variable2}) {$${variable3} = "";foreach($${variable4} in $${variable2}){$${variable3} += [char]($${variable4}.Length);}return $${variable3}}&(${variable1}(${builder('iex')}))(${variable1}(${builder(psCode)}))`
}
// random string
function randomString(len) {
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
let value = ""
for (let index = 0; index < len; index++) {
value += chars[Math.floor(Math.random() * chars.length)]
}
return value
}
module.exports = OBJ