Sending UDP packets to a destination

The name of the pictureThe name of the pictureThe name of the pictureClash 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?










share|improve this question














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














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?










share|improve this question














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












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?










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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












  • 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










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





share|improve this answer






















  • 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, 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




    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










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























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





share|improve this answer






















  • 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, 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




    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














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





share|improve this answer






















  • 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, 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




    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












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





share|improve this answer














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






share|improve this answer














share|improve this answer



share|improve this answer








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, 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




    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
















  • 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, 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




    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















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

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)