Skip to content

Instantly share code, notes, and snippets.

@icheernoom
Created November 23, 2015 04:51
Show Gist options
  • Save icheernoom/8efbb4a05e02d5e4dfff to your computer and use it in GitHub Desktop.
Save icheernoom/8efbb4a05e02d5e4dfff to your computer and use it in GitHub Desktop.

Revisions

  1. icheernoom created this gist Nov 23, 2015.
    32 changes: 32 additions & 0 deletions web50.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #!/usr/bin/python
    # Author: Kitwipat Towattana (@icheernoom)

    import hashlib, sys

    salt = 'f074dc1fbaaf66163dfca8ad1079ceea' # random
    valid = 'a8178dee94945e518c90dad6bffcc657' # random

    '''
    if (md5(salt+result)==valid)
    flag = md5(salt+result+result)
    '''

    for result in range(0000,9999):
    md5 = hashlib.md5("{0}{1}".format(salt,result)).hexdigest()
    print "{0} : {1}".format(result,md5)
    if md5 == valid:
    md5flag = hashlib.md5("{0}{1}{2}".format(salt,result,result)).hexdigest()
    print "Password: {0}".format(result)
    print "Flag: {0}".format(md5flag)
    sys.exit()

    '''
    root@ubuntu:~# web50.py
    ...[snip]...
    3396 : da54054da6a7cefa3204713b71669566
    3397 : bf918a33c530b497779200888e6eb582
    3398 : a8178dee94945e518c90dad6bffcc657
    Password: 3398
    Flag: 98635f80048b8abbd71e9bb55958a6c8
    root@ubuntu:~#
    '''