This commit is contained in:
Lain Iwakura 2025-07-12 19:01:18 +03:00
parent 1ed87b4d3a
commit 9e234e9178
No known key found for this signature in database
GPG Key ID: C7C18257F2ADC6F8

45
main.go
View File

@ -59,7 +59,7 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
} else if buffer == "whoareu" {
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
buffer = ""
} else if buffer == "whoami" {
} else if buffer == "whoami" {
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
buffer = ""
} else if buffer == "whoareyou" {
@ -102,7 +102,7 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
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"})
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://www.techtarget.com/searchsecurity/news/366618102/ESET-details-UEFI-Secure-Boot-bypass-vulnerability"})
buffer = ""
}
}
@ -111,11 +111,11 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
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)
@ -124,11 +124,11 @@ func statusHandler(w http.ResponseWriter, r *http.Request) {
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",
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)
}
@ -138,7 +138,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
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 := `
<!DOCTYPE html>
<html>
@ -202,9 +202,9 @@ func handler(w http.ResponseWriter, r *http.Request) {
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) {
@ -213,21 +213,34 @@ func main() {
mux.HandleFunc("/", handler)
mux.HandleFunc("/ws", wsHandler)
mux.HandleFunc("/status", statusHandler)
server := &http.Server{
Addr: ":" + p,
Handler: mux,
ReadTimeout: 30 * time.Second,
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Server", "0BSD_FOR_EVERYONE")
w.Header().Set("X-Powered-By", "0BSD_FOR_EVERYONE")
defer func() {
if r := recover(); r != nil {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(404)
w.Write([]byte("<html><body><h1>Not Found</h1></body></html>"))
}
}()
mux.ServeHTTP(w, r)
}),
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
IdleTimeout: 60 * 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()
}