views:

110

answers:

0

Dear All,

I want to write a script for network security IP scan porpose, such a tool may need spoofing it's host NIC status for testing purpose, for example, to setup NIC's ip address, to setup DNS address, while to setup hostname, MAC address and enable/disable the NICs adapter.

I googled and found most soultion is using "popen" invoking system existing tools such as

>>> import os
>>> p=os.popen("/sbin/ifconfig eth0")
>>> t=p.read()
>>> p.close() 

to get return from system. Also there's modules can reading the status of the NIC, such as netifaces, but seems all of them are "READ ONLY" but can not wirte directly.

Since I found no modules can setup the NIC status directly, then I asks help here to see if someone can give a hand or show a more better way.

Any hints will be appricated. Thanks!

Rgs KC