sending a rip1 request via python

S

scripteaze

ok, im new to this sort of coding so excuse me if im not exactly sure
as to what i need to pull this off.

I need to be able to send a rip1 request to my rip1 enabled device.,
so i need python to send :

01 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
10

which is an RIP1 request and then have it respond back to me. im not
to worried about the returned format, but is there anyway to do this
in just a few lines of python?

i was looking at this page for ideas:

http://www.larsen-b.com/Article/206.html

its just one of the few google responses for : sending packets with
python.

any responses welcome, thanks :)
 
D

Dirk Loss

scripteaze said:
I need to be able to send a rip1 request to my rip1 enabled device.,
so i need python to send :
01 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
10

Use Scapy:

from scapy import *
myrip = RIP()/RIPEntry(metric=16)
ans, unans = sr(IP(dst="192.168.1.1")/UDP(sport=520)/myrip)

http://www.secdev.org/projects/scapy/

Regards
Dirk
 
S

scripteaze

Well, i use scapy quite often, however, this needs to be very portable
from one box to another with out the installation of extra

I was not finished, lol, for some reason my keyboard went haywire and
did its own thing. Anywho, scapy is out of the question. any code
examples? and also, whats the alternative.

thanks in advance
 
D

Dirk Loss

scripteaze said:
> Well, i use scapy quite often, however, this needs to be very portable

import socket
rip_request = '\x01\x01\x00\x00\x00\x02' + '\x00' * 17 + '\x10'
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(rip_request, ("servername", 520))
s.close()

If you also want to handle the replies, you might want to have a look at
the SocketServer module:

http://docs.python.org/lib/module-SocketServer.html

Regards
Dirk
 
S

scripteaze

ok i got everthing setup and its sending the packets, do i have to
create a socket server or cant i simply setup a buf = 1024 and recieve
the replies and display them, i dont need to interact, just view the
returned data if any, thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top