#!/usr/bin/env python from c36 import SRP_client,i2s import hashlib import hmac import socket import os if __name__ == "__main__": NISTprime = 0xffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff print "Normal login:"******"127.0.0.1", 9001)) I,A = c.send1() client.send(str(I)+","+str(A)) data = client.recv(4096) salt,B = data.split(",") c.recv1(salt,int(B)) client.send(c.send2()) print client.recv(4096) client.shutdown(2) print "Attack A=0 (because of this S = 0):", client1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client1.connect(("127.0.0.1", 9001)) client1.send("[email protected],0")
#!/usr/bin/env python #coding:utf-8 import random from c36 import SRP_client,i2s import hashlib import hmac import socket import os if __name__ == "__main__": NISTprime = 0xc34f #定义大素数 print "Normal login:"******"127.0.0.1", 9001))#链接服务器 I,A = c.send1()#获取用户名和 公钥A client.send(str(I)+","+str(A)) #发送I和A data = client.recv(4096) salt,B = data.split(",") #接收服务器的数据传回的salt 和服务器公钥B c.recv1(salt,int(B)) #生成 u x s k client.send(c.send2()) #计算mac并发送 print client.recv(4096) #显示服务器返回的结果 client.shutdown(2) print "Attack A=0 (because of this S = 0):", client1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)