Page 18 of 30 FirstFirst ... 8161718192028 ... LastLast
Results 171 to 180 of 297

Thread: "Hello Ubuntu" in every programming language

  1. #171
    Join Date
    Apr 2007
    Beans
    14,781

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by WitchCraft View Post
    Shellcode is still missing
    I think it has been done before, but here it is:
    Code:
    #!/bin/bash
    
    echo "Hi. What is your name?";
    read name;
    echo "Hello, $name! Welcome to Ubuntu!";

  2. #172
    Join Date
    Sep 2006
    Beans
    2,914

    Re: "Hello Ubuntu" in every programming language

    shellcode != shell script

  3. #173
    Join Date
    Apr 2007
    Beans
    14,781

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by ghostdog74 View Post
    shellcode != shell script
    Shellcode? http://en.wikipedia.org/wiki/Shellcode

    That isn't a programming language, and it linked to Shell (Computing), so I thought it was just a mistaken reference to shell scripts.

  4. #174
    Join Date
    Oct 2006
    Location
    Austin, Texas
    Beans
    2,712
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by ghostdog74 View Post
    shellcode != shell script
    Just pack the machine code from one of the assembly examples into a C array (it's just bytes), dereference it as a function pointer, and call it.

  5. #175
    Join Date
    Sep 2006
    Beans
    2,914

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by Wybiral View Post
    Just pack the machine code from one of the assembly examples into a C array (it's just bytes), dereference it as a function pointer, and call it.
    thanks wy, I know what it is, but i don't really care . I was only clarifying the differences to La and Red about Witch's proposal. so maybe your suggestion should be directed to Witch.

  6. #176
    Join Date
    Feb 2008
    Location
    readlink("/proc/self/exe"
    Beans
    1,120
    Distro
    Ubuntu Development Release

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by Wybiral View Post
    Just pack the machine code from one of the assembly examples into a C array (it's just bytes), dereference it as a function pointer, and call it.
    nah, you still have to get rid of the 0 bytes first.
    And before you can dereference it, you have to typecast it, at least when compiling with g++

  7. #177
    Join Date
    Feb 2008
    Location
    Denmark
    Beans
    91

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by max.diems View Post
    C++

    Version 1: Do not write results to file


    Code:
    #include <cstdio>
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    string username = "";
    
    int main(int argc, char *argv[]);
    
    int main(int argc, char *argv[]){
        cout << "Hi! What's your name? ";
        cin >> username;
        cout << "Hello, " << username << "! Welcome to Ubuntu!\n";
        return 0;
    }
    No reason to make it so complicated:

    Code:
    #include <iostream>
    
    int main()
    {
    	std::string username;
    	std::cout << "Hi! What's your name? ";
    	std::getline(std::cin, username);
    	std::cout << "Hello, " << username << "! Welcome to Ubuntu!" << std::endl;
    	return 0;
    }
    I don't like using namespaces. And it's with getline instead of cin, so the name can contain spaces.

  8. #178
    Join Date
    Apr 2007
    Beans
    14,781

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by Nemooo View Post
    I don't like using namespaces.
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Surely you don't mean that...

  9. #179
    Join Date
    Feb 2008
    Location
    Denmark
    Beans
    91

    Re: "Hello Ubuntu" in every programming language

    Well, so far I'm only doing small console programs, so I don't have to type std:: a lot. When I get to the greater applications, they might be handy.

  10. #180
    Join Date
    Oct 2006
    Location
    Austin, Texas
    Beans
    2,712
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by WitchCraft View Post
    nah, you still have to get rid of the 0 bytes first.
    And before you can dereference it, you have to typecast it, at least when compiling with g++
    Yeah, but all of that is trivial (and you don't always have to get rid of the 0, it depends how the code is being fed in). I'm not sure what you mean by typecasting it, unless you mean casting a character array to a function pointer (I don't know why you'd need that because if you're writing the C code, you can code anything you want in the first place). The real difficult part would be finding a program with an obvious enough overflow exploit to slip it in (that part is probably much easier on an operating system line Windows ).

Page 18 of 30 FirstFirst ... 8161718192028 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •