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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
import kotlinx.browser.document
import kotlinx.browser.window
import kotlinx.css.*
import kotlinx.html.dom.append
import kotlinx.html.js.div
import kotlinx.html.dom.create
import kotlinx.html.js.a
import kotlinx.html.img
import kotlinx.html.js.p
import moe.nea89.website.*
import styled.injectGlobal
import kotlin.random.Random
import kotlinx.html.js.onLoadFunction
var isnickrude = true
val defaultFileSystem = fileSystem {
"run"{
"question" text "what is this folder anyways? is it like stuff that runs before everything?"
}
"tmp"{
"tentacle-hentai" image "https://cdn.discordapp.com/attachments/832652653292027904/1014832179911610408/Screenshot_20220423_113521.png"
}
"boot"{
"grub"{
"bruh" text " mf you expect me to recreate the entire filesystem? go fuck yourself"
}
}
"home"{
"exhq"{
"kill" image "https://cdn.discordapp.com/attachments/917977729322872853/1015922996126425108/ummkrplmos861.jpg"
"gamering" download "https://cdn.discordapp.com/attachments/985989849813237810/1003346125186674859/2022-07-31-notimezoneforyouraid.mp4"
}
"nea"{
"note" text "lmfao shes gone"
}
}
/* "home/exhq" {
"etc" {
"passwd" text "hunter2"
}
"todo" text """
| - git gud
| - finish this website
| - convince the general public that comic sans is a viable font
""".trimMargin()
}
"flag" text "CTF{12345abcdefghijklmonp3.1.4.1.5.9.2.8}"*/
}
val funny = arrayOf(
"398964",
"244327",
"265725",
"260629",
"407384",
"356093",
"140870",
"359126",
)
fun redirect(arg: String){
if(arg.matches("(https://|http://).*")){
window.location.href = arg
}
else{
window.location.href = "https://$arg"
}
}
fun isNumericToX(toCheck: String): Boolean {
return toCheck.toDoubleOrNull() != null
}
fun main() {
var startupmsg = "type help to get a list of commands"
val root = document.body!!.append.div()
val console = KConsole.createFor(root, fileSystem = defaultFileSystem)
injectGlobal {
".${Styles.consoleClass}" {
minHeight = 100.vh
backgroundColor = Color("#282a39C6")
}
body {
backgroundImage = Image("url(weebshit1.jpg)")
backgroundSize = "cover"
}
}
console.PS1 = { "${console.fileAccessor!!.currentDir.joinToString("/", "/")} > " }
if (window.location.hash == "#mobile" || (window.location.hash != "#desktop" && js("'ontouchstart' in document.documentElement") as Boolean)) {
console.openMobileKeyboardOnTap()
startupmsg = "nea added phone support, kindaaa. phone is shit anyways \ntype help for a list of commands"
}
console.addMultilineText(startupmsg)
console.fileAccessor!!.cd("/home/exhq")
console.rerender()
console.registerCommand(command("ls"){
val fa = requireFileAccessor()
val path = when(args.size){
0 -> "."
1 -> args[0]
else -> {
console.addLine("Usage: ls [directory or file]")
return@command
}
}
val file = fa.resolve(path)
if (file == null){
console.addLine("ls : Could not find file or directory")
return@command
}
when(file){
is KFile.Directory ->{
val longestName = file.files.keys.maxOf { it.length }
file.files.forEach { (name, file) ->
console.addLine(
name + " ".repeat(longestName + 1 - name.length) + "(${file.fileType})"
)
console.rerender()
}
}
else -> console.addLine("ls: is a ${file.fileType}")
}
})
console.registerCommand(defaultCdCommand("cd"))
console.registerCommand(defaultCwdCommand("cwd", "pwd"))
console.registerCommand(command("help", "?"){
console.addMultilineText("""
ls - lists stuff in current directory
cd - move to another directory
cat - open files
pwd - shows current directory
there are also a lot of hidden commands ;)
""".trimIndent())
})
console.registerCommand(command("blahaj", "shark"){
if (isnickrude){
console.addLine("nick was rude ;-;")
}
else{
console.addMultilineText("""
,(((/
/(((((
((((#(( (//
(((((((. *(((/
/(######/ *((((/
*//%#####((/ ((#((/
,*/********/////////////////(//* (%* ,((##((
,*/((///(//////////((/(///////(/////(////*,(*#((/(/((//////###(###(/(
/(((((((//((///((////((((((/(((((((((((((((((/(((##((#%(##(/((///*(&#(##/
/#((%(#(((((//#((((((((((((((((((((((((#(((((((((((/##(((((//((//* ####(/
(((###(###(#(#####(###############((#((((((((/((//(((#/(///// ,,
,(###%####%&%#############(#(#(####(((((((/(((/////*//,
. .....*#(#######(((###(#(##(##(((/(/(/////,
.. ....,..........,..*#%#######/(
.. .............,*%%%%#%((((/
**,,,****//*(##((###(#(((
&#(#/#((((((((#
""".trimIndent())
}
})
console.registerCommand(command("cat"){
val fa = requireFileAccessor()
val path = when (args.size){
1 -> args[0]
else -> {
console.addLine("usage: cat [text file]")
return@command
}
}
val file = fa.resolve(path)
if (file == null){
console.addLine("cat: could not find file")
}
when (file) {
is KFile.Directory -> console.addLine("cat: Is a directory")
is KFile.Text -> console.addMultilineText(file.text)
is KFile.Image -> console.addLine("cat: wrong file type")
is KFile.Download -> console.addLine("cat: wrong file type")
else -> {console.addLine("go kill yourself piece of shit")}
}
})
console.registerCommand(command("wget"){
val fa = requireFileAccessor()
val path = when (args.size){
1 -> args[0]
else -> {
console.addLine("usage: wget [download file]")
return@command
}
}
val file = fa.resolve(path)
if (file == null){
console.addLine("wget: could not find file")
}
when (file) {
is KFile.Directory -> console.addLine("wget: Is a directory")
is KFile.Text -> console.addLine("wget: wrong file type")
is KFile.Image -> console.addLine("wget: wrong file type")
is KFile.Download -> {
val link = document.create.a(file.url)
link.download = file.name.last()
document.body!!.append(link)
link.click()
link.remove()
console.addLine("Download started")
}
else -> {console.addLine("go kill yourself piece of shit")}
}
})
console.registerCommand(command("view", "show"){
val fa = requireFileAccessor()
val path = when (args.size){
1 -> args[0]
else -> {
console.addLine("usage: view [image]")
return@command
}
}
val file = fa.resolve(path)
if (file == null){
console.addLine("view: could not find file")
}
when (file) {
is KFile.Directory -> console.addLine("view: Is a directory")
is KFile.Text -> console.addLine("view: wrong file type")
is KFile.Image -> console.addLine(document.create.p {
img(src = file.url) {
this.onLoadFunction = { console.scrollDown() }
}
})
is KFile.Download -> console.addLine("view: wrong file type")
else -> {console.addLine("go kill yourself piece of shit")}
}
})
console.registerCommand(command("sudo"){
val funny = console.fileAccessor!!.currentDir.joinToString("/", "/")
var str = ""
for (e in args){
str += "$e "
}
if(str == "rm -rf /* " || str == "rm -rf / "){
console.addLine("haha funny xd im laughing so hard rn lmfao xddddddddddddd HAHAHAHAHAHAH")
}
else{
console.addLine("bro you don have the password smh")
}
})
console.registerCommand(command("vscode", "vsc", "code"){
console.addLine("ew microsoft")
redirect("https://www.youtube.com/watch?v=lpiB2wMc49g")
})
console.registerCommand(command("testredirect"){
redirect(args[0])
})
console.registerCommand(command("sauce"){
console.addLine(args[0])
if (isNumericToX(args[0])){
console.addLine("redirecting you to funny")
redirect("https://nhentai.net/g/${args[0]}") }
else{
console.addLine("here bro i got some good shit")
redirect(funny[Random.nextInt(funny.size)])
}
})
}
|