From f3e2c6f2add893710dc9a54098acff13c5934a90 Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Tue, 21 Oct 2014 21:35:40 +0000 Subject: Separated tasks from lectures git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@2 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- .../tasks/rdate/preparation/TejoLicen/rServe.zip | Bin 499 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu1.png | Bin 979 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu15.png | Bin 679 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu2.png | Bin 826 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu3.png | Bin 13656 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu4.png | Bin 1564 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu5.png | Bin 11278 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu6.png | Bin 15244 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu7.png | Bin 3842 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu8.png | Bin 3420 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu9.png | Bin 4245 -> 0 bytes .../howtos/images/predvaja_clip_image003.gif | Bin 686 -> 0 bytes .../tasks/rdate/preparation/howtos/images/s1.png | Bin 700 -> 0 bytes .../tasks/rdate/preparation/howtos/images/s2.png | Bin 3882 -> 0 bytes .../tasks/rdate/preparation/howtos/images/s3.png | Bin 3569 -> 0 bytes .../tasks/rdate/preparation/howtos/si/index.html | 57 ----------- kpov_judge/tasks/rdate/preparation/task.py | 107 --------------------- 17 files changed, 164 deletions(-) delete mode 100644 kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/s1.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/s2.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/s3.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/si/index.html delete mode 100644 kpov_judge/tasks/rdate/preparation/task.py (limited to 'kpov_judge/tasks/rdate/preparation') diff --git a/kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip b/kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip deleted file mode 100644 index 9061692..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png deleted file mode 100644 index c6eeac8..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png deleted file mode 100644 index c2ac808..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png deleted file mode 100644 index 85fcfa8..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png deleted file mode 100644 index 831e764..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png deleted file mode 100644 index 495351a..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png deleted file mode 100644 index 103e0e6..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png deleted file mode 100644 index b032223..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png deleted file mode 100644 index bd50500..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png deleted file mode 100644 index 98f7812..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png deleted file mode 100644 index 9ed78ce..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif b/kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif deleted file mode 100644 index 02be389..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/s1.png b/kpov_judge/tasks/rdate/preparation/howtos/images/s1.png deleted file mode 100644 index 52b6ee5..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/s1.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/s2.png b/kpov_judge/tasks/rdate/preparation/howtos/images/s2.png deleted file mode 100644 index 78a65ce..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/s2.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/s3.png b/kpov_judge/tasks/rdate/preparation/howtos/images/s3.png deleted file mode 100644 index c32eae1..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/s3.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/si/index.html b/kpov_judge/tasks/rdate/preparation/howtos/si/index.html deleted file mode 100644 index a22f5c2..0000000 --- a/kpov_judge/tasks/rdate/preparation/howtos/si/index.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - -

XX. predvaja:


-

Naloga na hitro:


- Nastavi uro na strežniku s pomočjo rdate. Napiši program, ki pretvori 24-bitna števila z dvojiškim komplementom v decimalno obliko.

-

Navodila:


- 1. Iz imenika s slikami virtualnih računalnikov povlecite sliki Student.vdi(klient) in SimpleArbiter.vdi(strežnik).
- 2. Z VirtualBoxom (ali ostalim programom za virtualne računalnike) ustvarite dva virtualna računalnika in jim kot disk za shranjevanje podajte Student.vdi ter SimpleArbiter.vdi.
- 3. Zaženite oba navidezna računalnika.
- 4. Na Student se prijavite z uporabnikom root in geslom kaboom na SimpleArbiter pa z uporabnikom tester in geslom SedemKrogovPekla.

- -

Prvi del naloge: posodobi uro računalnika s pomočjo rdate.


- 1. Preverite in si zapišite IP naslov na SimpleArbiter. (ifconfig)


- 2. Z ukazom sudo apt-get install rdate namestimo program rdate.
- 3. Na Student z pomočjo rdate posodobi uro računalnika. rdate IP_SIMPLE_ARBITER

- Opozorilo: NI napaka, če se posodobljen čas ne ujema s pravilnim časom.
-

-


-

Drugi del naloge: napiši program, ki pretvori binarni zapis 32-bitnega števila v decimalnega.


- Nalogo lahko rešite v Javi ali v Pythonu. Prav tako pa lahko kodo pišete v poljubnem tekstovnem urejevalniku.

-


- JAVA------
- 1. Z ukazom nano bintodec3.java ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano
- 2. Napišemo program za pretvarjanje 24-bitnega števila z dvojiškim komplementom v decimalno obliko
-

- 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.
- 4. Če je še nimamo, naložimo Javo sudo apt-get install openjdk-6-jdk

- 5. Prevedemo program javac bintodec3.java
- 6. Lahko ga še zaženemo ter preizkusimo java bintodec3. Na standardni vhod vnašamo 24-bitno število v šestnajstiški obliki

-

PYTHON------
- 1. Z ukazom nano bintodec3.py ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano
- 2. Napišemo program za pretvarjanje 24-bitnega števila z dvojiškim komplementom v decimalno obliko
-
- 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.
- 4. Program zaženemo z ukazom python bintodec3.py



- - -

-

Testiranje

- 1. Lahko poženemo tester; z ukazom ./run_test.py
-
- 2. Kot "Upor. Ime" in "Geslo" napišite vaše podatke učilnice. (npr.: "pz1234@student.uni-lj.si" in "geslo123")
-
- 3. Kot ime naloge vpišite XX.predvaja.
- 4. Ko vas program vpraša po poti programa vnesite vašo pot do programa za pretvarjanje. (npr.: če imate program bintodec3.py v isti mapi kot program run_test.py, vnesete: ./bintodec3.py)
- 5. Povpraša tudi po IP naslovu SimpleArbiterja, vnesite.
- 6. Če je šlo vse po sreči, program vrne OK vi pa ste opravili nalogo.

- -
- - - diff --git a/kpov_judge/tasks/rdate/preparation/task.py b/kpov_judge/tasks/rdate/preparation/task.py deleted file mode 100644 index caf6298..0000000 --- a/kpov_judge/tasks/rdate/preparation/task.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py -# TODO: finish this! - -instructions = { - 'si':u""" -Postavi dva navidezna računalnika - SimpleArbiterDhcpRdate s slike diska simpleArbiterRdate ter rdateClient. -Na rdateClient ustvarite uporabnika test z geslom test. Nastavite čas na rdateClient tako, da kot rdate strežnik -uporabite SimpleArbiterDhcpRdate. Nato v domačem imeniku uporabnika test spravite program z imenom guliver, ki prebere 4 byte -podatkov s standardnega vhoda in jih pretvori v predznačeno celo število, pri čemer naj uporablja zapis z debelim koncem (big endian). -Število naj program izpiše na standardni izhod. -""" -} - -computers = { - 'rdateClient': { - 'disks': [ - { 'name': 'maliBrezNetworkManager', - }, - #{ 'name': 'CDROM', - # 'options':{'readonly': True}, - # 'parts': [],# no parts, no mounting. - #} - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcpRdate', - # attempt automount - }, - #{ 'name': 'CDROM', - # 'options': {'readonly': True}, - # 'parts': [{'dev': 'b1', 'path': '/cdrom'}], - #}, - ], - 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - } -} - -networks = { 'net1': {'public': False}, 'test-net': {'public': True} } - -params_meta = { - 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - import pxssh - import pexpect - results = dict() - peer_user = 'student' - peer_passwd = 'vaje' - sA = pxssh.pxssh() - sB = pxssh.pxssh() - sA.login(IP_NM, peer_user, peer_passwd) - sB.login(IP_static, peer_user, peer_passwd) - # sA - # make sure NM is not handling eth0 - results['NM_nmcli'] = sA.run('nmcli d') - results['NM_nslookup'] = sA.run('nslookup www.arnes.si') - # sB - # check whether NM is handling eth0 - results['static_nmcli'] = sB.run('nmcli d') - results['static_nslookup'] = sB.run('nslookup www.arnes.si') - sA.logout() - sB.logout() - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id) - # IP_NM, DNS_NM, IP_static, DNS_static) - dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220'] - net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - if results['NM_nslookup'].find('Server:\t\t{0}\r'.format(params['DNS_NM'])) > -1: - score += 3 - if results['static_nslookup'].find('Server:\t\t{0}\r'.format(params['DNS_static'])) > -1: - score += 3 - if re.search(r'eth0 +802-.*connected', results['NM_nmcli']): - score += 2 - if not re.search(r'eth0 +802-.*connected', results['static_nmcli']): - score += 2 - score = 0 - return score - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - -- cgit v1.2.1