Can anyone guess what this is?
def routerGet(ip):
def snmpGet (ip, oidSpecific):
from os import popen
return popen("snmpget -v 1 -c public -O qv %s .1.3.6.1.2.1.%s" %(ip, oidSpecific)).read().strip('\n')
def ipAdEntAddr(ip):
from os import popen
return popen("snmpwalk -v 1 -c public -O qv %s .1.3.6.1.2.1.4.20.1.1" % ip).read().splitlines()
iAEA = ipAdEntAddr(ip)
for walk in iAEA:
if walk[:-1] <> '127.0.0.' and walk <> '0.0.0.0':
ipAdEntIfIndex = snmpGet(ip, '4.20.1.2.'+walk)
iAENM = '4.20.1.3.'+ walk
iD = '2.2.1.2.' + ipAdEntIfIndex
iT = '2.2.1.3.' + ipAdEntIfIndex
iS = '2.2.1.5.' + ipAdEntIfIndex
iIO = '2.2.1.10.' + ipAdEntIfIndex
iOO = '2.2.1.16.' + ipAdEntIfIndex
collect = map((lambda arg: apply(snmpGet, (ip, arg))), [iD, iT, iAENM, iS, iIO, iOO])
ethlist = ['EN1', 'Eth', 'eth', 'ETH', 'ie0']
wanlist = ['WAN', 'fra', '106', 'wan', 'ATM', 'FR-', '159']
if collect[0][:3] in wanlist or collect[1][:3] in wanlist:
iftype="WAN"
if walk[:3] == "10.":
iftype="WAN Management:"
elif collect[0][:3] in ethlist or collect[1][:3] in ethlist:
iftype="Ethernet"
print iftype
print "IP Address:", walk
print "Subnet Mask:", collect[2]
print "Interface Speed:", collect[3]
print "Octets In:", collect[4]
print "Octets Out:", collect[5], '\n'
It’s a script for extracting basic router network info from a router, namely SDSL/IDSL routers.
Maxims, rules of thumb and other observations on human cognition and sociocultural affectations
- What is said to humans directly is received with skepticism and considered with dubiousness while that which is heard in passing, especially that which most conforms to their mentality or prejudices, is readily believed.
- Humans have a certain cognitive latency between exposure to new information or experiences and the ability to think dispassionately and intellectually about it.
- Humans have a certain cognitive spectrum starting with the moment of exposure to new information or experiences and ending with some point at which the thing is effectively "in the past" for them.
- This cognitive spectrum is linked to the emotional process often referred to as shock, anger, denial and acceptance.
- The more and faster information or experiences are presented to people and the closer the quarters and the lesser the distance between people, the more their early reactions in the passionate emotional stage are reflected back to them in the manner of responses to those reactions from others in light of those responses.
- The more outrages which are suffered without sufficient time to allow emotional bleed-off, the farther the bar for subsequent reaction and outrage are pushed, and the more further events must progress before reaction and outrage.
- It is possible for serious detriments to eventually sit below this threshold for long enough for their damaging effects to build and multiply until their entire society undergoes some reactive convulsion.
Monday, March 27, 2006
Python code example for the heck of it...
Slashdot post of mine, feeling frisky and ticked tonight
Simple solution(Score:3)
by suitepotato (863945) on Monday March 27, @07:24PM (#15007488)
Design a computer with tcp/ip, http, ftp, etc native onboard with a basic interface. It connects and downloads whatever OS you want and installs it without an OS already being onboard beyond the "super bios" skeleton OS there for doing the aforementioned primary OS download. That ends the chicken and egg argument as to having to have one OS already on there to download the OS you really want. No more "Windows tax", no more preloaded PCs unless you order them that way. Everything is bare.
DRM? Fine, put it on there so that OSes that require authenticity of initial downloaded files have it to check themselves on install. Those OSes that don't, can ignore it. No other shenanigans linking the thing to only those OSes (cough, Windows, cough) that rigidly adhere to the dogma that the PC user should be the b*tch of an **AA organization.
We could have done this years ago with a simple thing like QNX onboard and finished all this crap. No muss, no fuss, no tears. Simple, easy, even a Geico caveman could do it.
Need an architecture to allow the formatting? Fine, default to FAT16 and put the primary files needed there, boot to them, they extract and build and reboot and then connect out to whatever secure servers are needed to get the rest, and finish the customer partitions and formats. This is not hard to do people.
Why does this sort of obviousness keep missing people? MS can do f-all about bundling. I don't care. I actually like them to bundle. F knows I DON'T want to have to deal with a mini-VS to compile every frigging Windows app I want to add. I like it being done already. I like having things already bundled compiled on Linux and being able to add whatever later.
Want to open a can of worms? Which serious Linux user ain't been farked by the distro coming by default with code bases that are completely wrong for something we want to use? Like the wrong net-snmp version to use with yapsnmp? Okay, uninstall, remove, reinstall, rebuild, fail that thirteen times, write off certain other things, make do. I never have to deal with this on Windows. No such thing. I'm reasonably certain writing a wrapper to put SNMP functions in Python or any other language would be a lot easier on Windows than on Linux where the slightest change in files totally fouls everything up.
Okay, I've ranted enough. The quick and dirty and ultimately best solution is right in front of us. Make the average personal computer "smart" enough to be able to go get an OS of the user's choice whenever they need. The standards and frameworks are already on the shelf. We would rather not do it in favor of bashing Microsoft and wrapping our Linux using selves in victimhood. Whatever. Not my bag. I have a night of recompiling to get to.
--
If my grammar and spelling are off, I am [distracted/tired/careless] (take your pick)