Jump to content
Usr6

RST-python- Cautatoru de mesaje ascunse in 'plain text'

Recommended Posts

Posted

Pana in prezent stie sa tipareasca:


Nr. caractere in text:
Nr. propozitii in text:
Nr. cuvinte in text:
Nr. randuri in text:
MD5 text:
Nr. caractere pe fiecare rand:
Dec to str/reversed:
Prima/ultima litera din fiecare rand/reversed:
Primul/ultimul cuvant din fiecare rand/reversed:
Prima/ultima litera din fiecare cuvant/reversed:
Prima/ultima litera din fiecare propozitie/reversed:
Primul/ultimul cuvant din fiecare propozitie/reversed:
Fibonacci litere/cuvinte /reversed
Nr prime litere/cuvinte /reversed
Diagonala litere/cuvinte /reversed
Step -custom /reversed
Coloana -custom /reversed

De exemplu, pentru challenge-ul realizat de @Gio33 : https://rstforums.com/forum/94853-decrypt-me-easy-mesaj-de-la-partener.rst

Nr. caractere pe fiecare rand:
48 55 52 55 51 49 46 48 45 32 44 51 50 54 50 49 53 46 49 53 32 64 32 48 48 58 48 50 32 111 103
Dec to str/reversed:
074731.0- ,326215.15 @ 00:02 og
go 20:00 @ 51.512623, -0.137470

Source code:

text = """Textul in care

este

ascuns mesajul secret."""

print """

\t Cautatoru de mesaje ascunse in plain text

\t Proprietate RSTforums.com

\t Usr6, Sulea

Este interzisa utilizarea acestui stript de catre:

\t persoanele aflate in stare de ebrietate(poate duce la descoperirea comorii dacice)

\t servicii speciale (ex:SRI, SIE, DIICOT, Patriarhie, STS, etc), firmele cu activitate in IT, etc. (fara suparare, dar va puteti permite sa cumparati un soft pro)

\t fanii justin bieber

Daca va incadrati in una din categoriile de mai sus si totusi doriti sa utilizati scriptul, trebuie sa cumparati o sharoma cu de toate unui om sarman inainte de fiecare utilizare

"""

import hashlib

print "Nr. caractere in text: %d " %(len(text))

propozitii = text.split(".")

print "Nr. propozitii in text: %d" %(len(propozitii))

cuvinte = text.split(" ")

print "Nr. cuvinte in text: %d" %(len(cuvinte))

randuri = text.splitlines()

print "Nr. randuri in text: %d" %(len(randuri))

m = hashlib.md5()

m.update(text)

print "MD5 text: %s" %(m.hexdigest())

a = b = c = d = e = f =""

for linie in randuri:

a += chr(len(linie))

d += str(len(linie)) + " "

b += linie[0]

c += linie[-1]

cuv = linie.split()

e += cuv[0] + " "

f += cuv[-1] + " "

print "\nNr. caractere pe fiecare rand:\n%s" %(d)

print "Dec to str/reversed:\n%s\n%s" %(a,a[::-1])

print "\nPrima litera din fiecare rand/reversed:\n%s\n%s" %(b, b[::-1])

print "Ultima litera din fiecare rand/reversed:\n%s\n%s" %(c, c[::-1])

print "\nPrimul cuvant din fiecare rand/reversed:\n%s\n%s" %(e, e[::-1])

print "Ultimul cuvant din fiecare rand/reversed:\n%s\n%s" %(f, f[::-1])

a = b = ""

for cuvant in cuvinte:

c = ""

for litera in cuvant:

if litera not in ['"', ".", ",", ";", "(", ")"]:

c += litera

if len© >0:

a += c[0]

b += c[-1]

print "\nPrima litera din fiecare cuvant/reversed:\n%s\n%s" %(a, a[::-1])

print "Ultima litera din fiecare cuvant/reversed:\n%s\n%s" %(b, b[::-1])

a = b = d = e = ""

for propozitie in propozitii:

f = propozitie.split()

if len(f) >0 :

d += f[0] + " "

e += f[-1] + " "

c = ""

for x in propozitie:

if x not in [" ", '"', ".", ",", ";", "(", ")", "\n"]:

c += x

if len© >0:

a += c[0]

b += c[-1]

print "\nPrima litera din fiecare propozitie/reversed:\n%s\n%s" %(a, a[::-1])

print "Ultima litera din fiecare propozitie/reversed:\n%s\n%s" %(b, b[::-1])

print "\nPrimul cuvant din fiecare propozitie/reversed:\n%s\n%s" %(d, d[::-1])

print "Ultimul cuvant din fiecare propozitie/reversed:\n%s\n%s" %(e, e[::-1])

prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]

fibo = [0,1,2,3,5,8,13,21,34,55,89,144,233,377,610]

nc = len(cuvinte)

nl = len(text)

a = b = ""

for c in prime:

if c < nc:

a += cuvinte[c] + " "

if c < nl:

b += text[c]

print "\nNumere prime:"

print "\tCuvinte /reversed:\n\t%s\n\t%s" % (a, a[::-1])

print "\tLitere /reversed:\n\t%s\n\t%s" % (b, b[::-1])

a = b = ""

for c in fibo:

if c < nc:

a += cuvinte[c] + " "

if c < nl:

b += text[c]

print "Fibonacci:"

print "\tCuvinte /reversed:\n\t%s\n\t%s" % (a, a[::-1])

print "\tLitere /reversed:\n\t%s\n\t%s" % (b, b[::-1])

step = 2

a = b = ""

for c in range(0, nc, step):

a += cuvinte[c]

for c in range(0, nl, step):

b += text[c]

print "\nStep: %d" %(step)

print "Cuvinte / reversed:\n%s\n%s" %(a, a[::-1])

print "Litere / reversed:\n%s\n%s" %(b, b[::-1])

a = b = ""

for c in range(0, len(randuri)):

if c < len(randuri[c]):

a += randuri[c][c]

d = randuri[c].split()

if c < len(d):

b += d[c] + " "

print "\nDiagonala :"

print "Litere /reversed:\n\t%s\n\t%s" % (a, a[::-1])

print "Cuvinte /reversed:\n\t%s\n\t%s" % (b, b[::-1])

coloana = 5

a = ""

for b in range(0, len(randuri)):

if len(randuri) < coloana:

a += " "

else:

a += randuri[coloana]

print "\nColoana: %d" %(coloana)

print "Litere /reversed:\n\t%s\n\t%s" % (a, a[::-1])

  • Upvote 8

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...