Kranu,
I made some slight modifications to your script. Nothing major, just makes it a little easier to see how to get the kindle to connect.
http://pastebin.com/Q6ipRm78
----
Here is a "better" way to get the ip, but I can't get the white space out between the IP and the port. If I can figure out a way to get rid of the white space, I'll post it up on pastebin again. And yes, I'm sure there is a much cleaner way to do this, but I'm not *that* familiar with awk. Anyway, you can see what I'm getting at:
Code:
os.system("/sbin/ifconfig | grep inet | grep -v inet6 | grep -v 127 | awk '{ sub(/inet addr:/, \"\"); print }' | awk '{ sub(/Bcast:.............../, \"\"); print }' | awk '{ sub(/M................./, \"\"); print }' | awk '{print $0,\":8000\"}'")
Ha, nevermind, I figured it out. Here is the 'correct' (if not very clean) way to do it:
Code:
os.system("/sbin/ifconfig | grep inet | grep -v inet6 | grep -v 127 | awk '{ sub(/inet addr:/, \"\"); print }' | awk '{ sub(/Bcast:.............../, \"\"); print }' | awk '{ sub(/M................./, \"\"); print }' | awk '{print $1,\":8000\"}' |awk '{ sub(/ /, \"\"); print }'")
... and here is the pastebin:
http://pastebin.com/2zTgPLFA