How can I code in python with a public and private key? - python

I am trying to code with public and private key. However I keep getting a error when I am trying to encrypt. this is what i have so far:
import random
Primes = [2,3,5,7,9,11,13,15]
p = random.choice(Primes)
q = random.choice(Primes)
n = p*q
z = (p-1)*(q-1)
deck = list(range(1,z))
e = random.choice(deck)
d = (z + 1)/e
a= divmod(d*e,z)
PublicKey = (e,n)
PrivateKey = (d,n)
input = raw_input ('Write text: ')
input = input.lower()
message = []
for character in input:
number = ord(character)
message.append(number)
#Encrypt
for character in message:
c = message**e % n
#Decrypt
for character in c:
decryption = c**d % n
The program is running fine until I get by the encryption part. The error I got is:
Traceback (most recent call last):
File "C:/Python27/rsa2.py", line 30, in <module>
c = message**e % n
TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'

Related

TypeError: string indices must be integers inpython

here is my code:
import time
ed = input('Encrypt (e) or decrypt (d)? ')
chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
charsLen = len(chars)
def numberToStr(num):
s = ""
while num:
s = chars[num % charsLen] + s
num //= charsLen
return(s)
def strToNumber(numStr):
num = 0
for i, c in enumerate(reversed(numStr)):
num += chars.index(c) * (charsLen ** i)
return(num)
def enc():
key = input('What is your key? (Alphanumeric and space) ')
ID = int(input('What is your ID? (0-9, 3+ digits) '))
inp = int(strToNumber(input('What do you want to encrypt? ')))
keyAsNum = int(strToNumber(key))
enc.asint = inp ** 2
enc.asint = enc.asint * ID
enc.asint = enc.asint - keyAsNum
enc.astext = numberToStr(int(enc.asint))
return(enc)
def dec():
key = input('What is your key? (Alphanumeric and space) ')
ID = int(input('What is your ID? (0-9, 3+ digits) '))
inp = int(strToNumber(input('What do you want to decrypt? ')))
keyAsNum = int(strToNumber(key))
message = inp + keyAsNum
message = message // ID
message = math.sqrt(message)
message = numberToStr(message)
return(message)
if ed=='e':
crypt = enc()
print('crypt.asint:\n' + str(crypt.asint) + '\ncrypt.astext:\n' + crypt.astext)
elif ed=='d':
crypt = dec()
print(crypt)
time.sleep(10)
and here is the error:
File "stdin", line 5, in module
File "stdin", line 9, in dec
File "stdin", line 4, in numberToStr
TypeError: string indices must be integers
I cannot figure out why it is throwing this error and cannot find anything on google.
The traceback tells you exactly what is wrong. You are doing
s = chars[num % charsLen] + s
but you don't know for sure that num is an int because, previously, you do:
message = math.sqrt(message)
message = numberToStr(message)
What type does math.sqrt return?

TypeError: unsupported operand type(s) for *: 'builtin_function_or_method' and 'int'

I have a code, which implements Perceptron manually. Unfortunately, I am receiving an error that I have no knowledge of how to fix it...
I searched and saw that this error normally occurs when a method is used and is not called, but in this point, I do not know where is any method I should be calling in the error line.
My code is here:
import random
class Perceptron:
def __init__(self, amostras, saidas, taxa_aprendizado = 0.1, epocas = 1000, limiar = -1):
self.amostras = amostras
self.saidas = saidas
self.taxa_aprendizado = taxa_aprendizado
self.epocas = epocas
self.limiar = limiar
self.n_amostras = len(amostras)
self.n_atributos = len(amostras[0])
self.pesos = []
def treinar(self):
for amostra in self.amostras:
amostra.insert(0, -1)
for i in range(self.n_atributos):
self.pesos.append(random.random)
self.pesos.insert(0, self.limiar)
n_epocas = 0
while True:
erro = False
for i in range(self.n_amostras):
uzin = 0
for j in range(self.n_atributos + 1):
uzin += (self.pesos[j])*(self.amostras[i][j])
y = self.degrau(uzin)
if y != saidas[i]:
erro_aux = self.saidas[i] - y
for j in range(self.n_atributos + 1):
uzin += self.pesos[j] + (self.taxa_aprendizado) * (erro_aux) * (self.amostras[i][j])
erro = True
n_epocas +=1
if not erro or n_epocas > self.epocas:
break
print(self.pesos)
def degrau(self, u):
if u >=0:
return 1
else:
return 0
entradas = [[0,0], [0,1], [1,0], [1,1]]
saidas = [0,1,1,1]
rede = Perceptron(entradas, saidas)
rede.treinar()
print(rede.amostras)
Traceback (most recent call last): File
"C:/Users/nick/PycharmProjects/CursoMachineLearning/redes_neurais/perceptronzin.py",
line 58, in
rede.treinar() File "C:/Users/nick/PycharmProjects/CursoMachineLearning/redes_neurais/perceptronzin.py",
line 31, in treinar
uzin += (self.pesos[j])*(self.amostras[i][j]) TypeError: unsupported operand type(s) for *: 'builtin_function_or_method' and
'int'
In line 19 you created a list of function objects instead of floats.
Use:
self.pesos.append(random.random())
instead of
self.pesos.append(random.random)

Traceback (most recent call last) & TypeError: unsupported operand type(s) for +: 'int' and 'str'

#!/usr/bin/python
import time
import random
import struct
import select
import socket
def chk(data):
x = sum(x << 8 if i % 2 else x for i, x in enumerate(data)) & 0xFFFFFFFF
x = (x >> 16) + (x & 0xFFFF)
x = (x >> 16) + (x & 0xFFFF)
return struct.pack('<H', ~x & 0xFFFF)
def ping(addr, timeout=1, number=1, data=b''):
conn = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)
payload = struct.pack('!HH', random.randrange(0, 65536), number) + data
conn.connect((addr, 80))
conn.sendall(b'\x08\0' + chk(b'\x08\0\0\0' + payload) + payload)
start = time.time()
while select.select([conn], [], [], max(0, start + timeout - time.time()))[0]:
data = conn.recv(65536)
if len(data) < 20 or len(data) < struct.unpack_from('!xxH', data)[0]:
continue
if data[20:] == b'\0\0' + chk(b'\0\0\0\0' + payload) + payload:
return time.time() - start
if __name__ == '__main__':
target = raw_input("Please enter a IP Adress: ")
print(ping(target))
I have tried to script which works for creating packet and send to icmp packet. I got the error the result of the script is shown below:
# python Pinger.py
Please enter a IP Adress: 89.1.3.2
Traceback (most recent call last):
File "Pinger.py", line 35, in <module>
print(ping(target))
File "Pinger.py", line 22, in ping
conn.sendall(b'\x08\0' + chk(b'\x08\0\0\0' + payload) + payload)
File "Pinger.py", line 11, in chk
x = sum(x << 8 if i % 2 else x for i, x in enumerate(data)) & 0xFFFFFFFF
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Can you help m to resolve TypeError and Traceback?
checkout this !
data = b'\0\0\0\0'
list(enumerate(data))
>>> [(0, '\x00'), (1, '\x00'), (2, '\x00'), (3, '\x00')]
you missed here
x = sum(x << 8 if i % 2 else x for i, x in enumerate(data)) & 0xFFFFFFFF
^ << also raise TypeError ^ this is str
I guess, the reason of TypeError, function sum may use + operator.

Python encryption and decryption

I trying to use a Python script to decrypt a message. I have the cipher text (noted as FLAG in code) and most of the Python code used for encryption. I need to find the original plaintext message. Below I am trying to build a decode function into my Python code but failing (novice to Python). Can any genius help?
Here's the code so far:
import string
import random
from base64 import b64encode, b64decode
FLAG = '313312Mw16RXtNmlF2TVRmU1pIQxxmnTxtV1ZWV2JFOXBSnFwkVTI5o1ZGWxpXmxZWTVZmM1RWWyFwnFZ4Y0ZCWFJYUwjWRxJPVvA1p1NXTxpvRUbUWxROQ1RGoEpXmlxOY0ZWmFbdZDRVMVx4V2fwV2NGWvNmm1bXZUU5VVJdNVpWRVbNVxRJqFIjUzpTnGjVY1tSWFRXODFTMWRVUVpKVE1VWxtWRlsjYxZKV1pgWxZNV2tYV1ZmT1pGm3bwRxZXVvJ4UFZYRvRvnWjXVGfeU2IjWyFUVyRTVEZem1NdpGjvVxbmVTI5p2IjWxZwRXRVVyjipxZGZFNSMVZ2ZEZOnE1gZlBWnTVDTUZNqFRgVy1SqwZVVWfWWxxeWzZuRTViVyjWmFaiVvBWnVZdUyejVw1HmFtWMFbXUy1VqyJGVxpmRxwkVy5CV1IkVzpUnGtUY1tSp1ZeZFNwVxV4YUpWVGJ6RvJUVxV4VwZKWVFeVxpSnFalVxRGVxbHZEZOVlVXY1ZKRVZYQxpwMVJ4U25eVGNFNVBWmwEiWVZmVVNfOVVvRTVZVy5CT2JVMUVSnFbYVwVmVFV6Rw9wMXBJY0ZOnVJUVxbWVlVCWW1WqFZeZFJuM2tXVFo4MU1GVXxNVTxfY0VmWxZYQxNmV2j3U2feVw1GWxtVqwbOWVpmRw5XMVtSnHBUVyfSQ1xVMUpUV1JfUvNSVVZfOWFWVyf5TxZwnFZUVxpmMFZ3V2eiqFpgWxZNVzBQVwtCn2RfWwtvRxZYUxtSTVYkOW9UMU53UyjmnVJFWzVmVEZtZDFWp1ZdpFRvRlxdVy01V1pHWwZOVTxWTU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pVMxb3V2jWWFZFm3ttWEJXZGjKpyVGTxpNRFYjV2jwNGQjTXpPVytYYvNaYVRVUwpNVzBHV2e5T1ZdNVbWVlw0VvAjSVVdpFtWnHB2VvFmS1ZWSzZTnTFfYzbWVxZURxpZVTFHVxpOYVNFWxVmVEbTV1ZiWGQkSxRNnEbZVGjSQ1ZeWxVSm3RmWwU1SFUlQw5ZVTFYY0ZSWFJWoE9WRxbWWW1ap1VdmFZWRxbUVFZaQ1MjWwpVnE'
enc_ciphers = ['rot13', 'b64e', 'caesar']
dec_ciphers = ['rot13', 'b64d', 'caesard']
def rot13(s):
_rot13 = string.maketrans(
"zyxwvutsrqponZYXWVUTSRQPONmlkjihgfedcbaMLKJIHGFEDCBA",
"mlkjihgfedcbaMLKJIHGFEDCBAzyxwvutsrqponZYXWVUTSRQPON")
return string.translate(s, _rot13)
def b64e(s):
return b64encode(s)
def b64d(s):
return b64decode(s)
def caesar(plaintext, shift=4):
alphabet = string.ascii_lowercase
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
table = string.maketrans(alphabet, shifted_alphabet)
return plaintext.translate(table)
def caesard(plaintext, shift=-4):
alphabet = string.ascii_lowercase
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
table = string.maketrans(alphabet, shifted_alphabet)
return plaintext.translate(table)
def encode(pt, cnt=50):
tmp = '2{}'.format(b64encode(pt)) #2.format(b64encode(pt))
for cnt in xrange(cnt):
c = random.choice(enc_ciphers) # choose some enc_cipher
i = enc_ciphers.index(c) + 1 # position in the array + 1
_tmp = globals()[c](tmp)
tmp = '{}{}'.format(i, _tmp)
return tmp
def decode(tmp, cnt=50):
for cnt in xrange(cnt):
i = int(tmp[:1])-1
_tmp = tmp[1:]
c = dec_ciphers[i]
tmp = globals()[c](_tmp)
try:
s = b64decode(tmp[1:])
if s.find("flag") != -1:
return s
except:
pass
return b64decode(tmp[1:])
if __name__ == '__main__':
cnt=70
print "Cnt: %d" % cnt
print decode(FLAG, cnt)
Here is the error message:
/usr/bin/python -u "/media/pc/A8560F93560F6204/Python investigation/transfer_csaw2015 fully MODDED2.py"
Cnt: 70
Traceback (most recent call last):
File "/media/pc/A8560F93560F6204/Python investigation/transfer_csaw2015 fully MODDED2.py", line 64, in <module>
print decode(FLAG, cnt)
File "/media/pc/A8560F93560F6204/Python investigation/transfer_csaw2015 fully MODDED2.py", line 47, in decode
i = int(tmp[:1])-1
ValueError: invalid literal for int() with base 10: 'W'

Rsa cipher error

I wrote the following code in python 3.4
import sys
DEFAULT_BLOCK_SIZE = 128
BYTE_SIZE = 256
def main():
filename = 'encrypted_file.txt'
mode = 'encrypt'
if mode == 'encrypt':
message = '''"Journalists belong in the gutter because that is where the ruling classes throw their guilty secrets." -Gerald Priestland "TheFounding Fathers gave the free press the protection it must have to bare the secrets of government and inform the people." -Hugo Black'''
pubKeyFilename = 'vineeth_pubkey.txt'
print('Encrypting and writing to %s...' % (filename))
encryptedText = encryptAndWriteToFile(filename, pubKeyFilename, message)
print('Encrypted text:')
print(encryptedText)
elif mode == 'decrypt':
privKeyFilename = 'vineeth_privkey.txt'
print('Reading from %s and decrypting...' % (filename))
decryptedText = readFromFileAndDecrypt(filename, privKeyFilename)
print('Decrypted text:')
print(decryptedText)
def getBlocksFromText(message, blockSize=DEFAULT_BLOCK_SIZE):
messageBytes = message.encode('ascii')
blockInts = []
for blockStart in range(0, len(messageBytes), blockSize):
blockInt = 0
for i in range(blockStart, min(blockStart + blockSize, len(messageBytes))):
blockInt += messageBytes[i] * (BYTE_SIZE ** (i % blockSize))
blockInts.append(blockInt)
return blockInts
def getTextFromBlocks(blockInts, messageLength,blockSize=DEFAULT_BLOCK_SIZE):
message = []
for blockInt in blockInts:
blockMessage = []
for i in range(blockSize- 1, -1, -1):
if len(message) + i < messageLength:
asciiNumber = blockInt // (BYTE_SIZE ** i)
blockInt = blockInt % (BYTE_SIZE ** i)
blockMessage.insert(0, chr(asciiNumber))
message.extend(blockMessage)
return ''.join(message)
def encryptMessage(message, key, blockSize=DEFAULT_BLOCK_SIZE):
encryptedBlocks = []
n, e = key
for block in getBlocksFromText(message, blockSize):
encryptedBlocks.append(pow(block, e, n))
return encryptedBlocks
def decryptMessage(encryptedBlocks, messageLength, key, blockSize=DEFAULT_BLOCK_SIZE):
decryptedBlocks = []
n, d = key
for block in encryptedBlocks:
decryptedBlocks.append(pow(block, d, n))
return getTextFromBlocks(decryptedBlocks, messageLength, blockSize)
def readKeyFile(keyFilename):
fo = open(keyFilename)
content = fo.read()
fo.close()
keySize, n, EorD = content.split(',')
return (int(keySize), int(n), int(EorD))
def encryptAndWriteToFile(messageFilename, keyFilename, message, blockSize=DEFAULT_BLOCK_SIZE):
keySize, n, e = readKeyFile(keyFilename)
if keySize < blockSize * 8:
print'ERROR: Block size is %s bits and key size is %s bits. The RSA cipher requires the block size to be equal to or less than the key size. Either increase the block size or use different keys.' % (blockSize * 8, keySize)
sys.exit()
encryptedBlocks = encryptMessage(message, (n, e), blockSize)
for i in range(len(encryptedBlocks)):
encryptedBlocks[i] = str(encryptedBlocks[i])
encryptedContent = ','.join(encryptedBlocks)
encryptedContent = '%s_%s_%s' % (len(message), blockSize, encryptedContent)
fo = open(messageFilename, 'w')
fo.write(encryptedContent)
fo.close()
return encryptedContent
def readFromFileAndDecrypt(messageFilename, keyFilename):
keySize, n, d = readKeyFile(keyFilename)
fo = open(messageFilename)
content = fo.read()
messageLength, blockSize, encryptedMessage = content.split('_')
messageLength = int(messageLength)
blockSize = int(blockSize)
if keySize < blockSize * 8:
print 'ERROR: Block size is %s bits and key size is %s bits. The RSA cipher requires the block size to be equal to or less than the keysize. Did you specify the correct key file and encrypted file?' % (blockSize * 8, keySize)
encryptedBlocks = []
for block in encryptedMessage.split(','):
encryptedBlocks.append(int(block))
return decryptMessage(encryptedBlocks, messageLength, (n, d), blockSize)
if __name__ == '__main__':
main()
It generates the following error when used in python 2.7
Traceback (most recent call last):
File "E:\Python27\My programs\rsa.py", line 94, in <module>
main()
File "E:\Python27\My programs\rsa.py", line 11, in main
encryptedText = encryptAndWriteToFile(filename, pubKeyFilename, message)
File "E:\Python27\My programs\rsa.py", line 69, in encryptAndWriteToFile
encryptedBlocks = encryptMessage(message, (n, e), blockSize)
File "E:\Python27\My programs\rsa.py", line 46, in encryptMessage
for block in getBlocksFromText(message, blockSize):
File "E:\Python27\My programs\rsa.py", line 27, in getBlocksFromText
blockInt += messageBytes[i] * (BYTE_SIZE ** (i % blockSize))
TypeError: unsupported operand type(s) for +=: 'int' and 'str'
Could anyone help in troubleshooting this code so that it works in python 2.7?
Thanks!
P.S It worked in python 3.4.
Look at the error
TypeError: unsupported operand type(s) for +=: 'int' and 'str'
It is derived from
File "E:\Python27\My programs\rsa.py", line 27, in getBlocksFromText
blockInt += messageBytes[i] * (BYTE_SIZE ** (i % blockSize))
You are trying to and operation on a int and a string. You need to convert either of them to the same type
numbers = 12345
letters = 'abcde'
num_letters = '12345'
# this works:
str(numbers)
int(num_letters)
# this doesn't work:
int(letters)

Categories

Resources