Esempio n. 1
0
def show_post(header_name):
    """ Function to return individual headers
    """

    clientInfo = getClientInfo(request)

    if str(header_name).lower() == 'source-port':
        if 'Source-Port' in clientInfo:
            return str(clientInfo['Source-Port'])
    elif str(header_name).lower() == 'all':
        return jsonify(clientInfo)
    elif str(header_name).title() in clientInfo:
        return str(clientInfo[(header_name.title())])

    return ''
Esempio n. 2
0
def index():
    """ Function to return index page
    """
    clientInfo = getClientInfo(request)
    if 'User-Agent' in clientInfo:

        userAgent = clientInfo['User-Agent']

        if "Wget" in userAgent or "fetch" in userAgent or "curl" in userAgent or "WindowsPowerShell" in userAgent:
            if 'Source-IP' in clientInfo:
                return clientInfo['Source-IP']
            else:
                return ''

    return render_template('index.html', title='SwagIP', hostname=HOSTNAME, clientInfo=clientInfo)