packet

Python 3.4: Unknown format code 'x'

試著忘記壹切 提交于 2019-12-02 08:06:47
I have issue about packet sniffer in Python3. version of python: 3.4 I followed some tutorial that works, but not on my computer. This code has to get mac address, convert it to string and in main() method should print to me destination mac, source mac and protocol. code: sniffer_demo.py import socket import struct import textwrap def main(): conn = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.ntohs(3)) while True: raw_data, addr = conn.recvfrom(65536) # one's and zero's put to the method ehternet_frame dest_mac, src_mac, eth_proto, data = ethernet_frame(raw_data) print('\nEthernet

scapy packet manipulation and original pkt.time

社会主义新天地 提交于 2019-12-02 07:01:17
I have python, scapy peace of code that store my data into database (IP src and dst, ports, ..) which i use for some statistics. On some packets i am doing some manipulation (changing dst port) and then send them back out on interface. Problem is that this packet i was manipulating with have different pkt.time value than original one and if I store those packets into database they have different packet time then they have originally. Is there and option within creating UDP packet to put original pkt.time value? With this option packet manipulation delay would not cause disorder with my packets

Reading information from PAT section (MPEG-TS)

南笙酒味 提交于 2019-12-01 21:03:17
I'm writing a MPEG-TS file parser and I'm stuck on getting program_numbers and PIDs from the PAT section. I'm using a packet analyser to compare my results. For example, here's a PAT packet 47 40 00 16 00 00 B0 31 00 14 D7 00 00 00 00 E0 10 00 01 E0 24 00 02 E0 25 00 03 E0 30 00 04 E0 31 00 1A E0 67 00 1C E0 6F 43 9D E3 F1 43 A3 E3 F7 43 AC E4 00 C3 69 A6 D8 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

Java Multicast Sending Data, Not Receiving

ぃ、小莉子 提交于 2019-12-01 17:47:51
问题 I am writing a class in Java which is used to greatly simplify the process of multicasting. However, I am having two big problems with it: The class sends data (I can verify this with my net monitor, Wireshark) but the data is not received by any others in the same group. On some machines, the sending packet TTL is exceeded in transit (again, according to Wireshark). Could anyone please help me? I've been trying and searching for answers for hours, and it appears that my code follows all of

Java Multicast Sending Data, Not Receiving

ぐ巨炮叔叔 提交于 2019-12-01 17:25:33
I am writing a class in Java which is used to greatly simplify the process of multicasting. However, I am having two big problems with it: The class sends data (I can verify this with my net monitor, Wireshark) but the data is not received by any others in the same group. On some machines, the sending packet TTL is exceeded in transit (again, according to Wireshark). Could anyone please help me? I've been trying and searching for answers for hours, and it appears that my code follows all of the basic procedures for connecting to, joining, sending, and receiving data from a multicast host. Here

to read the packet of bytes on client(client Socket) from server(ServerSocket) using java

二次信任 提交于 2019-12-01 11:50:53
i m a new . i m a java developer(fresher) and currently i m working on BSE project and i m facing problem to read the packet of bytes on the client(client socket) from the server(server socket). if u can help me then please help me. Thanks in advance Well, if you want to interact directly with packets, then you need to use a DatagramSocket instead of the regular Socket and ServerSocket . Then, you should visit this link to see a good tutorial on how to get started with sending and receiving individual packets. The basic idea is that the Client or Server will block on the recieve() call while

Data loss TCP IP C#

我与影子孤独终老i 提交于 2019-12-01 10:35:40
Here's my code: private void OnReceive(IAsyncResult result) { NetStateObject state = (NetStateObject)result.AsyncState; Socket client = state.Socket; int size = client.EndReceive(result); byte[] data = state.Buffer; object data = null; using (MemoryStream stream = new MemoryStream(data)) { BinaryFormatter formatter = new BinaryFormatter(); data = formatter.Deserialize(stream); } //todo: something with data client.BeginReceive( state.Buffer, 0, NetStateObject.BUFFER_SIZE, SocketFlags.None, OnReceive, state ); } state.Buffer has a maximum size of NetStateObject.BUFFER_SIZE (1024). Firstly, is

iSCSI Packet Header

戏子无情 提交于 2019-12-01 08:03:02
问题 Does iSCSI introduce any layers (other than the TCP-headers themselves) on top of the SCSI packet? Are there any reference manuals for iSCSI other than the RFC itself? I need this information for controlling a RF-receiver over a Paralan iSCSI-to-SCSI-converter. 回答1: Yes there are a number of functions that iSCSI must implement (to name the least, authentication and authorization) on top of standard SCSI functions. The iSCSI PDU format is outlined in Chapter 10 of RFC 3720 - iSCSI In terms

General Socket Question - Transferring C++ Structs from Java to C++

旧街凉风 提交于 2019-12-01 07:14:21
I have a general socket programming question for you. I have a C struct called Data: struct data { double speed; double length; char carName[32]; struct Attribs; } struct Attribs { int color; } I would like to be able to create a similar structure in Java, create a socket, create the data packet with the above struct, and send it to a C++ socket listener. What can you tell me about having serialized data (basically, the 1's and 0's that are transferred in the packet). How does C++ "read" these packets and recreate the struct? How are structs like this stored in the packet? Generally, anything

For how long a router keeps records in the NAT and can they be reused forwarding requests from other hosts?

▼魔方 西西 提交于 2019-12-01 04:41:24
There is an answer explaining in simple terms how a router works translating requests from the local network to outside and back ( https://superuser.com/questions/105838/how-does-router-know-where-to-forward-packet ) what is not clear - for how long a record in the NAT is kept? For example, if I send a UDP request to 25.34.11.56:3874 and my local endpoint is 192.168.1.21:54389 the router rewrites the request packet and adds a record to the NAT. Let's say the external endpoint will be 68.55.32.89:34535. Then the computer which received my request responds to the 68.55.32.89:34535 and the packet