tester
This commit is contained in:
parent
1ed87b4d3a
commit
9e234e9178
45
main.go
45
main.go
@ -59,7 +59,7 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else if buffer == "whoareu" {
|
} else if buffer == "whoareu" {
|
||||||
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
|
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
|
||||||
buffer = ""
|
buffer = ""
|
||||||
} else if buffer == "whoami" {
|
} else if buffer == "whoami" {
|
||||||
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
|
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
|
||||||
buffer = ""
|
buffer = ""
|
||||||
} else if buffer == "whoareyou" {
|
} 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"})
|
conn.WriteJSON(map[string]string{"action": "show_message", "message": "Everything must be free, without tracking"})
|
||||||
buffer = ""
|
buffer = ""
|
||||||
} else if buffer == "uefi" {
|
} 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 = ""
|
buffer = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,11 +111,11 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
func statusHandler(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("Content-Type", "text/plain; charset=utf-8")
|
||||||
w.Header().Set("Server", "0BSD_FOR_EVERYONE")
|
w.Header().Set("Server", "0BSD_FOR_EVERYONE")
|
||||||
|
|
||||||
openbsdBirth := time.Date(1995, 10, 1, 0, 0, 0, 0, time.UTC)
|
openbsdBirth := time.Date(1995, 10, 1, 0, 0, 0, 0, time.UTC)
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
duration := now.Sub(openbsdBirth)
|
duration := now.Sub(openbsdBirth)
|
||||||
|
|
||||||
years := int(duration.Hours() / 8760)
|
years := int(duration.Hours() / 8760)
|
||||||
months := int((duration.Hours() - float64(years*8760)) / 730)
|
months := int((duration.Hours() - float64(years*8760)) / 730)
|
||||||
weeks := int((duration.Hours() - float64(years*8760) - float64(months*730)) / 168)
|
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
|
seconds := int(duration.Seconds()) % 60
|
||||||
milliseconds := int(duration.Milliseconds()) % 1000
|
milliseconds := int(duration.Milliseconds()) % 1000
|
||||||
nanoseconds := int(duration.Nanoseconds()) % 1000000
|
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,
|
years, months, weeks, hours, minutes, seconds, milliseconds, nanoseconds,
|
||||||
int(duration.Seconds()))
|
int(duration.Seconds()))
|
||||||
|
|
||||||
fmt.Fprint(w, status)
|
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-Powered-By", "0BSD_FOR_EVERYONE")
|
||||||
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
|
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
|
||||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||||
|
|
||||||
html := `
|
html := `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@ -202,9 +202,9 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ports := []string{"1337", "1488", "13373", "33737", "25575", "80", "8080"}
|
ports := []string{"1337", "1488", "13373", "33737", "25575", "80", "8080"}
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
for _, port := range ports {
|
for _, port := range ports {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(p string) {
|
go func(p string) {
|
||||||
@ -213,21 +213,34 @@ func main() {
|
|||||||
mux.HandleFunc("/", handler)
|
mux.HandleFunc("/", handler)
|
||||||
mux.HandleFunc("/ws", wsHandler)
|
mux.HandleFunc("/ws", wsHandler)
|
||||||
mux.HandleFunc("/status", statusHandler)
|
mux.HandleFunc("/status", statusHandler)
|
||||||
|
|
||||||
server := &http.Server{
|
server := &http.Server{
|
||||||
Addr: ":" + p,
|
Addr: ":" + p,
|
||||||
Handler: mux,
|
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
ReadTimeout: 30 * time.Second,
|
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,
|
WriteTimeout: 30 * time.Second,
|
||||||
IdleTimeout: 60 * time.Second,
|
IdleTimeout: 60 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Сервер запущен на порту %s", p)
|
log.Printf("Сервер запущен на порту %s", p)
|
||||||
if err := server.ListenAndServe(); err != nil {
|
if err := server.ListenAndServe(); err != nil {
|
||||||
log.Printf("Ошибка на порту %s: %v", p, err)
|
log.Printf("Ошибка на порту %s: %v", p, err)
|
||||||
}
|
}
|
||||||
}(port)
|
}(port)
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user