Better than AES

В задании говорится, что текст шифруется по следующему принципу: берётся первая буква, слева ставится третья буква, потом пятая и т.д. Таким образом из слова «привет» получается слово «еипрвт». Аналогичным образом шифруется всё предложение.
Шифротекст:

einos mlvoue an tle lcal eth tputrme dha eolos umoenros of. eitousd nrecheig aror by smalot it it eevn erslteecen ofrm swa dtcexie yaraled an eivoc nlbgabig eth tbu as dtastre swa dnodrwe a of ofrm. cgmai serstet duron dha eth wnes nru eth klie. esrfoeen he eephapnd dha atht to eth gisisun awht goenuh aher he ducol sjut of swa ofrm erslteecen eiarelz it lal as dha. eth ital sracos wraro eth yeenms in edsudn dlmsasebe dha noasebre a svat dmaraa lecserty a oblw eth arer eiwht giatern eth of kablc. ndi hurthog espuhd nhmitrupat snmafrget of ssrphae elsethmevs eth. yocvitr yocvitr nmhua yocvitr yocvitr sit casditne itwihn eth crafia eowhl of otzlrmdeoaiain seoiprsnr a urot otndocoriain evenmaour svat cgtrstaei terpefc rtute lhaf nilmilo tlmcopee lrncoto eth of gibrn rwa lauamesrbe of den stegraet in yoshitr yocvitr. vsuncovlie efet ebtal rdune eth ntnwisos dmae snmvmoeet. adef nrecheig docrws twih he ytiswfl swa nmid in aset ofrm tno he dha dristre shi tbu shi he ginrunn ginrunn swa eth eitousd femhisl. gbi irrpotat at up he eolokd naagi eth of rhobrte. eth atht eth uslcooss drsbetoe drwol. in esdahd of eth tnaagis eth crok hiwhc erhods iasa elsethmevs ivan. afdeet yocvitr be tofrn ofrm eth eenwodrd as shi otcvueqioain listl eethr nte sye stnmiue who he tgothuh nte oag lony stnmiue dha eben in taher he rhewhte wnes eth duwol of or. esrpeihd atht asreuain athn swa ah it rmoe a mary dha. iths eephapnd dha giaheln lnfia tbu of eth yda atht mhi dgachne cmuh dha in ensic trfis in rsnmiity vloe eth ebsesdinipnal gachne rvnee ltuni nmmoet. a edid eitousd eth rtgasluhe yobot seoiprsnr ltae hrfot listl erslteecen ofrm eth eivoc eth swa giuporn sit of dan dan tbu ntoshuig dha wdon ltlite. rethi cbak rwee eth seiwatr girtunn to rwok. scae in rwod is iths esanwr to mloprbe eth emroprgamr rwloe. ngi twih ethm eon of ecopaprahd eth ltbote. up swa shi nintateto ipad usiblsfl in ntnwiso gitsitn a medra no as sagls elfild. yan or tno he swa ginrunn nrecheig enlogr. as usol eirfogvn twih of eth cbak he swa in rsnmiity vloe nhyeevrtig shi eiwht osnw. giaipimlctn nsencofsig ibpulc in he swa eth cdok nhyeevrtig yoyeevrbd. shi dagur an hinsulgt gilwakn giefeln twih dltie eth gilwakn he swa wdon eiwht oircordr eth of in dan dmare at cbak. shi swa rfo eth dphnlogoe elbult nrteneig nabri. cfae eth up he dzgae at umoenros. rdak hanbeet swa of awht to nktae it yrfot sayer dha mhi naler nkid eisml edhidn eth ectumosah. slenedes o lucre ndasensmiudrtnig. sebrat eth eiexl lsef o rbustbon elwild ofrm nvloig. snoe of eth ekitrcld dtescne otw ngi sater wdon sdsie shi. esnfiihd lgrstuge tgrih swa tgrih swa tbu it lal nhyeevrtig lal eth swa. femhisl yocvitr nwo he dha eth eovr. gbi he dvloe rhobrte.

Пишем очень кривой скрипт для расшифровки:


f = open("text.txt")
text = f.read()

text = text.replace('.', ' .').replace('\n', '').split(' ')

res_text = []

def get_norm_word(word, start, space):
    normal_word = i[start]
    if space:
            normal_word += ' '
    next_right = start + 1
    next_left = start - 1
    
    counter = 1
    while counter != len(i):
        normal_word += i[next_right]
        if space:
            normal_word += ' '
        counter += 1
        if counter == len(i):
            break
        normal_word += i[next_left]
        if space:
            normal_word += ' '
        counter += 1
        if counter == len(i):
            break
        next_right += 1
        next_left -= 1
    return normal_word

for i in text:
    if len(i) % 2 == 0: # ch
        start = int(len(i) / 2 - 1)
        res_text.append(get_norm_word(i, start, False))
    else:
        start = int(len(i) / 2)
        res_text.append(get_norm_word(i, start, False))
print (res_text)

res = []
new_sen = []
for i in res_text:
    if i == '.':
        res.append(new_sen)
        new_sen = []
    else:
        new_sen.append(i)
        
print('++++++++++++++++++++++++++++++++++++++++')
print(res)
print('++++++++++++++++++++++++++++++++++++++++')

res_text = []
for i in res:
    if len(i) % 2 == 0: # ch
        start = int(len(i) / 2 - 1)
        res_text.append(get_norm_word(i, start, True))
    else:
        start = int(len(i) / 2)
        res_text.append(get_norm_word(i, start, True))

for i in res_text:
    print (i)

Вроде должно работать. Запускаем, получаем:

the trumpet call had let loose an enormous volume of noise 
already an excited voice was gabbling from the telescreen but even as it started it was almost drowned by a roar of cheering from outside 
the news had run round the streets like magic 
he could hear just enough of what was issuing from the telescreen to realize that it had all happened as he had foreseen 
a vast seaborne armada had secretly assembled a sudden blow in the enemys rear the white arrow tearing across the tail of the black 
fragments of triumphant phrases pushed themselves through the din 
vast strategic manoeuvre perfect coordination utter rout half a million prisoners complete demoralization control of the whole of africa bring the war within measurable distance of its end victory greatest victory in human history victory victory victory 
under the table winstons feet made convulsive movements 
he had not stirred from his seat but in his mind he was running swiftly running he was with the crowds outside cheering himself deaf 
he looked up again at the portrait of big brother 
the colossus that bestrode the world 
the rock against which the hordes of asia dashed themselves in vain 
he thought how ten minutes ago yes only ten minutes there had still been equivocation in his heart as he wondered whether the news from the front would be of victory or defeat 
ah it was more than a eurasian army that had perished 
much had changed in him since that first day in the ministry of love but the final indispensable healing change had never happened until this moment 
the voice from the telescreen was still pouring forth its tale of prisoners and booty and slaughter but the shouting outside had died down a little 
the waiters were turning back to their work 
answer to this problem is the word programmer in lower case 
one of them approached with the gin bottle 
winston sitting in a blissful dream paid no attention as his glass was filled up 
he was not running or cheering any longer 
he was back in the ministry of love with everything forgiven his soul white as snow 
he was in the public dock confessing everything implicating everybody 
he was walking down the white tiled corridor with the feeling of walking in sunlight and an armed guard at his back 
the longhoped for bullet was entering his brain 
he gazed up at the enormous face 
forty years it had taken him to learn what kind of smile was hidden beneath the dark moustache 
o cruel needless misunderstanding 
o stubborn self willed exile from the loving breast 
two gin scented tears trickled down the sides of his nose 
but it was all right everything was all right the struggle was finished 
he had won the victory over himself 
he loved big brother 

Гуглим оригинал, сравниваем, находим строку (которая по идее и так должна была бросаться в глаза):
answer to this problem is the word programmer in lower case
Флаг: InnoCTF{programmer}


Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *