Skip to content

Commit

Permalink
Fix: seems writing to closed channel is now fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
adedayo committed Mar 6, 2019
1 parent 4970bfb commit 9054110
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions portscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,15 +510,12 @@ func listenForACKPackets(handle *pcap.Handle, route routeFinder, config ScanConf
packetSource := gopacket.NewPacketSource(handle, handle.LinkType())
go func() {
defer func() {
println("Closing output and stop channels")
close(output)
close(stop)
println("Output and stop channels closed")
}()
for {
select {
case <-stop:
println("Firing Stop")
return
default:
packet, err := packetSource.NextPacket()
Expand All @@ -540,8 +537,6 @@ func listenForACKPackets(handle *pcap.Handle, route routeFinder, config ScanConf
SYN: tcp.SYN,
RST: tcp.RST,
}
println("Writing an ACK", ip.SrcIP.String(), strings.Split(tcp.SrcPort.String(), "(")[0],
tcp.SYN, tcp.RST)
output <- ack
if !config.Quiet && ack.IsOpen() {
fmt.Printf("%s:%s (%s) is %s\n", ack.Host, ack.Port, ack.GetServiceName(), ack.Status())
Expand Down

0 comments on commit 9054110

Please sign in to comment.