Skip to content

Instantly share code, notes, and snippets.

View spellancer's full-sized avatar

Sarkis Nanyan spellancer

  • Russian Federation
View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pprint import pprint
inp = [
{
'type': 'input',
'result': ['a','b','c','d','e','f']
},
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pprint import pprint
inp = [
{
'type': 'input',
'result': ['a','b','c','d']
},
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pprint import pprint
inp = [
{
'type': 'input',
'result': ['a','b','c','d']
},
@spellancer
spellancer / lab5_g.rb
Created May 1, 2014 12:13
XOR cipher
# Гаммирование
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
@spellancer
spellancer / lab5_1.rb
Created May 1, 2014 10:29
Gronsfeld Cipher
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
@spellancer
spellancer / lab5.rb
Created May 1, 2014 10:29
Cipher Caesar
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
# Нанян Саркис АК5-81
# Лабораторная работа № 4. Защита информации
km = false
def kword(sz)
kk = false
while !kk
keyword = gets
keyword.chomp!
if keyword.length == sz
# -*- 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:
@spellancer
spellancer / is3.py
Created April 3, 2014 14:18
lab3_infsecure
# -*- 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}
@spellancer
spellancer / is2.py
Last active August 29, 2015 13:58
lab2.last infsecure
# -*- 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]