Example #1
0
def decodeScan(apibase, password, **msg):
    """ Process an uploaded scan.
    """
    url = msg['url']

    print 'Decoding scan', msg['scan_id']
    decode.main(apibase, password, msg['scan_id'], url)
Example #2
0
def decodeScan(apibase, password, **msg):
    """ Process an uploaded scan.
    """
    url = msg['url']

    print 'Decoding scan', msg['scan_id']
    decode.main(apibase, password, msg['scan_id'], url)
Example #3
0
def decodeScan(apibase, password, **msg):
    """ Process an uploaded scan.
    """
    url = msg['url']

    print 'Decoding scan', msg['scan_id']

    try:
        decode.main(apibase, password, msg['scan_id'], url)
    except:
        client.captureException()
        raise
Example #4
0
    def test2(self):
        '''from task description, 3 ways of decoding 123

        asserts that there are three ways of decoding 123'''

        tinput = 123
        expOutput = 3
        self.assertEqual(decode.main(tinput), expOutput)
Example #5
0
    def test1(self):
        ''' from Task description, 2 ways of decoding 12

        asserts that there are 2 ways of decoding 12'''

        tinput = 12
        expOutput = 2
        self.assertEqual(decode.main(tinput), expOutput)
Example #6
0
    def test3(self):
        '''edge case - 1111 should have 5 ways of solving

        asserts that there are 5 ways of decoding 1111
        1) aaaa
        2) kk
        3) kaa
        4) aka
        5) aak
        '''

        tinput = 1111
        expOutput = 5
        self.assertEqual(decode.main(tinput), expOutput)
Example #7
0
            req = httplib.HTTPConnection(host, 80)
            req.request('POST', path+'/dequeue.php', params, {'Content-Type': 'application/x-www-form-urlencoded'})
            res = req.getresponse()
            
            assert res.status == 200, 'poll POST to dequeue.php resulting in status %s instead of 200' % res.status
            
            # success means we drop back to zero
            poll_failures = 0
            
            message_id, nil, url = res.read().strip().partition(" ") #split on first space in message, there may be spaces in the filename
            if (message_id == '' or url == ''):
              pass
            else:
              message_id = int(message_id)
              print >> sys.stderr, datetime.datetime.now(), 'Decoding message id', message_id, '-', url
              decode.main(url, getMarkers(), options.apibase, message_id, options.password)

        except KeyboardInterrupt:
            raise

        except Exception, e:
            print >> sys.stderr, 'Something went wrong:', e

            poll_failures += 1
            
            if poll_failures > 10:
                print >> sys.stderr, 'No, seriously.'
                raise

        if len(args) and args[0] == 'once':
            break
Example #8
0
def main():
    for i in range(1, 4):
        num_collection = str(i)
        code_builder.main(num_collection)
        encode.main(num_collection)
        decode.main(num_collection)
 def decrypt(self):
     decode.main()
     finalres = open("res.txt").read().strip()
     messagebox.showinfo("Decrypted Message :", finalres)
     os.remove("res.txt")