Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Homework sabotage [Was: Re: assignments] Date: Sat, 21 Jun 2014 08:46:55 -0400 Organization: A noiseless patient Spider Lines: 36 Message-ID: References: <6aafa91c-4b8c-4884-a30d-2c4af8b443c2@googlegroups.com> <8e2976e4-f31f-4363-9797-9e8d9a755708@googlegroups.com> <6noaq9p5vipknufe8nviilroc2mbp025aq@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 21 Jun 2014 12:47:00 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="bd4e1cba8d8592bec5d5ed9e4537fbfd"; logging-data="31841"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19kribXonpaON52KfyvgQc0" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <6noaq9p5vipknufe8nviilroc2mbp025aq@4ax.com> Cancel-Lock: sha1:GxUWnNdXeUQbRuiPAtsaIfzEZz8= Xref: csiph.com comp.lang.java.programmer:28807 On 6/21/2014 6:51 AM, Gordon Levi wrote: > Eric Sosman wrote: > >> One particularly nasty variant is a program that >> does what was asked but also prints "Ruben Ongayo is a lazy >> slimeball" *and* won't do anything at all if the message is >> removed or altered. > > I liked this idea so I took it as my homework. I added the condition > that mere obfuscation was not allowed. Even it was, we know the > homework shirker has a single stepping debugger. I have failed to > produce the program. Can you help me with my homework? Most of the details have faded from my fading memory, but I dimly recall somebody posting something along these lines here, perhaps about a decade ago. My hazy recollection is that the code used reflection to extract its own class name (or was it a method name?), used that name to decrypt a compiled-in byte[] of gibberish into a byte[] in .class format, then loaded and instantiated the resulting class -- which produced, naturally, the asked-for homework solution. If the containing class name was changed from SoAndSo_Is_A_Slimeball to something less damning, decryption would produce garbage and the decrypted class wouldn't load, much less execute. (I repeat: fading memory, foggy details, et cetera.) A skilled Java programmer could defeat this pretty easily, for example by breakpointing just after the decryption and then decompiling the decrypted class. But by asking to have his homework done for him the requestor had already shown that he was not a skilled Java programmer, so ... -- Eric Sosman esosman@comcast-dot-net.invalid