0

When im trying this code below and check it using "tcpdump -teni h32-eth0" cause i was attack on host32 but packets keep coming with length 0, i want to drop the incoming packet, anybody can help?

def _timer_func (): global diction global set_Timer

  if set_Timer==True:
    for k,v in diction.iteritems():
  print "Switch ID : "+str(k)
  #print "nilai v : "+str(v)
      #print "v iteritems : "+str(v.iteritems)
      for i,j in v.iteritems():
    print "Port Number : "+str(i)
    #print "nilai j : "+str(j)
        if j >=5:
          print "_____________________________________________________________________________________________"
          print "\n                               DDOS DETECTED                                              \n"
          print "\n",str(diction)
          print "\n",datetime.datetime.now(),": BLOCKED PORT NUMBER  : ", str(i), " OF SWITCH ID: ", str(k)
          print "\n___________________________________________________________________________________________"
          #os._exit(0)
          dpid = k
          msg = of.ofp_packet_out(in_port=i) #drop paket
      print msg
          core.openflow.sendToDPID(dpid,msg)          
  diction={}

1 Answers1

0

I think you are missing the packet's buffer-id or the packet itself in the message that you send to the switch. Note that, you are dropping one packet. It will not prevent from further packets arriving through that in-port. If you want to block that in-port or better this flow, then you should install a flow matching rule that will drop all matching packets.

Daniel
  • 440
  • 4
  • 13