If you don't have a computer that can read and write the filesystem on the image, it gets a little more complicated. In that case, you might be able to make these changes using a hex editor directly on the Raspbian images.
Changing a string like 'foo=yes' to 'foo=no ' would be easy enough - as long as the filesystem does not checksum data.
Adding multiple lines to multiple files is not going to work very well.
This allowed me to set up the RPi headless and keyboardless.
Of course the filesystem was dirty, but it's nothing an fsck couldn't solve.