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
fr = open('input.txt','r') | |
fw = open('output.txt','w') | |
line = fr.readline() | |
a = [] | |
i=0 | |
while len(line)!=0: | |
line = fr.readline() | |
i+=1 | |
line = line.split() | |
if len(line)!=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
#include <iostream> //Подключение библиотеки ввода-вывода | |
#include <math.h> //Подключение доп.библиотеки с мат. функциями (для вызова fabs() - взятия модуля числа. | |
using namespace std; | |
int main() // функция, основная часть программы, где {} - тело функции | |
{ | |
int a,b,s,max=0,ii; // объявление вспомогательных переменных типа int | |
// где а и б хранят промежуточные значения, s - хранит сумму цифр текущего элемента массива | |
// max -- хранит максимальную сумму цифр |
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
fin = open("input.xml", "r") | |
fout = open("output.xml","w") | |
a = fin.readlines() | |
for i in a: | |
if i.find("<type")!=-1 and i.find("<boot")==-1: | |
fout.write(i) | |
fout.write("<boot dev='hd'/>\n") | |
elif i.find("<kernel>")==-1 and i.find("<initrd>")==-1 and i.find("<cmdline>")==-1: |
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
fin = open("input.xml", "r") | |
a = fin.readline() | |
l = "" | |
kk = False | |
while len(a)!=0: | |
a = fin.readline() | |
if a.find("<kernel>")!=-1 and kk==False: | |
p = a.find("<kernel>") | |
for i in range(0,p): | |
l+= " " |
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
import socket | |
fr = open ("access.log", "r") | |
fw = open ("output.txt","w") | |
c = 0 | |
l = fr.readlines() | |
for i in l: | |
a = i.split() | |
try: |
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
import re | |
fr = open ("access.log", "r") | |
fw = open ("output.txt","w") | |
pipv4 = re.compile ("^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9][0-9]|[0-9])((\.25[0-5]|\.2[0-4][0-9]|\.1[0-9][0-9]|\.[0-9][0-9]|\.[0-9]){3}) ") | |
c = 0 | |
l = fr.readlines() | |
for i in l: |
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
#!/bin/bash | |
crsa=$(openssl rsa -noout -modulus -in input.txt | openssl md5) | |
ccer=$(openssl x509 -noout -modulus -in input.txt | openssl md5) | |
if [ "$crsa" == "$ccer" ]; then | |
echo "1" | |
else | |
echo "0" | |
fi |
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
#!/bin/bash | |
check=$(openssl verify input.txt| grep "self signed certificate") | |
if [ -n "$check" ]; then | |
echo "1" | |
else | |
echo "0" | |
fi | |
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
import subprocess | |
fout = open("output.txt","w") | |
s = subprocess.Popen (["openssl","verify","input.txt"], stdout=subprocess.PIPE) | |
out = s.stdout.read() | |
if "self signed certificate" in out: | |
r = 1 | |
else: | |
r = 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
import tarfile, re | |
cpusage = re.compile ("sys/fs/cgroup/cpuacct/lxc/.*/cpuacct.usage$") | |
ainput = tarfile.open ("input.tgz","r:gz") | |
res_value = 0 | |
for i in ainput: | |
if cpusage.search(i.name)!=None: | |
l = ainput.extractfile(i.name) | |
current = int(l.readline()) | |
if (current > res_value): |