Import Socket
Import Socket
import os
import time
import threading
from concurrent.futures import ThreadPoolExecutor
def checksum(source_string):
"""
A function to calculate the checksum for the ICMP packet
"""
sum = 0
countTo = (len(source_string) // 2) * 2
count = 0
while count < countTo:
thisVal = ord(source_string[count + 1]) * 256 + ord(source_string[count])
sum = sum + thisVal
sum = sum & 0xffffffff
count = count + 2
if countTo < len(source_string):
sum = sum + ord(source_string[len(source_string) - 1])
sum = sum & 0xffffffff
sum = (sum >> 16) + (sum & 0xffff)
sum = sum + (sum >> 16)
answer = ~sum & 0xffff
answer = answer >> 8 | (answer << 8 & 0xff00)
return answer
def main():
# Input for target IP, payload size, and number of pings
target_ip = input("Enter the target IP: ")
size_gb = float(input("Enter the size of payload (in GB): "))
count = int(input("Enter the number of pings to send: "))
# Start pinging
start_time = time.time()
ping_target(target_ip, size_bytes, count)
end_time = time.time()
if __name__ == "__main__":
main()