Programming :: Sending Arp Packets In C / C++?

Apr 5, 2010

I'm looking for a way how to send an arp request / reply packet using C or C++. I've written an application that can send different crafted packages using jpcap (java), but I'm not a C expert (trying to learn). The reason for this is that I would like to port my java program to C to use it on a less powerful system that can't fully cope with the resource hungry VM

View 3 Replies


ADVERTISEMENT

Programming :: Raw Socket Not Sending Packets?

Mar 26, 2010

(Let me first of all state that I am a newbie to any form of programming.) I have been trying to create an IP header + TCP header and send this to another machine on my network.using C)I used the normal stuff: two structures for the headers, a sockaddr_in structure, call to function socket with SOCK_RAW, setsockopt with HDRINCL and call to sendto.All functions seem to return fine (values other then -1) the function that I have used to calculate the checksum for the IPheader matches the value that I manually calculated. I just don?t see the anything coming out of the interface on whireshark.I assumed that it had something do with my piece of code so I used two examples (including mixter void ru rawip html A brief programming tutorial in C for raw sockets[/url]). They show exactly the same thing functions return fine but no packets being send.I use Ubuntu 9.04 2.6.28-14-genericThe machine has two interfaces one with an ip address the other interface is in promiscuous mode. (both interfaces connected to a switch with port mirroring) I can see all normal traffic in/out.

View 2 Replies View Related

Programming :: Segmentation Fault While Sending UDP Packets?

Jul 16, 2009

The following piece of code is suppose to send a UDP packet.but inside function udpsocketinit , i get a segmentation fault and i can not understand why

Code:
#include <arpa/inet.h>
#include <netinet/in.h>

[code]...

View 5 Replies View Related

Programming :: Write A Program In C That Can Sniff Packets From Ethernet And Distinguish RTP Packets From Non-RTP Packets?

Aug 30, 2010

i need to write a program in c that can sniff packets from Ethernet and distinguish RTP packets from Non-RTP packets, i have no idea what should i do

View 9 Replies View Related

Networking :: Sending/replaying Network Packets?

Dec 10, 2008

I am not a networking expert by any means (in fact I have never taken a networking course), but I have taken several security courses, and generally we wind up discussing replay attacks. For example, the Needham-Schroeder protocol (using symmetric-key cryptography anyway) is flawed because it allows for replay attacks, and I understand why.

I guess my question is actually how someone would perform a replay attack. I know I can sniff network traffic by downloading wireshark. I also have downloaded winpcap and npg on my WinXP virtual machine. I'm trying to use this guide to help me, but I'm quite lost:[URL]What I did was to post a "link" to my facebook profile and I sniffed the traffic using wireshark. What I would ultimately like to accomplish is to copy that packet out of the wireshark output, and then use a tool like npg to transfer the raw packet back to facebook, which should result in a second, redundant post. I just can't figure out how to do that.

I'm pretty sure this should be possible. Facebook only uses an SSL session for authentication during login. After that, the information is just sent in the clear, so I'm pretty sure this should be possible.Can anyone explain how to do such a thing? It would really help my research paper that I'm working on this semester if you can. As of right now the attack we are trying to demonstrate/defend against is using a Windows VM, which is why I'm using winpcap/npg. The attack is actually possible using just about any OS (depending on the exploit used), but our POC is Windows only at the moment

View 4 Replies View Related

Networking :: Sending Packets To Localhost Through Another Computer?

Jun 10, 2009

Suppose I have computer A with ip address on eth0 of 192.168.0.1 and ip address on eth1 of 192.168.1.1. If I send packets to 192.168.1.1 from computer A, it automatically uses the loopback interface. Is it possible to modify the routing table some how to send these packets out on eth0 instead and have them route around the network and come back on eth1.I've tried 'route add -host 192.168.1.1 dev eth0' but it seems to completely ignore this entry.

View 5 Replies View Related

Networking :: Sending Packets To The Local Interface Through A Route?

Oct 13, 2010

I want to build a topology of this kind:

|eth0 (a.a.a.a) |
Linux PC |<----------------> | ROUTER
|eth1 (b.b.b.b) |
|<----------------->|

the linux machine has two interfaces eth0 (a.a.a.a) and eth1 (b.b.b.b) connnected to two interfaces of a router. Now that if I send any packet destined to b.b.b.b from a.a.a.a interface on the linux machine, it should take the folowing path: eth0->router->eth1 . and it should be the same for vice versa.

View 1 Replies View Related

Networking :: Sending Ethernet Packets From Inside The Kernel?

Jun 20, 2011

I'm trying to create and send my own ETH packets from inside the kernel.My objective to send the packages from layer 2 by building my own skbuffand sending itusingdev_queue_xmit().anyone did it or have examples of how to do it ?I tried to build my own skbuff without success.

View 1 Replies View Related

Security :: Detect Infected PC In LAN (Sending Packets To Internet)

Jul 17, 2009

In my network I have 25 workstations and some serves. Everything working in local LAN with firewall. The problem is that on one machine (I dont know which one) is installed software which sending data to the internet. Actually I dont know what it is. Last time as I remember was trojan which can create new network interfaces in windows and send some data to the internet. The half speed of my network connection is used by this infected machine. How can I detect which machine it is? How can I listen/capture some traffic and analyze from which machine I have more connections.

Please take a look on this time. Instead of 141-150ms should be 4-5ms.

64 bytes from web30.ispnetz.de (62.xx.191.74): icmp_seq=1 ttl=249 time=141 ms
64 bytes from web30.ispnetz.de (62.xx.191.74): icmp_seq=2 ttl=249 time=135 ms
64 bytes from web30.ispnetz.de (62.xx.191.74): icmp_seq=3 ttl=249 time=147 ms
64 bytes from web30.ispnetz.de (62.xx.191.74): icmp_seq=4 ttl=249 time=127 ms
64 bytes from web30.ispnetz.de (62.xx.191.74): icmp_seq=5 ttl=249 time=156 ms
64 bytes from web30.ispnetz.de (62.xx.191.74): icmp_seq=6 ttl=249 time=129 ms
64 bytes from web30.ispnetz.de (62.xx.191.74): icmp_seq=7 ttl=249 time=188 ms

How can I detect which machine is infected using only linux and keyboard ?

View 5 Replies View Related

General :: LAN Machines Sending Packets By Iftop - Set Only Send And Recieve Http - Smtp - Ssh - Dns - Dhcp Request?

Jun 10, 2011

I have proxy running. I have seen LAN machines sending packets by iftop -P -F 192.168.10./24

[Code]....

How do i set my iptables so that I can only send and recieve http,smtp,ssh,dns,dhcp request in and out of the proxy

[Code]...

View 3 Replies View Related

Networking :: Firewall - Allow Packets Coming From Internet After Authenticating And To By Pass Packets Generated From Internal LAN?

Feb 8, 2010

i have a linux server runnig oracle applications. i need to access this server from putty using ssh through internet. i did by registering my static ip with the dnydns.org and i am able to connect to the server. but now there is no security to authenticate any user as any one knowing the password can login to it.

i thought of configuring the firewall of linux server but the client ip`s are not static and they change continiously. so thought of keeping one more pc between the server and the router which will do the work of authenticating. but i am confuse as how to configure it to allow the packets coming from the internet after authenticating and to by pass the packets generated from internal LAN?

View 8 Replies View Related

Debian Programming :: Cannot Receive UDP Packets

May 11, 2015

I am trying to build a socket to retrieve the ethernet packets from ECU(I do not know much about the ECU). When i run my code on windows there is no problem and the code runs correctly. But when i run my code on Debian it gets stuck at s.recv(1024).

I have already set static ip in /etc/network/interfaces as follows:

Code: Select alliface eth0 inet static
address 160.48.199.91
netmask 255.255.255.0
gateway 160.48.199.254

The simple code is as below:

Code: Select all import socket
    import sys
    HOST = "160.48.199.91"
    port = 30490
    s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_UDP)
    s.bind((HOST, 30490))
    while True:
         data = s.recvfrom(1024)
         print(data)

There is no LAN or Router. When i check netstat -s i see that there are 0 UDP and 0 TCP messages received. But when i check in Wireshark on Debian i could see the displayed UDP packets. Does it mean that the UDP packets are reaching the Raspberry Pi but not received by Debian ? Or are these packets being dropped?

View 4 Replies View Related

Programming :: Drop Packets (not Iptables) In C / C++

May 24, 2010

I have tried to google it around and couldn't find any good solution for it. What I want is to hook up to the kernel network hooks and for example investigate all of the packets (maybe keep some in the buffer and drop in the kernel so I could send them out lets say 10 minutes later) but from a C / C++ program perspective / level. I know it can be done via iptables but isn't there a way to do it from a program ?? I have found a library called ipq but apparently doesn't work with kernel 2.6.x anymore.

View 10 Replies View Related

Programming :: How To Send And Receive Packets Using Libpcap

Mar 11, 2011

How can I send and receive packets using libpcap, reply as early as possible.

View 1 Replies View Related

Programming :: Send UPD Packets To Neighbor Mac Address?

Sep 26, 2010

I want to send Received UDP Packets to neighbor MAC Address. Anyone can guide me to how to do it?

I can received UDP packets and then forward to unicast address as follow: How can i modify this codes (Maybe Last Line) to send the received packets to destination MAC Address instead of destination IPv6 Address?

Code:
int main(int argc, char ** argv)
{
int s,s1;
struct sockaddr_in6 a,a1;

[Code]....

View 8 Replies View Related

Programming :: Make A Listener For ICMP Packets?

Oct 17, 2010

I have a gateway server which is currently listening for TCP/UDP packets and authenticating clients if their details IP/MAC is known.

I have a couple of clients who's network equipment sends ICMP pings to a remote site to determine internet connectivity and I'm missing those resulting in the client's device not logging in.

Is there some way that I can write a listener similar to a listener for TCP/UDP sockets which will listen to ICMP packets and pick up the IP and MAC address of the sender upon which I can perform processing on?

View 1 Replies View Related

Programming :: Sending Email From The Localhost

Jan 21, 2011

I have designed and one form and php code to send mail. I am developing this in my localhost, So now i want to send email from my localhost to test my programming. I googled and i find something like editing "php.ini" file. But it didnt work for me.

View 9 Replies View Related

Programming :: Java - Sending A 2d Array Over UDP?

Feb 26, 2011

I'm currently writing a program which will eventually send two 2d arrays to another machine using UDP, and then back again.

To do this I'm converting to a byte array which as far as I'm aware is the only way possible. I'm sure the problem is on the receiving program which receives like this:

Code:
DatagramSocket socket = new DatagramSocket(2000);
DatagramPacket packet = new DatagramPacket(new byte[5000] , 5000);
socket.receive(packet);
ByteArrayInputStream bin = new ByteArrayInputStream(packet.getData());

[Code].....

View 3 Replies View Related

Programming :: Php And (pdf) File Sending By Http?

Dec 9, 2010

I have a web page that has links to a php script that sends pdf files to the browser when clicked.
The links are like this:

Code:
<a href="getfile.php?id=1201234">

The files sent are shown embedded in the browser, which is what I want.

The problem is: the title of the browser window or tab in which the pdf file is opened is "getfile.php?id=1201234"), and not the actual file name of the pdf file.

Is it possible to send the file by a php script in a way that the window/tab title becomes the filename and not the link by which it has been accessed?

View 5 Replies View Related

Programming :: Sending Binary Data Through Sockets In C

Nov 29, 2010

I am coding a http server which has to send the file(s) such as images, .avi files, .mpeg, that the client is going to request. I have been trying of sending files through sockets.

char info [256];
bzero(info, 256);
//memset(&info,0,sizeof(info));
read(socket, info, 255);
write(socket, HTTP, 255);
FILE *fl= fopen(info,"rb");
fseek(fl, 0, SEEK_END);
long len = ftell(fl);
printf("largo: %ld", len);
unsigned char *ret = (char*) malloc(len);
fseek(fl, 0, SEEK_SET);
fread(ret, 1, len, fl);

However, it's supposed to be shown in Mozilla Firefox (as the client). But it is not doing it, so.. It's just not getting the complete file.

View 1 Replies View Related

Programming :: Bash Script - Sending Shortcuts To Firefox

Aug 26, 2010

When I attempt to extract some webpages there are far too many jscript functions and html encodings. Hence, I can manually search the page, perform select all (^A), copy (^C) it, open a prepared file (^O), but cannot figure how to paste it (&V). I want to do this from a bash script. I know how to do the search. Now how do I send these shortcuts (especially ctrl-C) to Firefox. Once I have the page copied to the clipboard, I think I can figure out how to open a file and save the clipboard to a file using bash script on the Linux side. How do I send shortcuts to Firefox? Is this done with the hex equivalent of the keystrokes?

View 8 Replies View Related

Programming :: Sending Binary Data To Bluetooth With Terminal

Aug 30, 2010

I am using centos 5, want to send a sets of binary data to other bluetooth device I know how to sent a file but dont know how to sent raw data. My case is like this I have a bluetooth device I need to send data to then after it process I need to get it back, I plan to do this all using terminal is that possible?

View 2 Replies View Related

Programming :: Sending Keystrokes From C Program To Certain Running Applications?

Jan 13, 2010

My requirement is to save files before shutting the Linux machine down, unattended ie: when the user is not near the machine. This is done whenever the UPS battery is about to die, so that the files get saved. open-Office/text-editor applications that can be saved using keystrokes will have to be found from the running processes and keystrokes should be sent to them from a C program that was started in non-graphics stage. ie: from a C program that forks into memory as a daemon before xwindows part starts. How to I send keystrokes to a running application? (like cotrol + F and then wait and then send next set of keystrokes till the file is saved as a new file or as the same file itself), either from C program or a script?

View 1 Replies View Related

Programming :: Sending Mail To Mailing-lists In Perl?

Jan 25, 2011

Im creating a perl script that will be sending out mail to mailing-lists, but im not getting it to work. Its no problem getting the script to send mail to regular mail addresses, but it doesnt seem to handle to send mail to mailing lists. Im using the Net::SMTP perl module.how to send mail from a perl script to a mailing list (and not just regular mail addresses) ?

View 2 Replies View Related

Programming :: VLC Control With Perl Sending Via Serial Connection?

Oct 6, 2010

My computer for a project I'm working on will be using Ubuntu with Perl and VLC from the repositories, if that matters at all. I'm not sure what I should/could use to accomplish this, but essentially I'm looking for Perl to be able to send predefined data via a serial connection based on the time within a song that VLC is playing.

A couple of the things that I've thought about after Googling a bit are SMPTE and subtitles/lyrics; I can't stop thinking that there's got so be a simple way that I'm just overlooking, though - most of the stuff I've found is for over-the-network applications, and that's overkill for this situation. All the subtitles/lyrics would have for text is hexadecimal values; all the SMPTE would do is keep Perl and VLC (playing audio) in-sync with each other. I would need either one or the other, but not both. Or, I could use something else...

I'm envisioning something like the setup below, I just don't know what else I need to make it happen.

Files:
song.mp3
timing.txt
script.pl

When I run "./script.pl song.mp3 timing.txt", VLC will open, and start playing "song.mp3", and the variable "$mils", for milliseconds elapsed, will be equal to zero. For each line in "timing.txt", the "script.pl" will assume the portion before an underscore is the "$time" for that line (time in milliseconds), and "script.pl" will assume that the portion after the underscore is the "$data", a three-byte hexadecimal value (such as "ff101f", or "011c00"), for that line.

I think that I will need to use two arrays, "@time" and "@data", such that the given line in "timing.txt" would read the same as printing: "$time[$line]".'_'."$data[$line]"."
" (if "$line" is the line number). My problem: jitter/stuttering playback. If VLC stumbles (which it sometimes does), and is a about half a second behind where it "should" be, but Perl didn't stumble, then I've got an out-of-sync issue.

Since Perl can't just count the time by itself to avoid synchronization issues, I've got two main ideas for getting this done: One way: Perl has to "read" where VLC is at, and use that as the "$mils" value. Then, if VLC delays/stubmles, so will Perl, but everything will still be in-sync. Alternative way: VLC has to "listen" to what Perl says "$mils" is at any given moment, essentially having Perl be in control of VLC's timing. This would make VLC "skip ahead" (to where it "should" be) if it starts to fall behind, thus keeping the two in sync.

I don't know which, if either, of these ways is best for my particular need. I would need "script.pl" to send "$data[$line]" over the serial connection when "$mils" == "$time[$line]". I already know how to send serial data from Perl, read files via Perl, and convert the hexadecimal number (if needed). I don't know how to "link" Perl and VLC so that they stay synchronized, and I am quite lost as to where to go from here.

View 5 Replies View Related

Programming :: Extract Data By Sending Queries To A Website?

Dec 17, 2010

What would be the best way to extract data by sending queries to a website?

View 2 Replies View Related

Debian Programming :: Sending Ethernet Frame Payload To Server

Nov 25, 2014

How can I send already encapsulated Ethernet frame payload to server? Basically what I would like to do is to is route Ethernet packages I get from other peripherals to their needed destinations and packets I receive send to requested device on peripheral. Program will be running on BeagleBone Black with Debian OS. Steps program should do from my point of view:

# <IPv6<UDP<DATA>>> packet received on some peripheral (UART in exact case) sent to server requested by <IPv6> destination address field# <IPv6<UDP<DATA>>> packet need to be sent to server that server application would receive <DATA> extracted from IPv6 and UDP encapsulation# <IPv6<UDP<DATA>>> packet need to be sent to server that server would know that device which is requested is available in BBB local network# <IPv6<UDP<DATA>>> packet received from server would be sent to requested device

From what I already found out I need to add routing header to packet I want to send and pass it to MAC encapsulation layer, or there is service which can add routing header and pass to other layers for me?

Also how can I get data sent from server, since if I'm not very wrong, system should receive them also encapsulated in Routing header, not as RAW data payload.

View 0 Replies View Related

Networking :: Socket Programming: Sending And Receiving Msgs Back And Forth

May 19, 2010

I have a server which is used by number of client Apps. Now when a client initiates a sendto request to a server it has to respond(after recvfrom) by sending a message using sendto back to client and this should be done back and forth.

What I dont understand is, does the client have to open a new port to receive packets from client? If yes, then how will server know to what port of the client(assuming server ports are well-known to clients)?

I had given up on sending messages back and forth using UDP and switched to TCP. I could send a read and write message back and forth. But the trouble comes when I have more than one client wanting to talk to server using SOCK_STREAM. The first one gets through but the second client seems to get blocked forever(but I got no error upon socket creation or upon connect with the server on the same port as the previous client)..

View 4 Replies View Related

Programming :: Sending RSA Public/private Keys Into Calling Function?

Sep 9, 2010

My calling application will accept only strings and interger. we are replacing RSA bsafe library to openssl. using RSA bsafe, we have generated the private and public key in BER format. Then convert the keys, BER format into ASCII format to send the calling function. (these everything done by using RSA supplied bsafe library) same way i have to right using openssl..i m now able convert the RSA public and private key into DER format

rsa = RSA_generate_key(1024, 3, NULL, NULL);
{
size_t size;

[code]....

View 1 Replies View Related

Programming :: Sending Video Stream From Webcam To Online Computer

Mar 16, 2009

How could I (using c++ language on linux machine) put media stream (like mpeg4 movie) into the udp packets and send it to other computer in the network?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved