Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/gavin/workspace/comecondo/python/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gavin/workspace/comecondo/python/ip_log.py
import datetime
import mysql.connector
import time
import requests
import json
import re

config = {
  'user': 'root',
  'password': 'Ilovekitty1',
  'host': '127.0.0.1',
  'database': 'comecondo',
  'raise_on_warnings': True
}
token = 'd090217d3bff83'

def normal_character(strg, search=re.compile(r'[^a-zA-Z0-9-é.]').search):
    return not bool(search(strg))

def hasOtherThanSpaceAlpha(string):
    return not all(normal_character(char) or char.isspace() for char in string)

while True:
    d = datetime.date.today()
    today_str = str(d.year)+'-'+'{:02d}'.format(d.month)+'-'+'{:02d}'.format(d.day)
    cnx = mysql.connector.connect(host="localhost", user="root", password="Ilovekitty1", database="comecondo")
    dbcur = cnx.cursor(buffered=True)
    dbcur.execute("select a.ip from wp_statistics_useronline a left join cc_ip_city b on a.ip=b.ip where b.city is null and a.page_id>1;")
    for (ip) in dbcur:
        this_ip = ip[0]
        print (this_ip)
        res = requests.get('http://ipinfo.io/'+this_ip+'?token=d090217d3bff83')
        res_data = res.json()
        print(res_data['city']+' '+res_data['region']+' '+res_data['country'])
        if hasOtherThanSpaceAlpha(res_data['city']) or hasOtherThanSpaceAlpha(res_data['region']) or hasOtherThanSpaceAlpha(res_data['country']):
            print('Exception')
            continue
        # print("insert into cc_ip_city (ip, city, region, country, logdate) values ('"+this_ip+"','"+res_data['city']+"','"+res_data['region']+"','"+res_data['country']+"','"+today_str+"');")
        dbcur1 = cnx.cursor(buffered=True)
        dbcur1.execute("insert into cc_ip_city (ip, city, region, country, logdate) values ('"+this_ip+"','"+res_data['city']+"','"+res_data['region']+"','"+res_data['country']+"','"+today_str+"');")
        cnx.commit()
        dbcur1.close()
    cnx.commit()
    dbcur.close()
    cnx.close()    
    time.sleep(9)

Youez - 2016 - github.com/yon3zu
LinuXploit