Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Properly sending TCP packages through a specific port

Currently trying to create requests that were extracted from Wireshark for honing my networking skills. I've got the location, destination port, and the message itself, but each time I attempt to send the request I am returned with just a blank empty byte. All I could conclude is that the difference between the original packets and mine are that my ports must be different, as the sending ports are different.

This is the code I have tested:

TCP_IP = '111.111.111.111' # destination address
TCP_PORT = 19999 #destination port
BUFFER_SIZE = 20 # for quicker receiving
MESSAGE = b'<Message />' # dest message

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
data = s.recv(BUFFER_SIZE)
s.close()

print("received data:", data) #b''

Which nets me with the empty byte after hanging for a few seconds.

So, the trouble seems to be from the differing packet sending ports on my own computer. Any help/thoughts are greatly appreciated.
I do automation in new ways, build tools, great SaaS' and derive great value and ideas out of simple concepts - always looking for new profitable projects to get involved in.
The source port is randomly generated by the operating system and is not your issue. Inspect the packets more. Check and see if there are any additional bytes that are within the message. Could be a \x0a byte that you're missing or something. The protocol may be line-delimited and you're simply not sending the terminating line.
SRPP Discord Server

I am a professional network/cloud security architect.
My Old Tutorials
(Jan 14, 2020 12:41 AM)Goodies Wrote:  The source port is randomly generated by the operating system and is not your issue. Inspect the packets more.  Check and see if there are any additional bytes that are within the message. Could be a \x0a byte that you're missing or something. The protocol may be line-delimited and you're simply not sending the terminating line.

Appreciate this reply - I'll give this a shot!
I do automation in new ways, build tools, great SaaS' and derive great value and ideas out of simple concepts - always looking for new profitable projects to get involved in.
I would also suggest checking if the server is supposed to speak first or if you are


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by C++Dec 29, 2019 06:16 PM 16 822 Dec 29, 2019 06:16 PM
Last Post: DNA
[Shell] by TravelersAug 20, 2017 12:54 PM 7 265 Aug 20, 2017 12:54 PM
Last Post: HFDone
[Shell] by TravelersAug 13, 2017 05:10 PM 6 150 Aug 13, 2017 05:10 PM
Last Post: Travelers