packagemainimport("flag""fmt""net""strconv""time")funcmain(){resolution:=flag.Int("res",200,"Port step size (lower = higher resolution)")duration:=flag.Duration("dur",10*time.Second,"Total run time")ip:=flag.String("ip","127.0.0.1","Address to send packets to")flag.Parse()start:=time.Now()fortime.Since(start)<*duration{elapsed:=time.Since(start).Seconds()forport:=1;port<=65535;port+=*resolution{ifisSmiley(port,elapsed){addr:=net.JoinHostPort(*ip,strconv.Itoa(port))conn,err:=net.Dial("udp",addr)iferr==nil{// Send minimal payloadconn.Write([]byte{0x00})conn.Close()}fmt.Println("Sent Packet to port",port,addr)}}// Controls horizontal spacing (time axis density)time.Sleep(100*time.Millisecond)}}// Determines whether a packet should be sent at (time, port)funcisSmiley(portint,tfloat64)bool{thickness:=400// line thickness for drawingtimeScale:=2500.0// scale time axis to match port axis for circles// Both eyes at same vertical height (port), separated horizontally (time)eyePort:=50000eyeRadius:=2000.0// Left eye (at time = 3)leftEyeTime:=3.0dt:=(t-leftEyeTime)*timeScaledp:=float64(port-eyePort)ifdt*dt+dp*dp<eyeRadius*eyeRadius{returntrue}// Right eye (at time = 7)rightEyeTime:=7.0dt=(t-rightEyeTime)*timeScaledp=float64(port-eyePort)ifdt*dt+dp*dp<eyeRadius*eyeRadius{returntrue}// Mouth (curved smile line below eyes)mouthTimeStart:=2.5mouthTimeEnd:=7.5ift>=mouthTimeStart&&t<=mouthTimeEnd{mouthCenterTime:=5.0// center of facemouthLowestPort:=30000// bottom of smile curve (at center)mouthHighestPort:=38000// top of smile curve (at edges)// Smile shape: U curve (low in middle, high at edges)halfWidth:=(mouthTimeEnd-mouthTimeStart)/2// 2.5dt:=t-mouthCenterTimea:=float64(mouthHighestPort-mouthLowestPort)/(halfWidth*halfWidth)curvePort:=int(a*dt*dt)+mouthLowestPort// Only draw if port is ON the curve line (not inside)ifport>curvePort-thickness&&port<curvePort+thickness{returntrue}}returnfalse}