Polymorphic quine
This quine prints itself in encrypted form. Each time with a new key for decoding. The code is simple - we take the code of the symbol and add the key to it. Then the key is incremented by one. And so it is infinite. Until the numbers end. :)
Zero patient:
exec (str (). join (chr (c) for c in[107, 61, 49, 59, 101, 61, 39, 101, 120, 101, 99, 40, 115, 116, 114, 40, 41, 46, 106, 111, 105, 110, 40, 99, 104, 114, 40, 99, 45, 41, 32, 102, 111, 114, 32, 99, 32, 105, 110, 32, 41, 41, 39, 59, 115, 61, 39, 107, 61, 59, 101, 61, 59, 115, 61, 59, 112, 114, 105, 110, 116, 40, 101, 91, 58, 50, 50, 93, 43, 115, 116, 114, 40, 107, 41, 43, 101, 91, 50, 50, 58, 45, 50, 93, 43, 114, 101, 112, 114, 40, 91, 111, 114, 100, 40, 99, 41, 43, 107, 32, 102, 111, 114, 32, 99, 32, 105, 110, 32, 115, 91, 58, 50, 93, 43, 115, 116, 114, 40, 107, 43, 49, 41, 43, 115, 91, 50, 58, 53, 93, 43, 114, 101, 112, 114, 40, 101, 41, 43, 115, 91, 53, 58, 56, 93, 43, 114, 101, 112, 114, 40, 115, 41, 43, 115, 91, 56, 58, 93, 93, 41, 43, 101, 91, 45, 50, 58, 93, 41, 39, 59, 112, 114, 105, 110, 116, 40, 101, 91, 58, 50, 50, 93, 43, 115, 116, 114, 40, 107, 41, 43, 101, 91, 50, 50, 58, 45, 50, 93, 43, 114, 101, 112, 114, 40, 91, 111, 114, 100, 40, 99, 41, 43, 107, 32, 102, 111, 114, 32, 99, 32, 105, 110, 32, 115, 91, 58, 50, 93, 43, 115, 116, 114, 40, 107, 43, 49, 41, 43, 115, 91, 50, 58, 53, 93, 43, 114, 101, 112, 114, 40, 101, 41, 43, 115, 91, 53, 58, 56, 93, 43, 114, 101, 112, 114, 40, 115, 41, 43, 115, 91, 56, 58, 93, 93, 41, 43, 101, 91, 45, 50, 58, 93, 41]))
It's not difficult to remake it to work with files, and then a funny polymorphic virus can come out.
Iteration development:
q = "'"; s =' q = ""; s =; print (s[:3]+ q + s[3:7]+ q + s + q + s[7:]) '; print (s[:3]+ q + s[3:7]+ q + s + q + s[7:])
basic quine ( ? source
)
s = 's =; print (s[:2]+ repr (s) + s[2:])'; print (s[:2]+ repr (s) + s[2:])
getting rid of the variable q
exec ('s =' s =; print ("exec (" + repr (s[:2]+ repr (s) + s[2:]) + ")"); print ("exec (" + repr (s[:2]+ repr (s) + s[2:]) + ")") ')
use of exec
exec ("e = 'exec ()'; s = 'e =; s =; print (e[:-1]+ repr (s[:2]+ repr (e) + s[2:5]+ repr (s) + s[5:]) + e[-1:]) '; print (e[:-1]+ repr (s[:2]+ repr (e) + s[2:5]+ repr (s) + s[5:]) + e[-1:]) ")
option without shielding
e = 'exec (str (). join (chr (c) for c in))'; s = 'e =; s =; print (e[:-2]+ repr ([ord(c) for c in s[:2]+ repr (e) + s[2:5]+ repr (s) + s[5:]]) + e[-2:]) '; print (e[:-2]+ repr ([ord(c) for c in s[:2]+ repr (e) + s[2:5]+ repr (s) + s[5:])) + e[-2:])
added encryption
k = 0; e = 'exec (str (). join (chr (c-) for c in))'; s = 'k =; e =; s =; print (e[:22]+ str (k) + e[22:-2]+ repr ([ord(c)+k for c in s[:2]+ str (k + 1) + s[2:5]+ repr (e) + s[5:8]+ repr (s) + s[8:])) + e[-2:]) '; print (e[-2:]) , + str (k) + e[22:-2]+ repr ([ord(c)+k for c in s[:2]+ str (k + 1) + s[2:5]+ repr (e) + s[5:8]+ repr (s) + s[8:]]) + e[-2:])
the final version with the addition of the key
It may be interesting
weber
Author30-09-2018, 22:13
Publication DateDevelopment / Programming
Category- Comments: 0
- Views: 319