Skip to content

Instantly share code, notes, and snippets.

@imebeh
Last active October 13, 2015 10:28
Show Gist options
  • Save imebeh/4182267 to your computer and use it in GitHub Desktop.
Save imebeh/4182267 to your computer and use it in GitHub Desktop.
河南网通用户名转换工具,可以用转换后的用户名直接进行PPPoE拨号,无需Racer客户端。
#coding: utf-8
#河南网通用户名转换工具,可以用转换后的用户名直接进行PPPoE拨号,无需Racer客户端。
def cncc_pppoe_username_decode(username):
u= username
k1='9012345678abcdeABCDEFGHIJKLMNfghijklmnUVWXYZxyzuvwopqrstOPQRST'
k2=[0x11,0x34,0xC9,0x23,0x75,0x18,0xD7,0xE2,0x12,0x35,0x29,0x2B,0xEC,0xB6,0x23,0x19]
r=[0 for x in range(0,len(u))]
a=37
b=0
for i in range(0, len(u)):
for j in range(0, len(k1)):
if u[i]==k1[j]:
#chars in k1
t= k2[i] if i<16 else k2[i % 16]
t= ((t ^ (a * 3)) ^ b) + j
r[i]= k1[t % 62]
a= a ^ ((t % 62) + 9433)
break
if r[i]==0:
#unlist chars
r[i]= k1[i]
b= b+ 5
return ''.join(r)
u=raw_input('username: ')
print 'your PPPoE account: 2:%s' % cncc_pppoe_username_decode(u)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment