CTF "One question per day 20160606"

Source: Internet
Author: User
Tags readable
smart Little Lamb.

A little lamb jumped over the fence, two samples jumped over the fence, a lump of lamb jumped over the fence ...

TN cjtfsiwal kes,hwitbn G,NPT ttessfg}ua u hmqik e {c, n Huiouosarwzmiibecesnren.


Please answer what you can see, the answer form cwtf{your answer}



Analysis

There is the word fence, which may be "fence" encryption.

Fence encryption is a relatively simple and fast encryption method.

Fence encryption is to divide the plaintext into n groups in order, and then combine the n groups into a cipher text.

For example, the encrypted string "ABCDEFGHIJKLM"

Divided into 3 groups, the encryption process is as follows:

A

D

G

J

M

B

E

H

K

C

F

I

L

Get ciphertext: Adgjmbehkcfil

If divided into 4 groups, the results are as follows:

A

E

I

M

B

F

J

C

G

K

D

H

L

Get ciphertext: AEIMBFJCGKDHL

Encryption is, in line first, to produce an array (fence is the number of groups), then the position of a character from a fence is equal to the position of the next character of the ciphertext, such as POS (a) +4=pos (e). All cryptographic algorithms are roughly as follows:

#! /usr/bin/env python

#-*-Coding:utf-8-*-

'''

20160605

Simple implementation of fence encryption algorithm

Fence encryption is to divide the plaintext into n groups in order, and then combine the n groups into a cipher text.

If the number of characters is insufficient, fill in the blanks.

'''

s = raw_input ("pl input a string:") #要求输入源串, and remove both spaces

S.strip ()

Fence = input ("PL Input the fence number:") #分组数 (greater than 2)

encodes = ' '

Len = Len (s)

Spacenum = len% Fence

f = Open ("./t0605.txt", ' w+ ') #打开存放结果的文件

For I in xrange (fence):

j = I

While J < len+spacenum:

If J < len:

Encodes + = S[j]

Else

Encodes + = "

J + = Fence

Print >>f, encodes

When you are done, type: "The Anwser iswctf{zjbgcmtn},if you are a big new,u can help us think more question,tks." and type fence as 5, see T0605.txt can see To:

TN cjtfsiwal kes,hwitbn G,NPT ttessfg}ua u hmqik e {c, n Huiouosarwzmiibecesnren.

Fence decryption is relatively complex. In the previous we can see that encryption will produce some whitespace, and these blanks in the production of ciphertext is not recorded, so this creates the complexity of decryption.

We take ciphertext: AEIMBFJCGKDHL as an example

A

E

I

M

B

F

J

C

G

K

D

H

L

The algorithm is as follows:

#! /usr/bin/env python

#-*-Coding:utf-8-*-

'''

20160605

Simple implementation of fence decryption algorithm

Fence decryption is more complicated than encryption. As we can see in the front, encryption creates some whitespace,

And these blanks in the production of ciphertext is not recorded ,

So this creates the complexity of the decryption.

 

Here are some variables to be defined to facilitate the explanation:

Len Cipher length

Column number

Fence (Row) Number of groups

 

But in actual decryption, fence is not deterministic, so column is not deterministic, and vice versa. The text may itself contain spaces (non-encrypted spaces), so you cannot use spaces to determine the starting position.

Therefore, it is a criterion to judge whether the decoding is successful by traversing the various cases of LEN/2>FENCE>2 and observing whether the text is readable.

'''

s = raw_input ("pl input a string:") #要求输入源串

Len = Len (s)

decodes = ' '

f = Open ("./t0604.txt", ' w+ ') #打开存放结果的文件

Print >>f, '------OPEN Ur EYES-------'

For fence in xrange (2,LEN/2):

Print >>f, '-----fence= ' +str (fence) + '------'

For I in range (fence):

Decodes + = S[i::fence ]

Print >>f,decodes

decodes = ' '

      

When executed, type the string as required: tn cjtfsiwalkes,hwitbn G,NPT ttessfg}ua u hmqik e {c, Nhuiouosarwzmiibecesnren.

When you are done, review t0604.txt. Found only fence=17 when there is a readable string: the Anwser iswctf{zjbgcmtn},if U is a big new,u can help us think more question,tks.


 

------OPEN Ur EYES-------

-----fence=2------

T Jfia e,wtn, p tesgu hqke{, Uooawmieene.nctswlkshib gnt tsf}au mi c nhiusrzibcsrn

-----fence=3------

TCFW SWB N ts} q {iormber.njsak,ingp Efuuhiec Hoswiese tileht, Ttsga mk, NUUAZICNN

-----fence=4------

Tji, T Ptsu QE, OAMEN.NTWKHBGTTFA i huricr faewn, eg hk{uowieecslsi n s}um cniszbsn

-----fence=5------

Ttastg su KC uwbnnfl,b, Sah, Hozer s hnntf me usmcecikw ptguq iaienjwei te} i{noris.

-----fence=6------

TF W s q{ome.nskig fuichsis iet,tg k,uaincwsbnt} irbrja,npeuhe oweetlh Tsam NUZCN

-----fence=7------

tsebps I,iwc.nisntsuk Oze W, f Umscah g Enoinjlwgt}h Sirt I,tum{habefktneaqcuren

-----fence=8------

TI, Tuq,omnnwhgtai uir aw,e k oieclinsu nsbnj TPs e AE.TKBTF hrcfen gh{uwess}mcizs

-----fence=9------

twwns {Imrnaipfhcoie Lttgm,uinc b}q ob.jkn UI Sete Taknacfs t res,geuehwsih,s uzn

-----fence=10------

Tat UK WNNLB A hzr nt Eumeck tu iinje e {oi.tsgs cubf,,sh,oeshnfm sciwpgq Aewit}inrs

-----fence=11------

TLNT cocn e, se k sh ascegsm rnjs,fqnwrt,ngi zefhp}khmnswtu ui.ii aeiiwt obabtu{ue

-----fence=12------

t sq m.nkgfihi E,GKUICSN} ibj,pueoethta ucfw {oesi Ucssitt, ANWBT rraneh wel smnzn

-----fence=13------

Tk,}euenenu os spa{snc,t carjh u,retw wnfit z.stthnmibem iwnsqhia siubl fkie gg OC

-----fence=14------

TEP, W.nstu Z, MCH nijwth ititmhbftequesbsiicinskoew F USA geonlg} SR, U{aeknacrn

-----fence=15------

TS Bn, hhe Htmuccwtqiejieiosttskunfbs orsnfesei g anw}{r.agucwl,a,z n mkpu iet ni

-----fence=16------

T,tqonnhtiur wekoecis SNJTSEA.TBF Rfng{ws}czi u,mwga ia, Ilnunb p ekt hce hues MIS

-----fence=17------

The anwser is wctf{zjbgcmtn},if u are a big new,u can help us think more question,tks.

-----fence=18------

TWS{MNIFCI TG,ICB} bjnu et ancf esguhsi, unwn iraphoeltmun qo.k isetkast r,eewhs Z

-----fence=19------

Tig ENT} c BUNECNA SJ hnt UURFG ies, ONINHU.WPMOATQSL ia krkt wetezse m,s{ihsciwf,b

-----fence=20------

TTu Nnbahr n uec uinj o.tg uf,hosnmsipqawtira kwl z temkt iee{isscb,s,ehf CWG ei}ns

-----fence=21------

TB I.nnuo UC Ojghst,mafnqrspiwitkzw ma eilt i t{bkecees,css e,f SHGNNW} Riuhetaun

-----fence=22------

TN on S Hacgmrj,qwtnizfpkmst II eiw BAT{ELTCC e,eks ses nsfnr,g eh}hnwuu.iait Obuu

-----fence=23------

T hrn MW gqzc,imjnkitp iftebs ei {cwtceat,sle n s rksneef nsgh.,}uhuiwaoi utuob sn A

-----fence=24------

T qmngii, Kicn Bjpeett CF {es csit,nwt rae elsnn S. Kfhegus}i,uohauw oiust ab rnhw mz

-----fence=25------

TGKBN, E neccp ejt{st cnf, rst EIT nwen.as LSH Fukgie}osuu,aoh Swuai rt wbhznmm Qi II

-----fence=26------

T,eenn s P{NCTCRJ, et nft stnie wshasulfi gok}ueuosas, AHURW wi zthmbminqi IB Keg C

-----fence=27------

Tn{rnpce T,nc. J Ttnft Sehisuwsiafolgu}okuseaas r,uwh ZW Mihitmibqbnie KC eges, N

-----fence=28------

Tp,.nt c NJT tthfeussiisowfuagol}s uakare Wsuz, MH Iwhiimbtqebicnke s Eng R,{ENCN

-----fence=29------

tt N n cthjtuteifsossuifowgsa}alur awk zeums i, ihhbwmeiqctiebksn n er eg{n,c.n,p

-----fence=30------

T n H Tuctijeotsufsosfsigaw}rauwlaz Mkuie is B,HEHMCWQEIISTKNB rnee n {. gc,,n p TN

-----fence=31------

T unti toceujsotssffasgri}wwuzaaml i Uik be eshc,mehqswinikrt ebenn. {CG,, n pnt H

-----fence=32------

Ttontu Eocssjsatfrfgws}ziumwaia ilub ek cehesms,qnhirwkei nte.b n{C, g, NNP th u i

-----fence=33------

Ttones sacsrjfwtgzf}msuiiaiw bauel C ekhsemnsqr,iehknw. Iet b{nc, G, nn Phtu i otu

-----fence=34------

TEANSR Swcfzjgmt}ifuisabi Ewuca el s hnkmreqesin,k.h wei T{BCN, gn, Nhputi o utots

-----fence=35------

Tswnsz fmcgij}itubfaes ciuew sa nlhr mekqnei.sk, Hew i{tcb,n ng, Hnupito u otstaer

-----fence=36------

Tsmnfi GIC}BJUETACF Esusi NW rahelmn q.kieks, eh w{ict,b n n gh,unipotu o Statrewsz

-----fence=37------

TFINGB}ecucjaet sfuns ri ewhnam.lq ikke se, h{wci,t b nn hgu,inoputo s Atrtwezsmsi

-----fence=38------

Tgen}c uecasj nturf es nih.wmaqli kk ees, {hcw,i t bnn h ugi,onupots a RTWTZEMSISIFB

-----fence=39------

T}enus ANC Rjuet NF. Shimwqailk Kee s{,ch,w i tnb NH u igo,unopsta r WTZTMEISISBFEGC

-----fence=40------

Tunnar Ecunj. T fhsmiqwiakl ek e{sc,,h w int bhnu i ogu,onspatr w ztmtieisbsefcge}s

-----fence=41------

Taen N u.c J Thfmsqiiwka le K{ecs,, h wni thbuni o ugo,snaprtw z mtitiebsescfegs}nur

So the answer is WCTF{ZJBGCMTN}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.