This commit is contained in:
Lain Iwakura 2025-07-12 19:38:53 +03:00
parent dff228cdbb
commit 9eddfdd502
No known key found for this signature in database
GPG Key ID: C7C18257F2ADC6F8
2 changed files with 48 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 MiB

48
main.go
View File

@ -1,9 +1,11 @@
package main
import (
"encoding/base64"
"fmt"
"log"
"net/http"
"os"
"sync"
"time"
@ -104,10 +106,55 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
} else if buffer == "uefi" {
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://www.techtarget.com/searchsecurity/news/366618102/ESET-details-UEFI-Secure-Boot-bypass-vulnerability"})
buffer = ""
} else if buffer == "trolling" {
conn.WriteJSON(map[string]string{"action": "redirect", "url": "/trolling"})
buffer = ""
}
}
}
func trollingHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Header().Set("Server", "0BSD_FOR_EVERYONE")
fileContent, err := os.ReadFile("files/мы-делаем-небольшой-троллинг.gif")
if err != nil {
log.Printf("Ошибка чтения файла: %v", err)
fileContent = []byte("Файл не найден")
}
base64Content := base64.StdEncoding.EncodeToString(fileContent)
html := fmt.Sprintf(`
<!DOCTYPE html>
<html>
<head>
<title>Trolling</title>
<style>
body {
background-color: #000;
color: #00ff00;
font-family: 'Courier New', monospace;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
img {
max-width: 100%%;
max-height: 100%%;
}
</style>
</head>
<body>
<img src="data:image/gif;base64,%s" alt="мы делаем небольшой троллинг">
</body>
</html>`, base64Content)
fmt.Fprint(w, html)
}
func statusHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.Header().Set("Server", "0BSD_FOR_EVERYONE")
@ -213,6 +260,7 @@ func main() {
mux.HandleFunc("/", handler)
mux.HandleFunc("/ws", wsHandler)
mux.HandleFunc("/status", statusHandler)
mux.HandleFunc("/trolling", trollingHandler)
server := &http.Server{
Addr: ":" + p,