This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from pprint import pprint | |
inp = [ | |
{ | |
'type': 'input', | |
'result': ['a','b','c','d','e','f'] | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from pprint import pprint | |
inp = [ | |
{ | |
'type': 'input', | |
'result': ['a','b','c','d'] | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from pprint import pprint | |
inp = [ | |
{ | |
'type': 'input', | |
'result': ['a','b','c','d'] | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Гаммирование | |
class String | |
def ^( other ) | |
b1 = self.unpack("U*") | |
b2 = other.unpack("U*") | |
longest = [b1.length,b2.length].max | |
b1 = [0]*(longest-b1.length) + b1 | |
b2 = [0]*(longest-b2.length) + b2 | |
b1.zip(b2).map{ |a,b| a^b }.pack("U*") | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alpha = ('a'..'z').to_a | |
#num = (0..25).to_a | |
print alpha | |
puts | |
puts "Шифр Гронсфельда" | |
print "Введите исходный текст: " | |
text = gets | |
text.gsub!(/\s+/, '') | |
print "Введите ключ: " | |
key = gets.to_s.chop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alpha = ('a'..'z').to_a | |
#num = (0..25).to_a | |
print alpha | |
puts | |
puts "Шифр Цезаря" | |
print "Введите исходный текст: " | |
text = gets | |
text.gsub!(/\s+/, '') | |
print "Введите ключ: " | |
key = gets.to_i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Нанян Саркис АК5-81 | |
# Лабораторная работа № 4. Защита информации | |
km = false | |
def kword(sz) | |
kk = false | |
while !kk | |
keyword = gets | |
keyword.chomp! | |
if keyword.length == sz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Нанян Саркис АК5-81 | |
# ДЗ1 Защита информации. Расчет рисков | |
print "Расчет рисков\n" | |
"""k = False | |
while not k: | |
# r - режим работы, 1 или 3 угрозы | |
r = input("Введите 1 для режима с одной базовой угрозой и 3 для режима с тремя угрозами: ") | |
if r == 1 or r == 3: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Нанян Саркис АК5-81 | |
# Вариант 11, 5 субъектов 3 объекта | |
import random | |
# Массив пользователей системы | |
subjects = {'Michael':0, 'Gabriel':0, 'Raphael':0, 'Uriel':0,'Salaphiel':0} | |
# Массив объектов системы | |
objects = {'file1.doc':0, 'report.doc':0, 'config.txt':0} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Нанян Саркис АК5-81 | |
# Вариант 11, 5 субъектов 3 объекта | |
import random | |
# print random.randint(0,7) | |
# Функция вывода списка файлов с правами | |
def sprint(sb,ss=-1): | |
print '------------------------------------------------------------------------------------' | |
print "\nСписок файлов для пользователя %s: " % subjects[sb] |