您现在所在的是:

人机界面

回帖:19个,阅读:1468 [上一页] [1] [2] [下一页]
10454
xlian
文章数:3232
年度积分:94
历史总积分:10454
注册时间:2002/5/7
发站内信
2018论坛热心网友
西门子PLC体验(二)
发表于:2016/3/23 8:35:21
#0楼
1、判断授权码时否过期
sub short Ecu_month_day(short year,short month)
select case(month)
case 1
return 31
break
case 2
if (((year % 4) == 0)and(year % 100 <> 0)) or ((year % 400) == 0) then
return 28
else
   return 29
end if
break
case 3
return 31
break
case 4
return 30
break
case 5
return 31
break
case 6
return 30
break
case 7
return 31
break
case 8
return 31
break
case 9
return 30
break
case 10
return 31
break
case 11
return 30
break
case 12
return 31
break

case else
break
end select

end sub
macro_command main()
short year,month,day
short oyear,omonth,oday
short lincesce_cir,NowLincesce_cir
short page,licence_tim

short mday

bool  done,en_sw

//GetData(NowLincesce_cir, "Local HMI", "licence_CR", 1)
GetData(lincesce_cir, "Local HMI", "licence_CR", 1)

GetData(year, "Local HMI", LW, 9022, 1)   //年


GetData(month, "Local HMI", LW, 9021, 1)   //月


GetData(day, "Local HMI", LW, 9020, 1)   //日

//获取授权时间
GetData(oyear, "Local HMI", "licence_year", 1)

GetData(omonth, "Local HMI", "licence_month", 1)

GetData(oday, "Local HMI", "licence_day", 1)


if(lincesce_cir == 0)then
//无设备编码
en_sw = 0
page = 124
SetData(page, "Local HMI", "SW_window", 1)
else if(lincesce_cir == 1)then
//无效授权
en_sw = 0
page = 121
SetData(page, "Local HMI", "SW_window", 1)



else if(lincesce_cir == 2)then
//获取当前系统时间
if(oyear > year) or ( (oyear == year)and ((omonth > month) or((omonth ==month)and(oday >= day))))then
mday = oday  - day
while(year < oyear)
while(month < 12)
mday = mday + Ecu_month_day(year, month)
month = month + 1
wend
mday = mday + Ecu_month_day(year, month)
month = 1
year  = year + 1
wend
while(month < omonth)
mday = mday + Ecu_month_day(year, month)
month = month + 1
wend

else
mday = oday  - day
while(oyear < year)
while(omonth < 12)
mday = mday - Ecu_month_day(year, month)
omonth = omonth + 1
wend
mday = mday - Ecu_month_day(year, month)
omonth = 1
oyear  = oyear + 1
wend

while(omonth <= month)
mday = mday - Ecu_month_day(year, month)
omonth = omonth + 1
wend

end if

if(mday < 1)then
//lincesce_cir = 1
page = 122    //授权过期
SetData(page, "Local HMI", "SW_window", 1)
en_sw  = 0
else if((mday >= 1)and(mday < 30))then
//GetData(licence_tim, "Local HMI", "dislicence_time", 1)
GetData(page, "Local HMI", LW, 9050, 1)
if(page <> 123)then
//if(licence_tim > 10)then
page = 123       //授权将过期
SetData(page, "Local HMI", "SW_window", 1)
end if
en_sw = 1
else if(mday>=30)then
en_sw = 1
end if

else if(lincesce_cir == 8)then
en_sw = 1
end if

SetData(en_sw, "Siemens S7-200 SMART PPI", "licence_en_M", 1)
SetData(en_sw, "Local HMI","licence_en", 1)
SetData(mday, "Local HMI","licence_mod_day", 1)



//if(NowLincesce_cir <> lincesce_cir)then
// SetData(lincesce_cir, "Local HMI", "licence_CR", 1)
//end if

end macro_command

2、设置识别码
macro_command main()
char   device[8]
char   j_device[16]
short  len
short  licence_cri,page,new_licence_cr
bool   done



GetData(device[0], "Local HMI", "key_device", 8)

GetData(licence_cri, "Local HMI", "licence_CR", 1)

len = StringLength(device[0])

if((len == 8)and(licence_cri == 0))then
done = 0
SetData(done, "Local HMI", "Execl_CreaDervice", 1)
SetData(device[0], "Local HMI", "licence_dervice", 8)
new_licence_cr = 1
SetData(new_licence_cr, "Local HMI", "licence_CR", 1)
page =  121
SetData(page, "Local HMI", "SW_window", 1)
else

end if

end macro_command
3、输入新的授权码
sub short Ecu_month_day(short year,short month)
select case(month)
case 1
return 31
break
case 2
if (((year % 4) == 0)and(year % 100 <> 0)) or ((year % 400) == 0) then
return 28
else
   return 29
end if
break
case 3
return 31
break
case 4
return 30
break
case 5
return 31
break
case 6
return 30
break
case 7
return 31
break
case 8
return 31
break
case 9
return 30
break
case 10
return 31
break
case 11
return 30
break
case 12
return 31
break

case else
break
end select

end sub


sub bool Excule_data(short year,short month,short day)
   bool ok
select case(month)
case 1
ok =  (day >= 1) and (day <= 31)
break
case 2
if (((year % 4) == 0)and(year % 100 <> 0)) or ((year % 400) == 0) then
ok =  (day >= 1) and (day <= 28)
else
   ok =  (day >= 1) and (day <= 29)
end if
break
case 3
ok =  (day >= 1) and (day <= 31)
break
case 4
ok =  (day >= 1) and (day < 31)
break
case 5
ok =  (day >= 1) and (day <= 31)
break
case 6
ok =  (day >= 1) and (day < 31)
break
case 7
ok =  (day >= 1) and (day <= 31)
break
case 8
ok =  (day >= 1) and (day <= 31)
break
case 9
ok =  (day >= 1) and (day < 31)
break
case 10
ok =  (day >= 1) and (day <= 31)
break
case 11
ok =  (day >= 1) and (day < 31)
break
case 12
ok =  (day >= 1) and (day <= 31)
break
case else
ok =  0
break
end select

ok = ok and ((year >= 2000) or (ok < 2999))

return ok
end sub



macro_command main()
//授权码格式
//授权时间4位年2位月2位日授权码8位校验码8位

//输入授权码,解析授权码
char jm[32]     //输入授权码
char rs[32]
char js[8] //校验码
char hm[8] //授权码
char hp[8] //原码

short year,month,day
short hyear,hmonth,hday
short oyear,omonth,oday
short len

short  page,year_j,month_j,licence_cir,new_licence_cr
short  day_j
bool   ok

ok = 0
SetData(ok, "Local HMI", "EXCULE_GetLicence", 1)

page = 0

GetData(licence_cir, "Local HMI", "licence_CR", 1)
GetData(jm[0], "Local HMI", "key_licence_code_1", 32)
GetData(js[0], "Local HMI", "licence_dervice", 8)
len  = StringLength(jm[0])

if(licence_cir == 1)or(licence_cir == 2)then
if(len == 32)then
//还原授权码
   ASCII2HEX(jm[0],hp[0],2 )
ASCII2HEX(jm[2],hp[1],2 )
ASCII2HEX(jm[4],hp[2],2 )
ASCII2HEX(jm[6],hp[3],2 )
ASCII2HEX(jm[8],hp[4],2 )
ASCII2HEX(jm[10],hp[5],2 )
ASCII2HEX(jm[12],hp[6],2 )
ASCII2HEX(jm[14],hp[7],2 )

ASCII2HEX(jm[30],hm[0],2 )
ASCII2HEX(jm[28],hm[1],2 )
ASCII2HEX(jm[26],hm[2],2 )
ASCII2HEX(jm[24],hm[3],2 )
ASCII2HEX(jm[22],hm[4],2 )
ASCII2HEX(jm[20],hm[5],2 )
ASCII2HEX(jm[18],hm[6],2 )
ASCII2HEX(jm[16],hm[7],2 )

hp[0] = hp[0] ^ js[0] ^ 0x66
hp[1] = hp[1] ^ js[0] ^ 0x99
hp[2] = hp[2] ^ js[0] ^ 0x66
hp[3] = hp[3] ^ js[0] ^ 0x99
hp[4] = hp[4] ^ js[0] ^ 0x66
hp[5] = hp[5] ^ js[0] ^ 0x99
hp[6] = hp[6] ^ js[0] ^ 0x66
hp[7] = hp[7] ^ js[0] ^ 0x99


ASCII2HEX(hp[4],hyear, 4)
ASCII2HEX(hp[2],hmonth, 2)
ASCII2HEX(hp[0],hday, 2)

SetData(hyear, "Local HMI", LW, 0, 1)
SetData(hmonth, "Local HMI", LW, 1, 1)
SetData(hday, "Local HMI", LW, 2, 1)

hm[0] = hm[0] ^ js[0] ^ 0x55
hm[1] = hm[1] ^ js[1] ^ 0xAA
hm[2] = hm[2] ^ js[2] ^ 0x55
hm[3] = hm[3] ^ js[3] ^ 0xAA
hm[4] = hm[4] ^ js[4] ^ 0x55
hm[5] = hm[5] ^ js[5] ^ 0xAA
hm[6] = hm[6] ^ js[6] ^ 0x55
hm[7] = hm[7] ^ js[7] ^ 0xAA


ASCII2HEX(hm[4],oyear, 4)
ASCII2HEX(hm[2],omonth, 2)
ASCII2HEX(hm[0],oday, 2)


SetData(oyear, "Local HMI", LW, 3, 1)
SetData(omonth, "Local HMI", LW,4, 1)
SetData(oday, "Local HMI", LW, 5, 1)

//获取系统时间
GetData(year, "Local HMI", LW, 9022, 1)
GetData(month, "Local HMI", LW, 9021, 1)
GetData(day, "Local HMI", LW, 9020, 1)

if(hyear == oyear)and(hmonth == omonth)and(hday == oday)and(Excule_data(hyear, hmonth, hday))then
//授权码正确
if(hyear > year) or ( (hyear == year)and ((hmonth > month) or((hmonth ==month)and(hday > day))))then
//授权有效
//改写控制
   
//写有效授权码
SetData(jm[0], "Local HMI", "licence_code_1", 32)
//写有效授权时间
SetData(hyear, "Local HMI", "licence_year", 1)
SetData(hmonth, "Local HMI", "licence_month", 1)
SetData(hday, "Local HMI", "licence_day", 1)
//如果授权时间大于1000天则不需要继续授权
day_j  = hday - day
month_j = month
year_j = year
while(year_j < hyear)
while(month_j < 13)
day_j = day_j + Ecu_month_day(year,month)
month_j = month_j + 1
wend
month_j = 1
year_j = year_j + 1
wend

while(month_j < hmonth)
day_j = day_j + Ecu_month_day(year,month)
month_j = month_j + 1
wend
SetData(day_j, "Local HMI", LW, 10, 1)
if(day_j >= 999)then
//取得永久授权
new_licence_cr = 8
SetData(new_licence_cr, "Local HMI", "licence_CR", 1)
else
new_licence_cr = 2
SetData(new_licence_cr, "Local HMI", "licence_CR", 1)
end if
page = 21
else
page = 127  //授权码无效
end if
else
page = 126  //授权码错误
end if
else
page = 125   //授权码格式错误
end if
end if

SetData(page, "Local HMI", "SW_window", 1)
end macro_command
10454
xlian
文章数:3232
年度积分:94
历史总积分:10454
注册时间:2002/5/7
发站内信
2018论坛热心网友
西门子PLC体验(二)
发表于:2016/3/23 8:38:54
#1楼
附件 %【$YP8J6$S%3T`A1T~X【~4S.jpg
附件 6UZ{37BPTKOKA5RPI`VVVSP.jpg
10454
xlian
文章数:3232
年度积分:94
历史总积分:10454
注册时间:2002/5/7
发站内信
2018论坛热心网友
西门子PLC体验(二)
发表于:2016/3/23 8:41:16
#2楼
生成授权码
sub short Ecu_month_day(short year,short month)
select case(month)
case 1
return 31
break
case 2
if (((year % 4) == 0)and(year % 100 <> 0)) or ((year % 400) == 0) then
return 28
else
   return 29
end if
break
case 3
return 31
break
case 4
return 30
break
case 5
return 31
break
case 6
return 30
break
case 7
return 31
break
case 8
return 31
break
case 9
return 30
break
case 10
return 31
break
case 11
return 30
break
case 12
return 31
break

case else
break
end select

end sub



macro_command main()
short mday,lday,lmonth
short year,month,day
char  ps[8]
char  jp[8]
char  js[8]
char  jm[32]
char  hm[32]
short slen
short page

GetData(year, "Local HMI", "licence_year", 1)
GetData(month, "Local HMI", "Licence_month", 1)
GetData(day, "Local HMI", "Licence_day", 1)

GetData(mday, "Local HMI", "licence_mod_day", 1)
GetData(ps[0], "Local HMI", "Key_Device_ID", 8)

if (Excule_data(year, month, day)== 1 ) then
slen = StringLength(ps[0])
if(slen == 8)then
if(mday > 0)then
day = mday + day
while(day > Ecu_month_day(year, month))
day = day - Ecu_month_day(year, month)
month = month + 1
if(month > 12)then
month = 1
year = year + 1
end if
wend
end if

SetData(year, "Local HMI", LW, 0, 1)
SetData(month, "Local HMI", LW, 1, 1)
SetData(day, "Local HMI", LW, 2, 1)

//获取原码
HEX2ASCII(year, jp[4], 4)
HEX2ASCII(month, jp[2], 2)
HEX2ASCII(day, jp[0], 2)
//生成识别码
js[0] = jp[0] ^ ps[0] ^ 0x55
js[1] = jp[1] ^ ps[1] ^ 0xAA
js[2] = jp[2] ^ ps[2] ^ 0x55
js[3] = jp[3] ^ ps[3] ^ 0xAA
js[4] = jp[4] ^ ps[4] ^ 0x55
js[5] = jp[5] ^ ps[5] ^ 0xAA
js[6] = jp[6] ^ ps[6] ^ 0x55
js[7] = jp[7] ^ ps[7] ^ 0xAA

//生成校验码
jp[0] = jp[0] ^ ps[0] ^ 0x66
jp[1] = jp[1] ^ ps[0] ^ 0x99
jp[2] = jp[2] ^ ps[0] ^ 0x66
jp[3] = jp[3] ^ ps[0] ^ 0x99
jp[4] = jp[4] ^ ps[0] ^ 0x66
jp[5] = jp[5] ^ ps[0] ^ 0x99
jp[6] = jp[6] ^ ps[0] ^ 0x66
jp[7] = jp[7] ^ ps[0] ^ 0x99
//生成授权码
HEX2ASCII(jp[0], jm[0], 2)
HEX2ASCII(jp[1], jm[2], 2)
HEX2ASCII(jp[2], jm[4], 2)
HEX2ASCII(jp[3], jm[6], 2)
HEX2ASCII(jp[4], jm[8], 2)
HEX2ASCII(jp[5], jm[10], 2)
HEX2ASCII(jp[6], jm[12], 2)
HEX2ASCII(jp[7], jm[14], 2)

HEX2ASCII(js[0], jm[30], 2)
HEX2ASCII(js[1], jm[28], 2)
HEX2ASCII(js[2], jm[26], 2)
HEX2ASCII(js[3], jm[24], 2)
HEX2ASCII(js[4], jm[22], 2)
HEX2ASCII(js[5], jm[20], 2)
HEX2ASCII(js[6], jm[18], 2)
HEX2ASCII(js[7], jm[16], 2)
//合成授权码


SetData(jm[0], "Local HMI", "licence_code_1", 32)
page = 11
else
page = 12
end if
else
page = 13
end if
SetData(page, "Local HMI", "Licence_window", 1)

end macro_command
10454
xlian
文章数:3232
年度积分:94
历史总积分:10454
注册时间:2002/5/7
发站内信
2018论坛热心网友
西门子PLC体验(二)
发表于:2016/3/23 8:42:44
#3楼
附件 SSVULQXQH【FHD4O}DDE)XI2.jpg
10454
xlian
文章数:3232
年度积分:94
历史总积分:10454
注册时间:2002/5/7
发站内信
2018论坛热心网友
西门子PLC体验(二)
发表于:2016/3/23 8:44:16
#4楼
生成授权码文件(威纶通触摸屏,宏指令)
附件:
[本地下载]
[此贴子已经被作者于2016/3/23 8:44:57编辑过]
14444
deweg
文章数:2039
年度积分:664
历史总积分:14444
注册时间:2005/6/10
发站内信
发表于:2016/3/23 8:50:13
#5楼
这个是好贴,要顶一下。
6871
lixuefeng7272
文章数:1153
年度积分:100
历史总积分:6871
注册时间:2009/12/9
发站内信
发表于:2016/3/23 9:20:06
#6楼
为了货款费尽心机,这世道真TMD的悲哀!说好的人与人之间的信任呢。
不要怕被别人利用,人家利用你说明你还有用
5704
qiuqianshu
文章数:715
年度积分:174
历史总积分:5704
注册时间:2014/2/19
发站内信
发表于:2016/3/23 9:30:19
#7楼
这也太强大了吧!
14813
liuhuoaaa
文章数:8568
年度积分:50
历史总积分:14813
注册时间:2007/6/11
发站内信
发表于:2016/3/23 10:19:55
#8楼
这是好东西 谢谢楼主的分享!
25125
wenquan753
文章数:15253
年度积分:56
历史总积分:25125
注册时间:2006/10/18
发站内信
2018论坛解答高手
发表于:2016/3/23 10:22:06
#9楼
这个不能破解了吗?

关于我们 | 联系我们 | 广告服务 | 本站动态 | 友情链接 | 法律声明 | 非法和不良信息举报

工控网客服热线:0755-86369299
版权所有 工控网 Copyright©2024 Gkong.com, All Rights Reserved

93.6006