Re: Ping and ARP on both Win and Linux in Python



On Mar 13, 9:14 pm, "Mauro \"Baba\" Mascia" <baba_...@xxxxxxxx> wrote:
Hi, this is my question:

I want to know if several switch (about 50) in a big lan are up and then
know their MAC addresses to do a list that contains host name, ip and mac.
I know only the range of their IP addresses (the host name it's simply
to know using socket.gethostn.

The first idea it's to ping all ip, parse the response and then execute
the command "arp -a" and parse the response.
However this way depends on the operating system and the ping response
depends too from the language.

Another way it's to open the main page of the switch and parse the HTML
code where i can find the MAC address.
However this way depends on the particular brand's switch.

I know (or better i think) that there is a third way: make ping and arp
building the packets with socket and so on (but i dont have understand
in what way do this).

Any suggestion?

(i've already search in google, found many sources but a lot of them
don't works or don't do what im trying to do...)

Regards,
Mauretto.

There are several Ping /ICMP implentations in Python. I did something
similar using a python ping module and parsing the arp cache. A
different approach may be to use SNMP. I believe there are Python
tools around.
.



Relevant Pages

  • Re: Find out a device by knowing IP
    ... cheap switch won't tell you anything about what's connected and where. ... to the router or somewhere from there, maybe with a switch/hub or similar. ... Next check "arp" to find out the MAC address. ... Go to the last router, unplug one cable, ping, if it is still ...
    (comp.security.misc)
  • Re: [fw-wiz] How to find hidden host within LAN
    ... identify this host within my LAN: ... if you ping do you get something like "host unknown" (means ethernet ... can't find the MAC) or or just no answer (he may have a firewall ... I assume you don't have a fancy switch that lets you trace ethernet ports... ...
    (Firewall-Wizards)
  • Routing Problem - 2900XL and 2950 Switches
    ... LAN has Switch A connected to Router. ... Can ping and tracert 192.168.2.8 and 192.168.2.226. ... MAC Address table on Switch A is populated. ...
    (comp.dcom.sys.cisco)
  • RE: Exploit code for IP Smart Spoofing
    ... If there is a MAC violation, this is logged and the port is ... traffic of one other host on the switch. ... but there is no way to protect against ...
    (Bugtraq)
  • Re: Network scanning
    ... > level before the switch will enable that port... ... > new MAC and disable the port. ... >> informieren Sie bitte sofort den Absender und vernichten ... Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich ...
    (Security-Basics)