Created
August 28, 2018 16:03
-
-
Save heisvoid/dc269e299429dd8ba144128d591700bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| import requests | |
| from lxml import html | |
| import sys | |
| def main(): | |
| ap = argparse.ArgumentParser(description="Get cell phone usage from AMobile.") | |
| ap.add_argument("-i", required=True, help="User ID", dest="id") | |
| ap.add_argument("-p", required=True, help="User Password", dest="pw") | |
| args = ap.parse_args() | |
| s = requests.Session() | |
| req = s.post("http://annextele.com/csmenu/login_act.asp", data = {"userid": args.id, "userpw": args.pw}) | |
| req = s.get("http://annextele.com/main.asp") | |
| tree = html.fromstring(req.content) | |
| call = tree.xpath('//li[@class="call"]/dl/dt/text()') | |
| call = call[0].split() | |
| call = int(float(call[0])) | |
| sms = tree.xpath('//li[@class="message"]/dl/dt/text()') | |
| sms = sms[0].split() | |
| sms = int(sms[0]) | |
| data = tree.xpath('//li[@class="data"]/dl/dt/text()') | |
| data = data[0].split() | |
| data = int(float(data[0])) | |
| if (30 > call) or (20 > sms) or (100 > data): | |
| print(str(data) + " " + str(call) + " " + str(sms)) | |
| return 0 | |
| if "__main__" == __name__: | |
| sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment