package main import ( "fmt" "log" "net/http" "sync" "time" "github.com/gorilla/websocket" ) var upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { return true }, } type KeyPress struct { Key string `json:"key"` } func wsHandler(w http.ResponseWriter, r *http.Request) { conn, err := upgrader.Upgrade(w, r, nil) if err != nil { log.Printf("WebSocket upgrade error: %v", err) return } defer conn.Close() var buffer string var lastPress time.Time for { var keyPress KeyPress err := conn.ReadJSON(&keyPress) if err != nil { break } now := time.Now() if now.Sub(lastPress) > 5*time.Second { buffer = "" } lastPress = now buffer += keyPress.Key if len(buffer) > 20 { buffer = buffer[len(buffer)-20:] } if buffer == "lain" { conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://fauux.neocities.org"}) buffer = "" } else if buffer == "rabbit" { conn.WriteJSON(map[string]string{"action": "show_message", "message": "wake up, Neo"}) buffer = "" } else if buffer == "whoareu" { conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"}) buffer = "" } else if buffer == "whoami" { conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"}) buffer = "" } else if buffer == "whoareyou" { conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"}) buffer = "" } else if buffer == "answer" { conn.WriteJSON(map[string]string{"action": "show_message", "message": "it must be easy for you, isn't that right?"}) buffer = "" } else if buffer == "answers" { conn.WriteJSON(map[string]string{"action": "show_message", "message": "it must be easy for you, isn't that right?"}) buffer = "" } else if buffer == "noise" { conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://noiseprotocol.org/"}) buffer = "" } else if buffer == "openbsd" { conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://openbsd.org/"}) buffer = "" } else if buffer == "linux" { conn.WriteJSON(map[string]string{"action": "show_message", "message": "Linux sucks"}) buffer = "" } else if buffer == "mac" { conn.WriteJSON(map[string]string{"action": "show_message", "message": "Yet another BSD-like OS"}) buffer = "" } else if buffer == "windows" { conn.WriteJSON(map[string]string{"action": "show_message", "message": "Windows ALWAYS sucks"}) buffer = "" } else if buffer == "github" { conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://codeberg.org/"}) buffer = "" } else if buffer == "status" { conn.WriteJSON(map[string]string{"action": "redirect", "url": "/status"}) buffer = "" } else if buffer == "reddit" { conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://www.reddit.com/r/openbsd/s/zxEkMj0uaW"}) buffer = "" } else if buffer == "intelme" { conn.WriteJSON(map[string]string{"action": "show_message", "message": "Everything must be free, without tracking"}) buffer = "" } else if buffer == "amdpsp" { conn.WriteJSON(map[string]string{"action": "show_message", "message": "Everything must be free, without tracking"}) buffer = "" } 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 = "" } } } 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") openbsdBirth := time.Date(1995, 10, 1, 0, 0, 0, 0, time.UTC) now := time.Now() duration := now.Sub(openbsdBirth) years := int(duration.Hours() / 8760) months := int((duration.Hours() - float64(years*8760)) / 730) weeks := int((duration.Hours() - float64(years*8760) - float64(months*730)) / 168) hours := int(duration.Hours() - float64(years*8760) - float64(months*730) - float64(weeks*168)) minutes := int(duration.Minutes()) % 60 seconds := int(duration.Seconds()) % 60 milliseconds := int(duration.Milliseconds()) % 1000 nanoseconds := int(duration.Nanoseconds()) % 1000000 status := fmt.Sprintf("OpenBSD created: %d:%d:%d:%d:%d:%d:%d:%d\nTimestamp: %d", years, months, weeks, hours, minutes, seconds, milliseconds, nanoseconds, int(duration.Seconds())) fmt.Fprint(w, status) } func handler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") w.Header().Set("Server", "0BSD_FOR_EVERYONE") w.Header().Set("X-Powered-By", "0BSD_FOR_EVERYONE") w.Header().Set("X-Frame-Options", "SAMEORIGIN") w.Header().Set("X-Content-Type-Options", "nosniff") html := ` 0BSD_FOR_EVERYONE 0BSD_FOR_EVERYONE
` fmt.Fprint(w, html) } func main() { ports := []string{"1337", "1488", "13373", "33737", "25575", "80", "8080"} var wg sync.WaitGroup for _, port := range ports { wg.Add(1) go func(p string) { defer wg.Done() mux := http.NewServeMux() mux.HandleFunc("/", handler) mux.HandleFunc("/ws", wsHandler) mux.HandleFunc("/status", statusHandler) server := &http.Server{ Addr: ":" + p, Handler: mux, ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second, IdleTimeout: 60 * time.Second, } log.Printf("Сервер запущен на порту %s", p) if err := server.ListenAndServe(); err != nil { log.Printf("Ошибка на порту %s: %v", p, err) } }(port) } wg.Wait() }