#!/usr/bin/env python

import sys,os,thread,threading
import tweepy
import netifaces

CONSUMER_KEY = 'GvCF4RA5wnB1W25FvOfWvA'
CONSUMER_SECRET = '4NCGsZV6qqIEi0Ux4EI2yY1neTWifnY3pAHANlm5k'
ACCESS_KEY = '1654721785-78Eqt2R5uLvghITw3ux7GarSdtMdNGmG3eOnAWw'
ACCESS_SECRET = 'v6Q1zEpTpLOCbpn5ZJDV8as71yrARitY5m3COxXA'

def shell_cmd(cmd):
	_result = os.popen("su -c \"" + cmd + "\"").read()
	_result = _result.replace("\r","")
	_result = _result.replace("\n","")
	print(_result)
	return(_result)

def get_Gatewayroute -n | grep '^0\.0\.\0\.0[ \t]\+[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]\+[ \t]\+0\.0\.0\.0[ \t]\+[^ \t]*G[^ \t]*[ \t]' | awk '{print $2}':
	_result = shell_cmd("route -n | grep UG")
	return(_result)

myDate = shell_cmd("date +\"%Y%m%d:%H%M%S\"")
myHost = shell_cmd("hostname")
myUptime = shell_cmd("uptime")

myStatus = myHost + " > " + myUptime
print myStatus

#auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
#auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
#api = tweepy.API(auth)
#api.update_status(myStatus)

myGateway = get_Gateway
print myGateway

#myIP = shell_cmd("")
