科专webvpn

科专webvpn

logo

声明

一切开发旨在学习请勿用于非法用途
by rick
关注 永雏塔菲喵

永雏塔菲

相关链接🔗

解密分析:https://xz.aliyun.com/t/11007

wrdvpn官网 :https://www.wrdtech.com/content/content.php?p=2_30_203

ps :某科专不配上榜是吧

image-20230531113025311

代码:

效果

image-20230531113653389

请先执行

 sudo pip3 install pycryptodome==3.9.7
from Crypto.Cipher import AES
from binascii import hexlify, unhexlify

key_ = b'wrdvpnisthebest!'
iv_  = b'wrdvpnisthebest!'
institution = 'webvpn.hnust.edu.cn'

def getCiphertext(plaintext, key = key_, cfb_iv = iv_, size = 128):

    message = plaintext.encode('utf-8')

    cfb_cipher_encrypt = AES.new(key, AES.MODE_CFB, cfb_iv, segment_size = size)
    mid = cfb_cipher_encrypt.encrypt(message)

    return hexlify(mid).decode()


def getPlaintext(ciphertext, key = key_, cfb_iv = iv_, size = 128):
    '''From ciphertext hostname to plaintext'''

    message = unhexlify(ciphertext.encode('utf-8'))

    cfb_cipher_decrypt = AES.new(key, AES.MODE_CFB, cfb_iv, segment_size = size)
    cfb_msg_decrypt = cfb_cipher_decrypt.decrypt(message).decode('utf-8')

    return cfb_msg_decrypt

    return message

def getVPNUrl(url):

    parts = url.split('://')
    pro = parts[0]
    add = parts[1]

    hosts = add.split('/')
    domain = hosts[0].split(':')[0]
    port = '-' + hosts[0].split(':')[1] if ":" in hosts[0] else ''
    cph = getCiphertext(domain)
    fold = '/'.join(hosts[1:])

    key = hexlify(iv_).decode('utf-8')

    return 'https://' + institution + '/' + pro + port + '/' + key + cph + '/' + fold

def getOrdinaryUrl(url):

    parts = url.split('/')
    pro = parts[3]
    key_cph = parts[4]

    if key_cph[:16] == hexlify(iv_).decode('utf-8'):
        print(key_cph[:32])
        return None
    else:
        hostname = getPlaintext(key_cph[32:])
        fold = '/'.join(parts[5:])

        return pro + "://" + hostname + '/' + fold

if __name__ == '__main__':
    url="https://blog.rick.icu"
    print('From ordinary url: \n' + getVPNUrl(url))
    print('From vpn url: \n' + getOrdinaryUrl(getVPNUrl(url)))


  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值