diff options
Diffstat (limited to 'kpov_judge/tasks/vlc_stream_rtp')
-rw-r--r-- | kpov_judge/tasks/vlc_stream_rtp/task.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/kpov_judge/tasks/vlc_stream_rtp/task.py b/kpov_judge/tasks/vlc_stream_rtp/task.py index ea9b905..39b315f 100644 --- a/kpov_judge/tasks/vlc_stream_rtp/task.py +++ b/kpov_judge/tasks/vlc_stream_rtp/task.py @@ -79,6 +79,7 @@ def task(NASLOV, TOK): results['ps'] = pexpect.run('ps xa') results['tcpdump_hex'] = pexpect.run('sudo /usr/sbin/tcpdump -x -c 2 dst host 239.255.255.255 and port 9875'.format(NASLOV)) results['tcpdump'] = pexpect.run('sudo /usr/sbin/tcpdump -c 8 dst host {}'.format(NASLOV)) + # print("HAHA") return results def gen_params(user_id, params_meta): @@ -95,14 +96,19 @@ def task_check(results, params): import re score = 0 hints = [] - packs = results['tcpdump_hex'].split('> 239.255.255.255.9875: UDP, length') - p1 = packs[1] - p1_l = p1.split('\n') - p1_d = p1_l[1:-1] p1_s = "" - for i in p1_d: - p1_s = p1_s + "".join([j.strip() for j in i.split(' ')[1:]]) - sname = "".join([hex(ord(i))[2:] for i in params['TOK']]) + sname = "" + try: + packs = results['tcpdump_hex'].split('> 239.255.255.255.9875: UDP, length') + p1 = packs[1] + p1_l = p1.split('\n') + p1_d = p1_l[1:-1] + p1_s = "" + for i in p1_d: + p1_s = p1_s + "".join([j.strip() for j in i.split(' ')[1:]]) + sname = "".join([hex(ord(i))[2:] for i in params['TOK']]) + except: + hints.append("problem parsing RTP stream capture result") if p1_s.find(sname) > 2: score += 5 else: |