Jump to content

How To Prevent Python SQL Inject


Recommended Posts

  • Active+ Member

Consinfo.py add

def GetInjectText(text):
    characters = ["SELECT","TRUNCATE","INSERT","REPLACE","DELETE",'/', '>', '<', '|', ';', ':', '}', '{', '[', ']', '%', '#', '@', '^','&']
    succes = False
    for j in xrange(len(characters)):
        if text.find(characters[j]) != -1:
            succes = True
            break
    return succes

use

def __SendShoutChatPacket(self, text):
    if constInfo.GetInjectText(text):
       chat.AppendChat(chat.CHAT_TYPE_INFO, " SQL INJECT")
       return

quote from turkish forum

  • Sad 1
  • Confused 2
  • Love 2
Link to comment
Share on other sites

  • Active Member

Literally the worst fix ever :facepalm:

 

void LogManager::ShoutLog(const char * pszName, const char * pszText)
{
    m_sql.EscapeString(__escape_hint, sizeof(__escape_hint), pszText, strlen(pszText));
   // bla bla bla
}

  • Love 1
Link to comment
Share on other sites

  • Active+ Member
11 hours ago, Exygo said:

Literally the worst fix ever :facepalm:

 

void LogManager::ShoutLog(const char * pszName, const char * pszText)
{
    m_sql.EscapeString(__escape_hint, sizeof(__escape_hint), pszText, strlen(pszText));
   // bla bla bla
}

very clever friend this was just an example. if you can do better, do it and share

Link to comment
Share on other sites

  • Forum Moderator
2 hours ago, enisina said:

над чем ты смеешься Тебе нравится детка: D

Rules

§1 Language

(1.1) Language

The language in this board is english. If you want to post something in your own language always add an english translation. The only exception for this rule is this section: Private Servers

 

Regards
Raylee

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.