1. Python / Говнокод #7866

    −179

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    def mac_search(*args):
        db = MySQLdb.connect(host="localhost",user="test",passwd="test",db="test")
        cursor = db.cursor()
        cursor.execute('SELECT * FROM ip_groups WHERE mac="%s" AND is_deleted=0;' %args[0].split()[0])
        for j in cursor.fetchall():
            cursor.execute("SELECT * FROM iptraffic_service_links WHERE ip_group_id=%s and is_deleted=0;" %j[1])
            for j1 in cursor.fetchall():
                cursor.execute("SELECT * FROM service_links WHERE id=%s AND is_deleted=0;" %j1[0])
                for j2 in cursor.fetchall():
                    cursor.execute("SELECT * FROM accounts WHERE is_deleted=0 AND id=%s AND is_blocked=0;" %j2[2])
                    for j3 in cursor.fetchall():
                        cursor.execute("SELECT * FROM service_links WHERE account_id=%s AND is_deleted=0;" %j2[2])
                        for j4 in cursor.fetchall():
                            if j4[3]==465 or j4[3]==641:
                                cursor.execute("SELECT * FROM s_multicast WHERE service_id=%s AND %s>=ip_start AND %s<=ip_end;" %(j4[3],args[0].split()[1],args[0].split()[1]))
                                for j5 in cursor.fetchall():
                                    return j5

    Я конечно понимаю, таким уже не удивить. Но все же.

    http://www.python.su/forum/viewtopic.php?pid=76855

    Запостил: cutwater, 14 Сентября 2011

    Комментарии (5) RSS

    Добавить комментарий