Skip to content

Commit 8f58cb7

Browse files
authored
Merge pull request #366 from lobsterjerusalem/add-sleeps-for-atomics
Adds sleeps
2 parents 7c2817d + fb30501 commit 8f58cb7

File tree

8 files changed

+16
-0
lines changed

8 files changed

+16
-0
lines changed

c2/cli/basic.go

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func backgroundResponse(ch *channel.Channel, wg *sync.WaitGroup, conn net.Conn,
4949
// below. I that that's tolerable for now.
5050
responseCh <- string(responseBuffer[:bytesRead])
5151
}
52+
time.Sleep(10 * time.Millisecond)
5253
}
5354
}
5455

@@ -83,6 +84,7 @@ func Basic(conn net.Conn, ch *channel.Channel) {
8384
output.PrintShell(response)
8485
default:
8586
}
87+
time.Sleep(10 * time.Millisecond)
8688
}
8789
}(ch)
8890

@@ -109,6 +111,7 @@ func Basic(conn net.Conn, ch *channel.Channel) {
109111

110112
break
111113
}
114+
time.Sleep(10 * time.Millisecond)
112115
}
113116
}(ch)
114117

c2/httpservefile/httpservefile.go

+2
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ func (httpServer *Server) Run(timeout int) {
265265

266266
break
267267
}
268+
time.Sleep(10 * time.Millisecond)
268269
}
269270
}()
270271
// Handle timeouts
@@ -292,6 +293,7 @@ func (httpServer *Server) Run(timeout int) {
292293

293294
break
294295
}
296+
time.Sleep(10 * time.Millisecond)
295297
}
296298
}()
297299
// Handle timeouts

c2/httpserveshell/httpserveshell.go

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ package httpserveshell
3333
import (
3434
"flag"
3535
"sync"
36+
"time"
3637
"sync/atomic"
3738
"time"
3839

@@ -207,6 +208,7 @@ func (serveShell *Server) Run(timeout int) {
207208

208209
break
209210
}
211+
time.Sleep(10 * time.Millisecond)
210212
}
211213
}()
212214
go func() {
@@ -227,6 +229,7 @@ func (serveShell *Server) Run(timeout int) {
227229

228230
break
229231
}
232+
time.Sleep(10 * time.Millisecond)
230233
}
231234
}()
232235
} else {
@@ -240,6 +243,7 @@ func (serveShell *Server) Run(timeout int) {
240243

241244
break
242245
}
246+
time.Sleep(10 * time.Millisecond)
243247
}
244248
}()
245249
}

c2/httpshellserver/httpshellserver.go

+2
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ func (httpServer *Server) Run(timeout int) {
244244

245245
break
246246
}
247+
time.Sleep(10 * time.Millisecond)
247248
}
248249
}()
249250
// Handle timeouts
@@ -271,6 +272,7 @@ func (httpServer *Server) Run(timeout int) {
271272

272273
break
273274
}
275+
time.Sleep(10 * time.Millisecond)
274276
}
275277
}()
276278
// Handle timeouts

c2/shelltunnel/shelltunnel.go

+2
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ func (shellTunnel *Server) Run(timeout int) {
191191

192192
break
193193
}
194+
time.Sleep(10 * time.Millisecond)
194195
}
195196
}()
196197

@@ -214,6 +215,7 @@ func (shellTunnel *Server) Run(timeout int) {
214215
// but may not be immediately clear.
215216
shellTunnel.Channel().AddSession(&client, client.RemoteAddr().String())
216217
go handleTunnelConn(client, shellTunnel.ConnectBackHost, shellTunnel.ConnectBackPort, shellTunnel.ConnectBackSSL, shellTunnel.channel)
218+
time.Sleep(10 * time.Millisecond)
217219
}
218220
}
219221

c2/simpleshell/simpleshellclient.go

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func (shellClient *Client) Run(timeout int) {
8484

8585
break
8686
}
87+
time.Sleep(10 * time.Millisecond)
8788
}
8889
}()
8990

c2/simpleshell/simpleshellserver.go

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func (shellServer *Server) Run(timeout int) {
107107

108108
break
109109
}
110+
time.Sleep(10 * time.Millisecond)
110111
}
111112
}()
112113
// Accept arbitrary connections. In the future we need something for the

c2/sslshell/sslshellserver.go

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ func (shellServer *Server) Run(timeout int) {
154154

155155
break
156156
}
157+
time.Sleep(10 * time.Millisecond)
157158
}
158159
}()
159160
// Accept arbitrary connections. In the future we need something for the

0 commit comments

Comments
 (0)