Sending UDP packets to a destination

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
On my Linux machine, I am receiving UDP packets from another machine. When I receive the UDP packets, I get the message
"Listening on UDP port : 8999"
This is triggered by the following command part of a code that listens on that specific port.
GET_PORT((&(paraThread->destHost)), tmpPort);
fprintf(stderr, "Listening on UDP port : %dn", ntohs(tmpPort));
What I need is that as soon as I receive every UDP packet, I need to send a response UDP packet of say 400 bytes to the IP address from which I received the UDP packet.
How can I accomplish that?
udp packet
bumped to the homepage by Community⦠10 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |Â
up vote
0
down vote
favorite
On my Linux machine, I am receiving UDP packets from another machine. When I receive the UDP packets, I get the message
"Listening on UDP port : 8999"
This is triggered by the following command part of a code that listens on that specific port.
GET_PORT((&(paraThread->destHost)), tmpPort);
fprintf(stderr, "Listening on UDP port : %dn", ntohs(tmpPort));
What I need is that as soon as I receive every UDP packet, I need to send a response UDP packet of say 400 bytes to the IP address from which I received the UDP packet.
How can I accomplish that?
udp packet
bumped to the homepage by Community⦠10 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
2
This is a strange request and I can assure you that as soon as a hacker finds out you do that, your machine will become used to attack other targets. UDP spoofing is very easy to do.
â Julie Pelletier
May 19 '17 at 17:02
2
You're trying to re-invent port knocking.
â Satà  Katsura
May 19 '17 at 17:33
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
On my Linux machine, I am receiving UDP packets from another machine. When I receive the UDP packets, I get the message
"Listening on UDP port : 8999"
This is triggered by the following command part of a code that listens on that specific port.
GET_PORT((&(paraThread->destHost)), tmpPort);
fprintf(stderr, "Listening on UDP port : %dn", ntohs(tmpPort));
What I need is that as soon as I receive every UDP packet, I need to send a response UDP packet of say 400 bytes to the IP address from which I received the UDP packet.
How can I accomplish that?
udp packet
On my Linux machine, I am receiving UDP packets from another machine. When I receive the UDP packets, I get the message
"Listening on UDP port : 8999"
This is triggered by the following command part of a code that listens on that specific port.
GET_PORT((&(paraThread->destHost)), tmpPort);
fprintf(stderr, "Listening on UDP port : %dn", ntohs(tmpPort));
What I need is that as soon as I receive every UDP packet, I need to send a response UDP packet of say 400 bytes to the IP address from which I received the UDP packet.
How can I accomplish that?
udp packet
udp packet
asked May 19 '17 at 16:31
Ashish Kurian
213
213
bumped to the homepage by Community⦠10 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community⦠10 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
2
This is a strange request and I can assure you that as soon as a hacker finds out you do that, your machine will become used to attack other targets. UDP spoofing is very easy to do.
â Julie Pelletier
May 19 '17 at 17:02
2
You're trying to re-invent port knocking.
â Satà  Katsura
May 19 '17 at 17:33
add a comment |Â
2
This is a strange request and I can assure you that as soon as a hacker finds out you do that, your machine will become used to attack other targets. UDP spoofing is very easy to do.
â Julie Pelletier
May 19 '17 at 17:02
2
You're trying to re-invent port knocking.
â Satà  Katsura
May 19 '17 at 17:33
2
2
This is a strange request and I can assure you that as soon as a hacker finds out you do that, your machine will become used to attack other targets. UDP spoofing is very easy to do.
â Julie Pelletier
May 19 '17 at 17:02
This is a strange request and I can assure you that as soon as a hacker finds out you do that, your machine will become used to attack other targets. UDP spoofing is very easy to do.
â Julie Pelletier
May 19 '17 at 17:02
2
2
You're trying to re-invent port knocking.
â Satà  Katsura
May 19 '17 at 17:33
You're trying to re-invent port knocking.
â Satà  Katsura
May 19 '17 at 17:33
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
You can cat 400 bytes to the remote host when you receive the message :
cat 400bytes.txt >/dev/udp/remotehost/8000
As explained here.
Many other options are available of course.
To generate 400 random bytes to that device, use dd :
dd if=/dev/urandom bs=1 count=400 of=/dev/udp/remotehost/8000
should I replace remotehost with the IP address?
â Ashish Kurian
May 19 '17 at 17:00
@AshishKurian: of course.
â Julie Pelletier
May 19 '17 at 17:01
so I should also create a text file named 400bytes.text ? Is there a way to send some random 400 byte payload
â Ashish Kurian
May 19 '17 at 17:04
1
well, usefprintfto the '/dev/udp/remotehost/8000' and print 400 bytes for example. these kind of questions belong to stackoverflow.com
â mazs
May 19 '17 at 17:28
4
The answer in forbashthe question looks like C (though does not state a language). This question belongs on stack overflow, as it is about programming.
â ctrl-alt-delor
May 19 '17 at 17:33
 |Â
show 4 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You can cat 400 bytes to the remote host when you receive the message :
cat 400bytes.txt >/dev/udp/remotehost/8000
As explained here.
Many other options are available of course.
To generate 400 random bytes to that device, use dd :
dd if=/dev/urandom bs=1 count=400 of=/dev/udp/remotehost/8000
should I replace remotehost with the IP address?
â Ashish Kurian
May 19 '17 at 17:00
@AshishKurian: of course.
â Julie Pelletier
May 19 '17 at 17:01
so I should also create a text file named 400bytes.text ? Is there a way to send some random 400 byte payload
â Ashish Kurian
May 19 '17 at 17:04
1
well, usefprintfto the '/dev/udp/remotehost/8000' and print 400 bytes for example. these kind of questions belong to stackoverflow.com
â mazs
May 19 '17 at 17:28
4
The answer in forbashthe question looks like C (though does not state a language). This question belongs on stack overflow, as it is about programming.
â ctrl-alt-delor
May 19 '17 at 17:33
 |Â
show 4 more comments
up vote
0
down vote
You can cat 400 bytes to the remote host when you receive the message :
cat 400bytes.txt >/dev/udp/remotehost/8000
As explained here.
Many other options are available of course.
To generate 400 random bytes to that device, use dd :
dd if=/dev/urandom bs=1 count=400 of=/dev/udp/remotehost/8000
should I replace remotehost with the IP address?
â Ashish Kurian
May 19 '17 at 17:00
@AshishKurian: of course.
â Julie Pelletier
May 19 '17 at 17:01
so I should also create a text file named 400bytes.text ? Is there a way to send some random 400 byte payload
â Ashish Kurian
May 19 '17 at 17:04
1
well, usefprintfto the '/dev/udp/remotehost/8000' and print 400 bytes for example. these kind of questions belong to stackoverflow.com
â mazs
May 19 '17 at 17:28
4
The answer in forbashthe question looks like C (though does not state a language). This question belongs on stack overflow, as it is about programming.
â ctrl-alt-delor
May 19 '17 at 17:33
 |Â
show 4 more comments
up vote
0
down vote
up vote
0
down vote
You can cat 400 bytes to the remote host when you receive the message :
cat 400bytes.txt >/dev/udp/remotehost/8000
As explained here.
Many other options are available of course.
To generate 400 random bytes to that device, use dd :
dd if=/dev/urandom bs=1 count=400 of=/dev/udp/remotehost/8000
You can cat 400 bytes to the remote host when you receive the message :
cat 400bytes.txt >/dev/udp/remotehost/8000
As explained here.
Many other options are available of course.
To generate 400 random bytes to that device, use dd :
dd if=/dev/urandom bs=1 count=400 of=/dev/udp/remotehost/8000
edited May 23 '17 at 12:39
Communityâ¦
1
1
answered May 19 '17 at 16:45
mazs
2,5451622
2,5451622
should I replace remotehost with the IP address?
â Ashish Kurian
May 19 '17 at 17:00
@AshishKurian: of course.
â Julie Pelletier
May 19 '17 at 17:01
so I should also create a text file named 400bytes.text ? Is there a way to send some random 400 byte payload
â Ashish Kurian
May 19 '17 at 17:04
1
well, usefprintfto the '/dev/udp/remotehost/8000' and print 400 bytes for example. these kind of questions belong to stackoverflow.com
â mazs
May 19 '17 at 17:28
4
The answer in forbashthe question looks like C (though does not state a language). This question belongs on stack overflow, as it is about programming.
â ctrl-alt-delor
May 19 '17 at 17:33
 |Â
show 4 more comments
should I replace remotehost with the IP address?
â Ashish Kurian
May 19 '17 at 17:00
@AshishKurian: of course.
â Julie Pelletier
May 19 '17 at 17:01
so I should also create a text file named 400bytes.text ? Is there a way to send some random 400 byte payload
â Ashish Kurian
May 19 '17 at 17:04
1
well, usefprintfto the '/dev/udp/remotehost/8000' and print 400 bytes for example. these kind of questions belong to stackoverflow.com
â mazs
May 19 '17 at 17:28
4
The answer in forbashthe question looks like C (though does not state a language). This question belongs on stack overflow, as it is about programming.
â ctrl-alt-delor
May 19 '17 at 17:33
should I replace remotehost with the IP address?
â Ashish Kurian
May 19 '17 at 17:00
should I replace remotehost with the IP address?
â Ashish Kurian
May 19 '17 at 17:00
@AshishKurian: of course.
â Julie Pelletier
May 19 '17 at 17:01
@AshishKurian: of course.
â Julie Pelletier
May 19 '17 at 17:01
so I should also create a text file named 400bytes.text ? Is there a way to send some random 400 byte payload
â Ashish Kurian
May 19 '17 at 17:04
so I should also create a text file named 400bytes.text ? Is there a way to send some random 400 byte payload
â Ashish Kurian
May 19 '17 at 17:04
1
1
well, use
fprintf to the '/dev/udp/remotehost/8000' and print 400 bytes for example. these kind of questions belong to stackoverflow.comâ mazs
May 19 '17 at 17:28
well, use
fprintf to the '/dev/udp/remotehost/8000' and print 400 bytes for example. these kind of questions belong to stackoverflow.comâ mazs
May 19 '17 at 17:28
4
4
The answer in for
bash the question looks like C (though does not state a language). This question belongs on stack overflow, as it is about programming.â ctrl-alt-delor
May 19 '17 at 17:33
The answer in for
bash the question looks like C (though does not state a language). This question belongs on stack overflow, as it is about programming.â ctrl-alt-delor
May 19 '17 at 17:33
 |Â
show 4 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f366115%2fsending-udp-packets-to-a-destination%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
This is a strange request and I can assure you that as soon as a hacker finds out you do that, your machine will become used to attack other targets. UDP spoofing is very easy to do.
â Julie Pelletier
May 19 '17 at 17:02
2
You're trying to re-invent port knocking.
â Satà  Katsura
May 19 '17 at 17:33