diff options
-rw-r--r-- | iv/orodja/ldmitm/Makefile | 5 | ||||
-rw-r--r-- | iv/orodja/ldmitm/ldmitm.c | 153 | ||||
-rw-r--r-- | iv/orodja/ldmitm/tcp_times.c | 1 | ||||
-rw-r--r-- | iv/orodja/ldmitm/tcp_times_example.c | 32 | ||||
-rw-r--r-- | iv/orodja/napad/.gitignore | 1 | ||||
-rw-r--r-- | iv/orodja/napad/config | 44 | ||||
-rwxr-xr-x | iv/orodja/napad/exploit.sh | 23 | ||||
-rwxr-xr-x | iv/orodja/napad/submission.py | 64 | ||||
-rw-r--r-- | iv/orodja/waf/Dockerfile | 6 | ||||
-rw-r--r-- | iv/orodja/waf/regexes.txt | 2 | ||||
-rw-r--r-- | iv/orodja/waf/waf.py | 85 | ||||
-rw-r--r-- | šola/ana1/prak.lyx | 1609 | ||||
-rw-r--r-- | šola/ana1/teor.lyx | 6 | ||||
-rw-r--r-- | šola/citati.bib | 15 | ||||
-rw-r--r-- | šola/članki/dht/dokument.lyx | 269 |
15 files changed, 2253 insertions, 62 deletions
diff --git a/iv/orodja/ldmitm/Makefile b/iv/orodja/ldmitm/Makefile index 4010899..1ef8a92 100644 --- a/iv/orodja/ldmitm/Makefile +++ b/iv/orodja/ldmitm/Makefile @@ -14,4 +14,7 @@ clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean rm ldmitm.so tcp_times_example -.PHONY: allmods clean +prepare: + apt install libsqlite3-dev linux-headers-generic + +.PHONY: allmods clean prepare diff --git a/iv/orodja/ldmitm/ldmitm.c b/iv/orodja/ldmitm/ldmitm.c index 66cba41..2b8b815 100644 --- a/iv/orodja/ldmitm/ldmitm.c +++ b/iv/orodja/ldmitm/ldmitm.c @@ -5,7 +5,7 @@ Kako deluje: https://tbrindus.ca/correct-ld-preload-hooking-libc/ Prevedi z: gcc -shared -fPIC -ldl ldmitm.c -o ldmitm.so Poženi z: LD_PRELOAD=$PWD/ldmitm.so php -S 0:1234 A je treba beležit execve in fopen? Po mojem ne. Odtekanje flagov itak vidimo v TCP sessionu. -TODO: add mutex locks!!! +TODO: add mutex locks, openssl bio mitm, read, write, rtt, timestamps (if possible), namesto trenutnega mtu rajši dobi advertised mss iz tcp_info, dobi last ack timestamp option value: https://elixir.bootlin.com/linux/v6.11-rc3/source/include/linux/tcp.h#L302 <= tu notri je mogoče z BPF??? */ #include <stdio.h> #include <dlfcn.h> @@ -18,20 +18,25 @@ TODO: add mutex locks!!! #include <netinet/in.h> #include <arpa/inet.h> #include <string.h> +#include <sys/param.h> +#include <netinet/ip.h> #if SQLITE_VERSION_NUMBER < 3037000 #error "we require sqlite newer than 3037000, yours is " #SQLITE_VERSION_NUMBER " --- because of STRICT!" #endif #define LOG(x, ...) if (getenv("LDMITM_LOG")) printf("[ldmitm %s] " x "\n", __func__ __VA_OPT__(,) __VA_ARGS__) struct stream { - bool active; - bool silenced; - int id; // id in sqlite3 database + bool active; // only stream connections are true, listening sockets and inactive fds are false + bool silenced; // only makes sense for stream connections, true to silence traffic + int id; // id in sqlite3 database -- only makes sense for stream connections + int bound; // for listening sockets: port, for stream sockets: fd of listening socket }; typedef int (*accept_t)(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len); typedef int (*close_t)(int fd); -static accept_t real_accept; -static close_t real_close; -static __thread sqlite3 * db = NULL; +typedef int (*bind_t)(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +static accept_t real_accept = NULL; +static close_t real_close = NULL; +static bind_t real_bind = NULL; +static sqlite3 * db = NULL; struct stream * streams = NULL; int streams_sizeof = 0; static void setup_db () { // should be able to ignore being called in case db is already set up on this thread @@ -74,8 +79,8 @@ static void setup_db () { // should be able to ignore being called in case db is LOG("failed to step create " name ": %s", sqlite3_errstr(ret)); \ goto fail; \ } - CREATE_TABLE("connections", "id INTEGER PRIMARY KEY, peer TEXT NOT NULL, accepted TEXT DEFAULT (strftime('%FT%R:%f', 'now')) NOT NULL, closed TEXT, silenced TEXT"); // accepted, closed and silenced are iso datestrings - CREATE_TABLE("messages", "connection INTEGER NOT NULL, direction INTEGER NOT NULL CHECK (direction IN (0, 1)), time TEXT DEFAULT (strftime('%FT%R:%f', 'now')) NOT NULL, FOREIGN KEY(connection) REFERENCES connections(id)"); + CREATE_TABLE("connections", "id INTEGER PRIMARY KEY, bound INTEGER NOT NULL, peer TEXT NOT NULL, accepted TEXT DEFAULT (strftime('%FT%R:%f', 'now')) NOT NULL, closed TEXT, silenced TEXT, mtu INTEGER NOT NULL"); // accepted, closed and silenced are iso datestrings, bound is listening port + CREATE_TABLE("messages", "connection INTEGER NOT NULL, direction INTEGER NOT NULL CHECK (direction IN (0, 1)), time TEXT DEFAULT (strftime('%FT%R:%f', 'now')) NOT NULL, rtt INTEGER NOT NULL, FOREIGN KEY(connection) REFERENCES connections(id)"); return; fail: if (db) @@ -114,6 +119,74 @@ static void end_stream (int fd) { // cleanup function, should be able to handle fail: memset(&(streams[fd]), 0, sizeof streams[fd]); } +static bool more_fds (int largest_fd) { + if (largest_fd >= streams_sizeof) { + int streams_sizeof_new; + if (streams_sizeof == 0) + streams_sizeof_new = 128; + else + streams_sizeof_new = streams_sizeof * 2; + struct stream * streams_new = realloc(streams, streams_sizeof_new*sizeof *streams); + if (!streams_new) { + LOG("ENOMEM realloc streams!"); + return false; + } + memset(streams_new+streams_sizeof, 0, (streams_sizeof_new-streams_sizeof)*sizeof *streams); + streams = streams_new; + streams_sizeof = streams_sizeof_new; + } + if (largest_fd < streams_sizeof) + return true; + return more_fds(largest_fd); +} +static int port_from_sa (const struct sockaddr * sa) { // gets port from sockaddr + switch (sa->sa_family) { + case AF_INET: + return ntohs(((struct sockaddr_in *) sa)->sin_port); + case AF_INET6: + return ntohs(((struct sockaddr_in6 *) sa)->sin6_port); + default: + return -1; + } +} +static void str_from_sa (char * peeraddress, const struct sockaddr * address) { + switch (address->sa_family) { + case AF_INET: + if (!inet_ntop(AF_INET, &(((struct sockaddr_in *) address)->sin_addr), peeraddress, *address_len)) { + int myerrno = errno; + strcpy(peeraddress, "!"); + strcat(peeraddress, strerror(myerrno)); + } + sprintf(peeraddress+strlen(peeraddress), "/%d", ntohs(((struct sockaddr_in *) address)->sin_port)); + break; + case AF_INET6: + if (!inet_ntop(AF_INET6, &(((struct sockaddr_in6 *) address)->sin6_addr), peeraddress, *address_len)) { + int myerrno = errno; + strcpy(peeraddress, "!"); + strcat(peeraddress, strerror(myerrno)); + } + sprintf(peeraddress+strlen(peeraddress), "/%d", ntohs(((struct sockaddr_in6 *) address)->sin6_port)); + break; + default: + strcpy(peeraddress, "unknown family"); + break; + } +} +int bind (int sockfd, const struct sockaddr * addr, socklen_t addrlen) { + if (!real_bind) + real_bind = dlsym(RTLD_NEXT, "bind"); + LOG("called bind()"); + int ret = real_bind(sockfd, addr, addrlen); + int old_errno = errno; + if (ret == -1) + goto fail; + if (!more_fds(sockfd)) + goto fail; // enomem + streams[sockfd].bound = port_from_sa(addr); +fail: + errno = old_errno; + return ret; +} int close (int fd) { if (!real_close) real_close = dlsym(RTLD_NEXT, "close"); @@ -130,56 +203,42 @@ int accept (int socket, struct sockaddr *restrict address, socklen_t *restrict a LOG("called accept()"); int ret = real_accept(socket, address, address_len); int saved_errno = errno; - if (ret >= streams_sizeof) { - int streams_sizeof_new; - if (streams_sizeof == 0) - streams_sizeof_new = 128; - else - streams_sizeof_new = streams_sizeof * 2; - struct stream * streams_new = realloc(streams, streams_sizeof_new*sizeof *streams); - if (!streams_new) { - LOG("ENOMEM realloc streams!"); - goto fail; - } - memset(streams_new+streams_sizeof, 0, (streams_sizeof_new-streams_sizeof)*sizeof *streams); - streams = streams_new; - streams_sizeof = streams_sizeof_new; - } + if (ret == -1) + goto fail; + if (!more_fds(MAX(ret, socket)) + goto fail; // enomem end_stream(ret); streams[ret].active = true; + streams[ret].bound = socket; setup_db(); if (db) { sqlite3_stmt * stmt = NULL; - int sqlret = sqlite3_prepare_v3(db, "insert into connections (peer) values (:p);", -1, 0, &stmt, NULL); + int sqlret = sqlite3_prepare_v3(db, "insert into connections (peer, bound, mtu) values (:p, :b, :m);", -1, 0, &stmt, NULL); if (sqlret != SQLITE_OK) { LOG("failed to prepare insert connections: %s", sqlite3_errstr(sqlret)); goto sqlfail; } char peeraddress[INET_ADDRSTRLEN+128]; - switch (address->sa_family) { - case AF_INET: - if (!inet_ntop(AF_INET, &(((struct sockaddr_in *) address)->sin_addr), peeraddress, *address_len)) { - int myerrno = errno; - strcpy(peeraddress, "!"); - strcat(peeraddress, strerror(myerrno)); - } - sprintf(peeraddress+strlen(peeraddress), "/%d", ntohs(((struct sockaddr_in *) address)->sin_port)); - break; - case AF_INET6: - if (!inet_ntop(AF_INET6, &(((struct sockaddr_in6 *) address)->sin6_addr), peeraddress, *address_len)) { - int myerrno = errno; - strcpy(peeraddress, "!"); - strcat(peeraddress, strerror(myerrno)); - } - sprintf(peeraddress+strlen(peeraddress), "/%d", ntohs(((struct sockaddr_in6 *) address)->sin6_port)); - break; - default: - strcpy(peeraddress, "unknown family"); - break; - } + str_from_sa(peeraddress, address); sqlret = sqlite3_bind_text(stmt, sqlite3_bind_parameter_index(stmt, ":p"), peeraddress, -1, SQLITE_STATIC); if (sqlret != SQLITE_OK) { - LOG("failed to bind insert connection: %s", sqlite3_errstr(sqlret)); + LOG("failed to bind insert connection text: %s", sqlite3_errstr(sqlret)); + goto sqlfail; + } + sqlret = sqlite3_bind_int64(stmt, sqlite3_bind_parameter_index(stmt, ":b"), streams[streams[ret].bound].bound); + if (sqlret != SQLITE_OK) { + LOG("failed to bind insert connection bound: %s", sqlite3_errstr(sqlret)); + goto sqlfail; + } + int mtu; + int mtusize = sizeof mtu; + if (getsockopt(socket, IPPROTO_IP, IP_MTU, &mtu, &mtusize) == -1) { + mtu = -errno; + LOG("failed to get MTU: %s", -mtu); + } + sqlret = sqlite3_bind_int64(stmt, sqlite3_bind_parameter_index(stmt, ":m"), mtu); + if (sqlret != SQLITE_OK) { + LOG("failed to bind insert connection mtu: %s", sqlite3_errstr(sqlret)); goto sqlfail; } sqlret = sqlite3_step(stmt); diff --git a/iv/orodja/ldmitm/tcp_times.c b/iv/orodja/ldmitm/tcp_times.c index 082d2d8..02a067a 100644 --- a/iv/orodja/ldmitm/tcp_times.c +++ b/iv/orodja/ldmitm/tcp_times.c @@ -28,7 +28,6 @@ if (ioctl(tcp_times, 0, &tt) == -1) { #include <linux/tcp.h> #include <linux/version.h> #include "tcp_times.h" -#define MIN(a,b) (((a)<(b))?(a):(b)) MODULE_AUTHOR("Anton Luka Šijanec <anton@sijanec.eu>"); MODULE_DESCRIPTION("tcp last received tsval, rtt procfs ioctl driver"); MODULE_LICENSE(""); diff --git a/iv/orodja/ldmitm/tcp_times_example.c b/iv/orodja/ldmitm/tcp_times_example.c index c98b29a..707bfce 100644 --- a/iv/orodja/ldmitm/tcp_times_example.c +++ b/iv/orodja/ldmitm/tcp_times_example.c @@ -12,7 +12,24 @@ Posluša na TCP vratih 6969, prejme eno povezavo, vsako sekundo nanjo izpiše LF #include <stdbool.h> #include <sys/ioctl.h> #include <fcntl.h> +#include <signal.h> +int samomor = 0; +void handler (int sig __attribute__((unused))) { + samomor = 1; +} int main (void) { + if (signal(SIGINT, handler) == SIG_ERR) { + perror("signal"); + return 1; + } + if (signal(SIGHUP, handler) == SIG_ERR) { + perror("signal"); + return 1; + } + if (signal(SIGTERM, handler) == SIG_ERR) { + perror("signal"); + return 1; + } int tcp_socket = socket(AF_INET6, SOCK_STREAM, 0); if (tcp_socket == -1) { perror("socket"); @@ -29,12 +46,12 @@ int main (void) { } if (listen(tcp_socket, 1 /* only one client is handled*/) == -1) { perror("listen"); - return 1; + goto die; } int flow = accept(tcp_socket, NULL, NULL); if (flow == -1) { perror("accept"); - return 1; + goto die; } int tcp_times = open("/proc/tcp_times", O_RDWR); struct tcp_times tt = { @@ -44,13 +61,20 @@ int main (void) { while (true) { if (ioctl(tcp_times, 0, &tt) == -1) { perror("ioctl"); - return 1; + break; } printf(TCP_TIMES_PRINTF_FORMAT "\n", TCP_TIMES_PRINTF_VARIABLES(tt.)); if (send(flow, &buf, 1, MSG_NOSIGNAL) == -1) { perror("write"); - return 1; + break; } + if (samomor) + break; sleep(1); } +die: + close(tcp_times); + close(flow); + close(tcp_socket); + return 1; } diff --git a/iv/orodja/napad/.gitignore b/iv/orodja/napad/.gitignore new file mode 100644 index 0000000..e417f8f --- /dev/null +++ b/iv/orodja/napad/.gitignore @@ -0,0 +1 @@ +flags.db diff --git a/iv/orodja/napad/config b/iv/orodja/napad/config new file mode 100644 index 0000000..371faed --- /dev/null +++ b/iv/orodja/napad/config @@ -0,0 +1,44 @@ +# Common config for exploit.sh and submission.py. +# It is to be sourced. It only sets environment variables. + +# ========================== +# ========= COMMON ========= + +export FLAG_REGEX="^[A-Z0-9]{31}=$" +export SUBMISSION_PORT=21502 + +# ========================== +# ======= EXPLOIT.SH ======= + +# Where can exploit.sh find submission.py. Port is a common setting. +export SUBMISSION_HOST=k.4a.si + +# Must be precise, not less than round duration. Used to calculate round id. +export ROUND_DURATION=120 + +# When does the game start (in UTC). Used to calculate current round id. +export GAME_START=2024-09-01T07:00:00 + +# ========================== +# ====== SUBMISSION.PY ===== + +export SUBMISSION_DB=flags.db + +# How much flags to send in one request. +# With 2560, if it takes 37 bytes per flag, 2560*37=94720 +# Ostane nam torej še dobrih 5280 za headerje, +# če je request limited na 100 kB +export SUBMISSION_MAX_FLAGS=2560 + +# PUT request, ECSC 2024 AD style +export SUBMISSION_URL=http://10.10.0.1:8080/flags + +# How many seconds to delay after a successful submission. +# With 15, we send at most 4 requests per minute out of 15 allowed. +export SUBMISSION_DELAY=15 + +# This is sent in X-Team-Token in requests to SUBMISSION_URL +export SUBMISSION_TEAM_TOKEN=e5152d70a4d18093cae8844f4e959cf1 + +# Where to bind to. Use SUBMISSION_PORT in common settings for port. +export SUBMISSION_BIND=:: diff --git a/iv/orodja/napad/exploit.sh b/iv/orodja/napad/exploit.sh new file mode 100755 index 0000000..1111b00 --- /dev/null +++ b/iv/orodja/napad/exploit.sh @@ -0,0 +1,23 @@ +#!/bin/sh +if [ x$1 = x ] +then +echo >&2 <<EOF +No command. Subcommands: + $0 once <exploit> # runs an exploit once, print captured flags + $1 loop <exploit> # runs an exploit in a loop once per round +<exploit> is an executable file. Flags, grepped from stdout, are submitted. +It is called for every target. Args are target IP and flag IDs JSON object. + Example: <exploit> 10.1.2.3 '{"user": "root", "pass": "hunter2"}' +Flag IDs are also available in the environment as variables FLAG_ID_<key>: + {"user": "root", "pass": "hunter2"} will be in environment as vars + FLAG_ID_user=root and FLAG_ID_pass=hunter2 +In loop mode, exploit is first exec'd rapidly for still valid old rounds. +Max execution time is $EXPLOIT_TIMEOUT seconds (EXPLOIT_TIMEOUT in config) +Exploits are NOT executed in parallel. +Make sure that your system time is set CORRECTLY TO THE SECOND, it's used + to get the current round id. Current time: `date`. +Configuration values are also available in environment of exploits. +EOF + exit 1 +fi +set -xeuo pipefail diff --git a/iv/orodja/napad/submission.py b/iv/orodja/napad/submission.py new file mode 100755 index 0000000..dcf75ca --- /dev/null +++ b/iv/orodja/napad/submission.py @@ -0,0 +1,64 @@ +#!/usr/bin/python3 +import os +import asyncio +import re +import sqlite3 +import aiohttp +db = sqlite3.connect(os.getenv("SUBMISSION_DB", "flags.db")) +db.execute("CREATE TABLE IF NOT EXISTS flags (id INTEGER PRIMARY KEY, flag TEXT NOT NULL UNIQUE, sent INTEGER NOT NULL DEFAULT 0, date TEXT DEFAULT (strftime('%FT%R:%f', 'now')) NOT NULL, status TEXT, msg TEXT) STRICT") +flag_regex = re.compile(os.getenv("FLAG_REGEX", "^[A-Z0-9]{31}=$").encode(), re.ASCII | re.DOTALL | re.VERBOSE) +async def submitter (): + while True: + print("submitter loop") + flags = [] + for row in db.execute("SELECT flag FROM flags WHERE sent == 0 ORDER BY date DESC"): + if len(flags) < int(os.getenv("SUBMISSION_MAX_FLAGS", "2560")): + flags.append(row[0]) + if len(flags) == 0: + await asyncio.sleep(1) + for i in [1]: + async with aiohttp.ClientSession(headers={"X-Team-Token": os.getenv("SUBMISSION_TEAM_TOKEN")}) as session: + async with session.put(os.getenv("SUBMISSION_URL", 'http://10.10.0.1:8080/flags'), json=flags) as response: + if response.status // 100 != 2: + print("submitter error: " + await response.text()) + break + cursor = db.cursor() + for obj in await response.json(): + cursor.execute("UPDATE flags SET sent=?, status=?, msg=? WHERE flag=?", [int(obj.get("status") != "RESUBMIT"), obj.get("status"), obj.get("msg"), obj.get("flag")]) + db.commit() + await asyncio.sleep(int(os.getenv("SUBMISSION_DELAY", "15"))) +async def handle_client (reader, writer): + while True: + incoming = await reader.readuntil(b'\n') + if len(incoming) == 0: + break + buffer = incoming.replace(b'\r', b'').replace(b'\n', b'') + if buffer.startswith(b' '): + for row in db.execute(buffer[1:].decode()): + writer.write(str(row).encode() + b'\n') + continue + if buffer.startswith(b'@'): + writer.write(str(db.execute(buffer[1:].decode()).fetchall()).encode() + b'\n') + continue + if buffer.startswith(b'#'): + writer.write(str(len(db.execute(buffer[1:].decode()).fetchall())).encode() + b'\n') + continue + if re.match(flag_regex, buffer) == None: + writer.write(b'BAD_FLAG\n') + continue + flag = buffer.decode() + try: + db.execute("INSERT INTO flags (flag) VALUES (?)", [flag]) + except sqlite3.IntegrityError: + status, msg, date = [x for x in db.execute("SELECT status, msg, date FROM flags WHERE flag=?", [flag])][0] + writer.write(b"OLD_FLAG " + date.encode() + b" " + str(status).encode() + b" " + str(msg).encode() + b"\n") + else: + writer.write(b'NEW_FLAG\n') + writer.close() +async def run_server (): + server = await asyncio.start_server(handle_client, os.getenv("SUBMISSION_BIND", "::"), os.getenv("SUBMISSION_PORT", "21502")) + event_loop = asyncio.get_event_loop() + event_loop.create_task(submitter()) + async with server: + await server.serve_forever() +asyncio.run(run_server()) diff --git a/iv/orodja/waf/Dockerfile b/iv/orodja/waf/Dockerfile new file mode 100644 index 0000000..bc87aaf --- /dev/null +++ b/iv/orodja/waf/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:latest +RUN apk add python3 +WORKDIR /waf +COPY ./waf.py . +RUN chmod +x ./waf.py +CMD ["./waf.py"] diff --git a/iv/orodja/waf/regexes.txt b/iv/orodja/waf/regexes.txt new file mode 100644 index 0000000..301a41c --- /dev/null +++ b/iv/orodja/waf/regexes.txt @@ -0,0 +1,2 @@ +HACKERS +HACKERS diff --git a/iv/orodja/waf/waf.py b/iv/orodja/waf/waf.py new file mode 100644 index 0000000..701b4dd --- /dev/null +++ b/iv/orodja/waf/waf.py @@ -0,0 +1,85 @@ +#!/usr/bin/python3 +import asyncio +import os +import ssl +import re + +def manyregex (string, patterns): + for pattern in patterns: + if re.search(pattern, string) != None: + return True + return False + +async def cevovod (reader, writer, writer2, compiled): + buffer = b'' + while True: + prebral = await reader.read(65536) + buffer += prebral + if manyregex(buffer, compiled): + break ## hacker detected + if len(buffer) > 65536: + buffer = buffer[-32768:] + if len(prebral) == 0: + break + writer.write(prebral) + writer.close() + writer2.close() + +async def handle_client (reader, writer): + try: + compiled = [] + reflags = re.ASCII | re.MULTILINE | re.DOTALL | re.VERBOSE + with open(os.getenv("WAF_REGEXES"), "rb") as rulesfile: + regexes = rulesfile.read().split(b"\n") + for regex in regexes: + if len(regex) == 0: + continue + compiled.append(re.compile(regex, reflags)) + write_to_backend = b'' + if os.getenv("WAF_HTTP"): + headers = [] + while True: + line = (await reader.readuntil(b'\n')).replace(b'\r', b'').replace(b'\n', b'') + if not line.lower().startswith(b"accept-encoding:"): + write_to_backend += line + b"\r\n" + if len(line) == 0: + break + headers.append(line) + if headers[0].startswith(b"GET /waf HTTP/"): + writer.write(b"HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\nwaf works (: PID " + str(os.getpid()).encode() + b"\r\n") + writer.close() + return + context = None + if os.getenv("WAF_TLS"): + context = ssl.create_default_context() + context.check_hostname = False + context.verify_mode = ssl.CERT_NONE + backendr, backendw = await asyncio.open_connection(os.getenv("WAF_BACKEND_HOST"), os.getenv("WAF_BACKEND_PORT"), ssl=context) + if manyregex(write_to_backend, compiled): + writer.write(b'HTTP/1.0 469 Hacking\r\nContent-Type: text/plain\r\n\r\nHacking is illegal according to ZEKom-2.\r\n') + backendw.close() ## hacker + writer.close() + return + backendw.write(write_to_backend) + except Exception as e: + writer.write(b"HTTP/1.0 569 Exception\r\nContent-Type: text/plain\r\n\r\n") + writer.write(str(e).encode()) + writer.write(b"\r\n") + backendw.close() + writer.close() + raise e + else: + event_loop = asyncio.get_event_loop() + event_loop.create_task(cevovod(reader, backendw, writer, compiled)) + event_loop.create_task(cevovod(backendr, writer, backendw, compiled)) + +async def run_server (): + context = None + if os.getenv("WAF_TLS"): + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.load_cert_chain(certfile=os.getenv("WAF_TLS"), keyfile=os.getenv("WAF_TLS_KEY")) + server = await asyncio.start_server(handle_client, os.getenv("WAF_LISTEN_ADDR"), os.getenv("WAF_LISTEN_PORT"), ssl=context) + async with server: + await server.serve_forever() + +asyncio.run(run_server()) diff --git a/šola/ana1/prak.lyx b/šola/ana1/prak.lyx new file mode 100644 index 0000000..b6b21e7 --- /dev/null +++ b/šola/ana1/prak.lyx @@ -0,0 +1,1609 @@ +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 620 +\begin_document +\begin_header +\save_transient_properties true +\origin unavailable +\textclass article +\begin_preamble +\usepackage{siunitx} +\usepackage{pgfplots} +\usepackage{listings} +\usepackage{multicol} +\sisetup{output-decimal-marker = {,}, quotient-mode=fraction, output-exponent-marker=\ensuremath{\mathrm{3}}} +\DeclareMathOperator{\ctg}{ctg} +\end_preamble +\use_default_options true +\begin_modules +enumitem +theorems-ams +\end_modules +\maintain_unincluded_children no +\language slovene +\language_package default +\inputencoding auto-legacy +\fontencoding auto +\font_roman "default" "default" +\font_sans "default" "default" +\font_typewriter "default" "default" +\font_math "auto" "auto" +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_roman_osf false +\font_sans_osf false +\font_typewriter_osf false +\font_sf_scale 100 100 +\font_tt_scale 100 100 +\use_microtype false +\use_dash_ligatures true +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\float_placement class +\float_alignment class +\paperfontsize default +\spacing single +\use_hyperref false +\papersize default +\use_geometry true +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine basic +\cite_engine_type default +\biblio_style plain +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\justification false +\use_refstyle 1 +\use_formatted_ref 0 +\use_minted 0 +\use_lineno 0 +\index Index +\shortcut idx +\color #008000 +\end_index +\leftmargin 1cm +\topmargin 1cm +\rightmargin 1cm +\bottommargin 2cm +\headheight 1cm +\headsep 1cm +\footskip 1cm +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\is_math_indent 0 +\math_numbering_side default +\quotes_style german +\dynamic_quotes 0 +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tablestyle default +\tracking_changes false +\output_changes false +\change_bars false +\postpone_fragile_content false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\docbook_table_output 0 +\docbook_mathml_prefix 1 +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +newcommand +\backslash +euler{e} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +setlength{ +\backslash +columnseprule}{0.2pt} +\backslash +begin{multicols}{2} +\end_layout + +\end_inset + + +\begin_inset Formula $\log_{a}1=0$ +\end_inset + +, + +\begin_inset Formula $\log_{a}a=1$ +\end_inset + +, + +\begin_inset Formula $\log_{a}a^{x}=x$ +\end_inset + +, + +\begin_inset Formula $a^{\log_{a}x}=x$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $\binom{n}{k}\coloneqq\frac{n!}{k!\left(n-k\right)!}$ +\end_inset + +, + +\begin_inset Formula $\log_{a}x^{n}=n\log_{a}x$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $D=b^{2}-4ac$ +\end_inset + +, + +\begin_inset Formula $x_{1,2}=\frac{-b\pm\sqrt{D}}{2a}$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $x^{2}+\left(a+b\right)x+ab=\left(x+a\right)\left(x+b\right)$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $zw=\left(ac-bd\right)+\left(ad+bc\right)i$ +\end_inset + +, + +\begin_inset Formula $\vert zw\vert=\vert z\vert\vert w\vert$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $\arg\left(zw\right)=\arg z+\arg w$ +\end_inset + + (kot) +\end_layout + +\begin_layout Standard +\begin_inset Formula $z\overline{z}=a^{2}-\left(bi\right)^{2}=a^{2}+b^{2}$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $\left(\cos\phi+i\sin\phi\right)$ +\end_inset + + +\begin_inset Formula $\left(\cos\psi+i\sin\psi\right)=\cos\left(\phi+\psi\right)+i\sin\left(\phi+\psi\right)$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $z^{2}=a^{2}+2abi-b^{2}$ +\end_inset + +, + +\begin_inset Formula $z^{3}=a^{3}-3ab^{2}+\left(3a^{2}b-b^{3}\right)i$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $(a+b)^{n}=\sum_{k=0}^{n}{n \choose k}ab^{n-k}$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $z^{n}=r^{n}\left(\cos\left(n\phi\right)+i\sin\left(n\phi\right)\right)$ +\end_inset + +, + +\begin_inset Formula $\phi=\arctan\frac{\Im z}{\Re z}$ +\end_inset + + +\end_layout + +\begin_layout Standard +Odprta množica ne vsebuje robnih točk. + Zaprta vsebuje vse. +\end_layout + +\begin_layout Standard +\begin_inset Formula $\sin\left(x\pm y\right)=\sin x\cdot\cos y\pm\sin y\cdot\cos x$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $\cos\left(x\pm y\right)=\cos x\cdot\cos y\mp\sin y\cdot\sin x$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $\tan\left(x\pm y\right)=\frac{\tan x\pm\tan y}{1\text{\ensuremath{\mp\tan}x\ensuremath{\cdot\tan y}}}$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $a_{n}$ +\end_inset + +je konv. + +\begin_inset Formula $\Longleftrightarrow$ +\end_inset + + +\begin_inset Formula $\forall\varepsilon>0:\exists n_{0}\ni:\forall n,m:n_{0}<n<m\wedge\vert a_{n}-a_{m}\vert<\varepsilon$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $\euler^{1/k}\coloneqq\lim_{n\to\infty}\left(1+\frac{1}{nk}\right)^{n}$ +\end_inset + + +\end_layout + +\begin_layout Standard +Vrsta je konv., + če je konv. + njeno zap. + delnih vsot. +\end_layout + +\begin_layout Standard +\begin_inset Formula $s_{n}=\begin{cases} +\frac{1-q^{n+1}}{1-q}; & q\not=1\\ +n+1; & q=1 +\end{cases}$ +\end_inset + +. + Geom. + vrsta konv. + +\begin_inset Formula $\Longleftrightarrow q\in\left(-1,1\right)$ +\end_inset + + +\end_layout + +\begin_layout Standard + +\series bold +Primerjalni krit. +\series default +: + +\begin_inset Formula $\sum_{1}^{\infty}a_{k}$ +\end_inset + + konv. + +\begin_inset Formula $\wedge$ +\end_inset + + +\begin_inset Formula $b_{k}\leq a_{k}$ +\end_inset + +za +\begin_inset Formula $k>n_{0}$ +\end_inset + + +\begin_inset Formula $\wedge$ +\end_inset + + vrsti sta navzdol omejeni +\begin_inset Formula $\Longrightarrow$ +\end_inset + + +\begin_inset Formula $\sum_{1}^{\infty}b_{k}$ +\end_inset + + konv. + +\begin_inset Formula $\sum_{1}^{\infty}a_{k}$ +\end_inset + + rečemo +\shape italic +majoranta +\shape default +. +\end_layout + +\begin_layout Standard + +\series bold +Kvocientni +\series default +: + +\begin_inset Formula $a_{k}>0$ +\end_inset + +, + +\begin_inset Formula $D_{n}\coloneqq\frac{a_{n}+1}{a_{n}}$ +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Formula $\forall n<n_{0}:D_{n}\in\left(0,1\right)\Longrightarrow\sum_{1}^{\infty}a_{k}<\infty$ +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Formula $\forall n<n_{0}:D_{n}\geq1\Longrightarrow\sum_{1}^{\infty}a_{k}=\infty$ +\end_inset + + +\end_layout + +\begin_layout Itemize +Če +\begin_inset Formula $\exists D\coloneqq\lim_{n\to\infty}D_{n}$ +\end_inset + +: + +\begin_inset Formula $\vert D\vert<1\Longrightarrow$ +\end_inset + +konv., + +\begin_inset Formula $\vert D\vert>1\Longrightarrow div.$ +\end_inset + + +\end_layout + +\begin_layout Standard + +\series bold +Korenski +\series default +: + Kot Kvocientni, + le da +\begin_inset Formula $D_{n}\coloneqq\sqrt[n]{a_{n}}$ +\end_inset + +. +\end_layout + +\begin_layout Standard + +\series bold +Leibnizov +\series default +: + +\begin_inset Formula $a_{n}\to0\Longrightarrow\sum_{1}^{\infty}\left(\left(-1\right)^{k}a_{k}\right)<\infty$ +\end_inset + + +\end_layout + +\begin_layout Standard +Absolutna konvergenca +\begin_inset Formula $\left(\sum_{1}^{\infty}\vert a_{n}\vert<\infty\right)$ +\end_inset + + +\begin_inset Formula $\Longrightarrow$ +\end_inset + + konvergenca +\end_layout + +\begin_layout Standard +Pri konv. + po točkah je +\begin_inset Formula $n_{0}$ +\end_inset + + odvisen od +\begin_inset Formula $x$ +\end_inset + +, + pri enakomerni ni. +\end_layout + +\begin_layout Standard +Potenčna vrsta: + +\begin_inset Formula $\sum_{j=1}^{\infty}b_{j}x^{j}$ +\end_inset + +. + +\begin_inset Formula $R^{-1}=\limsup_{k\to\infty}\sqrt[k]{\vert b_{k}\vert}$ +\end_inset + +. + +\begin_inset Formula $\vert x\vert<R\Longrightarrow$ +\end_inset + +abs. + konv., + +\begin_inset Formula $\vert x\vert>R\Longrightarrow$ +\end_inset + +divergira +\end_layout + +\begin_layout Standard +\begin_inset Formula $\lim_{x\to a}\left(\alpha f\left(x\right)\right)=\alpha\lim_{x\to a}f\left(x\right)$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular +<lyxtabular version="3" rows="4" columns="4"> +<features tabularvalignment="middle"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<row> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\sin$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\cos$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\tan$ +\end_inset + + +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $30^{\circ}=\frac{\pi}{6}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{1}{2}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{\sqrt{3}}{2}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{\sqrt{3}}{3}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $45^{\circ}=\frac{\pi}{4}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{\sqrt{2}}{2}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{\sqrt{2}}{2}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $60^{\circ}=\frac{\pi}{3}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{\sqrt{3}}{2}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{1}{2}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\sqrt{3}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +</row> +</lyxtabular> + +\end_inset + + +\end_layout + +\begin_layout Standard +Krožnica: + +\begin_inset Formula $\left(x-p\right)^{2}+\left(y-q\right)^{2}=r^{2}$ +\end_inset + + +\end_layout + +\begin_layout Standard +Elipsa: + +\begin_inset Formula $\frac{\left(x-p\right)^{2}}{a^{2}}+\frac{\left(y-q\right)^{2}}{b^{2}}=1$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular +<lyxtabular version="3" rows="8" columns="4"> +<features tabularvalignment="middle"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<row> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +Izraz +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +Odvod +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +Izraz +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +Odvod +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{f}{g}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{f'g-fg'}{g^{2}}$ +\end_inset + +, + +\begin_inset Formula $g\not=0$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $f\left(g\right)$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $f'\left(g\right)g'$ +\end_inset + + +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\tan x$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\cos^{-2}x$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\cot x$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $-sin^{-2}x$ +\end_inset + + +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $a^{x}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $a^{x}\text{\ensuremath{\ln a}}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $x^{x}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $x^{x}\left(1+\ln x\right)$ +\end_inset + + +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\log_{a}x$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{1}{x\ln a}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $f^{-1}\left(a\right)$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{1}{f'\left(f^{-1}\left(a\right)\right)}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\arcsin x$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\left(1-x^{2}\right)^{-\frac{1}{2}}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\arccos x$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $-\left(1-x^{2}\right)^{-\frac{1}{2}}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\arctan x$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\frac{1}{1+x^{2}}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $\text{arccot\,}x$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $-\frac{1}{1+x^{2}}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $x^{n}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +\begin_inset Formula $nx^{n-1}$ +\end_inset + + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset +</cell> +</row> +</lyxtabular> + +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Formula $f''\left(I\right)>0\Leftrightarrow f$ +\end_inset + + konveksna na +\begin_inset Formula $I$ +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Formula $f''\left(I\right)<0\Leftrightarrow f$ +\end_inset + + konkavna na +\begin_inset Formula $I$ +\end_inset + + +\begin_inset Formula +\[ +ab>0\wedge a<b\Leftrightarrow a^{-1}>b^{-1},\quad ab<0\wedge a<b\Leftrightarrow a^{-1}<b^{-1} +\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +\lim_{x\to0}\frac{\sin x}{x}=1\quad\quad\tan\phi=\left|\frac{k_{1}-k_{2}}{1+k_{1}k_{2}}\right| +\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +\lim_{x\to0}x\ln x=0 +\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +f\text{ zv.+odv.@ }\left[a,b\right]\Rightarrow\exists\xi\in\left[a,b\right]\ni:f\left(b\right)-f\left(a\right)=f'\left(\xi\right)\left(b-a\right) +\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +T_{f,a,n}\left(x\right)=\sum_{k=0}^{n}\frac{f^{\left(k\right)}\left(a\right)}{k!}\left(x-a\right)^{k} +\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $f\text{\ensuremath{\in C^{n+1}}}$ +\end_inset + + na odprtem +\begin_inset Formula $I\subset\mathbb{R}\Rightarrow\forall a,x\in I\exists c\in\left(\min\left\{ a,x\right\} ,\max\left\{ a,x\right\} \right)\ni:f\left(x\right)-T_{f,a,n}\left(x\right)=R_{f,a,n}\left(x\right)=\frac{f^{\left(n+1\right)}\left(c\right)}{\left(n+1\right)!}$ +\end_inset + + +\begin_inset Formula $\left(x-a\right)^{n+1}.\text{ Posledično velja tudi takale ocena:}$ +\end_inset + + +\begin_inset Formula +\[ +\exists M>0\forall x\in I:\left|f^{\left(n+1\right)}\right|\leq M\Rightarrow R_{f,a,n}\left(x\right)=\frac{M}{\left(n+1\right)!}\left|x-a\right|^{n+1} +\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +R=\lim_{n\to\infty}\left|\frac{c_{n}}{c_{n+1}}\right|,\quad R=\lim_{n\to\infty}\frac{1}{\sqrt[n]{\left|c_{n}\right|}} +\] + +\end_inset + + +\end_layout + +\begin_layout Standard +Zvezna +\begin_inset Formula $\text{f}$ +\end_inset + + na zaprtem intervalu +\begin_inset Formula $\left[a,b\right]$ +\end_inset + + doseže +\begin_inset Formula $\inf$ +\end_inset + + in +\begin_inset Formula $\sup$ +\end_inset + +, + je omejena in doseže vse funkcijske vrednosti na +\begin_inset Formula $\left[f\left(a\right),f\left(b\right)\right]$ +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset Formula $f:I\to\mathbb{R}$ +\end_inset + + je enakomerno zvezna na +\begin_inset Formula $I$ +\end_inset + +, + če +\begin_inset Formula $\forall\varepsilon>0\exists\delta_{\left(\varepsilon\right)}>0\ni:\forall x,y\in I:\left|x-y\right|<\delta\Rightarrow\left|f\left(x\right)-f\left(y\right)\right|<\varepsilon$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $f:I\to\mathbb{R}$ +\end_inset + + je zvezna na +\begin_inset Formula $I$ +\end_inset + +, + če +\begin_inset Formula $\forall\varepsilon>0\forall x\in I\exists\delta_{\left(x,\varepsilon\right)}>0\ni:\forall x,y\in I:\left|x-y\right|<\delta\Rightarrow\left|f\left(x\right)-f\left(y\right)\right|<\varepsilon$ +\end_inset + + +\end_layout + +\begin_layout Standard +Zvezna +\begin_inset Formula $f$ +\end_inset + + na kompaktni množici je enakomerno zvezna. +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +f'\left(x\right)=\lim_{x\to0}\frac{f\left(x+h\right)-f\left(x\right)}{h} +\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +\sinh x=\frac{e^{x}-e^{-x}}{2},\quad\cosh x=\frac{e^{x}+e^{-x}}{2} +\] + +\end_inset + + +\end_layout + +\begin_layout Paragraph +Uporabne vrste +\end_layout + +\begin_layout Standard +\begin_inset Formula $\sin x=\sum_{n=0}^{\infty}\frac{\left(-1\right)^{n}}{\left(2n+1\right)!}x^{2n+1}$ +\end_inset + +, + +\begin_inset Formula $\cos x=\sum_{n=0}^{\infty}\frac{\left(-1\right)^{n}}{\left(2n\right)!}x^{2n}$ +\end_inset + +, + +\begin_inset Formula $\sinh x=\sum_{n=0}^{\infty}\frac{x^{2n+1}}{\left(2n+1\right)!}$ +\end_inset + +, + +\begin_inset Formula $e^{x}=\sum_{x=0}^{\infty}\frac{x^{n}}{n!}$ +\end_inset + +, + +\begin_inset Formula $\left(1+x\right)^{\alpha}=\sum_{n=0}^{\infty}\frac{x^{n}}{n!}$ +\end_inset + +, + +\begin_inset Formula $\frac{1}{1-x}=\sum_{n=0}^{\infty}x^{n}$ +\end_inset + +, + +\begin_inset Formula $\ln\left(1+x\right)=\sum_{n=1}^{\infty}\left(-1\right)^{n+1}\frac{x^{n}}{n}$ +\end_inset + +, + +\begin_inset Formula $\ln\left(1-x\right)=-\sum_{n=1}^{\infty}\frac{x^{n}}{n}$ +\end_inset + +. +\end_layout + +\begin_layout Paragraph +Razcep racionalnih +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +\frac{p\left(x\right)}{\left(x-a\right)^{3}}=\frac{A}{x-a}+\frac{B}{\left(x-1\right)^{2}}+\frac{C}{\left(x-1\right)^{3}} +\] + +\end_inset + + +\begin_inset Formula +\[ +\frac{p\left(x\right)}{\left(x-a\right)\left(x-b\right)^{2}}=\frac{A}{x-a}+\frac{B}{x-b}+\frac{C}{\left(x-b\right)^{2}} +\] + +\end_inset + + +\begin_inset Formula +\[ +\frac{p\left(x\right)}{\left(x-a\right)\left(x^{2}-b\right)}=\frac{A}{x-a}+\frac{Bx-C}{x^{2}-b} +\] + +\end_inset + + +\end_layout + +\begin_layout Paragraph +Integrali +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +\int\frac{1}{x^{2}+a^{2}}dx=\frac{1}{a}\arctan\frac{x}{a}+C +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{1}{x^{2}-a^{2}}dx=\frac{1}{2a}\ln\left|\frac{x-a}{x+a}\right|+C +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{1}{a^{2}-x^{2}}dx=\frac{1}{2a}\ln\left|\frac{a+x}{a-x}\right|+C +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{1}{ax+b}dx=\frac{1}{a}\ln\left|ax+b\right|+C +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\left(ax+b\right)^{n}dx=\frac{\left(ax+b\right)^{n+1}}{a\left(n+1\right)}+C +\] + +\end_inset + + +\begin_inset Formula +\[ +\int f\left(x\right)g'\left(x\right)dx=f\left(x\right)g\left(x\right)-\int f'\left(x\right)g\left(x\right)dx +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{1}{\sin^{2}\left(x\right)}dx=-\ctg\left(x\right) +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{1}{\cos^{2}\left(x\right)}=\tan\left(x\right) +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{1}{\sqrt{a^{2}+x^{2}}}dx=\ln\left|x+\sqrt{x^{2}+a^{2}}\right| +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{1}{\sqrt{x^{2}-a^{2}}}dx=\ln\left|x+\sqrt{x^{2}-a^{2}}\right| +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\sqrt{a^{2}+x^{2}}dx=\frac{1}{2}\left(x\sqrt{a^{2}+x^{2}}+a^{2}\ln\left(\sqrt{a^{2}+x^{2}}+x\right)\right) +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\sqrt{a^{2}-x^{2}}dx=\frac{1}{2}\left(x\sqrt{a^{2}-x^{2}}+a^{2}\arctan\left(\frac{x}{\sqrt{a^{2}-x^{2}}}\right)\right) +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{A}{x-a}dx=A\ln\left|x-a\right| +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{A}{\left(x-a\right)^{n}}dx=\frac{-A}{n-1}\cdot\frac{1}{\left(x-a\right)^{n-1}} +\] + +\end_inset + + +\begin_inset Formula +\[ +\int\frac{Bx+C}{x^{2}+bx+c}=\frac{B}{2}\ln\left|x^{2}+bx+c\right|+\frac{2C-Bb}{\sqrt{-D}}\arctan\left(\frac{2x+b}{\sqrt{-D}}\right) +\] + +\end_inset + + In velja +\begin_inset Formula $D=b^{2}-4c$ +\end_inset + +. +\end_layout + +\begin_layout Standard +Pri +\begin_inset Formula $\int\sin\left(x\right)^{p}\cos\left(x\right)^{q}dx$ +\end_inset + + lih +\begin_inset Formula $q$ +\end_inset + + substituiramo +\begin_inset Formula $t=\cos\left(x\right)$ +\end_inset + +, + lih +\begin_inset Formula $p$ +\end_inset + + pa +\begin_inset Formula $t=\sin\left(x\right)$ +\end_inset + +. + Pri sodih nižamo stopnje s formulo dvonega kota. +\end_layout + +\begin_layout Standard +\begin_inset Note Note +status open + +\begin_layout Plain Layout +https://en.wikipedia.org/wiki/List_of_integrals_of_rational_functions +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +end{multicols} +\end_layout + +\end_inset + + +\end_layout + +\end_body +\end_document diff --git a/šola/ana1/teor.lyx b/šola/ana1/teor.lyx index f716983..104ba6c 100644 --- a/šola/ana1/teor.lyx +++ b/šola/ana1/teor.lyx @@ -6089,7 +6089,7 @@ Korenski oz. \begin_inset Formula $c_{n}\coloneqq\sqrt[n]{a_{n}}$ \end_inset -.ž +. \end_layout \begin_deeper @@ -13844,7 +13844,7 @@ krat odvedljiva na odprtem intervalu , tedaj -\begin_inset Formula $\forall b\in I\exists\alpha\in I\text{ med \ensuremath{a} in \ensuremath{x}}\ni:R_{n}\left(b\right)=\frac{f^{\left(n+1\right)}\left(\alpha\right)}{\left(n+1\right)!}\left(b-a\right)^{n+1}$ +\begin_inset Formula $\forall b\in I\exists\alpha\in I\text{ med \ensuremath{a} in \ensuremath{b}}\ni:R_{n}\left(b\right)=\frac{f^{\left(n+1\right)}\left(\alpha\right)}{\left(n+1\right)!}\left(b-a\right)^{n+1}$ \end_inset . @@ -15282,7 +15282,7 @@ Naj bo \begin_inset Formula $f:J\to\mathbb{R}$ \end_inset - je Riemannovo integrabilna, + je Riemannovo, če \begin_inset Formula $s\left(f\right)=S\left(f\right)$ \end_inset diff --git a/šola/citati.bib b/šola/citati.bib index 3c34475..f553435 100644 --- a/šola/citati.bib +++ b/šola/citati.bib @@ -225,3 +225,18 @@ Stara različica je v ~/projects/sola-gimb-4/citati.bib url={https://dev.maxmind.com/geoip/geolite2-free-geolocation-data}, urldate={2024-07-31}, year={2024} +} +@misc{rfc4086, + series = {Request for Comments}, + number = 4086, + howpublished = {RFC 4086}, + publisher = {RFC Editor}, + doi = {10.17487/RFC4086}, + url = {https://www.rfc-editor.org/info/rfc4086}, + author = {Donald E. Eastlake 3rd and Steve Crocker and Jeffrey I. Schiller}, + title = {{Randomness Requirements for Security}}, + pagetotal = 48, + year = 2005, + month = jun, + abstract = {Security systems are built on strong cryptographic algorithms that foil pattern analysis attempts. However, the security of these systems is dependent on generating secret quantities for passwords, cryptographic keys, and similar quantities. The use of pseudo-random processes to generate secret quantities can result in pseudo-security. A sophisticated attacker may find it easier to reproduce the environment that produced the secret quantities and to search the resulting small set of possibilities than to locate the quantities in the whole of the potential number space. Choosing random quantities to foil a resourceful and motivated adversary is surprisingly difficult. This document points out many pitfalls in using poor entropy sources or traditional pseudo-random number generation techniques for generating such quantities. It recommends the use of truly random hardware techniques and shows that the existing hardware on many systems can be used for this purpose. It provides suggestions to ameliorate the problem when a hardware solution is not available, and it gives examples of how large such quantities need to be for some applications. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.}, +} diff --git a/šola/članki/dht/dokument.lyx b/šola/članki/dht/dokument.lyx index af668ed..13a6f2b 100644 --- a/šola/članki/dht/dokument.lyx +++ b/šola/članki/dht/dokument.lyx @@ -87,8 +87,10 @@ \paperfontsize default \spacing single \use_hyperref true -\pdf_title "Your Title" -\pdf_author "Your Name" +\pdf_title "Kaj prenašamo s protokolom BitTorrent?" +\pdf_author "Anton Lula Šijanec" +\pdf_subject "Računalniška omrežja" +\pdf_keywords "podazdeljena razpršilna tabela, porazdeljeni sistemi, omrežje P2P, podatkovno rudarjenje, BitTorrent" \pdf_bookmarks true \pdf_bookmarksnumbered true \pdf_bookmarksopen true @@ -1431,14 +1433,262 @@ Zajem \end_layout \begin_layout Standard -Podatke smo zajemali iz različnih lokacij in v različnih časovnih obdobjih: +Podatke smo zajemali iz različnih lokacij in v različnih časovnih obdobjih. \end_layout -\begin_layout Itemize +\begin_layout Standard +\begin_inset Float table +placement document +alignment document +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset Tabular +<lyxtabular version="3" rows="4" columns="5"> +<features tabularvalignment="middle"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<column alignment="center" valignment="top"> +<row> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +mesto +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +datum +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +dni +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +torrentov +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +sek./torrent +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +T-2, + FTTH, + SI +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +1.-2. + '23 +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +16 +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +47863 +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +29 +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +GRNET, + VPS, + GR +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +1.-2. + '23 +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +31 +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +412846 +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +6 +\end_layout + +\end_inset +</cell> +</row> +<row> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +T-2, + FTTH, + SI +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +6. + '24 +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +5 +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +62110 +\end_layout + +\end_inset +</cell> +<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> +\begin_inset Text + +\begin_layout Plain Layout +7 +\end_layout + +\end_inset +</cell> +</row> +</lyxtabular> + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +Omrežne lokacije in časovna obdobja zajemov. +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Metapodatki prvega zajema opisujejo 3084321 datotek v skupni velikosti 259 TiB, + metapodatki drugega zajema 17101702 datotek v velikosti 1881 TiB in metapodatki tretjega zajema 3725125 datotek v velikosti 345 TiB. + +\begin_inset Note Note +status open + +\begin_layout Plain Layout januarja in februarja 2023: \end_layout -\begin_deeper \begin_layout Itemize 16 dni: domači optični priključek v Sloveniji (T-2): @@ -1457,6 +1707,7 @@ travnik \end_layout +\begin_deeper \begin_layout Itemize 31 dni VPS v Grčiji (grNet) \begin_inset Note Note @@ -1551,6 +1802,11 @@ status open \end_layout +\end_inset + + +\end_layout + \begin_layout Subsubsection Primer strukture torrent datoteke z metapodatki \end_layout @@ -2064,7 +2320,8 @@ nolink "false" Zaradi lastnosti uniformne porazdelitve zgoščevalne funkcije \begin_inset CommandInset citation LatexCommand cite -key "wikihashuniformity" +after "5.2" +key "rfc4086" literal "false" \end_inset |