• (cs)

    First

  • lurgar (unregistered)

    FIRST=NO

  • Kluge Doctor (unregistered)

    MYCOMMENT=WTF?

  • (cs)

    Oh come on, once you figure out stupid patterns like that, why not just stream edit it to at least put in proper spacing and parentheses (and of course, test compile).

    Then it's just a matter of dealing with stupid variable names. And even those, once deciphered can be stream edited into what they actually represent.

    Lots of work? Yup. But it can be done with a little (ok maybe a lot) of determination. Been there, done that.

    Edit: I see that Irish Girl - The Sequel - is back :)

  • masonreloaded (unregistered)

    The real WTF is that they "retained" the old developer's services after he intentionally sabotaged their code...

  • Bob Dole (unregistered) in reply to snoofle

    Seems rather trivial at that point you notice that... Hell, building a keyword library and inserting whitespace into the formatting should only take a few hours...days if the variant of VB has tons of weird/unique keywords. Then, variable by variable, you can find/replace X with more useful names. I admit the variable replacing thing might take awhile because you have to manually figure out what they all are, but if you just do it as you open code, I'd bet you'd only waste a few minutes in each piece of code.

  • Marcin (unregistered)

    Why didn't you write a pretty-printer?

  • Ken B (unregistered)
    IFC=ZTH ("if (c==z) then")
    Given that THEN/TH is optional (according to the post), what if you have a "ZTH" variable? Is that "if ( c == z ) then" or "if (c == zth)"? Eww.
  • geORge (unregistered) in reply to Bob Dole
    Bob Dole:
    Seems rather trivial at that point you notice that... Hell, building a keyword library and inserting whitespace into the formatting should only take a few hours...days if the variant of VB has tons of weird/unique keywords.
    But what do you do if geORge and sANDy are actual variable names? That might make the stream editing at least a little ... interesting, shall we say?
  • Marcin (unregistered) in reply to geORge

    You might need to use...some kind of non-context-free parser. If only unix came with a library for that, or if there were text-processing languages that were capable of that.

  • Code Slave (unregistered)

    Andy walks with me, Andy talks with me

  • (cs)

    Wouldn't copying it all and pasting it into a text document fix the spacing issues while trying to read through it?

    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

  • gurhall (unregistered) in reply to DangerMouse9
    DangerMouse9:
    Wouldn't copying it all and pasting it into a text document fix the spacing issues while trying to read through it?

    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

    I honestly don't know whether to explain it to you or punch you.

  • NiceWTF (unregistered)

    The real WTF's:

    1. Lawsuit time!
    2. Apparently they didn't have CVS/SVN logs nor even backups to revert the obfuscation?
    3. Even then I'd as a matter of principle rather rewrite the entire thing than hire the services of such an asshole.
  • dave (unregistered)

    Pity they didn't use source control so they could just check out the version before it was obfuscated

  • Marcin (unregistered) in reply to NiceWTF
    NiceWTF:
    The real WTF's:
    1. Lawsuit time!
    2. Apparently they didn't have CVS/SVN logs nor even backups to revert the obfuscation?
    3. Even then I'd as a matter of principle rather rewrite the entire thing than hire the services of such an asshole.

    Maybe they could have hired him, then delayed payment. Possibly ensured that no orders were ever placed in writing, that sort of thing, and then found out who had the upper hand.

  • greg (unregistered) in reply to snoofle
    snoofle:
    Oh come on, once you figure out stupid patterns like that, why not just stream edit it to at least put in proper spacing and parentheses (and of course, test compile).

    Then it's just a matter of dealing with stupid variable names. And even those, once deciphered can be stream edited into what they actually represent.

    s/stream edit/sed/

  • Anon (unregistered) in reply to geORge
    geORge:
    Bob Dole:
    Seems rather trivial at that point you notice that... Hell, building a keyword library and inserting whitespace into the formatting should only take a few hours...days if the variant of VB has tons of weird/unique keywords.
    But what do you do if geORge and sANDy are actual variable names? That might make the stream editing at least a little ... interesting, shall we say?

    This is true, but at least one piece of software, the interpreter is able to understand this shit. Therefore, it must be possible, in theory, to write another piece of software that can parse the source and spit out something more readable (i.e. with whitespace). Presumably this particular version of basic must have some restriction on variable names like geORge or sANDy.

  • IMSoP (unregistered) in reply to Anon
    Anon:
    geORge:
    But what do you do if geORge and sANDy are actual variable names? That might make the stream editing at least a little ... interesting, shall we say?

    This is true, but at least one piece of software, the interpreter is able to understand this shit. Therefore, it must be possible, in theory, to write another piece of software that can parse the source and spit out something more readable (i.e. with whitespace). Presumably this particular version of basic must have some restriction on variable names like geORge or sANDy.

    Precisely - I'm pretty sure many versions of BASIC only allowed variable names consisting of a single letter, or a single letter followed by a single digit.

    So you could define 'variable' as /[A-Z][0-9]?/ and 'keyword' as /AND|OR|IF|THEN|TH/ etc, and from there it doesn't seem that impossible to produce a set of rules for basic pretty-printing.

  • shadowphiar (unregistered)

    I'll never get used to not living next door to Andy.

  • biziclop (unregistered) in reply to geORge
    geORge:
    Bob Dole:
    Seems rather trivial at that point you notice that... Hell, building a keyword library and inserting whitespace into the formatting should only take a few hours...days if the variant of VB has tons of weird/unique keywords.
    But what do you do if geORge and sANDy are actual variable names? That might make the stream editing at least a little ... interesting, shall we say?

    The same thing a BASIC interpreter does. And what every normal human (using the western alphabet) does. Read it from left to right.

    Come on, tokenizing BASIC code is easy, some interpreters even de-tokenize/beautify it for you. In fact, most of them only store the tokenized form, so a LIST usually displays standard layout source code.

  • Loren Pechtel (unregistered)

    LAWSUIT=YES

  • biziclop (unregistered) in reply to DangerMouse9
    DangerMouse9:
    Wouldn't copying it all and pasting it into a text document fix the spacing issues while trying to read through it?

    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

    No, sadly that doesn't work. But if you print the code out, place it on a wooden table...

  • (cs) in reply to geORge
    geORge:
    Bob Dole:
    Seems rather trivial at that point you notice that... Hell, building a keyword library and inserting whitespace into the formatting should only take a few hours...days if the variant of VB has tons of weird/unique keywords.
    But what do you do if geORge and sANDy are actual variable names? That might make the stream editing at least a little ... interesting, shall we say?

    It probably needs whitespace before the keyword, but doesn't require it after, which of course means that you probably can't have variable names that begin with "OR" or "AND". Since this thing is unlikely to have the usual lex/parse structure, other keywords are probably immune.

  • (cs) in reply to Anon

    Do they not teach BASIC anymore? The old ones I used were simple left to right tokenizers. While they required spaces, their symbols could not be used as variables. And as I recall AppleBASIC would pre-tokenize so in the stored file AND would actually be a single character.

    I have no idea what this interpreter would do with GEORGE, but it should be easy to test and design a pseudo-parser that works the same way and inserts spaces.

    If you have the language set, it should be a straightforward matter. Read a file straight through and throw spaces around keywords. Test if the program still works. Repeat on code as you need to interact with it.

    Straightforward - not easy.

  • Anonymous (unregistered)

    Could he have just compiled the obfuscated code then decompile the compiled code back into source? It should be more legible at that point.

  • biziclop (unregistered) in reply to Throknor
    Throknor:
    Do they not teach BASIC anymore? The old ones I used were simple left to right tokenizers. While they required spaces, their symbols could not be used as variables. And as I recall AppleBASIC would pre-tokenize so in the stored file AND would actually be a single character.

    I have no idea what this interpreter would do with GEORGE, but it should be easy to test and design a pseudo-parser that works the same way and inserts spaces.

    If you have the language set, it should be a straightforward matter. Read a file straight through and throw spaces around keywords. Test if the program still works. Repeat on code as you need to interact with it.

    Straightforward - not easy.

    This.

    It does my head in how people can't think in anything other than regular expressions anymore. You don't need anything like that for a BASIC interpreter, let alone yacc or lex and friends. All you need is to read character after character into a buffer and check if you have a valid token or not. Even a ten year old kid should be able to do it.

  • biziclop (unregistered) in reply to Anonymous
    Anonymous:
    Could he have just compiled the obfuscated code then decompile the compiled code back into source? It should be more legible at that point.

    It's an interpreter, you haven't got compiled code on disk. But you do have tokenized code in memory and you should be able to list it in a standard readable format, most of the time simply by typing in LIST.

  • (cs) in reply to dave
    dave:
    Pity they didn't use source control so they could just check out the version before it was obfuscated
    If it was all basic, it was probably before source-control was widely being used.
  • Matt S. (unregistered)

    Too bad Ctrl + K then D wouldn't work with Basic, because then that consultant would be out of a(nother) job!

  • Peter (unregistered)

    I was rather expecting to find that Andy was the name of the original developer, and that when Mark changed the mysterious string to "ANDY=YES", the code magically became readable. That would have been neat (and would have enabled the company to dispense with the blackmailer's services). Pity.

  • (cs)
    COMPUTER OVER.
    ANDY = VERY YES.
  • Sutherlands (unregistered) in reply to NiceWTF
    NiceWTF:
    The real WTF's:
    1. Lawsuit time!
    2. Apparently they didn't have CVS/SVN logs nor even backups to revert the obfuscation?
    3. Even then I'd as a matter of principle rather rewrite the entire thing than hire the services of such an asshole.
    Basically this
  • Joe (unregistered) in reply to Code Slave

    Andy tells me I am his own!

  • (cs)

    Well, I don't have to obfuscate my code... it looks like shit naturally!

  • (cs) in reply to biziclop
    biziclop:
    ...Even a ten year old kid should be able to do it.

    Along that same line of thinking, you could just hire dozens of 10-year-olds at a low hourly wage to fix the code for you.

  • ML (unregistered)

    I wonder if this "off-brand" BASIC was actually Commodore BASIC, which was very highly popular in the early 1980's. To quote Wikipedia:

    Commodore BASIC keywords could be abbreviated by entering at least one letter, and then a shifted version of the next letter on. In the default text mode, this shifted character appeared as a graphics symbol; e.g. the GOTO command could be abbreviated G{Shift-O} (which resembled GΓ onscreen). In cases of ambiguity, more unshifted letters of the command were needed, such as GO{Shift-S} (GO♥) being required for GOSUB since G{Shift-O} was already taken.

    [...]

    Commodore BASIC lines did not need any spaces except where omitting one would be ambiguous, and in fact most Commodore BASIC programs were written with no spaces, e.g., 100IFA=5THENPRINT"YES":GOTO160 . Omitting spaces as such would lead to a more compact program, since the tokenizer never removes any space inserted between keywords: the presence of spaces results in extra 0x20 bytes in the tokenized program which are merely skipped during execution.

  • NH (unregistered)

    That kind of system is best resolved by rewriting the whole thing in a better language.

    You don't always need the source code of a piece of software - sometimes it's better to analyze what it does.

  • SeaDrive (unregistered)

    Following along with other commenters, I think it would not have been to hard to de-obfuscate. My first thought is that it may have been an off-brand BASIC, but if it was still BASIC, then moving it directly into a mainstream product should have resulted in code with only a few kinds of errors related to the compatibility issues.

    Since most BASIC interpreters did tokenize the keywords, I wonder if that capability had been turned off, or if some whitespace options were used to do the obfuscation in the first place.

  • me (unregistered) in reply to DangerMouse9
    DangerMouse9:
    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

    This... is priceless.

  • Tom (unregistered) in reply to gurhall
    gurhall:
    DangerMouse9:
    Wouldn't copying it all and pasting it into a text document fix the spacing issues while trying to read through it?

    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

    I honestly don't know whether to explain it to you or punch you.

    Best. Answer. Ever.

    claps

  • (cs) in reply to shadowphiar
    shadowphiar:
    I'll never get used to not living next door to Andy.
    Bob was there, too.
  • Anonym (unregistered) in reply to ML
    ML:
    I wonder if this "off-brand" BASIC was actually Commodore BASIC, which was very highly popular in the early 1980's. To quote Wikipedia:

    Commodore BASIC keywords could be abbreviated by entering at least one letter, and then a shifted version of the next letter on. In the default text mode, this shifted character appeared as a graphics symbol; e.g. the GOTO command could be abbreviated G{Shift-O} (which resembled GΓ onscreen). In cases of ambiguity, more unshifted letters of the command were needed, such as GO{Shift-S} (GO♥) being required for GOSUB since G{Shift-O} was already taken.

    [...]

    Commodore BASIC lines did not need any spaces except where omitting one would be ambiguous, and in fact most Commodore BASIC programs were written with no spaces, e.g., 100IFA=5THENPRINT"YES":GOTO160 . Omitting spaces as such would lead to a more compact program, since the tokenizer never removes any space inserted between keywords: the presence of spaces results in extra 0x20 bytes in the tokenized program which are merely skipped during execution.

    The abbreviations are automatically expanded, the same thing is stored in memory if you enter "GO♥" or "GOSUB". Also, commands can't span multiple lines in Commodore BASIC.
  • (cs) in reply to masonreloaded
    masonreloaded:
    The real WTF is that they "retained" the old developer's services after he intentionally sabotaged their code...
    Agreed. The companies I worked for had me sign an agreement that says I wouldn't do this kind of stuff.

    Besides, doesn't the IRS frown on this type of arrangement? If you are a consultant but working for your former employer, I think they may still consider you "employed" for tax reasons. (I am not an accountant or tax specialist.)

  • Herman (unregistered)

    Just copy paste the code in Word and give it a nice format, like 'Comic Sans'.

    Captcha = tristique, short for three pieces of antique.

  • (cs) in reply to gurhall
    gurhall:
    DangerMouse9:
    Wouldn't copying it all and pasting it into a text document fix the spacing issues while trying to read through it?

    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

    I honestly don't know whether to explain it to you or punch you.

    To avoid the hassle of a debate, I recommend you explain it to him while you punch him.

  • tragomaskhalos (unregistered) in reply to ML
    ML:
    I wonder if this "off-brand" BASIC was actually Commodore BASIC, which was very highly popular in the early 1980's. To quote Wikipedia:

    Commodore BASIC keywords could be abbreviated by entering at least one letter, and then a shifted version of the next letter on. In the default text mode, this shifted character appeared as a graphics symbol; e.g. the GOTO command could be abbreviated G{Shift-O} (which resembled GΓ onscreen). In cases of ambiguity, more unshifted letters of the command were needed, such as GO{Shift-S} (GO♥) being required for GOSUB since G{Shift-O} was already taken.

    Please tell me that people pronounced this stuff as written, eg "Mmmm, you forgot to go-heart the initialisation subroutine", or even "Go-gamma considered harmful" :-)
  • FORK=ATOM (unregistered)

    I always liked FORK=ATOM which would do highly different things on different implementations of BASIC.

  • chosenken (unregistered) in reply to gurhall
    gurhall:
    DangerMouse9:
    Wouldn't copying it all and pasting it into a text document fix the spacing issues while trying to read through it?

    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

    I honestly don't know whether to explain it to you or punch you.

    Usually punching works better.

  • (cs) in reply to chosenken

    In Zen, punching IS explaining.

Leave a comment on “ANDY=NO”

Log In or post as a guest

Replying to comment #:

« Return to Article