Thread: How to make a program that prints it's own source code???

  1. #31
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Anddos View Post
    maybe make some kind of decrytor ,
    The best you can get if trying to reverse engineer your program (which you need to do if you don't have the source handy), is to get assembly.
    Meaning no variable names, no function names, etc, etc.
    It's pretty meaningless.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #32
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Anddos View Post
    cpjust what kind of reply is that , i am only trying to help , keep your comments to your self
    I'm trying to help too -- helping people from writing useless programs.
    In any case, Laserlight already answered the question a while ago:
    http://en.wikipedia.org/wiki/Quine_%28computing%29

  3. #33
    Registered User
    Join Date
    Nov 2006
    Posts
    85
    Actually one of the challenges on this site is to write a quine. There's even a nice solution to it.

    http://www.cprogramming.com/challeng...elf_print.html

    Actually quines do have some uses. Some viruses that are built with showing off in mind (core wars) will make copies of themselves by outputting their own source code into a text folder and compiling itself. Well you can kind of call that a use...

  4. #34
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by A10 View Post
    Actually one of the challenges on this site is to write a quine. There's even a nice solution to it.

    http://www.cprogramming.com/challeng...elf_print.html

    Actually quines do have some uses. Some viruses that are built with showing off in mind (core wars) will make copies of themselves by outputting their own source code into a text folder and compiling itself. Well you can kind of call that a use...
    Wouldn't it be a hell of a lot easier to just copy the existing executable rather than recompile itself?

  5. #35
    Banned
    Join Date
    Nov 2007
    Posts
    678
    I doubt if they still remain quines but for one thing they can make some changes in their source and then compile!
    A kind of self evolving virus

  6. #36
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by cpjust View Post
    Wouldn't it be a hell of a lot easier to just copy the existing executable rather than recompile itself?
    Not if you are doing the original worm (as the son of the NSA director did in the late 1990's or so), which walked across machine architectures, as long as the machine had a version of Unix installed, it would attempt to compile and install itself. Since machines where of differing architectures, you couldn't just copy the binary...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #37
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by matsp View Post
    Not if you are doing the original worm (as the son of the NSA director did in the late 1990's or so), which walked across machine architectures, as long as the machine had a version of Unix installed, it would attempt to compile and install itself. Since machines where of differing architectures, you couldn't just copy the binary...

    --
    Mats
    So you mean the virus telnets into a machine, finds the compiler, spits out it's source code, compiles and remotely executes the new version?

  8. #38
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by cpjust View Post
    So you mean the virus telnets into a machine, finds the compiler, spits out it's source code, compiles and remotely executes the new version?
    Something along those lines, yes.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #39
    Registered User
    Join Date
    Nov 2006
    Posts
    85

    Exclamation

    Quote Originally Posted by cpjust View Post
    Wouldn't it be a hell of a lot easier to just copy the existing executable rather than recompile itself?
    That's not NEARLY as cool though

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Replies: 1
    Last Post: 03-12-2002, 06:31 AM
  4. C source code for int25 or code help
    By Unregistered in forum C Programming
    Replies: 0
    Last Post: 09-26-2001, 02:04 AM