@configure(
    label='HoneyMalt: Search for Sessions by IP',
    description='Connects to Kippo Honeypots via MYSQL db and searches for an IP address',
    uuids=['HoneyMalt.v2.search_ip_4_sess'],
    inputs=[('HoneyMalt', KippoHoneypot)],
    debug=False
)
def dotransform(request, response):
    msg = 'Enter Search Criteria'
    title = 'Kippo search for sessions by IP'
    fieldNames = ["IP"]
    fieldValues = []
    fieldValues = multenterbox(msg, title, fieldNames)
    if fieldValues[0] != '':
        s_ip = fieldValues[0]
    else:
        return response + UIMessage('You need to type an IP address!!')
    host = request.fields['kippodatabase']
    x = db_connect(host)
    try:
        cursor = x.cursor()
        query = "select * from sessions where ip like %s"
        cursor.execute(query, (s_ip,))
        for (id, starttime, endtime, sensor, ip, termsize, client) in cursor:
            e = KippoSession((id) %'%s')
            e.starttime = ('%s' %(starttime))
            e.endtime = ('%s' %(endtime))
            e.sensor = ('%s' %(sensor))
            e.ipaddr =  ('%s' %(ip))
            e.termsize =  ('%s' %(termsize))
            e.client = ('%s' %(client))
            e += Field('kippodatabase', host, displayname='Kippo Database')
            response += e
        return response
    except Exception as e:
        return response + UIMessage(str(e))
dataset/ETHPy150Open SneakersInc/HoneyMalt/src/HoneyMalt/transforms/kipposearchip.py/dotransform/swapped operands of `%`